Type
CONTRACT
Validation date
2023-10-27 09:53:25 UTC
Fee
0 UCO

Code (940 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x98c58cc143fb80e73a182c4ab7f2a533eae95805", 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: 0.00992015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0E163AF94BD0907C9155C9253C24ED49E2FD5405029C84E1ACC8A2A1C9C03FED3BEB037F5C725BBBF3B0F9F488358FE3E2B24853FB23B061B36110C5

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E1BDCBD5837061F40DC66221148ECCC70CA95BD39B273883BAB3D39E24C0E51C

Previous signature

BFE6A318844FB05F4C49D139A5E3DDCF0C96DFB979721FA6A7DEA6771E58913B2332EB069D4336E32BCCF4EF4DAA7D385ABF116F9B45597A29ED4DC1C9839A0F

Origin signature

304502206D1F52DE0EED9632971ED2D4EB93115EC581C41AE054872E2843F812959E71FE0221008B4A231D5CEE27FDA81B0B96664076C0D00B86A46A3B837005963C9503534FB4

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00F14EBF8442839985AA84058C044868D2B889961A0B97681A38F7522335158675

Coordinator signature

E87B28488D85673057515B2921C58707C7E9281A7C8761695AE08BF8A3622EF53FE98F21F328A58BD4339481CF07CCDF5977EE6812497F19FFF32F5DEE3E730E

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

F06D0613BE3C8509FA252CD58DBA78D72B0DB7887CFE58D8A437D58C60A4D54C41B2201F8E660638FF926EC3A61781D07479F3CF670C180A4A50663DBE5B7200

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

385E9E2882E3214797E694E04ED88D502A01381127C2078B45DE478D5371DE2603E1506BD1C5FC227619C40B17481D0328D41E7E04D2ADC6E19AD76AA53E4D06