Type
CONTRACT
Validation date
2023-11-15 21:04:47 UTC
Fee
0 UCO

Code (927 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.02991,
    end_time: 1700089440,
    secret_hash: 0x1008DE27292A2CEBEA6353E99229A6E4EA219DF49901BDB91137507241F1426E,
    secret_hash_signature: [
      r: 0xB0F51E367D6721BE9664AE6A6A939CC519EB19AF3CCC3799D2913BC9C8B9B3E0,
      s: 0x7252B107B37788A142E3B5975F21D9A14D3A2B09E6D97EC34D777CEB6F1FDBF4,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    83DBF013565BE19B50253A1B566847D42CE8F1D3A12CE02E8F9431F403CC2C4AB3ECBC14A28BB06A9C79C04E5E3F6180E133D6BF3671AD56B149F0BA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001EA7CF7B646DC746C31F46DBC0462FD3A08F481841E2780A6A196AC3B0D553262

Previous signature

F64A5F5EC35BBB9C919AECDA827D21EC6E141D746E34DCB39360F45BAB48EF06FB5757E33AF96069D84CE8E6E4F54A7691D6606A9CDCC4947E5DD039AAE47B07

Origin signature

3046022100DA8EDB83184128C298E9C7301DF90B024CE6FF1615483DE90A555696BA543755022100AF7F3EAE806460BAC189F2D4F18B8A1F019241DA8E7B3A240F0610526CCA1843

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00C2EC4FFAF291E652415765615FFD11CD982123F8A3963E194A8989272A808E17

Coordinator signature

1DEFB19628F9699C23E19F4913F72A45C6C4AB2F5DD604902F7338BCFD8746BDF8619990269C880B0D6383838F7BBA017FCBA1B6E4053FFD89C6499A25885C0B

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

12944BBA7671683D277B00D9A7579B8829A429AEFAA051FCB3291800C899805A3908015E87E429C87FEEAFB59C79EBD4E697E73E4EB2FE099DA1B28668077B00

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

EAC30055C576A7438FF4E404D4066B06C54F30313C7A88CCC67E78B5587A0613F5C6E2B1D449FF5EFC420287F4EB706CA0C3A0AE21D1B014C5FE6D3B2C2E7303