Skip to content

Commit

Permalink
chore: FEE_COLLECTOR -> FEE_COLLECTOR_ROLE
Browse files Browse the repository at this point in the history
  • Loading branch information
jparklev committed Jul 18, 2024
1 parent 690bbff commit 23b880d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions contracts/PointTokenVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall
bytes32 public constant REDEMPTION_RIGHTS_PREFIX = keccak256("REDEMPTION_RIGHTS");
bytes32 public constant MERKLE_UPDATER_ROLE = keccak256("MERKLE_UPDATER_ROLE");
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
bytes32 public constant FEE_COLLECTOR = keccak256("FEE_COLLECTOR");
bytes32 public constant FEE_COLLECTOR_ROLE = keccak256("FEE_COLLECTOR_ROLE");

// Deposit asset balances.
mapping(address => mapping(ERC20 => uint256)) public balances; // user => point-earning token => balance
Expand Down Expand Up @@ -322,7 +322,7 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall
pTokens[_pointsId].unpause();
}

function collectFees(bytes32 _pointsId) external onlyRole(FEE_COLLECTOR) {
function collectFees(bytes32 _pointsId) external onlyRole(FEE_COLLECTOR_ROLE) {
uint256 pTokenFee = pTokenFeeAcc[_pointsId];
uint256 rewardTokenFee = rewardTokenFeeAcc[_pointsId];

Expand Down
2 changes: 1 addition & 1 deletion contracts/script/PointTokenVault.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ contract PointTokenVaultScripts is BatchScript {
pointTokenVault.grantRole(pointTokenVault.MERKLE_UPDATER_ROLE(), SEOPLIA_MERKLE_BOT_SAFE);
pointTokenVault.grantRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), SEOPLIA_ADMIN_SAFE);
pointTokenVault.grantRole(pointTokenVault.OPERATOR_ROLE(), SEPOLIA_OPERATOR_SAFE);
pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), SEPOLIA_OPERATOR_SAFE);
pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), SEPOLIA_OPERATOR_SAFE); // TODO: should this be a separate address?

// Remove self
pointTokenVault.revokeRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), msg.sender);
Expand Down
8 changes: 5 additions & 3 deletions contracts/test/PointTokenVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract PointTokenVaultTest is Test {
pointTokenVault.grantRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), admin);
pointTokenVault.grantRole(pointTokenVault.MERKLE_UPDATER_ROLE(), merkleUpdater);
pointTokenVault.grantRole(pointTokenVault.OPERATOR_ROLE(), operator);
pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR(), feeCollector);
pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), feeCollector);
pointTokenVault.revokeRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), address(this));

// Deploy a mock token
Expand Down Expand Up @@ -673,7 +673,9 @@ contract PointTokenVaultTest is Test {

vm.expectRevert(
abi.encodeWithSelector(
IAccessControl.AccessControlUnauthorizedAccount.selector, nonCollector, pointTokenVault.FEE_COLLECTOR()
IAccessControl.AccessControlUnauthorizedAccount.selector,
nonCollector,
pointTokenVault.FEE_COLLECTOR_ROLE()
)
);

Expand Down Expand Up @@ -829,7 +831,7 @@ contract PointTokenVaultTest is Test {
mockVault.grantRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), admin);
mockVault.grantRole(pointTokenVault.MERKLE_UPDATER_ROLE(), merkleUpdater);
mockVault.grantRole(pointTokenVault.OPERATOR_ROLE(), operator);
mockVault.grantRole(pointTokenVault.FEE_COLLECTOR(), feeCollector);
mockVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), feeCollector);
mockVault.revokeRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), address(this));
}
}
Expand Down

0 comments on commit 23b880d

Please sign in to comment.