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

Code (874 B)

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

end

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

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

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.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698263820,
    secret_hash: 0xB26A15768FC88407E10EE63BB0C3CE13709D507965BD745CE3CE12A74FA09ED8,
    secret_hash_signature: [
      r: 0x2647AD5D608C66CFD2CA35B9B43A5BDD72ABF441107709407A37641ECC4B3593,
      s: 0x4E52E263481DC46E27BDD922D0329523D74D9A99F2461385819A1E4D28249E47,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    BFFA930488BC4427824F913076863FC783BC1B027EDCAD83CDE22EEA224D378B56F4C30D36765FF682FB58CA2CFA5241C5DD84BA24CED4C9B4B03074

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011B66830ED2740D46934CDF76DCBFE91A71ED09E265BC0620C4FC6752841A42AC

Previous signature

9DB58531DC80E2890AEE95A9160864332D57AF6114F45FE59102314597649EA300E09344FE679BA3B6B5206D473B47F3CAB73437D1E87C4855D756AD54B79D05

Origin signature

3045022100BF83281D047340D3528E15A6CD93257D7FAC5CD55E0D78A2A26E08BE910034A102206AB76396637E1D8F808D38EFA76AC38AB9484556EC9A7D77A98BC09289343EE5

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

003C6D1922403AF7201644C3FD124B1B71AD3C506B5C1870025DD1B1F920848A37

Coordinator signature

6A0E3C2353E4248963706B2C9B499EBCC72D7915266447132088F01CBDD3387DE3B1C46C2FF667E1AC6351A69757A5A9F15E4AA49E79C67E52549196ED620504

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

A7EE583C63CD7082DD766A93398D4D2D7EF587FB87FC58580F3D757B21432E2C9EC45AE4DB5FAF23BF6C8E7B4D3DF66C1315F95B0E0B670D01273A55892BFB0A

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

F25FAC1562070D5673B92EEECB0066D76D01FC1123EE3942B3E90812267D8B975AAF07003C44B698D53F5C59BB8EEB2874423A2D764A1D1D7850B7B9ED64260D