Type
CONTRACT
Validation date
2023-11-12 15:57:51 UTC
Fee
0 UCO

Code (930 B)

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

end

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

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.002, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1699811820,
  content: Crypto.hash(String.to_hex(secret)) == 0xFF1031CCC21EAB5713F26809B936740EE41A34DA4B775DF86C70E8A958FAD950
]

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.001994, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 6.0e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.001994,
    end_time: 1699811820,
    secret_hash: 0xFF1031CCC21EAB5713F26809B936740EE41A34DA4B775DF86C70E8A958FAD950,
    secret_hash_signature: [
      r: 0x94B672DDA1E4EB18E8D3C8FE3AAFB2D04CFA63EEDF7928A4CEB73BAA385CD85D,
      s: 0x3AA85A7786E7903B9CF36AF6FA7F4A7114B57E58910B8E03E3C6BFE397B399E2,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1FAB00AB859D7DAC1A570E10057FB583DBAEBE7FAE1301E6BC069D68D30D7E76672A08B3B807E826F70484D8DAD3E4D914911FB43B171F3E98435346

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000125016C4CE71644995300711568194E4CA5AB789B949DA2BBF4AF2E4F278088A8

Previous signature

AE7FEAAC7E601D32BC0766C283BE4673D8BE9038BEF0DF332F5CC16B0194D77C57381FF394FF1ADE6962A3497CE8FF60DF7FE6F3E3D6598B82BD54DFC4B6B906

Origin signature

3045022056ADB78243357C9360C546D6B724F0DF477326DE75B4C43D2A5EF1CC147EA43A0221009CDDC1BB5FA261E431B84D8944CF5AFC07A81206986DBF4913D865E47DBF39F7

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

009DBDD482092F28AF5CA848FE901FE0C3CAA346F6B6E2B7D758228FB1A9A2BC04

Coordinator signature

C5E517859BF353368AC8B4D965C02F26A24410C6A19DFD5A55F1F490FDB9EA1902F972DEDE232D4D68CC708E7B0AD0B41AC9F63311FD4B5B4F706ACB5D9AA205

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0127AB8105FBB444272319C443E1BACA4F6916B26DEE1B3513757CC0911444552828D49E8C080BD37C0645D644EDCD8EB5C2A22CA6FC927A9B9D308309FB9907

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8AD25B6256E4A0510DA4850DD4A7A3ACEBD0C45F72668995AA3DB09F7684A9C65087E59B52A251D8E71B52E55210684BEC5CAC5FDA977F9417C44DB54BF6390D