Type
CONTRACT
Validation date
2023-11-12 15:36:04 UTC
Fee
0 UCO

Code (931 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1699810500,
  content: Crypto.hash(String.to_hex(secret)) == 0xB6E9C916062C4A999BAC4B5D54C21D1FCCD5020C6FD1B517307A050606473C23
]

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: 9.97e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1699810500,
    secret_hash: 0xB6E9C916062C4A999BAC4B5D54C21D1FCCD5020C6FD1B517307A050606473C23,
    secret_hash_signature: [
      r: 0x3B8C8BE06DBE4F99ECA48E313CA165CD7BBA4C957F2C188A733B2CE88A95B974,
      s: 0x25CB5182CF9A2D5F75F3B203723EFDB00B70181859C525A1F2DAD64C12961E24,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    280C68491FC45EE94C2A129C51AF09AAB473EB74AE0351386218DBE552C0E4A89AD3D0CE9A35EABB2D76F139864F5F8637732089F6FAAF54C20EB56C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C013632264E73A8D5413B4768C5FC57469CE751F73D11ECA843CF8EDEEB79F89

Previous signature

12327594760D1A37E92611CC2C10A99617025511259FABF7D8CEC9F10C925FEDE44524AD0BDBD998AF3CC2267FB7D02460CCD4E824413445FED5C8A163D6590C

Origin signature

3045022100A4C885FC57617677C6D24599711BB921AA7CCF084D84C458CD81679492DDC54C022031A37AA507A2197CEFC64804D5999FD24F79878522330A74C767B0F644B4460F

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00EBAAC70808B32E55748194C981ACF85D1F4018D74A2CD1A37706CA6AA7B547AF

Coordinator signature

F20CBE1FFEC45F941B027B426A33015070FBFACE76D257B97DD62845BA830EE55F082FBEF968183CDC61D83FF061230E9774B66FDAECE27F794DC2784042780A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

FA2543CB16A55859C278357E5C98CD3F0D7A940191460CF5E13937513D680514B5652325510A5BD5BF8D3E6607E830BBA19E61EB5A5DCEF5B08640A478732B03

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8FCAAAF88AE6E477F1B9FC3FDFA90AA002E87E57B173B01FB1F4FF0224FAA75E30D034B4E9B1E36D8C770D6FBEC50C0571C8003AD060887D476FCCB1A682FA07