Type
CONTRACT
Validation date
2023-11-21 14:06:27 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1700582760,
    secret_hash: 0x25EC60EE5079DF1A38F8DA84C9279D53E068F13549CFD9F95B8D3A5B1167E10A,
    secret_hash_signature: [
      r: 0xAE48C23043F2A31D70C4B042C30041C3B65715B0E020B3D8F2F44F9780F18387,
      s: 0x280C67C99708EB64AC809B21FB0189DBD6D0E45D71CD420C296FB2ACD97D65F2,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B4B5E72A97937E8330F61D1DB9E3051354AB22023FE38C5922EB770638E4595F0D0914A474C3BC9FB940B91F15D4BCFF5A7618ACD307262C772D8D53

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001952DC0FD7B59E7BFCE149DB0EB075E9A4D26997752CFC044DC89A2683CE5FBA3

Previous signature

A8C390DD3522E04E3C55356CECCF965A63A67760EFAF5AE81FD72D4E4A79922FC0FC4083350643B6317BB816FB37C0573B0DCF0CAC6F9BA7286C4A8CE053740D

Origin signature

304402200A592B0899D2582E2A4C89348C418132C9E98FD5C14D16F108C0754507208C0E02206EDE00459A5DBCB76F18DF68E1C23FC8A67DECA3E164CDB663F21F750C99854D

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00FA634ECBFC5068B44EF979477EDD9FF7B6439FC97C341022704B7F501152DD96

Coordinator signature

E369F2FCA6E6F41D4E7EEEAF112D7730CA6A402C2F70DBE30F1DB9EFE1C447165057B877977B9FCB15CA131076F34115CE6F7F597CEB1A82899FFC64E52CFB02

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

00E463A61DA82226399F02CBE8EA96ED2895D3C400AA292537572F20BC63709459FDB0045B478A55BDC9CD41A6FA6437E80B9CD41CB88837032F1211C2CDBF00

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

31D9DFA6DD3C51795649B87877353FE3307896E8682D48E19D7CA54FDF0B21202A9B0ED5D2D0F413322EE3C69D9B41CE76AEBF67E7D8B0D0FB8403BB8F89EF0F