Type
CONTRACT
Validation date
2023-11-12 19:48:08 UTC
Fee
0 UCO

Code (874 B)

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

end

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

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.363405
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 < 1699825680,
  content: Crypto.hash(String.to_hex(secret)) == 0x489C324831065F194B2F760C982CB87259D5456994FE9814A834C0CF3D3F506C
]

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.36231479
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00109021

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.36231479,
    end_time: 1699825680,
    secret_hash: 0x489C324831065F194B2F760C982CB87259D5456994FE9814A834C0CF3D3F506C,
    secret_hash_signature: [
      r: 0x387822094567342BE5C937EFD71428950F924DB7902D9863A4D4AFFB712C2441,
      s: 0x6B02011EEDAA90D93348CE4CAD26B9B6241FE8531A18BC0B55009F57AABCC9F9,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9236F9D197641E7C95EBA8E3340D6026E69AC9067D78C1956E75E1A0BD16950AB0AB4786346B0B16BC66FA4BA8A133E4D8595E83C59571472E9982E8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001DD8B06139D1B29D38B7F60442DDF7D82C345BF035391EDA08028C900E563E0C1

Previous signature

0D46FDF4BB56E9F3D67C70D6D4FCC2F582D3FE208310C9C901757D387498F61DEF34A81B376DE15F9D900EC5BBC67D19CCC74B4CADE1F71A11C71BBD27B70B08

Origin signature

30460221009C3A3E78CDFFBA1B73DBE1B3E45F6E141A2271F1D544DAD4F3A56FAC85745338022100C7A7F0E5FB56305F07D83866B40374E9A10C99D23A2B3F1F92B03564EB8B691A

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00D3946C5CB9DDD40BF5BAE22A7A458251B3991643FCD5FE6F3D7E07C6CAA505E7

Coordinator signature

894085FF7BE70DB7D39EE9E5C3D02E8A9BCF49656445DE249B749DE8FFBB09D6306CE92E742661A223E97AEB335A623C3F4BF872989DDF08C104A6C993051C0A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7B01B86E7CBB4AECFE7A325A2456166686569AFE98AD4E7FA096FA5BDE7C8E152D117A136E57E16BC0F4A31AB22C08118395AA8A1FAA6FB95144B4C8C8B55B05

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

26A7F22EB4CDEAB695F89BD33AE66DD3E28EC9B870CD4AAA9201375D905407A9F32B38CBB21EDE770CECD3ED8AA2977D640162F9B2B9CEB1C89A35357594F706