Type
CONTRACT
Validation date
2023-11-14 20:29:29 UTC
Fee
0 UCO

Code (931 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf170d8181936682a09908b83e2bed0b791b75cfa", 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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 99.2015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.2985

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    78A6D6F37FD2848F68B4B4B3C6D7C1F7FFC5FA7A651BE5A9C18413D0F92E1A0D3EBACC759600D8AACA39F5246804DC30BAE33EC676EE1A2D6AB37F9A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EAAE52E895CACF79C7539281780E37C437CC1EC0C8E446EEA69E76633EA5DAD2

Previous signature

2545050BBBD95CC3CCB9B2CAFC075F9434DD3FD974712FF1D8A3B508B1DF78C0060BE0FD777424311B10C4CFACD72A03A1B600489E6004C3ABBB331C8D034905

Origin signature

3045022100C3DC1A0FB35FAF42CD8F977109227FFEB75631D1742B789EF113929BFD5E500D0220217F0353226AC92519DE897B723DB7E0E1648A00DB66DF8BEC097BD0BC392BAB

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00BC2DC475C0E9BB017E9C4FC10B674E043635D9BE4373C48676657B42DCAD58C1

Coordinator signature

C3F6543C7BD1B18E269C6418C10CAEB3591FD10B67AD4DA62AA9A528E51BF6E4B0C5676DE3B2CB0F7F57610405B548A7237643E819D537C05BF261BBAFD38B0F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

BA2039E402F8760082FCBD6FF5ED387291308E2CF304D26A2CD56CA00670977A136B81675DD2A774CB516743961B27AA551AE7A084E3DEB6F9FAA2346D7D2D06

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

58FEE0D77E232964E8F9B53A1FAB1DE1D5D60F9A9F0BD5CA755BF394A4C9DF1E8435AB2147910AE3ED5CC2A6C9AA10D955D0A78DB2E14F32941A6BDD450F8006