Type
CONTRACT
Validation date
2023-12-09 06:28:22 UTC
Fee
0 UCO

Code (871 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 7.22825,
    end_time: 1702110480,
    secret_hash: 0xE8CDD1BC25E73B44DE2FF4EC81632DD05487F54291EEF93F32EB88B72B052D23,
    secret_hash_signature: [
      r: 0x22F7753F39E8D013E6ED07D19BD3A03EE56D4D6D5C353A6FC48170DF947F26FA,
      s: 0x78541D57DCDC08804537A1BD81052810C2FAEA187D4D92E36492EB851F6A90E2,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B8265E5842832EF9C95873BE91A0E5C256C2425AD5DABA666FDDCB1E75E9D16DC352B5EBE0C0B1EC597B6196B71FA3E43A6C2AA96D6721FADAC91EB7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F96371760C73029B84EC28ECCEBDB45F9BCFB2030C538C274A86CB7C4F427A7C

Previous signature

04D150CA8F469352E23CB103B8D888880B05558826A034C291F35F1942291B40FBB35F3716A6086EDFC093449F72E8B4512D7EAEEB5F99AA49FEFD4DF216650F

Origin signature

30460221008274C7C4F9EB888F203874E17DADD1DC150F27E31E4AA48F2BE87C29CCDC8A0A022100B0DDC6841C185C2C12BB99658ED68F5E6DCEA1716810EA2BC72DCF97F17195C0

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0012E2AEA3373EFA1A918A30018E596E5676BE7560278559310BEE6FB14CBFB29A

Coordinator signature

ACA5D9CAC7042FAA6624ECAF0695DC13F27BF0FCB915EA43867213FB108A48FFBE17674E300581662D066D94E4A4A29353A2CAF5D7657F5E7D50167492C66C0B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

C734E245D5B38CDFD5259FCF2AB4AFD02CB0805C64E8347A10D4A1FE3A9597DADEA58340FD2CDFD7F49E1AF0584186394061C9003FB6A0C10EC9407D8E361400

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

1BBD08C15CD709DC0CB3F2D65CAF4501FBBA56F211DC6D680CEFD0295A1BF5BA6A4A634552C868B435556C03AC97A9F82F9902754C06311F8D683AF8C9B45E01