Type
CONTRACT
Validation date
2023-12-08 07:26:28 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 6.4805,
    end_time: 1702027560,
    secret_hash: 0xD78B28B3B7FC61B7319014996FDDD4F047F724318544077935B5B79A8224DBDF,
    secret_hash_signature: [
      r: 0xEF9B75567D29C15F042B3CEFD18672BB18F2D35BAB408A702D40E543329856CE,
      s: 0x4CC6E72C8CF0942E67AB9701AA54E903471604E256872655A55745373A1736B7,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D3DFA8ACD13F78FFF30EEB7C879C70A56987D151D2F3C7C641142EE2393F90443E4D05994CD9920E1A05A21D7A315D39AAAD81FF3A1614B449C7192A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012DE187B1418A1949ED452EAECC0FC959978EC1308BBF1620ABA45541C9F1DBE1

Previous signature

C83FCFC8916A85A12AAE9A5A190DCA1EBF433DDAB6F07B8ED5152A85675EE416684EA1793C0C006454AD7B250D88FEA464F37EDA74A24D632AA0AC6605CDF109

Origin signature

304502204C49DBF285F439F3D91F43E542A3D42121877BD1585C1FE63AAEB64BB9C641BD022100A60F7952554DA416FE98AB664EF3D8891930DB8297EAE1F8C1511D941081D52F

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

00E7B98F782056A0E2163DD22CF5EDF5780AD484A18FAC61DDFE765E4AB4BAA5B4

Coordinator signature

3C4D6940FE2BB1B21911CEB2D135831DEE0352E26185458E487518AD7EDD7AA7C91C6DA1D68FC92CB340C0DC203DD6AFCD6BF1EC480C6E235A725BE3B420D50F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

D5503CC6A18832B95FE93AB3FC0FE85FA962FBAA9156EFA91735A59FB29A18F74C7A06F5833D2AC53EDFF73097BE69608B092E672628D7337BF62716C474E200

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

29824772AEA222E4FCEF524EBC19CCD9AF52BD7E895F8A5D0A5FBC3634A6EDAD8C73A87B3DFE342D7524B63A8A0B9488F8D978903099C22CE9886E7BAB9DC80A