Type
CONTRACT
Validation date
2023-10-23 15:22:49 UTC
Fee
0 UCO

Code (930 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 0.01, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1698081720,
  content: Crypto.hash(String.to_hex(secret)) == 0x0D1F2F2CB2A44FD1133817E7FAE9D44D5D551F51C2A2173C8A33262544487A6B
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00997, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1698081720,
    secret_hash: 0x0D1F2F2CB2A44FD1133817E7FAE9D44D5D551F51C2A2173C8A33262544487A6B,
    secret_hash_signature: [
      r: 0xDC0E87D606A75462AE821059DFB5B47FF67CEEB48E9BD419D22135452E227F87,
      s: 0x3F25B6EC75AFD28F490D4C4092506EDB61402E61BC1B03CBA2DD69852CD253BE,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    72B690907D7179FF6FB8462D9509BFD679E553CE3D0E8286BB101A20405C20059975169CC90AE37ECAA16D404BD28C696937BFEAB09DE8191C1DF7F0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B5ABD398F6BCBD3B9055EF139A0A387293BC64AB36966DEB5505F7929F975CF8

Previous signature

96135C78A3211850297B779883CBE47278435191FB6F3957451B0BD9A4AFD2BBC29FA4A153EAFAE631FC2FDC3D51CE3CCB7D4A79E44B374AE0003D6D01098C07

Origin signature

30440220580AE262FFDB61F04B0B8408DEA6DF2F97464600742D59CD5E2AEA174B8515AD02200BFBC7DF0255AEA726B1E42ABE401E479B8948D1AC292B5991FD86D369BAFEC1

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0098FBB21D0669E50D8A171646F3322869D55DF1904BA8932EFC422D39956D3127

Coordinator signature

D273E34EE7337AF30D6AF63EB493862EAFAC896BCA2AE9FA3AEF55115903E5443EFD60CBCADD261AAAD723F4FD6D8D3648FF0494FE922E19B2B6C044562C3600

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

BC7C30B4054681B941359F5CD90D6141D0AF3DF7381912F5458D9B068E99D5996E96EA335CD62B79580E1F94420F3C134929264790C8DB3740BA21D5EC43290F

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

9345758900BEC53D0FD8D4233DA392E3872E7F83CF0714CC24F1581B8F871B4228ABE7DBB33F009E7A6BEB3D9D5F4737EB01C6B42434CD52103BF99B36C40909