Type
CONTRACT
Validation date
2023-11-12 15:50:56 UTC
Fee
0 UCO

Code (927 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.05, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
  timestamp: transaction.timestamp < 1699811400,
  content: Crypto.hash(String.to_hex(secret)) == 0xE0C1D06F7DF783D0024359A66F9AE5D69AF04471BA23BEFE9A5A8955C23C6EB7
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.04985, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.04985,
    end_time: 1699811400,
    secret_hash: 0xE0C1D06F7DF783D0024359A66F9AE5D69AF04471BA23BEFE9A5A8955C23C6EB7,
    secret_hash_signature: [
      r: 0x9B1E2C2003A89B5BC7C508DCD58295B379E3DA120E661BDA951F83802232237F,
      s: 0x5F2FD539441870A43498D08945E4D10DAC829CA450364CE909540464CEAD01D8,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F997217EDAFF6C45D586CDA242BD93B29FD8BE02E1B9AC007C6DE57336316A1ABE5D0E916EA650AFBE40E52044E5C29400A5676DC4F7B5C485DA8587

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E0AA700C1502C3F81899FF525CC97D66D9C7809EEE8951FA885779353AA84C0C

Previous signature

320A408CFCE38B2A671B326E1848FC3847205F419C93D870B03712654BF79EF26CDEEB52AAF38D366C9226588B1040A16EB8049962359CC4C434810FDAC48408

Origin signature

304502207EEF6E5825392A593F6949F7BF4D0C549157B57881F740AAD988A39252C6823A0221008493CEBD27A67263EF27A0164A81C941062AB2F7814C49918CF6E510628D3378

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0058283152C64BA080F05C08610CA654E3EAFC41567F03E5141823A7B39CA392F4

Coordinator signature

CEAFB9697CD29F0BFD128EE1F2F3FC56518BEAB39A9851775BEDEFD7CF64D01B81CC01E27A5A8FA9C001B28EF3F338F43C6C60BA834632C01769ACFE69EF420F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

45CBADACC5F7F47272663D74175DF1F26E46B2BE0CD9661B9926723111D3C09DB9837D2A79CE48751BFA7C20C3B2AF5FFE2872B55B9000FFF271F918F6E51509

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

7F020B043968C1D5070339FC8313EEA2398C57522C2A889F3AF39AD34561F369F139FD6A6D21585DD337F0A390AE2C644FEC1711203E295DD4BFFE9D28FF050B