Type
CONTRACT
Validation date
2023-12-08 14:48:38 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1702054080,
    secret_hash: 0xB487A5EC63C5083C750914D1F661D932AE961F39E8C6941185FAEAD791F93250,
    secret_hash_signature: [
      r: 0x828C99D317C863F9011EA374F34371EA2294DD2F068D53D154C89C98EF272B4D,
      s: 0x5AA31DA79ABB11E5B3A94CE16BEE3AE2452490643029A5B3C0415EB3547ED0E7,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    39AEDC44D22DF5F6B7B12C88D6FC0F97C18E0A911F2D36CA2D8A975BB57FE5F7D78804E967F1CEFF94DBDFE42A24C3A6EBA3146832C852F231F78A82

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B0BA47159B59504A124BE78C8F47A5D6180B19929CCB9713391CF62E13DA8B36

Previous signature

7EAB84F865A357D4D358E7AD9D33668E88CCA9C8D0D2925CD5628961C42EE73A6B45D4006FB5F0A7ACD4FE54965A26C1D0E2F37B603162EA60C5A9963139DD06

Origin signature

304402206FD1DEC3315FE638FB8723A5ABB5B0E359AD6DF1EF3F3C8631BF4EEEC06CA54D02207F398A85477E85F9634241E9D7F144C96AB00DFBFCDFD502C9BBF83E27A8E3BB

Proof of work

01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704

Proof of integrity

00E351472850B730D301CE033AFD01D375A73816D909C349A0FD46679954FC8BD1

Coordinator signature

B819D73FEBD217E2BFA0FC905D5B31ECA463506A5D81BF3B860147AB4BBE49F5600D413CE4D1A38B0CB6E0CC56B6BC44229AD56FAE58BF1C40165BBE2E448B00

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

8982BAC01776F654F63C618BF739294859A9C1DCF36783042F894BC5B0470B8AB8C86F3BFCFC25468FBA8E8B7DAC6B90810475886FACCAAD400B2E3D6021F703

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4847B2DEE2F1262D358E242F1712971C6499B95F83E6F1AD1B4935CF13B158696B966C17FF97D1C0E8A5AA0B34A7423D02C916AC91261BBD31FFA8B79C2CD80D