Type
CONTRACT
Validation date
2023-11-29 21:11:08 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1701299400,
    secret_hash: 0xEFBA1F4B23F1448E1FF44F8C03834F708F8E9539587C5B85B0558E2CE444FDD7,
    secret_hash_signature: [
      r: 0x1D276C0D6966F76914B002BABF211FA193255CDA6E14ABFB5A04113EE1C18520,
      s: 0x6C2DAB1AF5FD7277D3089A5814A6DD16986D8D5F06510405DDFC3CAF3D4B41AD,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1FF5C565DDB6F7A331FC3E9C749E3A626FB4115A91E4F9F45E9534BDE627C8946C62B4B1FF7A508D4FE62E48F252B936698FB665CCDFE3218BFFF004

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000122B7C180C30330A6D136E13E18BFC6CCD864853C483A18C7198D6FF635868179

Previous signature

790CB85E559CAB6A972EAF43AFC8CBC6ACAA4BCE0908D352833BAAECCD877896EBDC3B2D98C30F9F07D2FD27FFA299CBF11405401EFB3DDBA9A0F36B3F591E0B

Origin signature

3044022029D9EB6EFC12EC4F5F2FC9E4DE3448E52CE07E66EDC23240804722DC91C20B21022060D76A182781984178C56B180989D34CF8E3FC4F7EC70E20AF29500138C0EB71

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00C19DECB058997DD434EC5F97E0AFAE1CECD1FFC81A6AA80FF9140C3EF379BD1F

Coordinator signature

154E7067DFAE047C1732643D90EA23BA026F1E49364FB9A934C8C14A72DE15D861CC0447A070A5DBFC34FA98469B5079003EC7762C8830F5B7CE29FAB4C7A306

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A105AD14EC5760AD07EE995E6CA2222C6D341E5401D583EE69B87DBDCBE8DAEE8C97855DE0465AF9DE5CB882270887DE4F06F037B715743E63B7D61DEF93C10C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AFC21BC7A2579FB063CE58F31522107975CA76059166A329895445338D29C9FB581FE3AE726C2C3CB79329FF9B6FF908B593A4144069598877FB46150010F807