@0x/contracts-staking: Rebase against 3.0
				
					
				
			This commit is contained in:
		@@ -69,7 +69,7 @@ contract Staking is
 | 
				
			|||||||
        address payable _rewardVaultAddress,
 | 
					        address payable _rewardVaultAddress,
 | 
				
			||||||
        address _zrxVaultAddress
 | 
					        address _zrxVaultAddress
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
        external
 | 
					        public
 | 
				
			||||||
        onlyAuthorized
 | 
					        onlyAuthorized
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // DANGER! When performing upgrades, take care to modify this logic
 | 
					        // DANGER! When performing upgrades, take care to modify this logic
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -210,7 +210,7 @@ contract StakingProxy is
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Minimum stake must be > 1
 | 
					        // Minimum stake must be > 1
 | 
				
			||||||
        if (minimumStake < 2) {
 | 
					        if (minimumPoolStake < 2) {
 | 
				
			||||||
            LibRichErrors.rrevert(
 | 
					            LibRichErrors.rrevert(
 | 
				
			||||||
                LibStakingRichErrors.InvalidParamValueError(
 | 
					                LibStakingRichErrors.InvalidParamValueError(
 | 
				
			||||||
                    LibStakingRichErrors.InvalidParamValueErrorCode.InvalidMinimumPoolStake
 | 
					                    LibStakingRichErrors.InvalidParamValueErrorCode.InvalidMinimumPoolStake
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -246,24 +246,4 @@ contract MixinParams is
 | 
				
			|||||||
            _zrxVaultAddress
 | 
					            _zrxVaultAddress
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /// @dev Rescind the WETH allowance for `oldSpenders` and grant `newSpenders`
 | 
					 | 
				
			||||||
    ///      an unlimited allowance.
 | 
					 | 
				
			||||||
    /// @param oldSpenders Addresses to remove allowance from.
 | 
					 | 
				
			||||||
    /// @param newSpenders Addresses to grant allowance to.
 | 
					 | 
				
			||||||
    function _transferWETHAllownces(
 | 
					 | 
				
			||||||
        address[2] memory oldSpenders,
 | 
					 | 
				
			||||||
        address[2] memory newSpenders
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
        internal
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        IEtherToken weth = IEtherToken(_getWETHAddress());
 | 
					 | 
				
			||||||
        // Grant new allowances.
 | 
					 | 
				
			||||||
        for (uint256 i = 0; i < oldSpenders.length; i++) {
 | 
					 | 
				
			||||||
            // Rescind old allowance.
 | 
					 | 
				
			||||||
            weth.approve(oldSpenders[i], 0);
 | 
					 | 
				
			||||||
            // Grant new allowance.
 | 
					 | 
				
			||||||
            weth.approve(newSpenders[i], uint256(-1));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,6 @@ import "./MixinVaultCore.sol";
 | 
				
			|||||||
contract EthVault is
 | 
					contract EthVault is
 | 
				
			||||||
    IEthVault,
 | 
					    IEthVault,
 | 
				
			||||||
    IVaultCore,
 | 
					    IVaultCore,
 | 
				
			||||||
    Ownable,
 | 
					 | 
				
			||||||
    MixinVaultCore
 | 
					    MixinVaultCore
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    using LibSafeMath for uint256;
 | 
					    using LibSafeMath for uint256;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,15 +24,14 @@ import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
 | 
				
			|||||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
 | 
					import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
 | 
				
			||||||
import "../libs/LibStakingRichErrors.sol";
 | 
					import "../libs/LibStakingRichErrors.sol";
 | 
				
			||||||
import "../libs/LibSafeDowncast.sol";
 | 
					import "../libs/LibSafeDowncast.sol";
 | 
				
			||||||
import "./MixinVaultCore.sol";
 | 
					 | 
				
			||||||
import "../interfaces/IStakingPoolRewardVault.sol";
 | 
					import "../interfaces/IStakingPoolRewardVault.sol";
 | 
				
			||||||
 | 
					import "./MixinVaultCore.sol";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// @dev This vault manages staking pool rewards.
 | 
					/// @dev This vault manages staking pool rewards.
 | 
				
			||||||
contract StakingPoolRewardVault is
 | 
					contract StakingPoolRewardVault is
 | 
				
			||||||
    IStakingPoolRewardVault,
 | 
					    IStakingPoolRewardVault,
 | 
				
			||||||
    IVaultCore,
 | 
					    IVaultCore,
 | 
				
			||||||
    Ownable,
 | 
					 | 
				
			||||||
    MixinVaultCore
 | 
					    MixinVaultCore
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    using LibSafeMath for uint256;
 | 
					    using LibSafeMath for uint256;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,11 +18,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
pragma solidity ^0.5.9;
 | 
					pragma solidity ^0.5.9;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import "../interfaces/IZrxVault.sol";
 | 
					 | 
				
			||||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
 | 
					import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
 | 
				
			||||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetProxy.sol";
 | 
					import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetProxy.sol";
 | 
				
			||||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
 | 
					import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
 | 
				
			||||||
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
 | 
					import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
 | 
				
			||||||
 | 
					import "../interfaces/IZrxVault.sol";
 | 
				
			||||||
import "./MixinVaultCore.sol";
 | 
					import "./MixinVaultCore.sol";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,7 +36,6 @@ import "./MixinVaultCore.sol";
 | 
				
			|||||||
contract ZrxVault is
 | 
					contract ZrxVault is
 | 
				
			||||||
    IVaultCore,
 | 
					    IVaultCore,
 | 
				
			||||||
    IZrxVault,
 | 
					    IZrxVault,
 | 
				
			||||||
    Ownable,
 | 
					 | 
				
			||||||
    MixinVaultCore
 | 
					    MixinVaultCore
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    using LibSafeMath for uint256;
 | 
					    using LibSafeMath for uint256;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ pragma experimental ABIEncoderV2;
 | 
				
			|||||||
import "../src/StakingProxy.sol";
 | 
					import "../src/StakingProxy.sol";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// solhint-disable no-empty-blocks
 | 
				
			||||||
contract TestAssertStorageParams is
 | 
					contract TestAssertStorageParams is
 | 
				
			||||||
    StakingProxy
 | 
					    StakingProxy
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,6 @@ import "../src/interfaces/IStructs.sol";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
contract TestStorageLayout is
 | 
					contract TestStorageLayout is
 | 
				
			||||||
    MixinConstants,
 | 
					 | 
				
			||||||
    Ownable,
 | 
					    Ownable,
 | 
				
			||||||
    MixinStorage
 | 
					    MixinStorage
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "config": {
 | 
					    "config": {
 | 
				
			||||||
        "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
 | 
					        "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
 | 
				
			||||||
        "abis": "./generated-artifacts/@(EthVault|IEthVault|IStaking|IStakingEvents|IStakingPoolRewardVault|IStakingProxy|IStorage|IStorageInit|IStructs|IVaultCore|IZrxVault|LibCobbDouglas|LibFixedMath|LibFixedMathRichErrors|LibProxy|LibSafeDowncast|LibStakingRichErrors|MixinConstants|MixinCumulativeRewards|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinParams|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakeStorage|MixinStakingPool|MixinStakingPoolMakers|MixinStakingPoolModifiers|MixinStakingPoolRewards|MixinStorage|MixinVaultCore|ReadOnlyProxy|Staking|StakingPoolRewardVault|StakingProxy|TestAssertStorageParams|TestCobbDouglas|TestCumulativeRewardTracking|TestInitTarget|TestLibFixedMath|TestLibProxy|TestLibProxyReceiver|TestLibSafeDowncast|TestMixinVaultCore|TestProtocolFees|TestProtocolFeesERC20Proxy|TestStaking|TestStakingProxy|TestStorageLayout|ZrxVault).json"
 | 
					        "abis": "./generated-artifacts/@(EthVault|IEthVault|IStaking|IStakingEvents|IStakingPoolRewardVault|IStakingProxy|IStorage|IStorageInit|IStructs|IVaultCore|IZrxVault|LibCobbDouglas|LibFixedMath|LibFixedMathRichErrors|LibProxy|LibSafeDowncast|LibStakingRichErrors|MixinAbstract|MixinConstants|MixinCumulativeRewards|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinFinalizer|MixinParams|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakeStorage|MixinStakingPool|MixinStakingPoolMakers|MixinStakingPoolModifiers|MixinStakingPoolRewards|MixinStorage|MixinVaultCore|ReadOnlyProxy|Staking|StakingPoolRewardVault|StakingProxy|TestAssertStorageParams|TestCobbDouglas|TestCumulativeRewardTracking|TestDelegatorRewards|TestFinalizer|TestInitTarget|TestLibFixedMath|TestLibProxy|TestLibProxyReceiver|TestLibSafeDowncast|TestMixinParams|TestMixinVaultCore|TestProtocolFees|TestStaking|TestStakingNoWETH|TestStakingProxy|TestStorageLayout|ZrxVault).json"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "repository": {
 | 
					    "repository": {
 | 
				
			||||||
        "type": "git",
 | 
					        "type": "git",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,10 +54,11 @@ import * as TestLibFixedMath from '../generated-artifacts/TestLibFixedMath.json'
 | 
				
			|||||||
import * as TestLibProxy from '../generated-artifacts/TestLibProxy.json';
 | 
					import * as TestLibProxy from '../generated-artifacts/TestLibProxy.json';
 | 
				
			||||||
import * as TestLibProxyReceiver from '../generated-artifacts/TestLibProxyReceiver.json';
 | 
					import * as TestLibProxyReceiver from '../generated-artifacts/TestLibProxyReceiver.json';
 | 
				
			||||||
import * as TestLibSafeDowncast from '../generated-artifacts/TestLibSafeDowncast.json';
 | 
					import * as TestLibSafeDowncast from '../generated-artifacts/TestLibSafeDowncast.json';
 | 
				
			||||||
 | 
					import * as TestMixinParams from '../generated-artifacts/TestMixinParams.json';
 | 
				
			||||||
import * as TestMixinVaultCore from '../generated-artifacts/TestMixinVaultCore.json';
 | 
					import * as TestMixinVaultCore from '../generated-artifacts/TestMixinVaultCore.json';
 | 
				
			||||||
import * as TestProtocolFees from '../generated-artifacts/TestProtocolFees.json';
 | 
					import * as TestProtocolFees from '../generated-artifacts/TestProtocolFees.json';
 | 
				
			||||||
import * as TestProtocolFeesERC20Proxy from '../generated-artifacts/TestProtocolFeesERC20Proxy.json';
 | 
					 | 
				
			||||||
import * as TestStaking from '../generated-artifacts/TestStaking.json';
 | 
					import * as TestStaking from '../generated-artifacts/TestStaking.json';
 | 
				
			||||||
 | 
					import * as TestStakingNoWETH from '../generated-artifacts/TestStakingNoWETH.json';
 | 
				
			||||||
import * as TestStakingProxy from '../generated-artifacts/TestStakingProxy.json';
 | 
					import * as TestStakingProxy from '../generated-artifacts/TestStakingProxy.json';
 | 
				
			||||||
import * as TestStorageLayout from '../generated-artifacts/TestStorageLayout.json';
 | 
					import * as TestStorageLayout from '../generated-artifacts/TestStorageLayout.json';
 | 
				
			||||||
import * as ZrxVault from '../generated-artifacts/ZrxVault.json';
 | 
					import * as ZrxVault from '../generated-artifacts/ZrxVault.json';
 | 
				
			||||||
@@ -112,10 +113,11 @@ export const artifacts = {
 | 
				
			|||||||
    TestLibProxy: TestLibProxy as ContractArtifact,
 | 
					    TestLibProxy: TestLibProxy as ContractArtifact,
 | 
				
			||||||
    TestLibProxyReceiver: TestLibProxyReceiver as ContractArtifact,
 | 
					    TestLibProxyReceiver: TestLibProxyReceiver as ContractArtifact,
 | 
				
			||||||
    TestLibSafeDowncast: TestLibSafeDowncast as ContractArtifact,
 | 
					    TestLibSafeDowncast: TestLibSafeDowncast as ContractArtifact,
 | 
				
			||||||
 | 
					    TestMixinParams: TestMixinParams as ContractArtifact,
 | 
				
			||||||
    TestMixinVaultCore: TestMixinVaultCore as ContractArtifact,
 | 
					    TestMixinVaultCore: TestMixinVaultCore as ContractArtifact,
 | 
				
			||||||
    TestProtocolFees: TestProtocolFees as ContractArtifact,
 | 
					    TestProtocolFees: TestProtocolFees as ContractArtifact,
 | 
				
			||||||
    TestProtocolFeesERC20Proxy: TestProtocolFeesERC20Proxy as ContractArtifact,
 | 
					 | 
				
			||||||
    TestStaking: TestStaking as ContractArtifact,
 | 
					    TestStaking: TestStaking as ContractArtifact,
 | 
				
			||||||
 | 
					    TestStakingNoWETH: TestStakingNoWETH as ContractArtifact,
 | 
				
			||||||
    TestStakingProxy: TestStakingProxy as ContractArtifact,
 | 
					    TestStakingProxy: TestStakingProxy as ContractArtifact,
 | 
				
			||||||
    TestStorageLayout: TestStorageLayout as ContractArtifact,
 | 
					    TestStorageLayout: TestStorageLayout as ContractArtifact,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,10 +52,11 @@ export * from '../generated-wrappers/test_lib_fixed_math';
 | 
				
			|||||||
export * from '../generated-wrappers/test_lib_proxy';
 | 
					export * from '../generated-wrappers/test_lib_proxy';
 | 
				
			||||||
export * from '../generated-wrappers/test_lib_proxy_receiver';
 | 
					export * from '../generated-wrappers/test_lib_proxy_receiver';
 | 
				
			||||||
export * from '../generated-wrappers/test_lib_safe_downcast';
 | 
					export * from '../generated-wrappers/test_lib_safe_downcast';
 | 
				
			||||||
 | 
					export * from '../generated-wrappers/test_mixin_params';
 | 
				
			||||||
export * from '../generated-wrappers/test_mixin_vault_core';
 | 
					export * from '../generated-wrappers/test_mixin_vault_core';
 | 
				
			||||||
export * from '../generated-wrappers/test_protocol_fees';
 | 
					export * from '../generated-wrappers/test_protocol_fees';
 | 
				
			||||||
export * from '../generated-wrappers/test_protocol_fees_erc20_proxy';
 | 
					 | 
				
			||||||
export * from '../generated-wrappers/test_staking';
 | 
					export * from '../generated-wrappers/test_staking';
 | 
				
			||||||
 | 
					export * from '../generated-wrappers/test_staking_no_w_e_t_h';
 | 
				
			||||||
export * from '../generated-wrappers/test_staking_proxy';
 | 
					export * from '../generated-wrappers/test_staking_proxy';
 | 
				
			||||||
export * from '../generated-wrappers/test_storage_layout';
 | 
					export * from '../generated-wrappers/test_storage_layout';
 | 
				
			||||||
export * from '../generated-wrappers/zrx_vault';
 | 
					export * from '../generated-wrappers/zrx_vault';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ blockchainTests('Migration tests', env => {
 | 
				
			|||||||
    before(async () => {
 | 
					    before(async () => {
 | 
				
			||||||
        [authorizedAddress, notAuthorizedAddress] = await env.getAccountAddressesAsync();
 | 
					        [authorizedAddress, notAuthorizedAddress] = await env.getAccountAddressesAsync();
 | 
				
			||||||
        stakingContract = await StakingContract.deployFrom0xArtifactAsync(
 | 
					        stakingContract = await StakingContract.deployFrom0xArtifactAsync(
 | 
				
			||||||
            artifacts.Staking,
 | 
					            artifacts.TestStakingNoWETH,
 | 
				
			||||||
            env.provider,
 | 
					            env.provider,
 | 
				
			||||||
            env.txDefaults,
 | 
					            env.txDefaults,
 | 
				
			||||||
            artifacts,
 | 
					            artifacts,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { blockchainTests, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
 | 
					import { blockchainTests, constants, expect, filterLogsToArguments, randomAddress } from '@0x/contracts-test-utils';
 | 
				
			||||||
import { AuthorizableRevertErrors, BigNumber } from '@0x/utils';
 | 
					import { AuthorizableRevertErrors, BigNumber } from '@0x/utils';
 | 
				
			||||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
					import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
				
			||||||
import * as _ from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
@@ -89,6 +89,43 @@ blockchainTests('Configurable Parameters unit tests', env => {
 | 
				
			|||||||
        it('works if called by owner', async () => {
 | 
					        it('works if called by owner', async () => {
 | 
				
			||||||
            return setParamsAndAssertAsync({});
 | 
					            return setParamsAndAssertAsync({});
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        describe('WETH allowance', () => {
 | 
				
			||||||
 | 
					            it('rescinds allowance for old vaults and grants unlimited allowance to new ones', async () => {
 | 
				
			||||||
 | 
					                const [oldEthVaultAddress, oldRewardVaultAddress, newEthVaultAddress, newRewardVaultAddress] = _.times(
 | 
				
			||||||
 | 
					                    4,
 | 
				
			||||||
 | 
					                    () => randomAddress(),
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					                await testContract.setVaultAddresses.awaitTransactionSuccessAsync(
 | 
				
			||||||
 | 
					                    oldEthVaultAddress,
 | 
				
			||||||
 | 
					                    oldRewardVaultAddress,
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					                const { logs } = await setParamsAndAssertAsync({
 | 
				
			||||||
 | 
					                    ethVaultAddress: newEthVaultAddress,
 | 
				
			||||||
 | 
					                    rewardVaultAddress: newRewardVaultAddress,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                const approveEvents = filterLogsToArguments<TestMixinParamsWETHApproveEventArgs>(
 | 
				
			||||||
 | 
					                    logs,
 | 
				
			||||||
 | 
					                    TestMixinParamsEvents.WETHApprove,
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					                expect(approveEvents[0]).to.deep.eq({
 | 
				
			||||||
 | 
					                    spender: oldEthVaultAddress,
 | 
				
			||||||
 | 
					                    amount: constants.ZERO_AMOUNT,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                expect(approveEvents[1]).to.deep.eq({
 | 
				
			||||||
 | 
					                    spender: newEthVaultAddress,
 | 
				
			||||||
 | 
					                    amount: constants.MAX_UINT256,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                expect(approveEvents[2]).to.deep.eq({
 | 
				
			||||||
 | 
					                    spender: oldRewardVaultAddress,
 | 
				
			||||||
 | 
					                    amount: constants.ZERO_AMOUNT,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                expect(approveEvents[3]).to.deep.eq({
 | 
				
			||||||
 | 
					                    spender: newRewardVaultAddress,
 | 
				
			||||||
 | 
					                    amount: constants.MAX_UINT256,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
// tslint:enable:no-unnecessary-type-assertion
 | 
					// tslint:enable:no-unnecessary-type-assertion
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
 | 
					import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
 | 
				
			||||||
import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
 | 
					import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
 | 
				
			||||||
import { BlockchainTestsEnvironment, constants, filterLogsToArguments, txDefaults } from '@0x/contracts-test-utils';
 | 
					import { BlockchainTestsEnvironment, constants, filterLogsToArguments, txDefaults } from '@0x/contracts-test-utils';
 | 
				
			||||||
import { BigNumber, logUtils } from '@0x/utils';
 | 
					import { BigNumber } from '@0x/utils';
 | 
				
			||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
 | 
					import { Web3Wrapper } from '@0x/web3-wrapper';
 | 
				
			||||||
import { BlockParamLiteral, ContractArtifact, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
					import { BlockParamLiteral, ContractArtifact, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
				
			||||||
import * as _ from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
@@ -52,14 +52,11 @@ export class StakingApiWrapper {
 | 
				
			|||||||
        skipToNextEpochAndFinalizeAsync: async (): Promise<DecodedLogs> => {
 | 
					        skipToNextEpochAndFinalizeAsync: async (): Promise<DecodedLogs> => {
 | 
				
			||||||
            await this.utils.fastForwardToNextEpochAsync();
 | 
					            await this.utils.fastForwardToNextEpochAsync();
 | 
				
			||||||
            const endOfEpochInfo = await this.utils.endEpochAsync();
 | 
					            const endOfEpochInfo = await this.utils.endEpochAsync();
 | 
				
			||||||
            let totalGasUsed = 0;
 | 
					 | 
				
			||||||
            const allLogs = [] as DecodedLogs;
 | 
					            const allLogs = [] as DecodedLogs;
 | 
				
			||||||
            for (const poolId of endOfEpochInfo.activePoolIds) {
 | 
					            for (const poolId of endOfEpochInfo.activePoolIds) {
 | 
				
			||||||
                const receipt = await this.stakingContract.finalizePool.awaitTransactionSuccessAsync(poolId);
 | 
					                const receipt = await this.stakingContract.finalizePool.awaitTransactionSuccessAsync(poolId);
 | 
				
			||||||
                totalGasUsed += receipt.gasUsed;
 | 
					 | 
				
			||||||
                allLogs.splice(allLogs.length, 0, ...(receipt.logs as DecodedLogs));
 | 
					                allLogs.splice(allLogs.length, 0, ...(receipt.logs as DecodedLogs));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            logUtils.log(`Finalization cost ${totalGasUsed} gas`);
 | 
					 | 
				
			||||||
            return allLogs;
 | 
					            return allLogs;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,10 +52,11 @@
 | 
				
			|||||||
        "generated-artifacts/TestLibProxy.json",
 | 
					        "generated-artifacts/TestLibProxy.json",
 | 
				
			||||||
        "generated-artifacts/TestLibProxyReceiver.json",
 | 
					        "generated-artifacts/TestLibProxyReceiver.json",
 | 
				
			||||||
        "generated-artifacts/TestLibSafeDowncast.json",
 | 
					        "generated-artifacts/TestLibSafeDowncast.json",
 | 
				
			||||||
 | 
					        "generated-artifacts/TestMixinParams.json",
 | 
				
			||||||
        "generated-artifacts/TestMixinVaultCore.json",
 | 
					        "generated-artifacts/TestMixinVaultCore.json",
 | 
				
			||||||
        "generated-artifacts/TestProtocolFees.json",
 | 
					        "generated-artifacts/TestProtocolFees.json",
 | 
				
			||||||
        "generated-artifacts/TestProtocolFeesERC20Proxy.json",
 | 
					 | 
				
			||||||
        "generated-artifacts/TestStaking.json",
 | 
					        "generated-artifacts/TestStaking.json",
 | 
				
			||||||
 | 
					        "generated-artifacts/TestStakingNoWETH.json",
 | 
				
			||||||
        "generated-artifacts/TestStakingProxy.json",
 | 
					        "generated-artifacts/TestStakingProxy.json",
 | 
				
			||||||
        "generated-artifacts/TestStorageLayout.json",
 | 
					        "generated-artifacts/TestStorageLayout.json",
 | 
				
			||||||
        "generated-artifacts/ZrxVault.json"
 | 
					        "generated-artifacts/ZrxVault.json"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user