Skip to content

Arbitrator ruling event #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contracts/src/arbitration/IArbitrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ interface IArbitrator {
*/
event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);

/**
* @dev To be raised when a ruling is given.
* @param _arbitrable The arbitrable receiving the ruling.
* @param _disputeID ID of the dispute in the Arbitrator contract.
* @param _ruling The ruling which was given.
*/
event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);

/**
* @dev Create a dispute. Must be called by the arbitrable contract.
* Must pay at least arbitrationCost(_extraData).
Expand Down
1 change: 1 addition & 0 deletions contracts/src/arbitration/KlerosCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ contract KlerosCore is IArbitrator {

(uint256 winningChoice, , ) = currentRuling(_disputeID);
dispute.ruled = true;
emit Ruling(dispute.arbitrated, _disputeID, winningChoice);
dispute.arbitrated.rule(_disputeID, winningChoice);
}

Expand Down
5 changes: 3 additions & 2 deletions contracts/test/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("Integration tests", async () => {
homeGateway = (await ethers.getContract("HomeGatewayToEthereum")) as HomeGatewayToEthereum;
});

it("Honest Claim - No Challenge - Bridger paid", async () => {
it("Resolves a dispute on the home chain with no appeal", async () => {
const arbitrationCost = ONE_TENTH_ETH.mul(3);
const [bridger, challenger, relayer] = await ethers.getSigners();

Expand Down Expand Up @@ -170,7 +170,8 @@ describe("Integration tests", async () => {

const tx4 = await core.executeRuling(0);
console.log("Ruling executed on KlerosCore");
expect(tx4).to.emit(arbitrable, "Ruling").withArgs(foreignGateway.address, 1, 0);
expect(tx4).to.emit(core, "Ruling").withArgs(homeGateway.address, 0, 0);
expect(tx4).to.emit(arbitrable, "Ruling").withArgs(foreignGateway.address, 1, 0); // The ForeignGateway starts counting disputeID from 1.
});

async function mineBlocks(n) {
Expand Down