项目作者: kleros

项目描述 :
Smart contract infrastructure to allow arbitrable dapps on other chains to use Kleros on Ethereum as arbitrator.
高级语言: Solidity
项目地址: git://github.com/kleros/cross-chain-arbitration-proxy.git
创建时间: 2020-10-05T18:59:32Z
项目社区:https://github.com/kleros/cross-chain-arbitration-proxy

开源协议:MIT License

下载


Kleros Cross-Chain Arbitration for xDAI

Smart contract infrastructure to allow arbitrable dapps on xDAI to use Kleros on Ethereum as arbitrator.

Architectural Overview

  1. +----------------+
  2. +--------------------->+ Cross Chain |
  3. v | Arbitrable |
  4. +----------+----------+ +----------------+
  5. | Home Arbitration |
  6. | Proxy |
  7. +----------+----------+
  8. ^
  9. xDAI |
  10. +----------------------|---------------------------------------------+
  11. v
  12. +-----------+-------------------------------+
  13. | xDAI/Ethereum AMB +----------------+ |
  14. | | Oracle | |
  15. | +----------------+ |
  16. | +----------------+ +----------------+ |
  17. | | Oracle | | Oracle | |
  18. | +----------------+ +----------------+ |
  19. +-----------+-------------------------------+
  20. ^
  21. +----------------------|---------------------------------------------+
  22. Ethereum |
  23. v
  24. +----------+----------+
  25. | Foreign Arbitration |
  26. | Proxy |
  27. +----------+----------+
  28. ^ +------------+
  29. +--------------------->+ Kleros |
  30. +------------+

Glossary

  • Home Proxy: proxy on xDAI/Sokol.
  • Foreign Proxy: proxy on Ethereum Mainnet/Goerli.
  • Plaintiff: the dispute requester, interested in changing the current arbitrable outcome.
  • Defendant: the user interested in keeping the current arbitrable outcome.

Disclaimers

  • Users willing to request a dispute SHOULD watch the arbitrable contract on the Home Network to know when requesting dispute is possible.
  • However, if there is a time limit for when the dispute can be requested, the Arbitration Proxies CANNOT guarantee the dispute request will be notified in time. This is due to the asynchronous nature of cross-chain communication.
  • Once the dispute is created, its lifecycle will happen entirely on Ethereum.

High-Level Algorithm

Handshaking

  1. Arbitrable contracts MUST register themselves in the Home Proxy before any dispute can be created.
    1. Contracts CAN register the dispute params (namely metaEvidence, and arbitratorExtraData) at a contract level or on a per-item basis or a mix of both.
  2. The Home Proxy MUST forward the params to the Foreign Proxy.

At this point users CAN request a dispute for that given arbitrable item.

Dispute Request

  1. In order to request a dispute, the plaintiff MUST pay for the current arbitration cost beforehand.
  2. The dispute request MUST be relayed to the Home Proxy.
  3. The Home Proxy MUST check if the Arbitrable contract accepts the dispute.
    1. The arbitrable contract CAN accept or reject the request according to its own rules.
    2. If the dispute request is accepted, the information MUST be relayed to the foreign proxy, which will proceed to create the dispute.
      1. The home proxy MUST inform the arbitrable contract of the dispute request.
      2. The foreign proxy MUST now wait for the defendant to pay for the arbitration cost up to feeDepositTimeout seconds.
        1. If the defendant pays the due amount in time, then the dispute SHOULD be created.
          1. If the dispute could be created
            1. Then the foreign proxy MUST relay that information to the home proxy.
            2. Once the final ruling is recived, it MUST be relayed to the home proxy.
              1. The home proxy MUST rule over the arbitrable item.
          2. Otherwise, if the dispute creation fails
            1. Then the foreign proxy MUST relay that information to the home proxy.
              1. The home proxy MUST inform the arbitrable contract that the dispute could not be created.
        2. Otherwise, the plaintiff MUST be considered the winner
          1. The foreign proxy MUST forward the ruling to the home proxy.
          2. The home proxy MUST rule over the arbitrable item.
    3. Otherwise, the rejection MUST also be relayed to the foreign proxy.
      1. The plaintiff MUST be reimbursed of any deposited fees.
      2. The arbitration request process CAN be restarted.

State Charts

Home Proxy

  1. (I) Means the initial state.
  2. [condition] Means a guard condition.
  3. Receive Request +----------+
  4. +-------------------->+ Rejected |
  5. | [Rejected] +-----+----+
  6. | |
  7. | |
  8. | | Relay Rejected
  9. +-(I)--+ |
  10. | None +<----------------------+
  11. +--+---+ |
  12. | |
  13. | | Receive Dispute Failed
  14. | |
  15. | Receive Request +-----+----+ +--(F)--+
  16. +-------------------->+ Accepted +-------------------->+ Ruled |
  17. [Accepted] +----------+ Receive Ruling +-------+

Foreign Proxy

  1. (I) Means the initial state.
  2. (F) Means a final state.
  3. [condition] Means a guard condition.
  4. [Defendant did not pay]
  5. |
  6. +-(I)--+ Request Dispute +-----------+ +----------------+ | +--(F)--+
  7. | None +-------------------->+ Requested +----------------->+ DepositPending +---------------->+ Ruled |
  8. +------+ [Registered] +-----+-----+ [Accepted] +-------+--------+ +---+---+
  9. A | | ^
  10. | | | |
  11. | | [Rejected] | [Defendant Paid] |
  12. | | | | Rule
  13. | | | |
  14. | | | +---------+ |
  15. +------------------------------+--------------------------------+--------->+ Ongoing +---------+
  16. | | +---------+
  17. | |
  18. [Create Dispute Failed] [Create Dispute Created]

Available Proxies

Binary Arbitration

Used by arbitrable contracts which expect a binary ruling for dispute.

Deployed Addresses

Home Proxy:

  • Sokol: <none>
  • xDai: <none>

Foreign Proxy:

  • Goerli: <none>
  • Mainnet: <none>

Contributing

Install Dependencies

  1. yarn install

Run Tests

  1. yarn test

Compile the Contracts

  1. yarn build

Run Linter on Files

  1. yarn lint

Fix Linter Issues on Files

  1. yarn fix