Type
CONTRACT
Validation date
2023-10-30 17:09:49 UTC
Fee
0 UCO

Code (934 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698692160 do
  Contract.set_type "transfer"
  # Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.99

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 1.99

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb481dec0e708a67f3c335fee8e2c65b3c402cb4e", 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_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 1.98403
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00597

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8171362DB1A042117C6EF08C71578FADD8B9C46FC3BC4B0F863FA1F8AEB08431019209BBE63F4793093A5116B8C88423F30C10149FDF407574E831EE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019FE2F0E92258D20CC10D68D1A70A8B0D20B0114492D7C35103281D92A2F3E97A

Previous signature

BC0028C04E288D7939B515473CBAB78A0333D8EF0C17545E4E80CB7CCC4E2A4900097FB8E1B289B5BD598278EDE34F9CC98924283A8E5E8C674CC57B92263D06

Origin signature

304502205F574EB27F267E07AC9105EEE4BDD8091E29B7C3D2FAE9175C1F7B9C9AB7D623022100F271A4B0C5320D4C09D48DAAFFF57194AC48604D18786588C0052274EA34C6C5

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0039DE389A0BAE72EA874326512173AEA88CE6282100FA8623A62363A3CADCB31A

Coordinator signature

6E761B14700D5D80A775A02AA73A8BBC3487D01898F2A9AC2926CDE68F35AA4B766BDA11E68EEB03E74316C4D33E3925D6985C306C5BC47C5B869DFD6E888B04

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

8184C1F697222E10F26A6CDC27604825B86B6E55E9531BDA6569A2A4ABDA8EE559021177B24D3DBD590ADF70B0024AF277D02CCDFEF19EE38CD1787518A87F0F

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

B36C4FD480EE804EEF698F2A67753FBF365E3B90FAA7580015832634EF262800A349E6B8D3D81F0C8ED0CA8C1B3193588612F364391547E456286F732888860B