Type
CONTRACT
Validation date
2023-11-12 19:46:25 UTC
Fee
0 UCO

Code (933 B)

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

end

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

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.05217756, 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 < 1699825560,
  content: Crypto.hash(String.to_hex(secret)) == 0xD6BBB52208A804ACF3BE6097F5279EE26BD3ECC41FAC012C8B434B5FC4E850C0
]

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.05202103, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5653e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.05202103,
    end_time: 1699825560,
    secret_hash: 0xD6BBB52208A804ACF3BE6097F5279EE26BD3ECC41FAC012C8B434B5FC4E850C0,
    secret_hash_signature: [
      r: 0x3B1272915D0FC1EDE591BB29595DCE6BCB8A1D08BB4305B7736E82980D489009,
      s: 0x655640ACF89EAC3C56CA2D6EF89256D5F0D4AF6FD6A3442DF5EB3CDD1F84C2B0,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F1824836341E251FDE1718A0B8AA8EB69B46701BDCCA3B9306AAB29400FD514CF7960B11D9601AFEA1F04B62FBA80D558E8B7E6534EF1DE07F911F17

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F3B84E4D3C9C952CAC8C059E3CAC08C1A02224E36EF66E0799400048BF8D8771

Previous signature

DB0F0939B29B77306C5CDA727279EE7133633B0107D3AA39B647CF0ECCCE43179C855BFDB5E259D8BACE4E9B6CB36141FD2A1ABBF3185AEEE09D33422B297900

Origin signature

3045022053588096DA27D64484E5F16862C4C86870C53BC97C387837A6E37D2E05DF5D14022100FB5A4C951BBCDD7CB35D0C327D94A3A32407F3C2E1C1B0F4C3B7C852D9F721A1

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

001BA6C4A5F13780902505FC4723AC9C0642C027E3BB36710AE10C2D3B841583CD

Coordinator signature

21037E12BDE20F47A35EA56B16D56C0F96769E5580B3073E09817F2C3BC6FDAE7802972349CD57110597D337593F5BD60686CBD0B3B8C0BBD43BB133FCFAD20C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

88B194A1C73A25A1ACCD41BADC65AEC4F8C2FDC2998BF2B61BD8312CC7BE696989097BA9B2AC721D195AAD829E84B9AFB2443919E85A9A516EB58F6E715C5A08

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

3FF5C305DDEE8B01C21163683C8173FDC8FBA2DDDA5E021783C24074299C322E005137287C0E375719691E7E3A122D4F6A52DEB0D10866E875C41B747BA6C908