devutils 😕

This commit is contained in:
Michael Zhu
2019-11-08 15:58:03 -08:00
parent 48ecd32d5d
commit 2b887c336a
4 changed files with 21 additions and 12 deletions

View File

@@ -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;
},