From 66d3865401a045dd45150529828030cf2974c86d Mon Sep 17 00:00:00 2001 From: Fynn Date: Mon, 27 Nov 2023 19:26:57 -0300 Subject: [PATCH] Change functions names and comments --- src/FeeRewardsManager.sol | 14 ++++++++++---- test/FeeRewardsManager.t.sol | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/FeeRewardsManager.sol b/src/FeeRewardsManager.sol index ca48a06..41ead59 100644 --- a/src/FeeRewardsManager.sol +++ b/src/FeeRewardsManager.sol @@ -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 ); @@ -53,7 +53,7 @@ contract RewardsCollector is Ownable { feeNumerator = _feeNumerator; } - function changeFee(uint32 _newFeeNumerator) public onlyOwner { + function changeFeeNumerator(uint32 _newFeeNumerator) public onlyOwner { feeNumerator = _newFeeNumerator; } } @@ -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) { @@ -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( diff --git a/test/FeeRewardsManager.t.sol b/test/FeeRewardsManager.t.sol index a8da436..99fd224 100644 --- a/test/FeeRewardsManager.t.sol +++ b/test/FeeRewardsManager.t.sol @@ -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%.