Type
CONTRACT
Validation date
2023-11-28 09:41:01 UTC
Fee
0 UCO

Code (954 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x5e6d69bafd748dcb16cddc0ba72b810342ae6eaa", 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: 0x0000E3E9B897C1EE0DC7FE004AD18B4B23361B00861F0C4DC6FC85FEC6A762FF235C, amount: 0.24800375, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 7.4625e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    83ABF2FEA30B24D8764944093223AA31A20F4148DD2AE5380F73C5D7A23A4E8F2D4C352597AC3FCF9ACBAB7D56A49746BD1C166AE0205FFD97B44476

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00015546647710574B6D3800A8BA493B8931D6562C0C1B4E29288EE9C8EA7620355A

Previous signature

522A9CA62A6B761AAC6EF6CA6B380BC266CF18D0226FEA55379910DA30CF93C6E3A02C1F8B285519E769AF842A98A4D2CCCBE0D47CD5BD27830521801974A802

Origin signature

3046022100D877C99D443EA6E994EA7D80CA3D5D0DF13197414AFBDA2D193C14DA5C96589A0221009A71FEFB7B977FCEBFF41CF3E4ABCE7AE71C9D6EF1A2695B5985A98B003F51D0

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00ACD44264F1B8804F5795F7D9912441869DD1A43DED3E18E9178C7387C7878A9C

Coordinator signature

8F9FF42FA8B5AF502BEF3864DD3C4A58B97D826A88ADE989624B66E4B7D1594C407BAE53E984565BD7956E22CAF553828002B3486531F0AFCD4C3B391FD2C80C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

E20F2235A33DDA60C8AF8A91FA013448BD52A1719EAE74113738FAB6988FA22C338520F64E230292E98E579BB80E5897B746B3333E1CEDB2D5DAE0B55E135007

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C12C3BAE7CF7F402A1110989FA46492C9A3C19D9839AEFF1C4B2F4509413B3B827552079B7DF3B90C1262D0143360EC10480F70E3DF8F5F983DFA3EF8A810F0F