Type
CONTRACT
Validation date
2023-10-26 07:26:13 UTC
Fee
0 UCO

Code (869 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.01
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 < 1698312360,
  content: Crypto.hash(String.to_hex(secret)) == 0xC4E008933347A62C8AA8F07F6787D928C045C314C0B4DC7B61179D322066FA80
]

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: 0.00997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1698312360,
    secret_hash: 0xC4E008933347A62C8AA8F07F6787D928C045C314C0B4DC7B61179D322066FA80,
    secret_hash_signature: [
      r: 0x44D2A591B0003F737E47BEDB1C2D3E372512A7180A45BB07D2064397B3814BD0,
      s: 0x34512D403A24FD7D0216C6C40630C2C2EE33349AF5310A58FAE24A0363C3389A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B43306A682A141E2043A22499EC674F1711C1AACD6D7F29765E374C494EE78A8F5D67A2E6BABAF05DCFA19ACE7AC84DAD65420E67636C9526B9A622F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001035C26E73190D2CB4C6B5B560894889C450B77B453613FE8407B103A0911928E

Previous signature

7B6C02D06748C6C66055A372DD6D0E54983C56EB4CA345DFE8AFC1FD458962FBBCE7FA2982C8A7075F0EB3043141F3F253B145C5EA12DB927B763D2560FF8609

Origin signature

304502200D5E4D752BA665AAD220797F11232EB02B189B2A92E4696455A0468442EFFBCD022100C5536788B03261121A1EB9306739371DE76C20934294E325182E9D0BFE7DB544

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

005861225985290204E62377B515870C428A7830CFC2926FB802E00D1C4152C21A

Coordinator signature

CD5A8B4C321FA71B467B57C90265B8741DCDF008F1882C57FA1529BC29ED5F37545E1F2A441C170FBB69DF53B362E785C437D4F5414FBC3E7A172B79CF405C09

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

5A58CC9C89F6A28C3D9C975D42CC3111F607528DD1E440434528F624D4F09AAC5EA53467F903012C2A72CA5A6AAC8999D5CFD7B645FD9773148C805A49186306

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

CCED5E9BB36DAA9CF47BB8A7C8D7ADE08D9C16BFAA56821F84458C5AE6279413CCBBF3E095D15A7C8755AFE18F52F4339945FFF62487B6858E9DF20387B4BD05