Type
CONTRACT
Validation date
2023-11-29 18:28:23 UTC
Fee
0 UCO

Code (932 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8917D592DBD62DAB4AC8192C965BF2CD58757E9FB392EBCEC53D9444977B96F1FF2CB32DAD954DA9302AE0C938A1586A0CD6CB92627356C529A09AC3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001632284A697EBC5C46CC2D0E49581CE055866FE481973663C0CC1A0AF700F1B9A

Previous signature

34C944A940ED818594CB86B42E828D64DA7B82C28D5B50E69CB6D1E2FCC5801325DA62B919CED160CEF0232A2ECEAD6AAE67591575C28892E51CEBB13BB1C600

Origin signature

30460221008F421B1BCCFB1DDEF9702341C8C282CE0256D38B56F8D3317F34E16FF6C66E07022100B3EAA06D7FF18517CE519C45C6072B5AFD3E5411908F8DAE383B8F3472A8D85F

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

005DB88B4D738306041EF81175348BC58DC33A087EF90CC82074375A601AEB241D

Coordinator signature

60814967C4F9D7E828BB3570C3F9B6BCF949562CA1E4EF522621C84885F8834E53909DD43CF047330AEB5142778D86636DA07D659834D173524F97C2AE288C0B

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

62A91EC983BD48788C46DF2841EC00DB9F31F8B4941171AA0A224F229FEC19E873D9F38A0B4691CCD418D86A5DC7B587E4681091CCE6C5655B04E2DCE5EE1207

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

655C5CDBD28E9916B2032C946445AC79AEE6AA26A73C3B30E1896CA3675AF4F0C11582400279A9AE4DF11E0AD8164EFB8618D6E3911FA82A0B13117DBB3EBF0F