Type
CONTRACT
Validation date
2023-11-30 08:03:48 UTC
Fee
0 UCO

Code (929 B)

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

end

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

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

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.00997, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1701338580,
    secret_hash: 0x47409734757236F03578B63D51417319F064ADFC1F2D40D46948A29FC9E73024,
    secret_hash_signature: [
      r: 0x6AF4632EF6A2CE92674B1FF3B1DA3E6F7CB188AF172ACD79B6FA6DD8B6B04D07,
      s: 0x78BABDFEAD7A07CFFC8AC38C99F8126A4B588CAB7FB64DE24D71173ED26E8183,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D8CCDFD4B467061356BD8E51F5C4C67DC5A214EFDC42C8BCD868BF18FF2358FACD0BC6030A0D7537476EA827A8AC0E36C704B53E06BE9E1A904E18D2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000166175255AC42774E0A89AB8AA383EFE36B59A358F861C2152DA558F9271B70A7

Previous signature

34BE57C96CE742ADBEF51FD2CB781BF719BC7994C742AB72F673FF5BA213D412058B298A1A5CE584C6A1B31355D07B6F33B25334286D9CB27BE55F017767480F

Origin signature

3044022058CA9F2D651C7C277C09803B1E2611203A165E396FA3880F9197A2A1444748A502203C3D517D2713F8D06CDF2716F4601AD550F568D1873F509728692B58E3A00C17

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00589D6B0CC0903A83081CD7718BBB3F85BDAB79CCEBEAD25DA48310332F5CE1CD

Coordinator signature

BF7A6C1F1B94EB54CA92CF2E90818265353ABF01A1B2D0B7586F62980814EB21F2CA0D4A46E56643CBAF0A06FB3FAC58AF83456BDCF78ED34CFD893E40B07401

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B51FE1135E9DD0682D31538E540FA568E46105B1F301030C2AD125F6BABCEB7EEF9A72DC0FED1CD49A7904B7FBB474F8300442840B16537FB4087688D0E87A04

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

5D4212DAB7CFFF737ACB3374BB678EFC1666883C9569E4216829A1553EAAAEEF1B29D1512700C3F6023085E660A15F1C0DDDD3EA52D75F96907B5B856409A905