Type
CONTRACT
Validation date
2023-12-07 01:18:52 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 1701919080,
    secret_hash: 0x5052BC50F0736BADDCF49EA8DAC54D1A9907B3D93AA4784D51761437BA2BD3C3,
    secret_hash_signature: [
      r: 0xA81CBCE67FFFE5D35B962D139BB330AD03A6B61491E08CD213ABBB3B6788CF87,
      s: 0x0950576CAA482E794A023E0FB2EF6E74184C097EDFCDA01953B1F1A4E78DB32A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    46C9E5D48C37067333C0DA823D125908F4F3F2D699937EBEF1EFB1F4EADBB8A867190A0BED326CB953C2F06E1D2179CF9885FA207ECBD204A7D11887

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F0A8B9B0C5D648EACCB4C8CF07979AC2070FBA67F8471E88689E797B6F1D2535

Previous signature

092E53E1196B001E074D3E5D661E188280717CFFF2560070AD5B7907AFE56B320B3AEBC799AA87BC06AD95F1564A78CFE77172C2EEE34F6CEC40DA7C0B04900E

Origin signature

30450220457E9048B3EE0A3C47ADA2A45F8B5C2784CE27FD35F0C4B5CF84412C2720066D022100C44F77F7745B81C06BCF07DC1E084EA07E8606761C2F3AF014B3D96336AB4A34

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

0004562E81D79EF4D19241CAB653719B25251A8B7A94F306AC9660EC496AB7174F

Coordinator signature

3E33DD263C4EDD39D60B35DA548FEADEA65425FF7F6D1C4272D0E030C4DC48C941313CFA05E2106A77C76B7693B36C94CF32FA85F7BBBB35809E730FF181670C

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

168DC3D873C3F7E849AD4FD2F68C9F59BA604EC59CD17E078452F7CF2097E68D161ACCEA1CA5E991003A82ED0DEB76EA33B49EC0053097E5085640A7F4FCCB01

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

40B054B02B8C9E5EAADCA6E6E83C698FEC448173365E2D97921C2819424F8D878CCF9CAD801DC5FF8CA5641F885AF7E658C4386B1B0F9FB9AA0E5E4B6B12E806