Enables cross-chain arbitration for Sundial 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:
- https://docs.polygon.technology/docs/develop/l1-l2-communication/fx-portal/
- https://github.com/fx-portal/contracts
- Alice requests arbitration on the main chain paying the arbitration fee to the ETH proxy
- The ETH proxy communicates the request to the Polygon proxy through the Fx-Portal.
- The Polygon tries to notify Sundial of the arbitration request:
- If the Project ID is valid and reclaimation period has not passed, the arbitration request will be accepted.
- Notify the ETH proxy through the Fx-Portal.
- Call the receiveMessage function with Polygon Tx hash on Ethereum
- Otherwise, if it changed then:
- Notify the ETH proxy through the Fx-Portal.
- Call the receiveMessage function with Polygon Tx hash on Ethereum
- The ETH proxy refunds Alice. END
- If the Project ID is valid and reclaimation period has not passed, the arbitration request will be accepted.
- In the mean time while Sundial was being notified of the arbitration request, the arbitration fees might have changed:
- If the fees stayed the same (most common case) then:
- Create a dispute on Kleros Court.
- If the fees have decreased then:
- Create a dispute on Kleros Court.
- Refund Alice of the difference.
- If the fees have increased, then the arbitration request will fail:
- Refund Alice of the value paid so far.
- The ETH proxy notifies the Polygon proxy through the Fx-Portal that the arbitration failed to be created.
- The Polygon proxy notifies Sundial of the failed arbitration. END
- If the fees stayed the same (most common case) then:
- The Kleros court gives a ruling. It is relayed to the Polygon proxy through the Fx-Portal.
- If the ruling is the current answer, Bob, the last answerer, is the winner. END
- If it is not, Alice is the winner. END
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.
See contracts/README.md.
Each directory at the root of this repository contains code for each individual part that enables this integration:
contracts/
: Smart contracts to enable cross-chain arbitration for Sundial. Learn more.