Type
CONTRACT
Validation date
2023-12-01 14:32:30 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1701448320,
    secret_hash: 0x792782852AC2800BCF7FC618DB005DD71226BF57F78175D58E249561AF9D91F7,
    secret_hash_signature: [
      r: 0xB78C8FC825653D3FDAC13DAD42EF2B1BFFC16C6DD5A374F7D4EA4CC61DFB2CBD,
      s: 0x18B206D978232DACE5EF5FABCBC815F2DA59E97FA843743C3FDBE5450C343D40,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F22EB511AD621F73C7E46FA5CF5A4232A090369823A42DA8A68D6EDC79814E85DAC18014F7D4A55F4C75323758153A85483B6A9D16AFC6BC3BD1EAEE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E89B4565CDC4C5A4A5F66B8208A95960E708C1B6C8DFA4A80983A250D8C74E8A

Previous signature

661C703DFF0C02051FAEFCA028B193CC1EB6C73FB23E204DB8C030357C1DF9F9230E15A6FDEE962EFE4488F79827A3790C98D9CA95D084265F59430D5168B208

Origin signature

304402201ADAD00CECD6ABC67409EE159BCA98E6B1355CF6042491489589C4E87668A5DF02202400057564031D90EEF56B7D142EB5F834C673F0A103E1D7200C3478300E6BD8

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00C273DB744A25681D12F5A8A7D4C4844A55485F14C124750F6A941D29F2760EA9

Coordinator signature

331578E4096545BC9ED7C717ACE3CBFD5E464CDFE4B4C8C150495B8A39AC85E5D475E48DA4247929079C8F9E339E7A33C1A63E4AE110904E2B55D209F8ED9204

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

A2E68D4F1282160C9FAF6DDF8D16622F53B41449F0371319E55FF952AFE4249CBF600611954B11C63A5BB5B6C2113441C9EDC0AB982C21AB498EF0E9BA35DB0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

2A20DA1FB79CF61123C017777FD93D72004B9BB485A635D3123AC2FA47E8E5ED93CD276E59BEAC53A4371E7FBC830DA417831D3D5E961006A61380BB705A7902