Type
CONTRACT
Validation date
2023-11-12 20:33:27 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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: 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 < 1699828380,
  content: Crypto.hash(String.to_hex(secret)) == 0x9C6AF79A9CD72C349DF7B9B72F407810D4048754405C50249FFF7694884E6B3D
]

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: 1699828380,
    secret_hash: 0x9C6AF79A9CD72C349DF7B9B72F407810D4048754405C50249FFF7694884E6B3D,
    secret_hash_signature: [
      r: 0x6E3A833C75B8184666F34FAD715D2D00575E5F2A524B65AAC188D17BA7671AB5,
      s: 0x75FDBA21D05ADC4823A9DED1FCA2A36402AF9B9C4FFB37A5855A890C3F3B3319,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EBDA6E09A1DA962DAD0D89966F1FEAD771EBDE673DDA82121FA45C04F8E9109CC1F72969509FD5477EFBE11DB308547E6D033801920BADC23A2E04DC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000163415582F97D2B3A58F6B7514C6583CA4818FFD2AAF1F43573F62F41231A7621

Previous signature

2CC90D95072F7003568C3455DA89E7C2EE1546E646CBB5FADEC6A4A415082020BB2C06E6A721E92FEF78614D91362C10CFF1D054D5C16A2E24B316C83EADFB05

Origin signature

304502207ACB5AEFD9D652CA748A33BF95E0C61B049D58E7CF22D9751FD72982C5FE66A7022100FC4B554D11A0D8F2EC94E6EEB4A7C23AE913ACF27E982E66C486D13FE25215AA

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

005E0335FFF40F07531549BA27C1B317079F08A96BCC28EF8DBB978B7E6DBEF639

Coordinator signature

5C16E8E7405E7D8F4F9B2463207085426D57D04BE4749E7F7F8DB6C68BBB7350EEA86EF5E0FA1D275BBE1E71F98A48213238CF32756A306DBE547CEA57160D09

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

1D9E87E8ED0A41CFCD172D04FC832ED0B1082D23CF5360FA926AD99A2BCE095852E2B5421B24307035E277E92019FE58926A23AD0AC9D7A3CC3B02F341345304

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

3CB44C091D0CAFE11BC00C6F70A831A8E74DE030EBAA07C9D3942867E825B2D5928086D65357784E42C75333294E06BC4468432C60F168BCF6C9F42488918000