diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2019-01-22 06:20:33 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2019-01-22 13:41:21 +0800 |
commit | 0758f231e21e9b9d3c3ca21ea639b0d8d9acf2f1 (patch) | |
tree | d5afc5124cd49a361bf282df0255e8b122459373 /contracts/extensions | |
parent | 9fa86195900383640f382850f6fe0d827d48bb9b (diff) | |
download | dexon-0x-contracts-0758f231e21e9b9d3c3ca21ea639b0d8d9acf2f1.tar.gz dexon-0x-contracts-0758f231e21e9b9d3c3ca21ea639b0d8d9acf2f1.tar.zst dexon-0x-contracts-0758f231e21e9b9d3c3ca21ea639b0d8d9acf2f1.zip |
Split tokens package into erc20 and erc721
Diffstat (limited to 'contracts/extensions')
16 files changed, 62 insertions, 83 deletions
diff --git a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol index f98e553a7..7631880c0 100644 --- a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol +++ b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol @@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol"; import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol"; -import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol"; +import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol"; import "@0x/contracts-utils/contracts/src/LibBytes.sol"; import "@0x/contracts-utils/contracts/src/SafeMath.sol"; diff --git a/contracts/extensions/contracts/Forwarder/MixinAssets.sol b/contracts/extensions/contracts/Forwarder/MixinAssets.sol index c00a47088..330586ed9 100644 --- a/contracts/extensions/contracts/Forwarder/MixinAssets.sol +++ b/contracts/extensions/contracts/Forwarder/MixinAssets.sol @@ -20,8 +20,8 @@ pragma solidity ^0.4.24; import "@0x/contracts-utils/contracts/src/LibBytes.sol"; import "@0x/contracts-utils/contracts/src/Ownable.sol"; -import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol"; -import "@0x/contracts-tokens/contracts/ERC721Token/IERC721Token.sol"; +import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol"; +import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol"; import "./libs/LibConstants.sol"; import "./mixins/MAssets.sol"; diff --git a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol index fdc63e68c..3ff2a03e5 100644 --- a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol +++ b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol @@ -20,8 +20,8 @@ pragma solidity ^0.4.24; import "@0x/contracts-utils/contracts/src/LibBytes.sol"; import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol"; -import "@0x/contracts-tokens/contracts/EtherToken/IEtherToken.sol"; -import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol"; +import "@0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol"; +import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol"; contract LibConstants { diff --git a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol b/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol index 9d46f5844..65b36ea65 100644 --- a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol +++ b/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol @@ -20,8 +20,8 @@ pragma solidity ^0.4.24; import "@0x/contracts-utils/contracts/src/LibBytes.sol"; import "@0x/contracts-utils/contracts/src/Ownable.sol"; -import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol"; -import "@0x/contracts-tokens/contracts/ERC721Token/IERC721Token.sol"; +import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol"; +import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol"; import "./mixins/MAssets.sol"; import "./libs/LibConstants.sol"; diff --git a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol b/contracts/extensions/contracts/OrderValidator/OrderValidator.sol index 6e325665a..3297a980f 100644 --- a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol +++ b/contracts/extensions/contracts/OrderValidator/OrderValidator.sol @@ -21,8 +21,8 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol"; import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol"; -import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol"; -import "@0x/contracts-tokens/contracts/ERC721Token/IERC721Token.sol"; +import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol"; +import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol"; import "@0x/contracts-utils/contracts/src/LibBytes.sol"; diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 5cea0dcea..af0c37b51 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -74,7 +74,8 @@ "@0x/contracts-asset-proxy": "^2.2.3", "@0x/contracts-exchange-libs": "^1.0.6", "@0x/contracts-exchange": "^2.2.3", - "@0x/contracts-tokens": "^1.0.6", + "@0x/contracts-erc20": "^1.0.6", + "@0x/contracts-erc721": "^1.0.6", "@0x/contracts-utils": "^1.0.6", "@0x/order-utils": "^3.1.2", "@0x/types": "^1.5.2", diff --git a/contracts/extensions/src/index.ts b/contracts/extensions/src/index.ts index d55f08ea2..ba813e7ca 100644 --- a/contracts/extensions/src/index.ts +++ b/contracts/extensions/src/index.ts @@ -1,2 +1,3 @@ export * from './artifacts'; export * from './wrappers'; +export * from '../test/utils'; diff --git a/contracts/extensions/test/extensions/balance_threshold_filter.ts b/contracts/extensions/test/balance_threshold_filter.ts index 055beb487..c79a72f5a 100644 --- a/contracts/extensions/test/extensions/balance_threshold_filter.ts +++ b/contracts/extensions/test/balance_threshold_filter.ts @@ -7,13 +7,9 @@ import * as chai from 'chai'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { - artifacts as exchangeArtifacts, - ERC20Wrapper, - ERC721Wrapper, - ExchangeContract, - ExchangeWrapper, -} from '@0x/contracts-exchange'; +import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy'; +import { DummyERC20TokenContract } from '@0x/contracts-erc20'; +import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -27,11 +23,8 @@ import { txDefaults, web3Wrapper, } from '@0x/contracts-test-utils'; -import { DummyERC20TokenContract } from '@0x/contracts-tokens'; -import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter'; -import { artifacts } from '../../src/artifacts'; -import { BalanceThresholdWrapper } from '../utils/balance_threshold_wrapper'; +import { artifacts, BalanceThresholdFilterContract, BalanceThresholdWrapper } from '../src'; chaiSetup.configure(); const expect = chai.expect; diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/dutch_auction.ts index 132989efe..34ff25c3d 100644 --- a/contracts/extensions/test/extensions/dutch_auction.ts +++ b/contracts/extensions/test/dutch_auction.ts @@ -1,11 +1,8 @@ import { DutchAuctionWrapper } from '@0x/contract-wrappers'; -import { - artifacts as exchangeArtifacts, - ERC20Wrapper, - ERC721Wrapper, - ExchangeContract, - ExchangeWrapper, -} from '@0x/contracts-exchange'; +import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy'; +import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20'; +import { DummyERC721TokenContract } from '@0x/contracts-erc721'; +import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -18,12 +15,6 @@ import { txDefaults, web3Wrapper, } from '@0x/contracts-test-utils'; -import { - artifacts as tokensArtifacts, - DummyERC20TokenContract, - DummyERC721TokenContract, - WETH9Contract, -} from '@0x/contracts-tokens'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils'; import { RevertReason, SignedOrder } from '@0x/types'; @@ -32,9 +23,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; -import { artifacts } from '../../src/artifacts'; -import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper'; +import { artifacts, DutchAuctionContract, DutchAuctionTestWrapper } from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -93,7 +82,7 @@ describe(ContractName.DutchAuction, () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokensArtifacts.WETH9, provider, txDefaults); + wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults); erc20Wrapper.addDummyTokenContract(wethContract as any); const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); diff --git a/contracts/extensions/test/extensions/forwarder.ts b/contracts/extensions/test/forwarder.ts index e9bda43ae..24c219563 100644 --- a/contracts/extensions/test/extensions/forwarder.ts +++ b/contracts/extensions/test/forwarder.ts @@ -1,10 +1,7 @@ -import { - artifacts as exchangeArtifacts, - ERC20Wrapper, - ERC721Wrapper, - ExchangeContract, - ExchangeWrapper, -} from '@0x/contracts-exchange'; +import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy'; +import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20'; +import { DummyERC721TokenContract } from '@0x/contracts-erc721'; +import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -18,12 +15,6 @@ import { txDefaults, web3Wrapper, } from '@0x/contracts-test-utils'; -import { - artifacts as tokenArtifacts, - DummyERC20TokenContract, - DummyERC721TokenContract, - WETH9Contract, -} from '@0x/contracts-tokens'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils } from '@0x/order-utils'; import { RevertReason, SignedOrder } from '@0x/types'; @@ -32,10 +23,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { ForwarderContract } from '../../generated-wrappers/forwarder'; -import { artifacts } from '../../src/artifacts'; - -import { ForwarderWrapper } from '../utils/forwarder_wrapper'; +import { artifacts, ForwarderContract, ForwarderWrapper } from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -100,7 +88,7 @@ describe(ContractName.Forwarder, () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokenArtifacts.WETH9, provider, txDefaults); + wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults); weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider); erc20Wrapper.addDummyTokenContract(weth); diff --git a/contracts/extensions/test/extensions/order_matcher.ts b/contracts/extensions/test/order_matcher.ts index 61965dab3..0b2f9ddbb 100644 --- a/contracts/extensions/test/extensions/order_matcher.ts +++ b/contracts/extensions/test/order_matcher.ts @@ -1,7 +1,13 @@ -import { artifacts as proxyArtifacts, ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy'; import { - artifacts as exchangeArtifacts, + artifacts as proxyArtifacts, + ERC20ProxyContract, ERC20Wrapper, + ERC721ProxyContract, +} from '@0x/contracts-asset-proxy'; +import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contracts-erc20'; +import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721'; +import { + artifacts as exchangeArtifacts, ExchangeContract, ExchangeFillEventArgs, ExchangeWrapper, @@ -19,7 +25,6 @@ import { txDefaults, web3Wrapper, } from '@0x/contracts-test-utils'; -import { artifacts as tokenArtifacts, DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils } from '@0x/order-utils'; import { RevertReason } from '@0x/types'; @@ -29,8 +34,7 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { OrderMatcherContract } from '../../generated-wrappers/order_matcher'; -import { artifacts } from '../../src/artifacts'; +import { artifacts, OrderMatcherContract } from '../src'; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); chaiSetup.configure(); @@ -450,7 +454,7 @@ describe('OrderMatcher', () => { signedOrderLeft.signature, signedOrderRight.signature, ); - const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...exchangeArtifacts }); + const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts }); const txReceipt = await logDecoder.getTxWithDecodedLogsAsync( await web3Wrapper.sendTransactionAsync({ data, @@ -488,7 +492,7 @@ describe('OrderMatcher', () => { signedOrderLeft.signature, signedOrderRight.signature, ); - const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...exchangeArtifacts }); + const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts }); const txReceipt = await logDecoder.getTxWithDecodedLogsAsync( await web3Wrapper.sendTransactionAsync({ data, @@ -725,7 +729,7 @@ describe('OrderMatcher', () => { }); it('should allow owner to withdraw ERC721 tokens', async () => { const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync( - tokenArtifacts.DummyERC721Token, + erc721Artifacts.DummyERC721Token, provider, txDefaults, constants.DUMMY_TOKEN_NAME, @@ -770,7 +774,7 @@ describe('OrderMatcher', () => { }); it('should be able to approve an ERC721 token by passing in allowance = 1', async () => { const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync( - tokenArtifacts.DummyERC721Token, + erc721Artifacts.DummyERC721Token, provider, txDefaults, constants.DUMMY_TOKEN_NAME, @@ -787,7 +791,7 @@ describe('OrderMatcher', () => { }); it('should be able to approve an ERC721 token by passing in allowance > 1', async () => { const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync( - tokenArtifacts.DummyERC721Token, + erc721Artifacts.DummyERC721Token, provider, txDefaults, constants.DUMMY_TOKEN_NAME, diff --git a/contracts/extensions/test/extensions/order_validator.ts b/contracts/extensions/test/order_validator.ts index 7871867c7..88dae14fb 100644 --- a/contracts/extensions/test/extensions/order_validator.ts +++ b/contracts/extensions/test/order_validator.ts @@ -1,11 +1,7 @@ -import { ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy'; -import { - artifacts as exchangeArtifacts, - ERC20Wrapper, - ERC721Wrapper, - ExchangeContract, - ExchangeWrapper, -} from '@0x/contracts-exchange'; +import { ERC20ProxyContract, ERC20Wrapper, ERC721ProxyContract, ERC721Wrapper } from '@0x/contracts-asset-proxy'; +import { DummyERC20TokenContract } from '@0x/contracts-erc20'; +import { DummyERC721TokenContract } from '@0x/contracts-erc721'; +import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -15,7 +11,6 @@ import { txDefaults, web3Wrapper, } from '@0x/contracts-test-utils'; -import { DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils, orderHashUtils } from '@0x/order-utils'; import { SignedOrder } from '@0x/types'; @@ -23,8 +18,7 @@ import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { OrderValidatorContract } from '../../generated-wrappers/order_validator'; -import { artifacts } from '../../src/artifacts/index'; +import { artifacts, OrderValidatorContract } from '../src'; chaiSetup.configure(); const expect = chai.expect; diff --git a/contracts/extensions/test/utils/balance_threshold_wrapper.ts b/contracts/extensions/test/utils/balance_threshold_wrapper.ts index db2b23d42..3178d992e 100644 --- a/contracts/extensions/test/utils/balance_threshold_wrapper.ts +++ b/contracts/extensions/test/utils/balance_threshold_wrapper.ts @@ -1,3 +1,5 @@ +import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; +import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange'; import { FillResults, @@ -7,7 +9,6 @@ import { orderUtils, TransactionFactory, } from '@0x/contracts-test-utils'; -import { artifacts as tokensArtifacts } from '@0x/contracts-tokens'; import { SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; @@ -35,7 +36,8 @@ export class BalanceThresholdWrapper { this._web3Wrapper = new Web3Wrapper(provider); this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, - ...tokensArtifacts, + ...erc20Artifacts, + ...erc721Artifacts, ...exchangeArtifacts, }); } diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts index 985af336d..5899ffcac 100644 --- a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -1,6 +1,7 @@ +import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; +import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange'; import { LogDecoder } from '@0x/contracts-test-utils'; -import { artifacts as tokensArtifacts } from '@0x/contracts-tokens'; import { DutchAuctionDetails, SignedOrder } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; @@ -19,7 +20,8 @@ export class DutchAuctionTestWrapper { this._web3Wrapper = new Web3Wrapper(provider); this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, - ...tokensArtifacts, + ...erc20Artifacts, + ...erc721Artifacts, ...exchangeArtifacts, }); } diff --git a/contracts/extensions/test/utils/forwarder_wrapper.ts b/contracts/extensions/test/utils/forwarder_wrapper.ts index 5b89638a0..207106852 100644 --- a/contracts/extensions/test/utils/forwarder_wrapper.ts +++ b/contracts/extensions/test/utils/forwarder_wrapper.ts @@ -1,6 +1,7 @@ +import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; +import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange'; import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils'; -import { artifacts as tokensArtifacts } from '@0x/contracts-tokens'; import { SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; @@ -62,7 +63,8 @@ export class ForwarderWrapper { this._web3Wrapper = new Web3Wrapper(provider); this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, - ...tokensArtifacts, + ...erc20Artifacts, + ...erc721Artifacts, ...exchangeArtifacts, }); } diff --git a/contracts/extensions/test/utils/index.ts b/contracts/extensions/test/utils/index.ts new file mode 100644 index 000000000..d5d529c11 --- /dev/null +++ b/contracts/extensions/test/utils/index.ts @@ -0,0 +1,3 @@ +export * from './balance_threshold_wrapper'; +export * from './dutch_auction_test_wrapper'; +export * from './forwarder_wrapper'; |