Type
CONTRACT
Validation date
2023-11-16 15:17:13 UTC
Fee
0 UCO

Code (931 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700155020 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000080D5057516F335B1FA66F82ACCC4D05BBD983ED957B5D7D67505A4CFE10277FC, amount: 9.9202e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000080D5057516F335B1FA66F82ACCC4D05BBD983ED957B5D7D67505A4CFE10277FC, amount: 9.9202e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1700155020,
  content: Crypto.hash(String.to_hex(secret)) == 0x7E9EA7DD8F82290085C1127C7C91CD89AF92D38D549E95916A4984CD960C2032
]

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: 9.8905e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.97e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.8905e-4,
    end_time: 1700155020,
    secret_hash: 0x7E9EA7DD8F82290085C1127C7C91CD89AF92D38D549E95916A4984CD960C2032,
    secret_hash_signature: [
      r: 0x5ACF84D381644E8A34F1A46E7F25DDEF55711C6718413B66E7A4B17297E6F8B8,
      s: 0x5EB21B395854FEF2E706C270BB67D1FEE447F7C306C8227A69F206F7E4B8B478,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1FC2D4630B02933205D09896854D32D27B2A022D16C2B241854E07185E0AC0F012D92DCF8ADE3979B35B234B8DEDF2BD446D63A8A3C341761A21E283

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F01FE0FC81C50499906E51365BFF8015EC6B20E6EF1D38116C8EA0F0BF3559EC

Previous signature

D8B317851077E853F53636EAD4F79F8819D781787FAEF25486B8C6C63CE0BA78239957A0FF6D88A664B292FCD2756536CE60FED67008238D679FD3E787A7550C

Origin signature

304402201631C38F593DD0DCB865AA3A6FBFCA6CA3FDD8F43B1033E6D6A218DE05E3F317022048689C0C2A4C6515A99117EE52027E750344ED2B7185B3EE71ECD3FFA83A53A4

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00B1183E46730210A855E2E67B0F7D7B66BA6530D80E2EB4F8915819957E875237

Coordinator signature

5616EC528EC28927EA82F1BF0F9C87286B72F574EBF26A21F704BA82E67AFF1700ED2B1055F2B5480A0D6CAA729E2E57965F396479DCB233FADE64E3188C1E00

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

93BFCD09EB2032DB0A4530DF9F53692F067F325A538CBBDEA93C9A504E7EEA6E0A4FFC692327AC655D2E76E3DC14DFD4D3E329AD6E968E0A0182B616D5384A01

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

E9BE6FE84603A981105C06C550A45564FE3C47869803AD349AC896B13090F8B8B11E9B5B85CB25F59557D9721276255AC7E7B4616DE0C8F09DDA259349DB7D02