Type
CONTRACT
Validation date
2023-12-10 08:48:22 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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: 1702205280,
    secret_hash: 0xD83AD60333B4C4FBDCED9CF900C15C613C0FB95157D0C5C8B482A3E16F162A20,
    secret_hash_signature: [
      r: 0x10AADE9EFBA19DB556F33B2B712A2C5BDE9CD2E58949183AE0E2EDD3BCD7B391,
      s: 0x3DEA818DA34F040AB603E29744097676F322C16CBBDA9FFC4D7D2BA14BE95B6C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    56D3B310F1FCE3BBA0743A59220F37E615268DEDB160C838DE22EDA45DA0E9C82EA7A8BF1050780F444D9878339981AF7B5770442AE2D9AFD29F73E1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D3BC3E132588EDB8F734F0F8D36D40DBBB743F29AAA606C4356297F7D1785427

Previous signature

B342873F2D7E84C2CC4F0D4063C12F3AF4A1E4FA79F000685185C820211C11DC2FB8C816C509DC5057E944D8152A3C2F38C7B4943CDC5D500CAEED75FBAFA702

Origin signature

3045022056BEF8625A14237C1FE308B84A150633E82CF3AF99938F737092057B9A264428022100AC4A9228768475DA5238BEE81FD64E9A96453C4FD04CEB5EBF176053A92E6057

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00AD53AEA76E83F82C24E3A4A30095915547BB0DF4593825989953F2D98C95606C

Coordinator signature

A2BE0DB98DD225F68DB6BB075FAB0E2EF0CD8932CF7FC418F8463F195C00645D8EA32016159A9E7DED42DA5928DC8EBD9F70A70DD24BA8B6502ACDAF7213750F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

740E7AC48617B3E7720347DFFBC6F6D8B4FDA95D918D0516C1F5FF4C2B9874A8592FA86CF8D4FC49D0E27E925EA793556BB6750362C08EF56FEE6BCC2683CC0D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

2DE6E4510AE8AB8DFD720145AB828AE2F4314C46A14AA7100E946D1F5E7898215127E9FC71A3FAF630C41B3BC0EDC19A014B2394E61DE4C0111B186384F86601