Skip to content
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

fix: foundry test #1865

Closed
wants to merge 1 commit into from
Closed
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
23 changes: 12 additions & 11 deletions contracts/test/foundry/KlerosCore.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ pragma solidity 0.8.24;

import {Test} from "forge-std/Test.sol";
import {console} from "forge-std/console.sol"; // Import the console for logging
import {KlerosCoreMock, KlerosCoreBase, IArbitratorV2} from "../../src/test/KlerosCoreMock.sol";
import {KlerosCoreMock, KlerosCoreBase} from "../../src/test/KlerosCoreMock.sol";
import {IArbitratorV2} from "../../src/arbitration/KlerosCoreBase.sol";
import {IDisputeKit} from "../../src/arbitration/interfaces/IDisputeKit.sol";
import {DisputeKitClassic} from "../../src/arbitration/dispute-kits/DisputeKitClassic.sol";
import {DisputeKitClassic, DisputeKitClassicBase} from "../../src/arbitration/dispute-kits/DisputeKitClassic.sol";
import {DisputeKitSybilResistant} from "../../src/arbitration/dispute-kits/DisputeKitSybilResistant.sol";
import {ISortitionModule} from "../../src/arbitration/interfaces/ISortitionModule.sol";
import {SortitionModuleMock, SortitionModuleBase} from "../../src/test/SortitionModuleMock.sol";
Expand Down Expand Up @@ -1326,7 +1327,7 @@ contract KlerosCoreTest is Test {
uint256 nbChoices = 2;
vm.prank(disputer);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.DisputeCreation(disputeID, nbChoices, newExtraData);
emit DisputeKitClassicBase.DisputeCreation(disputeID, nbChoices, newExtraData);
vm.expectEmit(true, true, true, true);
emit IArbitratorV2.DisputeCreation(disputeID, arbitrable);
arbitrable.createDispute{value: 0.04 ether}("Action");
Expand Down Expand Up @@ -1592,7 +1593,7 @@ contract KlerosCoreTest is Test {

vm.prank(staker1);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.CommitCast(disputeID, staker1, voteIDs, commit);
emit DisputeKitClassicBase.CommitCast(disputeID, staker1, voteIDs, commit);
disputeKit.castCommit(disputeID, voteIDs, commit);

(, , , uint256 totalCommited, uint256 nbVoters, uint256 choiceCount) = disputeKit.getRoundInfo(disputeID, 0, 0);
Expand All @@ -1608,7 +1609,7 @@ contract KlerosCoreTest is Test {

vm.prank(staker1);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.CommitCast(disputeID, staker1, voteIDs, commit);
emit DisputeKitClassicBase.CommitCast(disputeID, staker1, voteIDs, commit);
disputeKit.castCommit(disputeID, voteIDs, commit);

(, , , totalCommited, nbVoters, choiceCount) = disputeKit.getRoundInfo(disputeID, 0, 0);
Expand Down Expand Up @@ -1913,7 +1914,7 @@ contract KlerosCoreTest is Test {

vm.prank(crowdfunder1);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.Contribution(disputeID, 0, 1, crowdfunder1, 0.21 ether);
emit DisputeKitClassicBase.Contribution(disputeID, 0, 1, crowdfunder1, 0.21 ether);
disputeKit.fundAppeal{value: 0.21 ether}(disputeID, 1); // Fund the losing choice. Total cost will be 0.63 (0.21 + 0.21 * (20000/10000))

assertEq(crowdfunder1.balance, 9.79 ether, "Wrong balance of the crowdfunder");
Expand All @@ -1922,9 +1923,9 @@ contract KlerosCoreTest is Test {

vm.prank(crowdfunder1);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.Contribution(disputeID, 0, 1, crowdfunder1, 0.42 ether);
emit DisputeKitClassicBase.Contribution(disputeID, 0, 1, crowdfunder1, 0.42 ether);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.ChoiceFunded(disputeID, 0, 1);
emit DisputeKitClassicBase.ChoiceFunded(disputeID, 0, 1);
disputeKit.fundAppeal{value: 5 ether}(disputeID, 1); // Deliberately overpay to check reimburse

assertEq(crowdfunder1.balance, 9.37 ether, "Wrong balance of the crowdfunder");
Expand Down Expand Up @@ -2117,7 +2118,7 @@ contract KlerosCoreTest is Test {
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.DisputeKitJump(disputeID, 1, newDkID, DISPUTE_KIT_CLASSIC);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.DisputeCreation(disputeID, 2, newExtraData);
emit DisputeKitClassicBase.DisputeCreation(disputeID, 2, newExtraData);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
vm.expectEmit(true, true, true, true);
Expand Down Expand Up @@ -2692,11 +2693,11 @@ contract KlerosCoreTest is Test {
assertEq(address(disputeKit).balance, 1.04 ether, "Wrong balance of the DK");

vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.Withdrawal(disputeID, 0, 1, crowdfunder1, 0.63 ether);
emit DisputeKitClassicBase.Withdrawal(disputeID, 0, 1, crowdfunder1, 0.63 ether);
disputeKit.withdrawFeesAndRewards(disputeID, payable(crowdfunder1), 0, 1);

vm.expectEmit(true, true, true, true);
emit DisputeKitClassic.Withdrawal(disputeID, 0, 2, crowdfunder2, 0.41 ether);
emit DisputeKitClassicBase.Withdrawal(disputeID, 0, 2, crowdfunder2, 0.41 ether);
disputeKit.withdrawFeesAndRewards(disputeID, payable(crowdfunder2), 0, 2);

assertEq(crowdfunder1.balance, 10 ether, "Wrong balance of the crowdfunder1");
Expand Down