diff --git a/contracts/staking/contracts/src/fees/MixinExchangeFees.sol b/contracts/staking/contracts/src/fees/MixinExchangeFees.sol index e4f33bb5f1..6d908881eb 100644 --- a/contracts/staking/contracts/src/fees/MixinExchangeFees.sol +++ b/contracts/staking/contracts/src/fees/MixinExchangeFees.sol @@ -41,17 +41,17 @@ contract MixinExchangeFees is /// (MixinExchangeManager). /// @param makerAddress The address of the order's maker. /// @param payerAddress The address of the protocol fee payer. - /// @param protocolFeePaid The protocol fee that should be paid. + /// @param protocolFee The protocol fee amount. This is either passed as ETH or transferred as WETH. function payProtocolFee( address makerAddress, address payerAddress, - uint256 protocolFeePaid + uint256 protocolFee ) external payable onlyExchange { - _assertValidProtocolFee(protocolFeePaid); + _assertValidProtocolFee(protocolFee); // Transfer the protocol fee to this address if it should be paid in // WETH. @@ -60,7 +60,7 @@ contract MixinExchangeFees is getWethContract().transferFrom( payerAddress, address(this), - protocolFeePaid + protocolFee ), "WETH_TRANSFER_FAILED" ); @@ -106,10 +106,10 @@ contract MixinExchangeFees is } // Credit the fees to the pool. - poolStatsPtr.feesCollected = feesCollectedByPool.safeAdd(protocolFeePaid); + poolStatsPtr.feesCollected = feesCollectedByPool.safeAdd(protocolFee); // Increase the total fees collected this epoch. - aggregatedStatsPtr.totalFeesCollected = aggregatedStatsPtr.totalFeesCollected.safeAdd(protocolFeePaid); + aggregatedStatsPtr.totalFeesCollected = aggregatedStatsPtr.totalFeesCollected.safeAdd(protocolFee); } /// @dev Get stats on a staking pool in this epoch. @@ -155,18 +155,18 @@ contract MixinExchangeFees is /// @dev Checks that the protocol fee passed into `payProtocolFee()` is /// valid. - /// @param protocolFeePaid The `protocolFeePaid` parameter to + /// @param protocolFee The `protocolFee` parameter to /// `payProtocolFee.` - function _assertValidProtocolFee(uint256 protocolFeePaid) + function _assertValidProtocolFee(uint256 protocolFee) private view { // The protocol fee must equal the value passed to the contract; unless // the value is zero, in which case the fee is taken in WETH. - if (msg.value != protocolFeePaid && msg.value != 0) { + if (msg.value != protocolFee && msg.value != 0) { LibRichErrors.rrevert( LibStakingRichErrors.InvalidProtocolFeePaymentError( - protocolFeePaid, + protocolFee, msg.value ) ); diff --git a/contracts/staking/contracts/src/interfaces/IStaking.sol b/contracts/staking/contracts/src/interfaces/IStaking.sol index e5b3d9135e..f0329f8cfd 100644 --- a/contracts/staking/contracts/src/interfaces/IStaking.sol +++ b/contracts/staking/contracts/src/interfaces/IStaking.sol @@ -40,11 +40,11 @@ interface IStaking { /// @dev Pays a protocol fee in ETH. /// @param makerAddress The address of the order's maker. /// @param payerAddress The address that is responsible for paying the protocol fee. - /// @param protocolFeePaid The amount of protocol fees that should be paid. + /// @param protocolFee The amount of protocol fees that should be paid. function payProtocolFee( address makerAddress, address payerAddress, - uint256 protocolFeePaid + uint256 protocolFee ) external payable; diff --git a/contracts/staking/contracts/src/stake/MixinStake.sol b/contracts/staking/contracts/src/stake/MixinStake.sol index c0b11bbd86..b92b354e28 100644 --- a/contracts/staking/contracts/src/stake/MixinStake.sol +++ b/contracts/staking/contracts/src/stake/MixinStake.sol @@ -178,19 +178,19 @@ contract MixinStake is staker ); - // Increment how much stake the staker has delegated to the input pool. + // Increase how much stake the staker has delegated to the input pool. _increaseNextBalance( _delegatedStakeToPoolByOwner[staker][poolId], amount ); - // Increment how much stake has been delegated to pool. + // Increase how much stake has been delegated to pool. _increaseNextBalance( _delegatedStakeByPoolId[poolId], amount ); - // Increase next balance of global delegated stake + // Increase next balance of global delegated stake. _increaseNextBalance( _globalStakeByStatus[uint8(IStructs.StakeStatus.DELEGATED)], amount @@ -216,19 +216,19 @@ contract MixinStake is staker ); - // decrement how much stake the staker has delegated to the input pool + // Decrease how much stake the staker has delegated to the input pool. _decreaseNextBalance( _delegatedStakeToPoolByOwner[staker][poolId], amount ); - // decrement how much stake has been delegated to pool + // Decrease how much stake has been delegated to pool. _decreaseNextBalance( _delegatedStakeByPoolId[poolId], amount ); - // decrease next balance of global delegated stake + // Decrease next balance of global delegated stake (aggregated across all stakers). _decreaseNextBalance( _globalStakeByStatus[uint8(IStructs.StakeStatus.DELEGATED)], amount diff --git a/contracts/staking/test/unit_tests/protocol_fees_test.ts b/contracts/staking/test/unit_tests/protocol_fees_test.ts index 9f3a917910..1c027fad3a 100644 --- a/contracts/staking/test/unit_tests/protocol_fees_test.ts +++ b/contracts/staking/test/unit_tests/protocol_fees_test.ts @@ -90,7 +90,7 @@ blockchainTests('Protocol Fees unit tests', env => { return expect(tx).to.revertWith(expectedError); }); - it('should revert if `protocolFeePaid` is zero with non-zero value sent', async () => { + it('should revert if `protocolFee` is zero with non-zero value sent', async () => { const tx = testContract.payProtocolFee.awaitTransactionSuccessAsync( makerAddress, payerAddress, @@ -104,7 +104,7 @@ blockchainTests('Protocol Fees unit tests', env => { return expect(tx).to.revertWith(expectedError); }); - it('should revert if `protocolFeePaid` is < than the provided message value', async () => { + it('should revert if `protocolFee` is < than the provided message value', async () => { const tx = testContract.payProtocolFee.awaitTransactionSuccessAsync( makerAddress, payerAddress, @@ -118,7 +118,7 @@ blockchainTests('Protocol Fees unit tests', env => { return expect(tx).to.revertWith(expectedError); }); - it('should revert if `protocolFeePaid` is > than the provided message value', async () => { + it('should revert if `protocolFee` is > than the provided message value', async () => { const tx = testContract.payProtocolFee.awaitTransactionSuccessAsync( makerAddress, payerAddress, diff --git a/contracts/staking/test/utils/cumulative_reward_tracking_simulation.ts b/contracts/staking/test/utils/cumulative_reward_tracking_simulation.ts index e321c0b0cb..e16f12c323 100644 --- a/contracts/staking/test/utils/cumulative_reward_tracking_simulation.ts +++ b/contracts/staking/test/utils/cumulative_reward_tracking_simulation.ts @@ -24,7 +24,7 @@ interface TestLog { export class CumulativeRewardTrackingSimulation { private readonly _amountToStake = toBaseUnitAmount(100); - private readonly _protocolFeeAmount = new BigNumber(10); + private readonly _protocolFee = new BigNumber(10); private readonly _stakingApiWrapper: StakingApiWrapper; private readonly _staker: string; private readonly _poolOperator: string; @@ -141,8 +141,8 @@ export class CumulativeRewardTrackingSimulation { receipt = await this._stakingApiWrapper.stakingContract.payProtocolFee.awaitTransactionSuccessAsync( this._poolOperator, this._takerAddress, - this._protocolFeeAmount, - { from: this._exchangeAddress, value: this._protocolFeeAmount }, + this._protocolFee, + { from: this._exchangeAddress, value: this._protocolFee }, ); break;