Type
CONTRACT
Validation date
2023-11-30 02:24:34 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 29.91,
    end_time: 1701318240,
    secret_hash: 0x4B3580BF841D39F2E9DD1EFAB1258DE17B26990BB5583B61EEA54E4A31E6C132,
    secret_hash_signature: [
      r: 0x2FAF1D4DCF24751055CDD9537A4D04BF974597FBDA5B9158CD3AC74A098F2C69,
      s: 0x12619FE99506E66C0241BC8D7A0D3D9D6ED2607EC78E526FDB64F2F0099E77E6,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0E287A3235BB112902DF74E94DFF688E2AF3DC729362A9E19D40B3D6C2BB706C0ED795B3E9EBEA1A9EDE7FEBA8832BE721889F9F9A1618AA17D4C350

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000160CA330F4AE087D4743A7D2ABE5F584EA31DDED84D7A2E3254BA8BECD0F36FCC

Previous signature

1AEEDE0A9086AF0CF7AD1FA4B915ED88DDD505F7156882157FDAB2E9ED928C70E7D47CC259507899C5DAE8D85B589078E5B0F56AEFD8C021581D248334023A06

Origin signature

3046022100B05ABA5CAB891A308C3FBA9CE8D2B7101C57EDB1D913D17778399655373775E7022100AA607751A55301CDE3B32FB7E8759F21EB98D91EB27AC5193550AE826E8E5B7A

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00833966AB74B0128C43A4C367E0BB64437C8D3FFCB5D35E900CF38935381A4AE8

Coordinator signature

F67393A18C142D3534D7FE9D1051D0F359D375BF13FB1A3C806973615EB7DC3CEF2BF1CAE5583D570E0A3D5148D5F36D95299B65EA22C13E85B34D305F53C701

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

5876033420631D3F0661E7D7309B9E2681DF66214356EA181E5ED0AF429355D4E754B65069E7774A27E850328977F89EF0506B481002C58F359276542FBFF30D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

9E25494BF83C7DCEF350DE4B9A155CCCE0C206B18933DF0A99D542DB6BDD89C26597581DE01C313B339BB3A77B7D2FC350881C60E1471F62485CF149F038CA0E