Type
CONTRACT
Validation date
2023-11-24 07:20:45 UTC
Fee
0 UCO

Code (941 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700817600 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

condition triggered_by: transaction, on: reveal_secret(secret), as: [
  content: Crypto.hash(String.to_hex(secret)) == 0x2A02EF18FF60DA99739E5C45BEB745C44B973D5041227F3DB0B19F0096077204,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xfc47e4eb4b738120cc6eeed3c2dbc13a8cb9703d", data: "0x#{abi_data}"]
    request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]

    headers = ["Content-Type": "application/json"]
    body = Json.to_string(request)

    res = Http.request("https://sepolia.infura.io/v3/3a7a2dbdbec046a4961550ddf8c7d78a", "POST", headers, body)
    if res.status == 200 && Json.is_valid?(res.body) do
      response = Json.parse(res.body)
      result = Map.get(response, "result")
      
      if result != nil do
        decoded_abi = Evm.abi_decode("(uint)", result)
        # Withdrawn status is 1
        valid? = List.at(decoded_abi, 0) == 1
      end
    end

    valid?
  )
]

actions triggered_by: transaction, on: reveal_secret(secret) do
  Contract.set_type "transfer"
  Contract.add_token_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 0.0992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A7B32895EB7EC8DDBAAEB6F094FF24F74C7063F9405B663654BE7D8F07F9BA65A4B4F2A6B113E47874D8C2EC38A14ADE1DCEB6D01E93B6A647E09AEB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A645A9B311BBDC1512D49611E1A153055A1500ED783B521F2B932C96CEFAA425

Previous signature

5434F29FCF6DCA8CA1F3D9FE12AC0DF80901DC1C7E2531792D797CE1F2D1AD71556E476BAFBCD3453017875409C2E550AF3AA79F368DEBF3C6AABBF8B2792806

Origin signature

3046022100A4EAC508890D9F01D96E44CEEDAE81BD5E35700F0BE4B55DA75CAEAF4062A1C4022100C5DAE1C0D17BE7F5EF135BB199FFCE78BBE72EC9F28EB8D0B050BB37523589F2

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00544F46CD9D1E60E72B1693AFF6DB7E57FD6515A1AA195285486E7EBC4F13BF8D

Coordinator signature

24258211424E1CBAE8AB9EF34049E6CBE12D49966F8B87D629C2591230EAC2F65E185024CAA6456CE447B26474395ED07149B23244F0256E15637C845FF0BD02

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

C97490A38F11992A013DF63D66FC6CD6CB4D032BEC5341763B945FC387E27E9976CE14309D62AAF97DE610DF100AF8389A8369E2768224BC11E8E90562881B0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

A9A91AB147E60DB018BA72F01532EE46A9F4E3036AB7F247C638C713743043B7822EA7689FC832CC569757DD53A7DA91B0FE590E75ADF57FEF40EBBB3F1C2601