Type
CONTRACT
Validation date
2023-11-21 14:15:54 UTC
Fee
0 UCO

Code (940 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xa3588c1dcff4233796ec32398c8e5d13a225a7f1", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 4.960075
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.014925

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CE8A822F3B4E5B7FB871412A5C12E71A74F4D10A9C5987AEC8B118C54CE0B23D2C783C74E38BC42DE7E5871C48360555FEF7F4D5B9076166BC8DA399

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001DCD0A337658BC92D2F9EFB4895F702321F29F98F19461D7E3DA2586BFC6AE241

Previous signature

2167A3E4BCEB46A7D735FF39A964765B8DCA0031EE4927AB59DCD6C4EB0A98DCC0350803D617AB46EE94D242AA4FFEF8D88535BF4A3E5A30CBB03022A4054007

Origin signature

3046022100C6576DD4726062EA1E95E4E076BB521A499AEC2DFBF1266EF7D62A7F1E0316880221008D1FA1BF4CFAE616F5E70500BF808A2D215C5A152B99AC9CD2B44CF65C7F0E6C

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00C27D054E26902D7496F65C0655E06AC5CFE2BB6604B94029073D5E0F9C65FB53

Coordinator signature

2CDA3570E3410B45E268CE303D67C57C760EC4F3C892DEA2BE9BCF2EF6331B9535BAB2A70B5BB4BB301BE4EA4AD9FA732E81383DBE29352098B04BFB6DAE2A02

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

CB85F2EB9DBC45DBC7A6EC6ADD05B60B002906F600EA0CA073393FBAE9997960C5213FF741476B391D400CFEF12DB65A46ED0AB04F87B161274C773956F30800

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D0DE49D415235D4DAD5DC48BD524DF793330D0D6ABE57A20E4A90BBD98A2D4D679094D8CB06D97B96DA593CAC3E918A4ED5C0AA64B775F5D80BE0E5C766A840B