Coder Social home page Coder Social logo

unknownunknown1 / cross-chain-realitio-proxy-polygon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kleros/cross-chain-realitio-proxy-polygon

0.0 0.0 0.0 4.72 MB

License: MIT License

Shell 2.03% JavaScript 45.52% HTML 1.98% Solidity 50.47%

cross-chain-realitio-proxy-polygon's Introduction

Cross-Chain Realitio Proxy

Enables cross-chain arbitration for Realition (Reality.eth) on Polygon using Kleros as arbitrator.

We use Polygon Fx-Portal mechanism for cross chain communication. You can find out more about how Fx-Portal works from here:

High-Level Flow Description

  1. Alice requests arbitration on the main chain paying the arbitration fee to the ETH proxy and indicates the maximum value of the bond for the question (A.K.A. max_previous).
  2. The ETH proxy communicates the request to the Polygon proxy through the Fx-Portal.
  3. The Polygon tries to notify Realitio of the arbitration request and forwards the max_previous value:
    1. If the bond has not changed, the arbitration request will be accepted.
      1. Notify the ETH proxy through the Fx-Portal.
      2. Call the receiveMessage function with Polygon Tx hash on Ethereum
    2. Otherwise, if it changed then:
      1. Notify the ETH proxy through the Fx-Portal.
      2. Call the receiveMessage function with Polygon Tx hash on Ethereum
      3. The ETH proxy refunds Alice. END
  4. In the mean time while Realitio was being notified of the arbitration request, the arbitration fees might have changed:
    1. If the fees stayed the same (most common case) then:
      1. Create a dispute on Kleros Court.
    2. If the fees have decreased then:
      1. Create a dispute on Kleros Court.
      2. Refund Alice of the difference.
    3. If the fees have increased, then the arbitration request will fail:
      1. Refund Alice of the value paid so far.
      2. The ETH proxy notifies the Polygon proxy through the Fx-Portal that the arbitration failed to be created.
      3. The Polygon proxy notifies Realitio of the failed arbitration. END
  5. The Kleros court gives a ruling. It is relayed to the Polygon proxy through the Fx-Portal.
    1. If the ruling is the current answer, Bob, the last answerer, is the winner. END
    2. If it is not, Alice is the winner. END

Relaying Messages from Polygon to Ethereum

Polygon-to-Ethereum communication requires manual intervention, the exact mechanism for it is described here

There is also a fx-tunnel-relayer bot developed by the UMAProtocol for this purpose that can either be used as is or as a reference for our own bot.

Deployed Addresses

See contracts/README.md.

Contributing

Repo Structure

Each directory at the root of this repository contains code for each individual part that enables this integration:

  • bots/: service to automate some steps of the flow which otherwise would required manual intervention from users.
    • Notice: while this is a centralized service, it exists only for convenience. Users can fulfill the role of the bots if they wish to.
  • contracts/: Smart contracts to enable cross-chain arbitration for Realitio (Reality.eth). Learn more.
  • dynamic-script/: allows fetching the dynamic content for the arbitration, as described by ERC-1497: Evidence Standard.
  • evidence-display/: display interface that should be used to render the evidence for arbitrators, as described by ERC-1497: Evidence Standard.

cross-chain-realitio-proxy-polygon's People

Contributors

hbarcelos avatar unknownunknown1 avatar 0xferit avatar clesaege avatar shalzz avatar jaybuidl avatar epiqueras avatar fnanni-0 avatar alcercu avatar merlinegalite avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.