Replaced protocolFeePaid
-> protocolFeeAmount
. Changed some wording in comments.
This commit is contained in:
parent
06715201a7
commit
cc7452da8f
@ -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
|
||||
)
|
||||
);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user