Type
CONTRACT
Validation date
2023-12-09 01:25:55 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 176.469,
    end_time: 1702092300,
    secret_hash: 0x8F5F0CC7AD9DA31BB2B5D8D8D60A6980599896C2A464C36E7B6C05D8F2073E88,
    secret_hash_signature: [
      r: 0x6726E1056AD27CAB7B3F0896E7A2DC26C2514873725A4E21BD941D042AEA5160,
      s: 0x02FB37D63381BF2FC5685AB00801F70EC00E43731DCFC36FBC530D2FF0535726,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    87D2995C2F39C34C43A6649A429DC802927AB4A96F4CE6033DFE5901B4866491235DCBEB37CB58C1E8CDF1B4D702DF1BB19D80598F72BC01B9882D7D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000189E3EA69ECCD715AA95EAE7C7E768AD3534BB367D5BF714EC21FAD9641183C86

Previous signature

3D4E5AD8C2EFA755FAE7224C185CE29677F5DCADC8A8DFA20011773941B7D65D1B2FEF726FDF6CD4FC82DEF365819ECEC7A2AB619C1FC4264117E49FDE1BE50B

Origin signature

304502201C69804EAFEE102D65D66F72E371C5CECC6C5A2A426DB53E3558BD05A26E06FD022100F5B0A71A0C856B6ED212C26B5158C15C31B9F6641CA53FAD147570158CEFE027

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

0078BA7796DCE8EFFD529F1027ED4F76BC317418775B6B693719904268B0CFC33A

Coordinator signature

E9E6723D65DC16CF4C917739B7A654A9D34CF5AC42D36DACA6F83ABD4A9A29DDDA51A81DF32854533EDED700DE344A2A59B1B1780C1B53BC824B5B3D1658DD08

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

F72831C82F0711214CE2F64666C887F51C96BFDAD67FBF85C846E2FB37B4156DEB86B551DCB99425E975FE48F803991FF36D87459AF5F46FEE6E90AA1624C908

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

530110EE0BE4BFE71FD4CEACE394F9F8F99E515F677069F39C53B9BD36939CC4498831B685FDD6102487052685BC1511B0D28BEF41607CF7FA7B9346E4E3960C