Type
CONTRACT
Validation date
2024-01-25 15:47:42 UTC
Fee
0 UCO

Code (950 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb767fea7bb93f31c97519172af30e170916eadda", 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: 0x00006DF0C3F3EDF04270B7DAD02E80FF9291F01A6797DCCDC062D77606B99D4B230E, amount: 0.198403, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-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

    E0761C2AE99246FF5A3B89C303E28E40500018064B771F73596286EAEE80D116A1D96A696F8E9BCC2CB3DB3D120C18E81CC16852C8AF07ACC6DC2D43

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001BB4517998F7FBD630A48F88C27231D3AA40AF24706CD82AC0DB8060466BB8DC1

Previous signature

1CBC6DAEBCB866B31A442C439316FD37AD2BA20B36F3C0CDB59491D648324AE20D585E5B8BC050615DD40379C9C89F2CD097652AD2B7F34DD8AB82C56B751C09

Origin signature

304402205BE8E19B2D85F6EF5BC8A5E384B9E18A657CC737A7CAF6BB206A224F04C40336022043188544BFD77E38673439BA407E025A3DD8D3376FDEAD0ED45A94D917ED1FDD

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00568A92779E5D97338EB0EAC85533D59A9CB93BA5D749A12F97C6948F24E64582

Coordinator signature

5F6E713BB374C5FAB896C90DF27FA9CE361994078C446D201C29AAC2B98BFEFB8F02AEEE2A82F438CC46FD970AC1D3AE92244942734879678881BBEBB4B78C0A

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

4F6DD2E2458460DDF95B897E42E7797669799663CD0F1D57BC778FD2A7BFE3D3494AC6FBC11965DB4CEB3458382FF233943471F0B79275F3DF45614C1C859001

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

1431918DFEB6C7053BC5EC4CADC12803E9D8532BCB369E7C234C9491A445DEE020BBEBF7636E74257100C1D26517878F3907066602E832BB8BDF7C4C1C7EE104