Type
CONTRACT
Validation date
2023-10-24 14:18:21 UTC
Fee
0 UCO

Code (928 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x577edfeb841089a05f67c3221c7121070e1d6522", 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://sepolia.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: 0x00009E731DE71C9598A6C853EA89C736B1DAC3652AE00753651B642536AB14821F06, amount: 5.95209
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.01791

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A69112BF891822F04F6A75134E2F2785EF1C8147D62FC5090270D8395DA3F8DB4E04CBC5A1B2C49BF141A2D5C8BBF30F43D1FFCCDDE9D71A53FF92FF

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00014DFAEB51F47C63E10415AAD0631FCB92E45210A2F28021476904DFDD0807EBD2

Previous signature

A0D6CC0DAC3231F7267B8D1A8D425BA474CD30E561EEE983D1E5C99BA1A4ED4D0C25BD37AB98B16D9076D0264B1BE22A2A0DA8F619358547D252332881324D0B

Origin signature

304402202E9D40A76915494C9FF5FE60497550665FD2141B85A1A86D9F738ED248AC06BA02207A7549C417B5814224795DCB0806D73806493F53917E4D2E13C04ECD44B58B75

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

001EAAD7FCFA28574060C181B142C09644018F5DE7B186C41199470AC00E1C7DC9

Coordinator signature

8FF6749B1BC685EF3CAB1117AC673942B006CB55206A7C7B8C89951C0FD3725EBA8DE9738635E278390B8F102CF0AD62B65D0AEE5C7A6085FAE4ACFD30A59703

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

840C883F3B9C2FF1D72A370FB32F9F4C6117B57FEF8C4FE5116D9ACB1DD06647BE3DE2A034AA96BC7C8930D30EB85010BC104DE779E73F452F36C1A488C5430B

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

FF449200079F1C56BAE730E0CC0590A497907126D378E5C4483B83D5333C894F09E45B3F403061F71D18062915C2882C0D5F4D06A640E2B03A75729B448B7100