Skip to content

Commit a703fdd

Browse files
feat(KlerosCore): snapshot proxy foundry test
1 parent d839f18 commit a703fdd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

contracts/test/foundry/KlerosCore.t.sol

+28
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {TestERC20} from "../../src/token/TestERC20.sol";
1717
import {ArbitrableExample, IArbitrableV2} from "../../src/arbitration/arbitrables/ArbitrableExample.sol";
1818
import {DisputeTemplateRegistry} from "../../src/arbitration/DisputeTemplateRegistry.sol";
1919
import "../../src/libraries/Constants.sol";
20+
import {IKlerosCore, KlerosCoreSnapshotProxy} from "../../src/snapshot-proxy/KlerosCoreSnapshotProxy.sol";
2021

2122
contract KlerosCoreTest is Test {
2223
event Initialized(uint64 version);
@@ -1279,6 +1280,33 @@ contract KlerosCoreTest is Test {
12791280
core.setStakeBySortitionModule(staker1, GENERAL_COURT, 1000, false);
12801281
}
12811282

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+
12821310
// *************************************** //
12831311
// * Disputes * //
12841312
// *************************************** //

0 commit comments

Comments
 (0)