Type
CONTRACT
Validation date
2023-10-25 17:59:41 UTC
Fee
0 UCO

Code (873 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698263940,
    secret_hash: 0xF829541D0344982B101DF2AB3492974A6C41D7FB628DA14C9CBB84746FEAEC5E,
    secret_hash_signature: [
      r: 0x7DA474E60298C187EDA934D3791D21303A4B38F5552AF8482768887B67B3D186,
      s: 0x649ABD398F3CD62505E05B6DF6979FEA7C45875B71D059BF585F732CA870315B,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    490D4EAE26D629461F6E03E7C1AAEBEAD70966F2E3B544D48DF01D6A10001B7DF738F3A519423A7DDC73F986D7DDDFD5F089D9A495B4F3EA0874F848

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00018C88E74302C4E57F2A6498640677F13DEB668685A4D98AA76E9ED610963FD841

Previous signature

E63EE00CA74ADD294BC46E5FDB573D6186732BA3BC0DD9C08B316ABC00D23402F8200B8A249163F113C944DADF336D48F41A795EBD4DF9B9A151A680D098F902

Origin signature

3045022100E07EE75C10A66BE941B6220CC406518B8A253576C81612A83658EB1E47D40B2202206814C2A5871D0491077AE0C1B7B871B51668EA708328B6BBAC4D009A5B8F07F3

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

003813B150773A0CBCDD50285FFB1DBFEA53D4ED8337765E7077CF4FF23E801893

Coordinator signature

E211D4CB85313061E939AD83A04B18B0701E07FD6F6570F21D503663B73FB15C20273EFB30B614A93D2204F56B478CFCE24FEBD41AE73FE74FF8A4BD221F7C0C

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

DCEF44BB2A93E811982EFD6ED48CFA4D8F7B08C9F742C5E9F6C21613D60AB7BB1A3665E89997EAF8236D8EC490E46E55A3FCCF687D0F44310C26D2AC403A650B

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

50744623C90ED5B407E800EB54CE822F3FC8CB845BE70B86C2860BCF2797B9E3F1373F49259A3BB5E827C750354C7791F57BA3C53E66BC55740BDD8BA8659306