Type
CONTRACT
Validation date
2023-11-22 00:33:12 UTC
Fee
0 UCO

Code (930 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.004985,
    end_time: 1700620380,
    secret_hash: 0x062129AD6D2486855BA16375085825D89D21691D2823DC8D5E19833EC8EFA2A2,
    secret_hash_signature: [
      r: 0x30D8B97D9F2ED7B8E79FEDE07BE02C19FB8C64D0BFEBE5A242ECC354EDBEA149,
      s: 0x6E190B0BFB941AB41C534A78D1F5AAF1C21340C0C3A5E4EED8CD746DA4CF6B05,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    DB96047AEEA3062F2B34E3069388A6171BA7CBB37142234FCA994CDEE7DD645FFE9D92EC8094BE54B2540CAC37DE2620B16A95E7C809E706DB10BF5E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000164BD2DAA125C42B57ABA93441046D3B5BF1408BB2009A0D4C70485B2C7D8F2D8

Previous signature

AC39BB87D5EC7011A8AC2F88709AE1623B0576C508446BEDB31F5F3A8090657DBC4763F3E7E6E71FED6B77438869A8B3A4A062A0D094A3360667C492AB6C1805

Origin signature

3046022100A5350EDCD6A6BBF21BF3CD61120F48167079BFC0EF1CC44CC950FE69D6DC9EC8022100DC15EDD7B4C665F517F73EF34386F8BB3574FA83BC0AC3A6A05FF76B7CF085E8

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

008A4E698BC3AAC45AC980340867791EBB41B0E32F208D559DD30928C491B043EF

Coordinator signature

FAC7E91A0B90BCC43CB8FC165C28BAEDCAEFCB2149BB22C7A643BFE109FE063CA0C972EEADEE75B4DB1B10BE3FE7A64EB0AEBD789FB42FA1B17B8E20101B0F08

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

6F70DA6CA79B87F95120124298D2D7C233CC77FD2404FD0903CDE453BC0C2AA0BF4CC11F4315B8AE18229E2A9A59EDEE41CB313D7FE28D0727A1AE43FFFD5000

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

E2B9BF59DBA3BEB83BD2903CD3FD668B919ECB178C12E1EAA773DDFD696E9E04A3F88E04E8A2491A2FE9F04E93C721FA5ED76E8360BEDD0AAA5293B55746AE06