Type
CONTRACT
Validation date
2023-10-25 17:43:29 UTC
Fee
0 UCO

Code (875 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698262980 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 >= 1698262980
]

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 < 1698262980,
  content: Crypto.hash(String.to_hex(secret)) == 0x9B77CB8828EC7AE9DAD88F2704BF61F5CA9F8547084DDE0CA719A5A12089EE59
]

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: 1698262980,
    secret_hash: 0x9B77CB8828EC7AE9DAD88F2704BF61F5CA9F8547084DDE0CA719A5A12089EE59,
    secret_hash_signature: [
      r: 0xD9DA1B5D68568B6002B61515B1470BBAE893AB0CA3C8A0F1440D05D049DBF2C5,
      s: 0x139C820E3C2C6CF64C001B1F2DF2AFACA226E538A543A98403211F7964E11A21,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2435347E5C2D4FB8DFCF1CA8BDC4EF6396C422533F677798B04F6237CF3FF475759F115B27A6903FFE35AE437C254E0AD8F90C8DB8106DA925A19D4B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000184594824FB400D522509E0AB6676B39963900C83A1845B14C949C4DC8C86B2BE

Previous signature

AC7917B930FDA520BCF7E83ABB897C2CC93C9E509407A643E18EDC3C3CAEE17ACBBD9E36B186F90CAA9332E79DA57B9CC0C753137C94258CE174261FF94BFA08

Origin signature

30450220643C606F331FEDBA4B1254E9B2043CCB5E5C5B2BE3C4A2DC366B7FA7C80D64810221008AF0C3F6FBBF487F131CACD4276B908E4E68CD756ADD278D71B62148C6C89353

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

007E7F8A58EA94ECE57AD026FC7C696A7FDF72D7FD02AF79B2311EDE91AD693AB5

Coordinator signature

34FA9171F20448561541825CF61A79FA60319FBE4A9371FCF7276B00030F8C8B539B45519C7DAAEED7487DE476D0C76AF06176AA0D9055846FA2C6EE0DEAFD07

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

900C8C2A7D1A1D47054A11AE874129E18B0928642FD46C46877DBF26B71F2521629459688FD784F3EF233A9124EEFEDEE0B34AC62C4FEEAAAB094DD6B8E6520E

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

CEF8FA100D6F6BE4EC771D1C515DF044764E3563D58CB49AD8C118196270372DFDFBA35A9AFB6AC2F5AD595712CF3D6A202270681CD58408819EA4EA82AE4504