Type
CONTRACT
Validation date
2023-12-11 05:59:24 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.988,
    end_time: 1702281540,
    secret_hash: 0xA9FB7134A107FC4CCCAD79B35B77B49CF7B41D685688D2FCE5A964BB6419AAFF,
    secret_hash_signature: [
      r: 0x86D93B38AFC81CD7C72B50DA98CD90DCEFC2AC0F0B5061E2824F4C4FF5275FF3,
      s: 0x0FD2B1E06B800997B7FE7E7EFCB2B8C9FA98A12399504EB4F47F00E857B3CF5C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7C19AA0EC67F48F21B1FEDA734521BACB7E265891C1F59B873BBCEA18369752D4225294AB860C3956ECCA57B12E3C10EFAC8FCDFC041C181750C7DDA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013F1B4F8DF2A24F0484BDD7D81C06202ECAAE658D7B4583C8A57F1C40468F5C97

Previous signature

94A7CFFA7F06DBD5395F50AC9787B98016087B0C57751C653E1BD33A6580E5ED71E9D55531F23C7BB99DD431198EF9E2ED34CD065591C7CFC113B110EF0B0405

Origin signature

3045022100C362BFDF01EB00A752666CD22B9C4B996F1A185404942D141E7BD334A1C15D9D0220383B3E69A669B1D61CC4BCBD5DB552ADC1E050A4C3F41D2CE9DDD48564A7C0D1

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

006FF6B2BA53714F11EB640F4DF08362C1CFE56BEA51629885920367FEC1044937

Coordinator signature

EDEC68AB5619D3EA9100EBC3356DFF98DC409A3D560A9CB0AB84C303F492AB4156CBA1CC1CC3933270676131D8FE4FF8C0391678CA2F94C4308E6842C27BE909

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9B848EFF1269DA7E59B6A215DAC2D3F3C7368EB04A7530EB4ED6063F7C20298DDB1EC113550F5CE776C8CAB7E95E4CF6EF315A541DF4953BD8ECA0B0E84CA505

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

79137E8506179D29B2CBD482CE9B4FDC36CE83C7821AF4E839F5BEF00434E6EB11F68008C33D5092A0D33CD562CE644985E44F3ECD1DC02431B25D7F56EFE300