diff --git a/src/ShellToken.sol b/src/ShellToken.sol index aebd643..f4fef4a 100644 --- a/src/ShellToken.sol +++ b/src/ShellToken.sol @@ -18,6 +18,8 @@ contract ShellToken is ERC20, Ownable { mapping(address => bool) public isAdmin; + uint256 public totalMultiplier = 10_000; + // address of activity -> multiplier // Activities are the contract addresses of Trove Managers, Stability Pools, LP tokens, etc. mapping(address => uint) public multiplier; //percentage out of 100 @@ -83,5 +85,9 @@ contract ShellToken is ERC20, Ownable { function setMultiplier(address activity, uint perc) public onlyOwner { multiplier[activity] = perc; } + + function setTotalMultiplier(uint256 _totalMultiplier) public onlyOwner { + totalMultiplier = _totalMultiplier; + } } diff --git a/test/ShellToken.t.sol b/test/ShellToken.t.sol index 92ca1da..e820a43 100644 --- a/test/ShellToken.t.sol +++ b/test/ShellToken.t.sol @@ -240,4 +240,28 @@ contract ShellTokenTest is Test { unchecked { ++i; } } } + + function test_setTotalMultiplier() public { + // Default value + assertEq(shellToken.totalMultiplier(), 10_000); + + vm.prank(owner); + shellToken.setTotalMultiplier(9999); + + assertEq(shellToken.totalMultiplier(), 9999); + } + + function test_revert_setTotalMultiplier_notOwner() public { + address notOwner = makeAddr("notOwner"); + + vm.startPrank(notOwner); + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, notOwner)); + shellToken.setTotalMultiplier(100); + vm.stopPrank(); + + vm.startPrank(admin); + vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, admin)); + shellToken.setTotalMultiplier(100); + vm.stopPrank(); + } } \ No newline at end of file