Type
CONTRACT
Validation date
2023-11-12 15:46:31 UTC
Fee
0 UCO

Code (930 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.001994,
    end_time: 1699811160,
    secret_hash: 0xF4FA4805A81F8A17F897ACCEB9BE102C34482FE5C87F1858864414E66E4E34A3,
    secret_hash_signature: [
      r: 0x4E915D4B21EF22A7D4C28EE8D14CF2901ADBF2643F28C0F0FE442120F9351A6D,
      s: 0x0EE4DE6178AE820B3EDB979D6D7411DB94B69FD03F369A36ADCCAB97595BF181,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1FCC7776BFFC42E89F131C24E57A54E2B6ED5D782460FA25EE82D910B2BF1889ACAEA4F1BB5B455B66E5DF963FCADAC62A88386A7FBA91729BE92DE2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016BF18A1C56F9E7E7B7B22C1B8441E3E368CA709B109ED4F1E1CEADEBEAC26DC6

Previous signature

CFF20FA65354E3C1249403CA7D14FD55DC4A5F00F73251FF3F81B96AF95CBEFBEBF41273B4BB6F4769C80CA900A50E1D3EBC7041B39D06C0EB81EBDD7D15480E

Origin signature

3044022043518441FF2434BB7BFBA63EE3178A81D4F51340DBA56C677049F1923C6876F1022023F8F2386ECD187816FA5654B0C74AB3E85E06702E34D96545A2173A48979DF6

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0069B4554E109DF68C5A9563EEF81C9007E3A042EF1C9E7FDB7BCDDA7E25002048

Coordinator signature

327128E30418200646AF81C55C22C7952D9A9DBC1B0B554837DE6F2640E1515A8EC210663D2630CB8CB3814EB9D0D157EEC3182EF57F5A9761041D87DFC3B70E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

1FCA65D8A187A3D11AE1D3BB000503E61498BE583084FFD6515E63E4DBB2E5FC54B616587F7E31B066D31D93FDE60CE0CD0395282F1CE2A183350804D3CA860E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

11CC534B15C29EF4F99D1C22C3FB22212B3B30ADE650847A1E5A1F35525EC96B86E4D5F4B3117BD66F3C03B208B075531305B0BC47D7861043DD1BFD356E8E00