Type
CONTRACT
Validation date
2023-11-21 20:03:57 UTC
Fee
0 UCO

Code (928 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700604180,
    secret_hash: 0x16A8773E7754D14AA9117489C60281028E113B97CFE0F1D88A63D4CCCDA74E59,
    secret_hash_signature: [
      r: 0x263A13F49FA05811F19F6BCF5054B72FE4FE24B99BCA9B7F034373789450780C,
      s: 0x356F106C69F8071D726219BB6570B05E337C474319C33BFF97BCBE62B1A1738F,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5A90F53522AC3684AD23491644E6CD49CF362A619F7A766B00618CB92B52A6532909A9411793C967B45FA8AABCD1130D940F5AD8BACA319FA2BD0BDA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B849A70496C7DF74F78792E2CBDF6A8080150CCED85F7EC06E9B131805F2DCC3

Previous signature

E749204AE34BB45179856D0E107109469219B7F3A6758CD2099AED148D2CA29C66F97F9EFBC33D963F2A058C4EBE2552F50856A7BEB24766A7463BC0ED881E0D

Origin signature

3046022100F794A6E5D9E83D24344565FEF62C9F034E6B6322790D43DCD818B2B6DE13F1B2022100C83B8E833176F8DA3A11C043FB892072897EB8BAA3FF1100FADCE30CD15D21E1

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00404AD856F3EFC465EAC64465DFADCF752AB33F5CB5F2CC78F1FDC92BD40710BD

Coordinator signature

0F0AD1D20C0AB3F156D25248BB31477216BE492C4572BE32ED3FDF5C073713CE98A2A3C7CC13ED262ABA177C8AEEBE3CFC4F3CFD088721985A3575E319FAC705

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

CE7456E628F383DA76A22F81AB389AFB425D0EFD156477657555C51F7C8FFB1B33824F2393C567D448D9F03E2D0C5BA81A2C23872112F9A6D764768CD3E0150D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

F77115EEAF24AB410E2A3A086952096A8CE4A0D5A1F8CC3DFF8B7B62DEBC8DA79602BBD5C863656BC84355AA9579F275A884437AAAB191B8FD184F5B8FFAC706