diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-11-29 08:16:55 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-12-19 05:36:05 +0800 |
commit | c854c99f20e399bd36f86f69738913c8e5819a9f (patch) | |
tree | 00fa2e0f025b9ce8471c54e3d8dedabdbc703b24 | |
parent | 0e0e05e0e07aca3cfbfd13b3fdc00183b7ac5a87 (diff) | |
download | dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.tar dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.tar.gz dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.tar.bz2 dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.tar.lz dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.tar.xz dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.tar.zst dexon-sol-tools-c854c99f20e399bd36f86f69738913c8e5819a9f.zip |
template for Compliant Forwarder tests
-rw-r--r-- | packages/contracts/test/extensions/compliant_forwarder.ts | 59 | ||||
-rw-r--r-- | packages/contracts/test/utils/compliant_forwarder_wrapper.ts | 0 |
2 files changed, 18 insertions, 41 deletions
diff --git a/packages/contracts/test/extensions/compliant_forwarder.ts b/packages/contracts/test/extensions/compliant_forwarder.ts index d26bbd8ec..bb9493aaa 100644 --- a/packages/contracts/test/extensions/compliant_forwarder.ts +++ b/packages/contracts/test/extensions/compliant_forwarder.ts @@ -1,4 +1,3 @@ -/* import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils } from '@0x/order-utils'; import { RevertReason, SignedOrder } from '@0x/types'; @@ -9,6 +8,7 @@ import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; import { ExchangeContract } from '../../generated-wrappers/exchange'; +import { CompliantForwarderContract } from '../../generated-wrappers/compliant_forwarder'; import { WETH9Contract } from '../../generated-wrappers/weth9'; import { artifacts } from '../../src/artifacts'; @@ -46,8 +46,7 @@ describe(ContractName.Forwarder, () => { let weth: DummyERC20TokenContract; let zrxToken: DummyERC20TokenContract; let erc20TokenA: DummyERC20TokenContract; - let erc721Token: DummyERC721TokenContract; - let forwarderContract: ForwarderContract; + let compliantForwarderContract: CompliantForwarderContract; let wethContract: WETH9Contract; let forwarderWrapper: ForwarderWrapper; let exchangeWrapper: ExchangeWrapper; @@ -85,12 +84,6 @@ describe(ContractName.Forwarder, () => { const erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); - [erc721Token] = await erc721Wrapper.deployDummyTokensAsync(); - const erc721Proxy = await erc721Wrapper.deployProxyAsync(); - await erc721Wrapper.setBalancesAndAllowancesAsync(); - const erc721Balances = await erc721Wrapper.getBalancesAsync(); - erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults); weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider); erc20Wrapper.addDummyTokenContract(weth); @@ -105,14 +98,10 @@ describe(ContractName.Forwarder, () => { ); exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider); await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); - await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner); await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, { from: owner, }); - await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, { - from: owner, - }); defaultMakerAssetAddress = erc20TokenA.address; const defaultTakerAssetAddress = wethContract.address; @@ -130,21 +119,28 @@ describe(ContractName.Forwarder, () => { const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)]; orderFactory = new OrderFactory(privateKey, defaultOrderParams); - const forwarderInstance = await ForwarderContract.deployFrom0xArtifactAsync( - artifacts.Forwarder, + const compliantForwarderInstance = await CompliantForwarderContract.deployFrom0xArtifactAsync( + artifacts.CompliantForwarder, provider, txDefaults, exchangeInstance.address, - zrxAssetData, - wethAssetData, + exchangeInstance.address, // @TODO CHANGE to Yes Token ); - forwarderContract = new ForwarderContract(forwarderInstance.abi, forwarderInstance.address, provider); - forwarderWrapper = new ForwarderWrapper(forwarderContract, provider); + + compliantForwarderContract = new CompliantForwarderContract( + compliantForwarderInstance.abi, + compliantForwarderInstance.address, + provider, + ); + /* + forwarderWrapper = new ForwarderWrapper(compliantForwarderContract, provider); + */ + const zrxDepositAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18); await web3Wrapper.awaitTransactionSuccessAsync( - await zrxToken.transfer.sendTransactionAsync(forwarderContract.address, zrxDepositAmount), + await zrxToken.transfer.sendTransactionAsync(compliantForwarderContract.address, zrxDepositAmount), ); - erc20Wrapper.addTokenOwnerAddress(forwarderInstance.address); + erc20Wrapper.addTokenOwnerAddress(compliantForwarderInstance.address); }); after(async () => { await blockchainLifecycle.revertAsync(); @@ -167,27 +163,8 @@ describe(ContractName.Forwarder, () => { }); describe('constructor', () => { - it('should revert if assetProxy is unregistered', async () => { - const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - artifacts.Exchange, - provider, - txDefaults, - zrxAssetData, - ); - return expectContractCreationFailedAsync( - (ForwarderContract.deployFrom0xArtifactAsync( - artifacts.Forwarder, - provider, - txDefaults, - exchangeInstance.address, - zrxAssetData, - wethAssetData, - ) as any) as sendTransactionResult, - RevertReason.UnregisteredAssetProxy, - ); - }); + it('should revert if assetProxy is unregistered', async () => {}); }); }); // tslint:disable:max-file-line-count // tslint:enable:no-unnecessary-type-assertion -*/
\ No newline at end of file diff --git a/packages/contracts/test/utils/compliant_forwarder_wrapper.ts b/packages/contracts/test/utils/compliant_forwarder_wrapper.ts new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packages/contracts/test/utils/compliant_forwarder_wrapper.ts |