Type
CONTRACT
Validation date
2023-11-20 22:01:18 UTC
Fee
0 UCO

Code (952 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x1102929bc04fbc9664f58c73c69c01499c3a4218", 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://polygon-mumbai.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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.00992015, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    483EC6CDEE843818892C62FFC505D70933DEECA956EC8D8EEF9511698DF29AF59A7EDEF7C51D9C3D16483D9921C252B581A6BA4F2EAC75B58F52E201

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001DD81171A1F92273785B16ABBE55E16AF991D87BC1ED1DA91A2B1B1C7144F9119

Previous signature

089B3F5C5C3E1644EBDF1687D874179C6DB368AD98A00E304F618825DB2B81D28FC947137DEDC2FDDEF80CFBCB196270E586F5DBEA15355B055ADE0B84812700

Origin signature

30450220574587F5B6DB2F7CF849E35E2C229E97B4B2B1BA817B565E51BC97B9D92DEDD8022100D0701D425C959E5071EE9060211A8F56C8D803439D442D822032B0A812413F40

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0022784439562EDDD00E2A186685F55F84A319B22DAF7719E7168FD8F280D4BB8E

Coordinator signature

4577ECA09A257B8F86ED2FE1DE73FDA7AB6AF02972B7C1A0F99668EB3BB254A4972E6016E267F593A864A5FE88AC9F9E2E2009468397E5CF81F5AEE19F36370D

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

ECE328A41880E83FECDBCC4CF6ABDF91E86EA7067E9EB62E39400EF6B561BA68974AD0D85B529B50CFE2D5F00BDDEA0CC26EAE674EAE67E1B01FF43BDCFA1B05

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

055D8F0D6E10B1671A01C28297E74C3C247995266E702059378A477325B2397B57878DA4E706C834A204F81FE9B3636BEBB1C862E5FD1F9C130D8F884C0F3B02