@@ -3,9 +3,10 @@ pragma solidity 0.8.24;
33
44import {Test} from "forge-std/Test.sol " ;
55import {console} from "forge-std/console.sol " ; // Import the console for logging
6- import {KlerosCoreMock, KlerosCoreBase, IArbitratorV2} from "../../src/test/KlerosCoreMock.sol " ;
6+ import {KlerosCoreMock, KlerosCoreBase} from "../../src/test/KlerosCoreMock.sol " ;
7+ import {IArbitratorV2} from "../../src/arbitration/KlerosCoreBase.sol " ;
78import {IDisputeKit} from "../../src/arbitration/interfaces/IDisputeKit.sol " ;
8- import {DisputeKitClassic} from "../../src/arbitration/dispute-kits/DisputeKitClassic.sol " ;
9+ import {DisputeKitClassic, DisputeKitClassicBase } from "../../src/arbitration/dispute-kits/DisputeKitClassic.sol " ;
910import {DisputeKitSybilResistant} from "../../src/arbitration/dispute-kits/DisputeKitSybilResistant.sol " ;
1011import {ISortitionModule} from "../../src/arbitration/interfaces/ISortitionModule.sol " ;
1112import {SortitionModuleMock, SortitionModuleBase} from "../../src/test/SortitionModuleMock.sol " ;
@@ -16,6 +17,7 @@ import {TestERC20} from "../../src/token/TestERC20.sol";
1617import {ArbitrableExample, IArbitrableV2} from "../../src/arbitration/arbitrables/ArbitrableExample.sol " ;
1718import {DisputeTemplateRegistry} from "../../src/arbitration/DisputeTemplateRegistry.sol " ;
1819import "../../src/libraries/Constants.sol " ;
20+ import {IKlerosCore, KlerosCoreSnapshotProxy} from "../../src/snapshot-proxy/KlerosCoreSnapshotProxy.sol " ;
1921
2022contract KlerosCoreTest is Test {
2123 event Initialized (uint64 version );
@@ -1278,6 +1280,33 @@ contract KlerosCoreTest is Test {
12781280 core.setStakeBySortitionModule (staker1, GENERAL_COURT, 1000 , false );
12791281 }
12801282
1283+ function test_setStake_snapshotProxyCheck () public {
1284+ vm.prank (staker1);
1285+ core.setStake (GENERAL_COURT, 12346 );
1286+
1287+ KlerosCoreSnapshotProxy snapshotProxy = new KlerosCoreSnapshotProxy (governor, IKlerosCore (address (core)));
1288+ assertEq (snapshotProxy.name (), "Staked Pinakion " , "Wrong name of the proxy token " );
1289+ assertEq (snapshotProxy.symbol (), "stPNK " , "Wrong symbol of the proxy token " );
1290+ assertEq (snapshotProxy.decimals (), 18 , "Wrong decimals of the proxy token " );
1291+ assertEq (snapshotProxy.governor (), msg .sender , "Wrong governor " );
1292+ assertEq (address (snapshotProxy.core ()), address (core), "Wrong core in snapshot proxy " );
1293+ assertEq (snapshotProxy.balanceOf (staker1), 12346 , "Wrong stPNK balance " );
1294+
1295+ vm.prank (other);
1296+ vm.expectRevert (bytes ("Access not allowed: Governor only. " ));
1297+ snapshotProxy.changeCore (IKlerosCore (other));
1298+ vm.prank (governor);
1299+ snapshotProxy.changeCore (IKlerosCore (other));
1300+ assertEq (address (snapshotProxy.core ()), other, "Wrong core in snapshot proxy after change " );
1301+
1302+ vm.prank (other);
1303+ vm.expectRevert (bytes ("Access not allowed: Governor only. " ));
1304+ snapshotProxy.changeGovernor (other);
1305+ vm.prank (governor);
1306+ snapshotProxy.changeGovernor (other);
1307+ assertEq (snapshotProxy.governor (), other, "Wrong governor after change " );
1308+ }
1309+
12811310 // *************************************** //
12821311 // * Disputes * //
12831312 // *************************************** //
@@ -1326,7 +1355,7 @@ contract KlerosCoreTest is Test {
13261355 uint256 nbChoices = 2 ;
13271356 vm.prank (disputer);
13281357 vm.expectEmit (true , true , true , true );
1329- emit DisputeKitClassic .DisputeCreation (disputeID, nbChoices, newExtraData);
1358+ emit DisputeKitClassicBase .DisputeCreation (disputeID, nbChoices, newExtraData);
13301359 vm.expectEmit (true , true , true , true );
13311360 emit IArbitratorV2.DisputeCreation (disputeID, arbitrable);
13321361 arbitrable.createDispute {value: 0.04 ether }("Action " );
@@ -1592,7 +1621,7 @@ contract KlerosCoreTest is Test {
15921621
15931622 vm.prank (staker1);
15941623 vm.expectEmit (true , true , true , true );
1595- emit DisputeKitClassic .CommitCast (disputeID, staker1, voteIDs, commit);
1624+ emit DisputeKitClassicBase .CommitCast (disputeID, staker1, voteIDs, commit);
15961625 disputeKit.castCommit (disputeID, voteIDs, commit);
15971626
15981627 (, , , uint256 totalCommited , uint256 nbVoters , uint256 choiceCount ) = disputeKit.getRoundInfo (disputeID, 0 , 0 );
@@ -1608,7 +1637,7 @@ contract KlerosCoreTest is Test {
16081637
16091638 vm.prank (staker1);
16101639 vm.expectEmit (true , true , true , true );
1611- emit DisputeKitClassic .CommitCast (disputeID, staker1, voteIDs, commit);
1640+ emit DisputeKitClassicBase .CommitCast (disputeID, staker1, voteIDs, commit);
16121641 disputeKit.castCommit (disputeID, voteIDs, commit);
16131642
16141643 (, , , totalCommited, nbVoters, choiceCount) = disputeKit.getRoundInfo (disputeID, 0 , 0 );
@@ -1913,7 +1942,7 @@ contract KlerosCoreTest is Test {
19131942
19141943 vm.prank (crowdfunder1);
19151944 vm.expectEmit (true , true , true , true );
1916- emit DisputeKitClassic .Contribution (disputeID, 0 , 1 , crowdfunder1, 0.21 ether);
1945+ emit DisputeKitClassicBase .Contribution (disputeID, 0 , 1 , crowdfunder1, 0.21 ether);
19171946 disputeKit.fundAppeal {value: 0.21 ether }(disputeID, 1 ); // Fund the losing choice. Total cost will be 0.63 (0.21 + 0.21 * (20000/10000))
19181947
19191948 assertEq (crowdfunder1.balance, 9.79 ether, "Wrong balance of the crowdfunder " );
@@ -1922,9 +1951,9 @@ contract KlerosCoreTest is Test {
19221951
19231952 vm.prank (crowdfunder1);
19241953 vm.expectEmit (true , true , true , true );
1925- emit DisputeKitClassic .Contribution (disputeID, 0 , 1 , crowdfunder1, 0.42 ether);
1954+ emit DisputeKitClassicBase .Contribution (disputeID, 0 , 1 , crowdfunder1, 0.42 ether);
19261955 vm.expectEmit (true , true , true , true );
1927- emit DisputeKitClassic .ChoiceFunded (disputeID, 0 , 1 );
1956+ emit DisputeKitClassicBase .ChoiceFunded (disputeID, 0 , 1 );
19281957 disputeKit.fundAppeal {value: 5 ether }(disputeID, 1 ); // Deliberately overpay to check reimburse
19291958
19301959 assertEq (crowdfunder1.balance, 9.37 ether, "Wrong balance of the crowdfunder " );
@@ -2117,7 +2146,7 @@ contract KlerosCoreTest is Test {
21172146 vm.expectEmit (true , true , true , true );
21182147 emit KlerosCoreBase.DisputeKitJump (disputeID, 1 , newDkID, DISPUTE_KIT_CLASSIC);
21192148 vm.expectEmit (true , true , true , true );
2120- emit DisputeKitClassic .DisputeCreation (disputeID, 2 , newExtraData);
2149+ emit DisputeKitClassicBase .DisputeCreation (disputeID, 2 , newExtraData);
21212150 vm.expectEmit (true , true , true , true );
21222151 emit KlerosCoreBase.AppealDecision (disputeID, arbitrable);
21232152 vm.expectEmit (true , true , true , true );
@@ -2692,11 +2721,11 @@ contract KlerosCoreTest is Test {
26922721 assertEq (address (disputeKit).balance, 1.04 ether, "Wrong balance of the DK " );
26932722
26942723 vm.expectEmit (true , true , true , true );
2695- emit DisputeKitClassic .Withdrawal (disputeID, 0 , 1 , crowdfunder1, 0.63 ether);
2724+ emit DisputeKitClassicBase .Withdrawal (disputeID, 0 , 1 , crowdfunder1, 0.63 ether);
26962725 disputeKit.withdrawFeesAndRewards (disputeID, payable (crowdfunder1), 0 , 1 );
26972726
26982727 vm.expectEmit (true , true , true , true );
2699- emit DisputeKitClassic .Withdrawal (disputeID, 0 , 2 , crowdfunder2, 0.41 ether);
2728+ emit DisputeKitClassicBase .Withdrawal (disputeID, 0 , 2 , crowdfunder2, 0.41 ether);
27002729 disputeKit.withdrawFeesAndRewards (disputeID, payable (crowdfunder2), 0 , 2 );
27012730
27022731 assertEq (crowdfunder1.balance, 10 ether, "Wrong balance of the crowdfunder1 " );
0 commit comments