Type
CONTRACT
Validation date
2023-11-12 15:33:48 UTC
Fee
0 UCO

Code (939 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xaf710d1568b50364bbfb9fb48e3d70febef8b216", 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: 11.90418
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03582

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3DD52180F157CF5B8046A65542ADAE6940AD9F4756ED2886E70541ED3060C0CD454566471B6F3D538AC94A0E42A20F0817DB93D11C799A2524599075

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CF0017F204ADD8A382623F74CCB06BFCCCDAF2C8B0970B0DC575F5C721942B69

Previous signature

D853FFA88836FC0D0E5B939478B2BAE141E3F4CE564D9027652882EE4FB876DD2E4591866EA84554FF49102387DEA13E4B995EB6B9F0ECC53A7AEAADDF844B0E

Origin signature

3045022100ED3752D079069DD08A4148DF33D491A179823D04269E11FEC9CFD08C348A65D902201F655211682CA1D4D02F5DF6192F57FC27820E130E34077AFB698670DCA49027

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00F6116A8C7C13DA5D5A27A31424CED835578853CE433CDA3B8F75687FA27FF1A8

Coordinator signature

6DC839AE717A394DB2E2CF6FA16DD4521CAA5EDEFE6F4CC5F8F399A12EB7EE85490D095D2330C4C5BF10A673AF5436296FF6DBA63C2E5045A1E8E0899202A507

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

51AF3305051E36D0341D8926D6C7C58BFF5929349DE34F8B7CB26019AED759DFEAF1CE2068A36D9F8E5A0831DFF36A750605C8E8B6F8012FB191503F5068360E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

6B99E6E98154169C8806345F0C80298F8C6C57EFBABBB3060F060A649D67A203166650BE247206FFB96A381A3E22904ADEB9DB38FDA91C82AEC47B8F9451840C