Type
CONTRACT
Validation date
2023-12-14 04:15:26 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702534500 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000714C336DDD8B3DE2F85115B1C5A25A93E1D2241EF8A7279040F22232A821FFB4, amount: 5
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1702534500
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000714C336DDD8B3DE2F85115B1C5A25A93E1D2241EF8A7279040F22232A821FFB4, amount: 5
Contract.set_code ""

end

condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
  previous_public_key: (
  # Transaction is not yet validated so we need to use previous address
  # to get the genesis address
  previous_address = Chain.get_previous_address()
 Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1702534500,
  content: Crypto.hash(String.to_hex(secret)) == 0xACAF7E50A678914CE8FE4DDDDB26CE95D227F3588135BC03892AD809922C5E6A
]

actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
  next_code = """
  @version 1

  export fun get_secret() do
    [
      secret: 0x#{secret},
      secret_signature: [
        r: 0x#{secret_signature.r},
        s: 0x#{secret_signature.s},
        v: #{secret_signature.v}
      ]
    ]
  end

  """

  Contract.set_type "transfer"
  Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 4.985
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1702534500,
    secret_hash: 0xACAF7E50A678914CE8FE4DDDDB26CE95D227F3588135BC03892AD809922C5E6A,
    secret_hash_signature: [
      r: 0xE6B4ABDED6317DB230F4CD0A58216C56A66DAB448AC2D06E4415179B8D063437,
      s: 0x36F255C42D361D1528E94D6C46B9FDD81C377711155FC023EEB648F545867C6E,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    401FF3D63ABE6AC6456903D807F70268F1CB110F421E094F81A89394571BAE006ADFB2EB6C11039D73A684D564896ED7CBF441AAE81EE85B90AFD44A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F15372A2E534A693C17D6F0318B12573C05DFD515984F6A47411311AD5C15E00

Previous signature

720BEEB2E9030A8769E063DF72EF6CA2526055D719A6DF64F6ACCFA4E3319B6040AD4A66D3CBFB4C78C3489542C3D26E5304CB0A298BD9A99F30C91122AF880A

Origin signature

3046022100CD12B29A1890EE0715BDB7AE620F03F95D9CEC2A51671461A8CD27E82552AEBF022100AA18821EA22D36197122DD819885E2A902D5F77F3EECDD90B60F2032ACE9131C

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

0014286F10F3990579DCE897B35A1DC6567A69B3DC570960B26D983E175A82CC94

Coordinator signature

E504CB3AF75EB434EC65135E09357130E44AC25B26F4284EB60CFC53C7D673ADADF8EEF305393498E9B926054E74BB2266DDC61B9D2FD8BCCCC21133442FFE0A

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

A58E748C18BA78C41F27425B87E9EC3FB2F4982CD61F5C0E1D553FBDFB5E1029F0005D5F156DEEAFB6D86BEA3D31AAB259BB6E964910DCAD7630A2BE33501905

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

CC558265516C377ED69B8DE8C43B2F9E11DEF57AC2EE167DB393E99591849ED1764BF75592D2D37275A199584137258B4FF6FC89B1AD7E30E057608FCDB5680A