Type
CONTRACT
Validation date
2023-10-23 11:52:08 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf5e38d1cb06b706bfce7834482a32adf6ca0374f", 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: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 1.98403
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00597

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    01B31EAB50A577FAA8386810DF2AE54754ED0FEF99D125982DFA6FE8D49B39E88FC04EE7D9F46439D574D742C400AC942581274570391F491EFFD442

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C2EE1FBC9CAB4FF25D3CD219FF90647299F664B47C9F58DF1287A0CA908AED50

Previous signature

E07C236D600A826648834542525EB4E94F0080D024BC6FFC0A8950962641DDCD8EB14C3FD2817D3686A9B8C3E121D06D43EA9D3F6E82DBDB76BE25E0352BE30A

Origin signature

3045022070F1C0282BE4D6CEE593735F85D6ECB6B7F80590ED75D577E402D4767D6896DA022100DD77A2C7EDAE6C01C0152C552850C6D83F601A60FCDB8F381AF00F4C727D8CBC

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

001117125DBB8F3F922A290A278F2497F9D1A8EB9C7E03716B466E271E0D5E39C1

Coordinator signature

C0FB158049F6666228E9604A99B338B78858BE7E75DF3DA43FCAE7BC50A96DEFE35F81E8127865C30CE840BE1DD36CE3E1CC85F7F24D11376605A7EA3AE97A0F

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

0385165384539DFF5EACC5B74DE9F7CCD9973845C11923958AC56D7D0334FF2ED215DD9CF3D6B233FF076F1BD7D5653101FCC5D1AC229A043ED8020E3303C20C

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

0BDC988349808C86A9A78AB70DB7C2E988DA77A0AA4091BC8DC7F8287F7A4ECF22F3FFE332F4CBCD46C00E05EB17294C918604087D6686DDB1637F496DD58908