Type
CONTRACT
Validation date
2023-12-02 19:58:36 UTC
Fee
0 UCO

Code (843 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701554280 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 1.0e-8
Contract.set_code ""

end

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

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

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: 1.0e-8
  # Transfer fee is less than the minimum decimals

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.0e-8,
    end_time: 1701554280,
    secret_hash: 0x49E47314800B0FA7BE8B4B365C148F7649E5FAAECE5FF61BFE9948927D3EFE37,
    secret_hash_signature: [
      r: 0xF3D52098832B2AE096432DD643A6E85E4EF9B8A16BB0327BBD0082F2E070EC6A,
      s: 0x334C9F780363AEB38892BC8B3F8930E15744CC8A7E14965FA8AB9941615E1236,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1FD7F9FFC9F35A7FCE1F254356DFACA6668410BCC6F772588E71A2AE63A4940E27C2709953B98616344ED0A808EB601A6AE7BFCE7A99F0DF4CB86B08

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00010333424155ED6E5DA8EC58115F79B997099FD14C36FB622085E2C62492D16B0E

Previous signature

8E4E89A8BF5A816F9D1537D37803F080D14356EDCFE2B134686DCC95E9DAA39DF1B95C88773130637A9108A4C5F5E57961AA1165730145BFA12AADBD45E15004

Origin signature

30460221008F142A5FD867D51AA8F3DD2B3EF5355A75E7107D4A6DFB156A1BBC621D502160022100FE08910352AC0AA386916C057A59A7501BBE3EB72C365992553CBD00DE39EAC7

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00DEE6217E0F64ED80E1D3946D95ACC8F6DBB51C9BA4C95438212A5974091BCA8A

Coordinator signature

E8A02325A9192CDDE23A7FA49FD65052A2C1AD5D413460588FAA4AC4A5535B6ACDBF58E801B9CE906E22F1B8E9955C7167A3197188C72270E8AE7AD302C38305

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

FD01C989A40994A3A53DE2B10458F2B0493C28C1BF6E03EFE91BFEC473B84C131ECB160938F3EEBE8BD73D569BD09ECF0309E20275C8D065152A4A615AA94D02

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

0CE7DE0811FEB2F9CF2D3A60B3FBCB448AF49158DE9693DB503D23076A7CCBD71C21704A8FF9679D6175B9E55C1879E04EB65D85813B38B94149B4BA8508E80A