Type
CONTRACT
Validation date
2023-10-25 17:32:17 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1698262320,
    secret_hash: 0x4EA2496D09CD755C4B23558B7535C76865CAC41B188067D650AA54E38C4A4F1F,
    secret_hash_signature: [
      r: 0x711712316797244CC9796B46562F80313175388E77779C010CBB137B924EEEA6,
      s: 0x16D4CD406A175EC3F4FA35D81862FB3EA95DB7C728509AF2F014937278AB9F04,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0ADBD4B618E382871AB41E754BF5E6251080E53830926D96C62EFB8038E24F6C025B1E43B509667279265A2F7F97B80433259387942F4979455DAD75

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CED1BED51A8FEC9EC723FE9509AA91DB4E3F90DC54BF094F3570EDC05DEF99F0

Previous signature

2C85CCB7A74EBC4F9C2222CC69762C179BF70BAB60C0E1F0C009EC6DF5610BF5036740452B02A7A5ABBF710B78CEC4D2BE5908EF3FA1C7F1B093DE6048C8A60E

Origin signature

3045022075472017739D02223266D462236E498DD7E23EA2173961188A7890752F85529E0221009D8F6190A3A22EDF9AB6543B545747FE26667A3DDE10B0C67DD733577D251D3D

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

003732805B4B487B016820B84BBB55EA86E347CC2FA51906F3E382A5564F24C3E2

Coordinator signature

4DDB7B9D918A432D4C2724C4C02A1016F159A66D6669F1B4FA7DBF48D800814C369B6090AECDDE2F982DE40291B84BF669C7802863FB33C6785633ADF5F95902

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

B47187D2DEC86C4CCC2B8426C778DC32F23D99B0A3351AAB29D439B25E99DE604252AE30ADA744BAD69B9473677C85A963C15DB9AF3A14B092B0797273771907

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

FBC57697F4EB38B66314C626C2EF8C56EF1A623DA65741A42AFE91B93C6A20B5DF6DBBDA4FA03A18F3ED79D4D59408DDA5AE987AF239B14E9424F0728641C50F