Type
CONTRACT
Validation date
2023-11-30 17:04:26 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1701371040,
    secret_hash: 0x25F632634785DA7464F34369AD2A44E5BE923CBDCCC3112994E4D8C82EB869BC,
    secret_hash_signature: [
      r: 0x9A8C218C5C2E048D8108D2BDA68D068AC4ABCA8D3CC89964D066ED7A4D228078,
      s: 0x5E4C0DF6F957D7C909E61239551B0A862CFB695C78826BDC89415E4D669C5A3F,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2DA66BF9EF57A5A51257FA15DBE06C1D7EB8A357ECA66CA436F66C9AEB9DC82B5E468C4858B1B5A96B4CDCD648A66A500CCB30D9A551A2BCE9F382B4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D7AEADF8960D1A890E8A9950EA520A303814E0487760E4123F93C909F50667E8

Previous signature

D0740BEB2705C9607C6A65BF700D9B8C6AC2DA049876D960FE0B6A8327EB77C95043E205CDDBE50EB574FF9DD8072C6A5A50861B106DE8F07405263E846E1E09

Origin signature

3046022100B98C4AD275FC7BB5E850338F2ACE68EA3F9AB676C4D751C8422E188EF00B469C0221009AFE796AEDCB03FAA3BEB6999BF4C38AC84D11131E4F51CFB8E4BEE8ADE18989

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00899349724B8CD4CB1DB9C52DF2C0358E64F1CCB0CABDD039D1C642FC350BDFF1

Coordinator signature

A4290B3E92F44DFF3FFB3D022BAFB4A0E67CFB5EE4FDFA1BACD168B9AF1F26CB602C409B9B317B720FB57D61561E729EFD53250B93F8B63AFD9614F7FB484802

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

BDA9B808609B10FF48C688C1685FAE546B526A14901394D204126A84ACC92B50FAFF94BAF1AD205FC92B614C5AF042BE4D47053365ABB51D5EFC39E94D756605

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

BA3678157CD4B1353C707AC02E4FA3B0755FCD55DD36532041120314477C59D9F6F17CB46DD03BD1824E6FEDB31B619EB7A78C865CAA59A10DF62B73F3F96805