Type
CONTRACT
Validation date
2023-11-22 23:41:22 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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: 1700703660,
    secret_hash: 0x0F0490BC2C686B4CEA07F8E1719A9DA266C917865B2BAC1CF346810A07155B9B,
    secret_hash_signature: [
      r: 0x7A5BC55231D0C7ACF25DE9111FED2B32BC0A00BBAB5518B233B2C57E4A2FDF78,
      s: 0x41389796375F1FAA422DF7EB849D5574EC3D3F43F4244503C14B0DA5F2D28788,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    48FE1B2686FF57E5090E77EB392AE38E17620B2B95031F5C67873686FF8EA72CAA84520EC2C59C8C3F1C9EDB5AB4E462DCB5EB7CD784AE52ADE4580C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001340B55C36D542359BF5F08A14ECE52AC668593E53A51AEC7F074A60AD34A4019

Previous signature

236770F9F2C71FDAD999F7972F0644258FA91A614926EB002BF8EEF25D263CC28E5189E4B5B289814C923C7C46C89D6DF865188EAF5C7214863266C707A5E903

Origin signature

3046022100E11F5F3DFF6D504FA6C651ADCA954BF633D00B4E28C3EDC3E4E1D549D54A0759022100D139C750736561F7882A719914ABB003049DA3612C58E6E0B3DBC1944FF1A44D

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

006E91E0351AD15D1C9C0B4E90FD2B8550504577BB65E2832853E4A90E7D56FC9B

Coordinator signature

9D3B513F9E3136652BCE0E24BA165477FC13B1087A2FF7FF58094BBF443C71EDE3D102DC8ECBB5CB0187019D78AA005A02C3DF9205A83E627645ECC750D8FC01

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

C5C6AFC980F9335E5D78BFB482524A314EFC8701A84CDC05CD9AF52C9F50469154ECAEC37303647704A6EE1B17D5649EC24F50601C1EE9D913BE9FCBA79D2807

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

CCC8F7F0B88CC45918164B6AF927E234DAAA899A5638EAB04E2D5B85A45FFFE8092199BF941C635CB28C121F540A0AD885BDE9A0761A6196658E6123F916CE0C