From 3432083343e43b5255094510fabaa279bc5a2f2c Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Wed, 28 Aug 2019 16:15:00 -0700 Subject: [PATCH] `@0x:contracts-staking` Updated payProtocolFee trivially to fix the build. This is not a real to update to `payProtocolFee`. Rather, the interface was updated to it's finished state. This will be addressed in my next PR. --- .../staking/contracts/src/fees/MixinExchangeFees.sol | 6 +++++- contracts/staking/src/artifacts.ts | 2 +- contracts/staking/test/simulations_test.ts | 3 ++- contracts/staking/test/utils/Simulation.ts | 4 +++- contracts/staking/test/utils/staking_wrapper.ts | 8 +++++++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/contracts/staking/contracts/src/fees/MixinExchangeFees.sol b/contracts/staking/contracts/src/fees/MixinExchangeFees.sol index fe91461044..1835d4ccda 100644 --- a/contracts/staking/contracts/src/fees/MixinExchangeFees.sol +++ b/contracts/staking/contracts/src/fees/MixinExchangeFees.sol @@ -59,7 +59,11 @@ contract MixinExchangeFees is /// @dev Pays a protocol fee in ETH. /// Only a known 0x exchange can call this method. See (MixinExchangeManager). /// @param makerAddress The address of the order's maker. - function payProtocolFee(address makerAddress) + function payProtocolFee( + address makerAddress, + address payerAddress, + uint256 protocolFeePaid + ) external payable onlyExchange diff --git a/contracts/staking/src/artifacts.ts b/contracts/staking/src/artifacts.ts index e9e86d7697..c183d1b48f 100644 --- a/contracts/staking/src/artifacts.ts +++ b/contracts/staking/src/artifacts.ts @@ -29,8 +29,8 @@ import * as MixinScheduler from '../generated-artifacts/MixinScheduler.json'; import * as MixinStake from '../generated-artifacts/MixinStake.json'; import * as MixinStakeBalances from '../generated-artifacts/MixinStakeBalances.json'; import * as MixinStakingPool from '../generated-artifacts/MixinStakingPool.json'; -import * as MixinStakingPoolRewardVault from '../generated-artifacts/MixinStakingPoolRewardVault.json'; import * as MixinStakingPoolRewards from '../generated-artifacts/MixinStakingPoolRewards.json'; +import * as MixinStakingPoolRewardVault from '../generated-artifacts/MixinStakingPoolRewardVault.json'; import * as MixinStorage from '../generated-artifacts/MixinStorage.json'; import * as MixinTimeLockedStake from '../generated-artifacts/MixinTimeLockedStake.json'; import * as MixinVaultCore from '../generated-artifacts/MixinVaultCore.json'; diff --git a/contracts/staking/test/simulations_test.ts b/contracts/staking/test/simulations_test.ts index 9425fa5060..d4fd0b129a 100644 --- a/contracts/staking/test/simulations_test.ts +++ b/contracts/staking/test/simulations_test.ts @@ -333,8 +333,9 @@ blockchainTests('End-To-End Simulations', env => { it('Should not be able to record a protocol fee from an unknown exchange', async () => { const makerAddress = users[1]; const protocolFee = new BigNumber(1); + // TODO(jalextowle) I need to update this test when I make my PR on adding protocol fees to the Staking contracts const revertError = new StakingRevertErrors.OnlyCallableByExchangeError(owner); - const tx = stakingWrapper.payProtocolFeeAsync(makerAddress, protocolFee, owner); + const tx = stakingWrapper.payProtocolFeeAsync(makerAddress, makerAddress, protocolFee, protocolFee, owner); await expect(tx).to.revertWith(revertError); }); }); diff --git a/contracts/staking/test/utils/Simulation.ts b/contracts/staking/test/utils/Simulation.ts index 56ac30104b..316c986e5c 100644 --- a/contracts/staking/test/utils/Simulation.ts +++ b/contracts/staking/test/utils/Simulation.ts @@ -189,7 +189,9 @@ export class Simulation { const maker = this._makers[i]; const makerAddress = maker.getOwner(); const feeAmount = p.protocolFeesByMaker[i]; - await this._stakingWrapper.payProtocolFeeAsync(makerAddress, feeAmount, p.exchangeAddress); + // TODO(jalextowle): I'll need to fix this once I make my PR on protocol fees. The arguments + // I'm adding are just placeholders for now. + await this._stakingWrapper.payProtocolFeeAsync(makerAddress, makerAddress, feeAmount, feeAmount, p.exchangeAddress); } // validate fees per pool let expectedTotalFeesThisEpoch = new BigNumber(0); diff --git a/contracts/staking/test/utils/staking_wrapper.ts b/contracts/staking/test/utils/staking_wrapper.ts index 72747a7542..848f3a7d74 100644 --- a/contracts/staking/test/utils/staking_wrapper.ts +++ b/contracts/staking/test/utils/staking_wrapper.ts @@ -499,10 +499,16 @@ export class StakingWrapper { ///// PROTOCOL FEES ///// public async payProtocolFeeAsync( makerAddress: string, + payerAddress: string, + protocolFeePaid: BigNumber, amount: BigNumber, exchangeAddress: string, ): Promise { - const calldata = this.getStakingContract().payProtocolFee.getABIEncodedTransactionData(makerAddress); + const calldata = this.getStakingContract().payProtocolFee.getABIEncodedTransactionData( + makerAddress, + payerAddress, + protocolFeePaid, + ); const txReceipt = await this._executeTransactionAsync(calldata, exchangeAddress, amount); return txReceipt; }