Type
CONTRACT
Validation date
2023-11-14 19:28:29 UTC
Fee
0 UCO

Code (951 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xa1882c5221117377476087ca0a34ebea115132fd", 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: 9.9202e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2808012FB559DD63C31F9F635EA8F3FD2883ACDBFBDE004CF28ADB1533870D1F749DF780BFCE9B71C00DBCB71450BBEEDA570356F8EE5A94548C98EE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B7D4E8B7D21A64EE9A9EEE9E731F387DD2EB955CBA10899BC5AC2EC8A3E22D4B

Previous signature

27E8217D18DF28A97AEEA20545F812A274C73657E63FFF1BB86AB310698F4F63938F8FCBC554489FFE509C0F3DEF88AD297D66E1877CA8361CC73B57B4303005

Origin signature

304502207363E035A83163A45AF728B66BDB786F01A7AEDBA6D2D7881F4459DED347E358022100D890055EA48F5556CB61B745004831C86E680EF57385C071D9362EC740784234

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00ABB42897A354350FD97497F5173CCB075F88C03F08EEF210682796CAE4A87DF4

Coordinator signature

0286C852D651EE84023A0E1CB9543108331CE5F96BC1166D4048A535686EA90877C95BDF141E720A44549B6F1EEE1540DD3FDE1C560EE4CE3F506DE495092607

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

92C92CDB101B3912EF5A1D1A9DAA1D444FD31A750918CDFE7685CBA46A42E421DFD5538A8F7D8587DBED755374678185868E64DFC6A70D6B3CD3DC00338C0703

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

9E3230CE0AA00DCA7013325BC2F6B5625457F3ACCA23B108A00A2C52FFA9C49865A272E0E8A622A43A7417B3478BFABC3904B5C852C71EE631E5ADB3194F250E