Skip to content
Closed
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/ShellToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

24 changes: 24 additions & 0 deletions test/ShellToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Loading