Type
CONTRACT
Validation date
2023-12-10 12:15:38 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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: 1702217700,
    secret_hash: 0x8405BD8C88D3D9B7908F8E1C655EA4EE76886051F4DDC84D6391231B730696F5,
    secret_hash_signature: [
      r: 0xBF69D4EC028B99E8E0C228E81AF9DBB70979A6A08B184FD51A05AE87D475FF40,
      s: 0x220414F53027CA2DA1BC9401E2E66001AFE208FE4812F61E425E72FC4E95D939,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EE9FDEF07844BFC8023EC76868927A5BE698B2424C37033F2545085E4F142B06C50EBDE0C82F3EDD7EBF0DAEF08CA612AF0D79E7996B4402D28DD411

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000136F39DFB76D1F02896A997D5A3ACDC5A2B7546E68CD45B32AEDCE6965D386D6B

Previous signature

BD5E9BABFDD17083F0614E7171F6F1E2CC1200912F8AC6A77C33E4F16EEFB863D9E5CB5C0BBD8BEC3B50296E40190796B9AFEF20AA6DF6717C82EA085694CE01

Origin signature

304502210084E07C291EC1B0E34D4603745C285D84AE40CCFC4DE06CE780E8C1C513236CD802203B76586714DDFE11A918EE4DFBDC6381930EBB9C1EDB1461CD7A64B22B13818D

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00D3654F9AAE96FA129745EE35F73697E4C68BD5A25666B39080162850560D3238

Coordinator signature

04E0D5D8ACA113A5369BC7813E255C15847350F9ABAA4C13DCEC85FB74C02C3F533F9C2A9F530C300D85F0E4131E99EF9640C31854748606CA3F3155A87D8307

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

2721ECF2FCE7733154DC336D3EE9D600023CEAC03550E916D7753ED7092140CBD372E542C72DAB5264B1E2697FE2163AEED4724F5943AF3F3E91B000B30A5001

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

7F141AF5776DF0188E1CD6FB2210424A68978F134C38392DFB6C72CB8A1CAE77472E60E368F3D591F81AE1440A00D9AB03931EE80FABAD9CF18F6ADA06A29306