Type
CONTRACT
Validation date
2023-11-29 18:32:41 UTC
Fee
0 UCO

Code (935 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    53789D88696AC795BFA3EB578608B2DF107D191B3FB97D6C9DF5592545379277E8301039422A2EE2AA2370DCC87F6D7802C518EA37C8550063CB56C8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EC8625A31009ECCDF91EF1D7F7C33D64675D9FA2390C1BE55A3B165A3D6C1EBD

Previous signature

E903889DF6E04474BCA1D358ECFB1A896980C8A2E3282B7AA45F4E745336B360FC9D5732539F471F5193B7D59E500EFD0985323DCCF8982713EEE241B3B6B00A

Origin signature

3045022100F7B169DDC2A4FEBEC4ABF501679A7D3A0F9F7FD2FE25EE56F978ADD03C8AA1F102201E91DAA54EB808F0E1F35E2790F81B2654D1E5D513ADD62B20F8C7B3921C37D5

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

0010EECDCBFFD2343ED04A2E04D6F7C2C082F034E886D1026E436BA6555F8EBDA8

Coordinator signature

7C0EBE5A179336B2432009800A3DC8C12843C7A1D2DBE02AE219A190A925CF5BF4B9336AFDD40F8854BDE4C1B3ECBDCC3561267F07526CD7E66EDDBCCD65F80E

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

51AABB5D48BD94A615AE4BE5430031581F3DCEA82FB8B9C5D223F816BFD260432F17BBDD4CF17CD60063645224570E9AEA8F41E1028A21B8DF1C2013F015C006

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

CA656F2F8F7B1681B141D1A5B5416D4AC2AE851AEDED2231727C21D8D8F4A6258F7FFDA902A445DBCCF1DEF71D7C344B484E072716765B11C02E26AD649EFB04