Type
CONTRACT
Validation date
2023-12-05 18:28:56 UTC
Fee
0 UCO

Code (863 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1701808080,
    secret_hash: 0x02D51E0BAA144F98C3B4633DC3B7221C45B3C1A2DE32A10826AD5A283419FF49,
    secret_hash_signature: [
      r: 0xBDBD3AE06288422854378BFB5F71164342B110C049A617612A83A854537C2A26,
      s: 0x5C30B0DF463D5AD3F78140C013A1EAF3288729DBE2E41D0F8F1056DA82FC1DDB,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    78A536286F6A88D5C2E02DDB43A8686F4CE0734002D896BA3E6A0E3DE3ED11F2200F9B038FB7261D4514F659FAA5FC5ADC381311161B487CD0954518

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001169A1BE09A456045A71E7AD0D6EAF2146834D3E4132CF1CEB1276EE21DF0B2EE

Previous signature

B4A58D1D614392633937332E821DCB3856DBE78160EA929FBA54CD9FE1AA9195C033E10DA1B34CE6D63A6DD7A65DABB8760C4A23EF36C66C3AAC6D76D4662F05

Origin signature

304502207FD78B94194B1299352C2AEA964DBC6E3B38E4076DC1C33C3248983C6771B21C022100D1EB82F188903F5AA8BA0CE398354F60FFF2A4C13477C5D9C77D298D8E268AAB

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

009AB187986AF43A028C60C918868BF3D385DBD24D7550FFB9CDCA78D0DB1FFC1C

Coordinator signature

E3670FBFDA83CC9F3E15E7F45808D03AAD2C4F2AA7E33296F1894020B2081F66660FA7027E561A5F6781639705DE78AC19EA96AD35B363606FBF7781063B1209

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B1CFBE8CE1F549B4580B341704D214D4C5FD06906A24708531146630E77A0496BACB2EC8DEE8C4F3B538CF59BD0073EE77A1E61DCC441E26919B025E987F630C

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

7E18C9E94E517556575A6164300F980430C2D8192F56BC95CE195D5D62E772C448C09F1147F820BAD308B3BCDB2443CAF1DBD3C14FA017B6D9C7BCF953DB9B03