Skip to content

Commit

Permalink
Change functions names and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
enriquefynn committed Nov 27, 2023
1 parent a7bbdd6 commit 66d3865
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/FeeRewardsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "@openzeppelin/contracts/access/Ownable.sol";
contract RewardsCollector is Ownable {
event CollectedReward(
address withdrawalCredential,
uint256 withdrawalFee,
uint256 withdrawnAmount,
address owner,
uint256 ownerFee
);
Expand Down Expand Up @@ -53,7 +53,7 @@ contract RewardsCollector is Ownable {
feeNumerator = _feeNumerator;
}

function changeFee(uint32 _newFeeNumerator) public onlyOwner {
function changeFeeNumerator(uint32 _newFeeNumerator) public onlyOwner {
feeNumerator = _newFeeNumerator;
}
}
Expand Down Expand Up @@ -88,6 +88,12 @@ contract FeeRewardsManager is Ownable {
return payable(addr);
}

// Predicts the address of a new contract that will be a `fee_recipient` of
// an Ethereum validator.
// Given the `_withdrawalCredential` we can instantiate a contract that will
// be deployed at a deterministic address, calculated given the
// `_withdrawalCredential`, the current contract address and the current
// contract's bytecode.
function predictFeeContractAddress(
address _withdrawalCredential
) public view returns (address) {
Expand All @@ -110,11 +116,11 @@ contract FeeRewardsManager is Ownable {
return address(uint160(uint(hash)));
}

function changeFee(
function changeFeeNumerator(
address payable _feeContract,
uint32 _newFee
) public onlyOwner {
RewardsCollector(_feeContract).changeFee(_newFee);
RewardsCollector(_feeContract).changeFeeNumerator(_newFee);
}

function batchCollectRewards(
Expand Down
2 changes: 1 addition & 1 deletion test/FeeRewardsManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ contract FeeRewardsTest is Test {
address addr = address(
createWithdrawalSimulateRewards(address(100), 10 ether)
);
feeRewardsManager.changeFee(payable(addr), 10000);
feeRewardsManager.changeFeeNumerator(payable(addr), 10000);
RewardsCollector(payable(addr)).collectRewards();
assertEq(address(100).balance, 0 ether);
// We receive 100%.
Expand Down

0 comments on commit 66d3865

Please sign in to comment.