Type
CONTRACT
Validation date
2023-11-14 16:36:04 UTC
Fee
0 UCO

Code (939 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x9995f1e0ff99f66f5e10ff0dc5aba1e404aec133", 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: 0x0000834AD179A291856494A6ECA9AA855AAE0F28E5F221666CBD11D2FF96B2A0FE19, amount: 14.880225
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.044775

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    872AFD3D450AE855A0AF93948233B123FA48EA653845BD7DE191C34300F9115FD4CBFA01DD464A3362FA157D92068E3D485B02CB6BB4788F7FD5A89A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000196923AF698C52C5ABC40EC4D216893BDB1F830AECB1825A8CF847292974CBA19

Previous signature

D6170034C0CE59650AA8734F8D0844A9E7DED88D5CD16B85527CF2F1A18CEAEA29593FAA647B87C7CAF34C921FF4F1684746A7FD9DA12EBD788FBC066C0C810E

Origin signature

3045022100BAFE7FB4895A8272ED1DFF95C0CE03903851EC9194D238984893B5D1791D16D602207BA5982EA6D2E1F790BFA80FF8B934754801B4ED4C40FB82BEB801D9280E52C0

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00472F910886D14F8687EEA7850B6D76D66EDF3C150FD2B5D02556170B95F77CAC

Coordinator signature

45D982372D48BA0B301DF397FB14A55C571F54BCA221F129B747E359B8C332B61CC6D1FDF25A70BB95FAEAE124610E41C76D7263CABDCD55CF7DDCFB691DEC0F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

B4670F25A06627D508DC3EAD5D3C0EE091FB49F7BCD8B949BFDF90EED5C78E51251FB427F4DFB5F9EBAE456B319361A7CA0B7A04D4AD94267846298562A16B0E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

345F8A7B8EE6752361867428E37A9613ED4F2248E80788CD4E72F77F500C9F3CA7FAE356EFCACEB522294FCEC02C65CAD14061750BA213A8961C579758DCC20E