Type
CONTRACT
Validation date
2023-11-30 09:35:11 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 29.91,
    end_time: 1701344100,
    secret_hash: 0x579196D28039517C0B285DC3733090DF7055D96B9CA894459F437EF01F3FBDE3,
    secret_hash_signature: [
      r: 0xD52E64333834BE3425A0246190B0FADC9421C84F99941D6E410DB2B141ED9BEF,
      s: 0x5CFC7E095C13266689698BF154827EF036AF419296B3B78180D4ECA59A280FA5,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    DB6CC723F4564750F917B4EF47D9A6CDBD2182CCE08F72B20FAA6791B9E2D5CEF8D361A8ACEE4FD31DCBEE8C18CBE5AB3D0C1915DBF0DA520734B00E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00017CF84782C099152B2D058A35796DA5F55D53F48A0604DF97B73C12A337FDF4EB

Previous signature

C4ABEDE9956AE85146E2E501BD34C61550AB4F1F06DACF3852502779AF856FB09284D0B1C666F5DFBC4976ABEBCC306ABB90F4615D31DAD5ECF7E96A280D680E

Origin signature

304402207F833530DD13DBC905856242DB1E094B71804B4672B3EB65C8856C650E7C0B8B02200D111A497F9F0BC9955B4DA051728DF2FB5106490CB93C6360B936B37C8A0A12

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

0005C007A40C81BD37DF9BEE739F2A1A968EF17A9C97AC405F8FA62062DEB6E77B

Coordinator signature

6C71FDFA181AEB429EED04561D0890F1ACFA506A76CDD91A65698DCA740BE396A0BA703F1E6647B34DA318565BC32BC2B2F75C31D34D614ACB71DF6FEE4A6101

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

69DA3864A4EBAFA6698FF680909BCC3F0A17971ADF3A12DEB355BC4719D7951AC28CF3C2D2D133D0EE41971606A8304507CE4EF75AB39880E61C7E0DCCEB0F01

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

2FD14F34D07A0E952E8EB9381C43F0540755036AD013ABDD825C40FE91E83442F17A2FFB609A8621A0525DDD37BB28D95C6B0AC4E55D31E9B5C93EB10A780205