@@ -3,9 +3,10 @@ pragma solidity 0.8.24;
3
3
4
4
import {Test} from "forge-std/Test.sol " ;
5
5
import {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 " ;
7
8
import {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 " ;
9
10
import {DisputeKitSybilResistant} from "../../src/arbitration/dispute-kits/DisputeKitSybilResistant.sol " ;
10
11
import {ISortitionModule} from "../../src/arbitration/interfaces/ISortitionModule.sol " ;
11
12
import {SortitionModuleMock, SortitionModuleBase} from "../../src/test/SortitionModuleMock.sol " ;
@@ -16,6 +17,7 @@ import {TestERC20} from "../../src/token/TestERC20.sol";
16
17
import {ArbitrableExample, IArbitrableV2} from "../../src/arbitration/arbitrables/ArbitrableExample.sol " ;
17
18
import {DisputeTemplateRegistry} from "../../src/arbitration/DisputeTemplateRegistry.sol " ;
18
19
import "../../src/libraries/Constants.sol " ;
20
+ import {IKlerosCore, KlerosCoreSnapshotProxy} from "../../src/snapshot-proxy/KlerosCoreSnapshotProxy.sol " ;
19
21
20
22
contract KlerosCoreTest is Test {
21
23
event Initialized (uint64 version );
@@ -1278,6 +1280,33 @@ contract KlerosCoreTest is Test {
1278
1280
core.setStakeBySortitionModule (staker1, GENERAL_COURT, 1000 , false );
1279
1281
}
1280
1282
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
+
1281
1310
// *************************************** //
1282
1311
// * Disputes * //
1283
1312
// *************************************** //
@@ -1326,7 +1355,7 @@ contract KlerosCoreTest is Test {
1326
1355
uint256 nbChoices = 2 ;
1327
1356
vm.prank (disputer);
1328
1357
vm.expectEmit (true , true , true , true );
1329
- emit DisputeKitClassic .DisputeCreation (disputeID, nbChoices, newExtraData);
1358
+ emit DisputeKitClassicBase .DisputeCreation (disputeID, nbChoices, newExtraData);
1330
1359
vm.expectEmit (true , true , true , true );
1331
1360
emit IArbitratorV2.DisputeCreation (disputeID, arbitrable);
1332
1361
arbitrable.createDispute {value: 0.04 ether }("Action " );
@@ -1592,7 +1621,7 @@ contract KlerosCoreTest is Test {
1592
1621
1593
1622
vm.prank (staker1);
1594
1623
vm.expectEmit (true , true , true , true );
1595
- emit DisputeKitClassic .CommitCast (disputeID, staker1, voteIDs, commit);
1624
+ emit DisputeKitClassicBase .CommitCast (disputeID, staker1, voteIDs, commit);
1596
1625
disputeKit.castCommit (disputeID, voteIDs, commit);
1597
1626
1598
1627
(, , , uint256 totalCommited , uint256 nbVoters , uint256 choiceCount ) = disputeKit.getRoundInfo (disputeID, 0 , 0 );
@@ -1608,7 +1637,7 @@ contract KlerosCoreTest is Test {
1608
1637
1609
1638
vm.prank (staker1);
1610
1639
vm.expectEmit (true , true , true , true );
1611
- emit DisputeKitClassic .CommitCast (disputeID, staker1, voteIDs, commit);
1640
+ emit DisputeKitClassicBase .CommitCast (disputeID, staker1, voteIDs, commit);
1612
1641
disputeKit.castCommit (disputeID, voteIDs, commit);
1613
1642
1614
1643
(, , , totalCommited, nbVoters, choiceCount) = disputeKit.getRoundInfo (disputeID, 0 , 0 );
@@ -1913,7 +1942,7 @@ contract KlerosCoreTest is Test {
1913
1942
1914
1943
vm.prank (crowdfunder1);
1915
1944
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);
1917
1946
disputeKit.fundAppeal {value: 0.21 ether }(disputeID, 1 ); // Fund the losing choice. Total cost will be 0.63 (0.21 + 0.21 * (20000/10000))
1918
1947
1919
1948
assertEq (crowdfunder1.balance, 9.79 ether, "Wrong balance of the crowdfunder " );
@@ -1922,9 +1951,9 @@ contract KlerosCoreTest is Test {
1922
1951
1923
1952
vm.prank (crowdfunder1);
1924
1953
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);
1926
1955
vm.expectEmit (true , true , true , true );
1927
- emit DisputeKitClassic .ChoiceFunded (disputeID, 0 , 1 );
1956
+ emit DisputeKitClassicBase .ChoiceFunded (disputeID, 0 , 1 );
1928
1957
disputeKit.fundAppeal {value: 5 ether }(disputeID, 1 ); // Deliberately overpay to check reimburse
1929
1958
1930
1959
assertEq (crowdfunder1.balance, 9.37 ether, "Wrong balance of the crowdfunder " );
@@ -2117,7 +2146,7 @@ contract KlerosCoreTest is Test {
2117
2146
vm.expectEmit (true , true , true , true );
2118
2147
emit KlerosCoreBase.DisputeKitJump (disputeID, 1 , newDkID, DISPUTE_KIT_CLASSIC);
2119
2148
vm.expectEmit (true , true , true , true );
2120
- emit DisputeKitClassic .DisputeCreation (disputeID, 2 , newExtraData);
2149
+ emit DisputeKitClassicBase .DisputeCreation (disputeID, 2 , newExtraData);
2121
2150
vm.expectEmit (true , true , true , true );
2122
2151
emit KlerosCoreBase.AppealDecision (disputeID, arbitrable);
2123
2152
vm.expectEmit (true , true , true , true );
@@ -2692,11 +2721,11 @@ contract KlerosCoreTest is Test {
2692
2721
assertEq (address (disputeKit).balance, 1.04 ether, "Wrong balance of the DK " );
2693
2722
2694
2723
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);
2696
2725
disputeKit.withdrawFeesAndRewards (disputeID, payable (crowdfunder1), 0 , 1 );
2697
2726
2698
2727
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);
2700
2729
disputeKit.withdrawFeesAndRewards (disputeID, payable (crowdfunder2), 0 , 2 );
2701
2730
2702
2731
assertEq (crowdfunder1.balance, 10 ether, "Wrong balance of the crowdfunder1 " );
0 commit comments