Type
CONTRACT
Validation date
2023-11-13 08:48:26 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1699872480,
    secret_hash: 0xB4763F87B3124AB316940B78898E94CB0ED3C5A4A98F9B45EA84AB6C9B38C4B3,
    secret_hash_signature: [
      r: 0x937A08C2C237ABEE45A0ECA09F7C6FCE8DE81CD55533887EA9B04BAE3AE9D6A4,
      s: 0x62B776586916C3E953E7331A961C1BE6AD9C5037D6CDA9BFE1FDF7F791AD158E,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    762983DDD574171EBD5006DFC39CF484CB43A0E1039DDE1B6C52C98D6A269A821DED782DA9D907B7BEA48EDB7A11175C7B274DB4659F3B00A21EBEEB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00014BAF2BB8664AE5C9C05E5D1C040416D273FFAFA8E8CAB406EDF2DE8B1D148C15

Previous signature

EA61A58459474A7A2CF93487923332642206CE045FCC74CC947D371E7C06B2D65396E6E482F8F1EC98DC5686B25D07EF700BACCC01B525BEDB956454A58DCB09

Origin signature

304502202CEC4D6A80D64EC4DBF4CD2DC5A80A5171779279844F81CBA48CF9B9B15545C9022100E2BF4D57FF762EAC9F694C9447D7705C224789845A11E384C6D320B302705C23

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00CAD4692AF455E0AACBCB1AE49E67A8478A0BB0139B605743437D9D1559659DDE

Coordinator signature

743D3F7F9210D358929D702CEB26D954CB10CD7E98659EDF866C021292F3D6EA5A97646FE21DCDE0A6AA1E3DF10AF2CC91795155DA784A330E92DB1EDB137A08

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

4713894AAE2AB6243EB26C6D284F23EE7012591BE520B2E48FE964F3DFB2CADCAF9B5845A694F45EE5FCDB8403386475BE82D2BC4E51865BFE5BEA9F7CB27900

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

27FC0627B793CE147AE3331C41F85AF27B005E5A20306CED2E877648EC0410579FA3E27CF29D533F35195DE0125BD0272301B407C14EACECE28EAFAE65CC4701