devutils 😕
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
MultiAssetProxyContract,
|
||||
StaticCallProxyContract,
|
||||
} from '@0x/contracts-asset-proxy';
|
||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||
import { artifacts as ERC1155Artifacts, ERC1155MintableContract } from '@0x/contracts-erc1155';
|
||||
import { artifacts as ERC20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
|
||||
import { artifacts as ERC721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||
@@ -191,7 +192,19 @@ export class DeploymentManager {
|
||||
staking.stakingProxy,
|
||||
]);
|
||||
|
||||
return new DeploymentManager(assetProxies, governor, exchange, staking, tokens, chainId, accounts, txDefaults);
|
||||
const devUtils = new DevUtilsContract(constants.NULL_ADDRESS, environment.provider);
|
||||
|
||||
return new DeploymentManager(
|
||||
assetProxies,
|
||||
governor,
|
||||
exchange,
|
||||
staking,
|
||||
tokens,
|
||||
chainId,
|
||||
accounts,
|
||||
txDefaults,
|
||||
devUtils,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,6 +493,7 @@ export class DeploymentManager {
|
||||
public chainId: number,
|
||||
public accounts: string[],
|
||||
public txDefaults: Partial<TxData>,
|
||||
public devUtils: DevUtilsContract,
|
||||
) {}
|
||||
}
|
||||
// tslint:disable:max-file-line-count
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { BlockchainBalanceStore, LocalBalanceStore } from '@0x/contracts-exchange';
|
||||
import { GlobalStakeByStatus, OwnerStakeByStatus, StakeStatus, StoredBalance } from '@0x/contracts-staking';
|
||||
import { expect } from '@0x/contracts-test-utils';
|
||||
import { assetDataUtils } from '@0x/order-utils';
|
||||
import { BigNumber, logUtils } from '@0x/utils';
|
||||
import { TxData } from 'ethereum-types';
|
||||
|
||||
@@ -31,17 +30,16 @@ export function validStakeAssertion(
|
||||
ownerStake: OwnerStakeByStatus,
|
||||
): FunctionAssertion<LocalBalanceStore> {
|
||||
const { stakingWrapper, zrxVault } = deployment.staking;
|
||||
const { zrx } = deployment.tokens;
|
||||
|
||||
return new FunctionAssertion(stakingWrapper.stake, {
|
||||
before: async (amount: BigNumber, txData: Partial<TxData>) => {
|
||||
// Simulates the transfer of ZRX from staker to vault
|
||||
const expectedBalances = LocalBalanceStore.create(balanceStore);
|
||||
expectedBalances.transferAsset(
|
||||
const expectedBalances = LocalBalanceStore.create(deployment.devUtils, balanceStore);
|
||||
await expectedBalances.transferAssetAsync(
|
||||
txData.from as string,
|
||||
zrxVault.address,
|
||||
amount,
|
||||
assetDataUtils.encodeERC20AssetData(zrx.address),
|
||||
await deployment.devUtils.encodeERC20AssetData.callAsync(deployment.tokens.zrx.address),
|
||||
);
|
||||
return expectedBalances;
|
||||
},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { BlockchainBalanceStore, LocalBalanceStore } from '@0x/contracts-exchange';
|
||||
import { GlobalStakeByStatus, OwnerStakeByStatus, StakeStatus, StoredBalance } from '@0x/contracts-staking';
|
||||
import { expect } from '@0x/contracts-test-utils';
|
||||
import { assetDataUtils } from '@0x/order-utils';
|
||||
import { BigNumber, logUtils } from '@0x/utils';
|
||||
import { TxData } from 'ethereum-types';
|
||||
|
||||
@@ -31,17 +30,16 @@ export function validUnstakeAssertion(
|
||||
ownerStake: OwnerStakeByStatus,
|
||||
): FunctionAssertion<LocalBalanceStore> {
|
||||
const { stakingWrapper, zrxVault } = deployment.staking;
|
||||
const { zrx } = deployment.tokens;
|
||||
|
||||
return new FunctionAssertion(stakingWrapper.unstake, {
|
||||
before: async (amount: BigNumber, txData: Partial<TxData>) => {
|
||||
// Simulates the transfer of ZRX from vault to staker
|
||||
const expectedBalances = LocalBalanceStore.create(balanceStore);
|
||||
expectedBalances.transferAsset(
|
||||
const expectedBalances = LocalBalanceStore.create(deployment.devUtils, balanceStore);
|
||||
await expectedBalances.transferAssetAsync(
|
||||
zrxVault.address,
|
||||
txData.from as string,
|
||||
amount,
|
||||
assetDataUtils.encodeERC20AssetData(zrx.address),
|
||||
await deployment.devUtils.encodeERC20AssetData.callAsync(deployment.tokens.zrx.address),
|
||||
);
|
||||
return expectedBalances;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user