Type
CONTRACT
Validation date
2023-12-09 07:12:37 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 6.4805,
    end_time: 1702113120,
    secret_hash: 0xED9CE29EA2414012D8DA492ADD033DD2FCFF453478A32C9FB97E2173667B9FD0,
    secret_hash_signature: [
      r: 0xB23D783393EFA01B081078FE406B04A7057FFBAA843A8C96F26D0BC5D96957FD,
      s: 0x1B5BC41C51672EF172A8008D805745B1D59413548955A76D18D6ABFFFBD48A20,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FDEF2932B54A95C1011378CE9A515B0457D310716EE27097B06A3BC59EF411200EF4122A149C5039A06BAE7DBE858BB79851BD7B253D419741823793

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000107661B16B0EC8A23DAA68F874633B2EE30CEB08AE46C25EBE6EDB01990026EE9

Previous signature

8F3C0B40D1BB97B97A29E88AA14D37C7D0044B5F1C4F1F899048D4FCA52224EABF8C2B963F92D2720E72D865BDAE72619B34937499908C8D5FE8174BD6B67305

Origin signature

3046022100E57F132B18E8AB79EFBFCB8B3FAECE1A012708D5B674CD8BEFA2C292B127DD03022100DE6A169DF50C7A4D6AD9AF6BEF069AEE44DBD772FA209E0AAC59D18C0737FAC0

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

008A02CC7B9B541B0F56902FAD9492F17F9C6C12597F60218C10A5183D7FAF178A

Coordinator signature

96D03D0D6DD794184305B843FC8C77DBC3C5641AFDD05AEF5CAE2CA596DD966D4A8CEED928A182CBF0C880255B98FFF7C3F7FB8E0F90517DCAE6D403129C7709

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

39B4A918A81C940CEE182ECCEC2AEA8844BC2B97CDDC631FF872E5B1005E7538C57388CC648F315CFB68C8DEC6C725625AA67135C6AA48CD7834696D3F475C0A

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

0BC53DF3C5F63624A4CCE9001FE05F5AF8CD823E7A6D26C301885C01A0A2A42D656E8F11DD4EE91CC8D5E555E7C7DF361F4FB0B8442931763D0AFAF558F07E09