Type
CONTRACT
Validation date
2023-10-24 14:38:07 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x0663af4cf8d8d63b0dd8a11c4891c4dab9a6d5e3", 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: 0x00009E731DE71C9598A6C853EA89C736B1DAC3652AE00753651B642536AB14821F06, amount: 7.93612
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.02388

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9D344847E628DCEED34259E701B91571422C3CF3A74715ECD7C832365A565F9FC640C7C6D9615D48291E4F9B2ED31EC7ABE544F51A029AC8BE8A8A8E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B1EE1FF43D1007008ACAA339CFE3475586F7B11EC128ACBF2C5808F48A4BC2DF

Previous signature

0CDC239317D7F891EA4AD8FE331D19C8DAA8471B9D87ECBA02C7FD5477641042BA6A0049533D262F2125C258D356133AFF5915C1EB75E937F12BB1FAFCBB0407

Origin signature

304502204014B7203A2AF4A49D9EB693FA9C1A61BEC668781A9F834F9400A39E3B5B5B8F022100DDADC2D6FA57469EFDE696EE1DB867BC33CDFE1C80F07AF1F47BE7A386661994

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

008BFAF1A9D5C242900620DC7EEE68DCD3F4D3E81227F5E9119260CE1276605EE7

Coordinator signature

54CF631739AC2FB8778B7BC713F3DCCE9E86DF2CCA027642FD1332326DCEA2B43DC12803E9006D54E3A179A97021EA09FF77D4A7461A2F953F35F566D68FC208

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

C8CD2F1C64E023147B3904AA3D476E64EED9373BD54DAB444ECC392D45566569DD70397F88D9EC3C6522FEC7234980AD8A5270226061B95D9318BEA98554FB0E

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

B138AD15D71C075E5A993CC9BA14450DDBEB7CD840F503687A690D558F93B49845F49D04B68302C521B49C6419419D12BE82D3AC4B5D05278D888827AC33B20D