Type
CONTRACT
Validation date
2023-11-14 13:33:21 UTC
Fee
0 UCO

Code (873 B)

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

end

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

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

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: 9.97e-5
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-7

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-5,
    end_time: 1699975980,
    secret_hash: 0xBF93F724D779E7CE10E36D3CAD192A93C524668D8062E1D563DFB1CD02319F8A,
    secret_hash_signature: [
      r: 0x899D502AF511042E2521CCC26983AB120332E91829EA5CD74AF261F73F415010,
      s: 0x0025B8C83785C2A3125BE41CAC031D70B982A2AB07A256AA582BA86FD31B6811,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D09CAA3D7DA210A7F0CC24F2C8F10D5D17218C71F9B97BE5802CAEFF7EA33862544C451C74939DB459C440E15D3ADE8AFAC9EC6312467507B5AB3548

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000178DBF2252D188D87DFD8BA4AA371C9D01DC6D8C8013341B1E9395F8C2E8D2F73

Previous signature

1FAE1FECDBFE683D6A74FB7F9962F67AE5CB8DD4CAEDE22787DF0A66C5427B09889DA0F51C84AA58EBBE00419910286662F2C12DFA86047E84AAC5475384E604

Origin signature

304402205A68FDBEEAFA1597BF1A7ADB303519D1801554F723DD9DBC00BB01F79FE4E71F022021A10C4D154CE71F0A862BFDFC4B510A8472C05F97AD7C78C6D32CA8B6BB0691

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

0036347F7DD170E4539340EDBDE1375E54AD59ECA0FD493BE779EDE9183F33A8F0

Coordinator signature

618A7DCAE0AFACE25E7238F365182A41D10F30214F1D9B5174F7BD449A01BA3D56E3020C1D3761B9094AB7A78DA28D3693A5DF8461A2398109726E78BF89D303

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

2D09FF8DEF0A010F3A6E66765490C46063D5F3FC5F4F937771FE89A6D4AFC390BCDC700FEBD1A78FB9AE69EBDCADB6F00694CD5F765FC4975C5CD43FD57E750E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

62C44DBF9E46E8065901D11F980AA97B6F9A76703A526F2F2E94DE8103E36D7F4CCC3AEC9B19FFEF35A231B3ED549FD2EBD0DEE5D39DA8099E7B71D4CCB56C04