Type
CONTRACT
Validation date
2023-11-15 20:16:45 UTC
Fee
0 UCO

Code (931 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    22AE1D3974E4D173ED43FB69630C0A19F38751BA75B3BBC0C04D511F8383E2C0CF474B56E1EBE70DB9DCA491566DFC5FC60855CCB2803445F4D44F6A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001531B32FA496CD276F46B011FC20EA9C583D8025C977D97DDE3D80B85A898A851

Previous signature

76CD57C1E257FAD5CD870AADA8DE8997B6BB2F167C41B06F45E341C44D8FC810748DC4C584C0E2E23D567F8F072C8D2425229BBF312E45C54BB827EF664D790E

Origin signature

3044022062963453E07D6840D8631C61E9A76D044AB8986CE4D070147930C93E4F52070E02207D042232CCE7648A745E414CB481796D55CBE332DE465CDDF141A7A1523707D0

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0097463EF0C76686646964CADD41CF5866E132D1A0A7C5BCD7DE496538ADE453F9

Coordinator signature

76745107FDEFDFE6892A44642B649F12BCE584BFA287BFEEC2E66141704B5055316A0DC563319269E42980F19F493961CB1917C51F4BD73820601734E7308E05

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

CF4C3DF8173F95FE6F6574CCD53E1DB1C1E25CE1158DDBEBE083F91A30A8C72404677A145170E1FEDB493B87CDF246E33C3146B99074EEB14986E4E3AC2F3601

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

315C9ECDA503FD9AFED2B38603C0137F76FD258D3858A9E8F60F8BCBCC8AA0D73E0C17F709A3958D8599F0357BE6506F937EF90875C2731D61BA8443B79FA007