Type
CONTRACT
Validation date
2023-12-03 04:15:20 UTC
Fee
0 UCO

Code (921 B)

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

end

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

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

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.0997, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1701584100,
    secret_hash: 0x3473546D44BFFC531AA03695677199F2C20DE0CA353B008785D5BFEA8D28CE32,
    secret_hash_signature: [
      r: 0x99B561F42B82EA6D1A3E688D72704E3D7D31BE38033D14367088ADB99BCFAA17,
      s: 0x5E8FDB2A74690FA13B66E65EA537D6BAD5B98F50E198822D727CFD4DF30C5614,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    93C8376546DC00CBE6E4B1FDE76521F6B1F47303BE43883C5EC2EC9366C828C6F8D3B4651C61131B631D0013A7D99D3C58DB60311F866FEFFDEBB27F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001EA15754D8363F630A24D2B6AD6B5E25588A45A006267A1F9E428AD43D1D65584

Previous signature

A2C642E7F5CDEE3630C613A8D54B99BCA31FC96B533E3BF3DFF966569D6B55705D3C26AAC939BC7715AB64926C890E6827C00731AAC54D9CB54872F7C6B86F0D

Origin signature

304502206216C99E2AAEADBFFB92692302A8AAD5EBA68713EBF7C5F996DAC902F45631360221008CF85374D4F5FCAD53926A3BE600A05960D6B55BB701FD890FF2C8BE02D309CC

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

006EAFE99E1D44E8CC1591735BD1D1E8DD36B858A0C173D55DE4C92642545B43B4

Coordinator signature

13A75B9475D874B2D5BF06CAD29876AF8A199A81C851CBBCFAE90B988EA272CB0E16EF7F6AC8FB1866B4E252CDF264FD93FE2BA6C3EDEF6105EC41835906EF0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

477A2F707DEAA2628F3F1FF2CD9934A314E939609B6FF3159065E75EE577FB4ACE36D4DE1D9DC6BAE3E3FFB0018F95C12C4D76F24E86B54F00B538CC02E2EE05

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

4F126F8CC726F70FC7720BDEB4C4C8CBBEB72C89A9B0E47F523274103298D73A9231389A296453E7BD058DDA54F2772CC6897EC7F724DAB21B62D16D6A804407