Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2324 from 0xProject/refactor/removeUnusedContract…
Browse files Browse the repository at this point in the history
…Wrappers

Remove unused contract wrappers
  • Loading branch information
fabioberger authored Nov 11, 2019
2 parents 869d2c0 + 5c40992 commit 35099d9
Show file tree
Hide file tree
Showing 55 changed files with 251 additions and 13,703 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc1155_proxy/__
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc20_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc721_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc721_token/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/eth_balance_checker/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/forwarder/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/i_asset_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/i_validator/__init__.py
Expand Down
9 changes: 2 additions & 7 deletions contracts/asset-proxy/test/erc20bridge_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ import { AbiEncoder, AuthorizableRevertErrors, BigNumber, StringRevertError } fr
import { DecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';

import {
artifacts,
ERC20BridgeProxyContract,
TestERC20BridgeBridgeWithdrawToEventArgs,
TestERC20BridgeContract,
} from '../src';
import { artifacts, ERC20BridgeProxyContract, TestERC20BridgeContract } from '../src';

blockchainTests.resets('ERC20BridgeProxy unit tests', env => {
const PROXY_ID = AssetProxyId.ERC20Bridge;
Expand Down Expand Up @@ -164,7 +159,7 @@ blockchainTests.resets('ERC20BridgeProxy unit tests', env => {
const opts = createTransferFromOpts();
const logs = await transferFromAsync(opts);
expect(logs.length).to.eq(1);
const args = logs[0].args as TestERC20BridgeBridgeWithdrawToEventArgs;
const args = logs[0].args;
expect(args.tokenAddress).to.eq(opts.assetData.tokenAddress);
expect(args.from).to.eq(opts.from);
expect(args.to).to.eq(opts.to);
Expand Down
1 change: 0 additions & 1 deletion contracts/dev-utils/src/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* -----------------------------------------------------------------------------
*/
export * from '../generated-wrappers/dev_utils';
export * from '../generated-wrappers/eth_balance_checker';
export * from '../generated-wrappers/lib_asset_data';
export * from '../generated-wrappers/lib_transaction_decoder';
export * from '../generated-wrappers/order_transfer_simulation_utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
import {
DevUtilsContract,
DummyERC20TokenContract,
ERC20ProxyContract,
ERC20TokenContract,
} from '@0x/abi-gen-wrappers';
import * as artifacts from '@0x/contract-artifacts';
import { BlockchainLifecycle, devConstants } from '@0x/dev-utils';
import { artifacts as assetProxyArtifacts, ERC20ProxyContract } from '@0x/contracts-asset-proxy';
import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { artifacts as erc20Artifacts, DummyERC20TokenContract, ERC20TokenContract } from '@0x/contracts-erc20';
import { blockchainTests, chaiSetup, constants } from '@0x/contracts-test-utils';
import { ExchangeContractErrs } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';

import { constants } from '../src/constants';
import { ExchangeTransferSimulator } from '../src/exchange_transfer_simulator';
import { BalanceAndProxyAllowanceLazyStore } from '../src/store/balance_and_proxy_allowance_lazy_store';
import { TradeSide, TransferType } from '../src/types';

import { chaiSetup } from './utils/chai_setup';
import { ExchangeTransferSimulator } from './utils/exchange_transfer_simulator';
import { SimpleERC20BalanceAndProxyAllowanceFetcher } from './utils/simple_erc20_balance_and_proxy_allowance_fetcher';
import { provider, web3Wrapper } from './utils/web3_wrapper';
import { BalanceAndProxyAllowanceLazyStore } from './utils/store/balance_and_proxy_allowance_lazy_store';
import { TradeSide, TransferType } from './utils/types';

chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);

describe('ExchangeTransferSimulator', async () => {
const GAS_LIMIT = 9e6;

blockchainTests('ExchangeTransferSimulator', env => {
const transferAmount = new BigNumber(5);
let userAddresses: string[];
let dummyERC20Token: DummyERC20TokenContract;
Expand All @@ -34,25 +27,25 @@ describe('ExchangeTransferSimulator', async () => {
let exchangeTransferSimulator: ExchangeTransferSimulator;
let txHash: string;
let erc20ProxyAddress: string;
const devUtils = new DevUtilsContract(constants.NULL_ADDRESS, provider);
const devUtils = new DevUtilsContract(constants.NULL_ADDRESS, env.provider);
before(async function(): Promise<void> {
const mochaTestTimeoutMs = 20000;
this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this

userAddresses = await web3Wrapper.getAvailableAddressesAsync();
userAddresses = await env.web3Wrapper.getAvailableAddressesAsync();
[coinbase, sender, recipient] = userAddresses;

const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
gas: GAS_LIMIT,
from: userAddresses[0],
};

await blockchainLifecycle.startAsync();
await env.blockchainLifecycle.startAsync();
const erc20Proxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC20Proxy,
provider,
assetProxyArtifacts.ERC20Proxy,
env.provider,
txDefaults,
artifacts,
assetProxyArtifacts,
);
erc20ProxyAddress = erc20Proxy.address;

Expand All @@ -62,10 +55,10 @@ describe('ExchangeTransferSimulator', async () => {
const decimals = new BigNumber(18);
// tslint:disable-next-line:no-unused-variable
dummyERC20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.DummyERC20Token,
provider,
erc20Artifacts.DummyERC20Token,
env.provider,
txDefaults,
artifacts,
erc20Artifacts,
name,
symbol,
decimals,
Expand All @@ -75,13 +68,13 @@ describe('ExchangeTransferSimulator', async () => {
exampleAssetData = await devUtils.encodeERC20AssetData.callAsync(dummyERC20Token.address);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
await env.blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
await env.blockchainLifecycle.revertAsync();
});
after(async () => {
await blockchainLifecycle.revertAsync();
await env.blockchainLifecycle.revertAsync();
});
describe('#transferFromAsync', function(): void {
// HACK: For some reason these tests need a slightly longer timeout
Expand All @@ -95,7 +88,7 @@ describe('ExchangeTransferSimulator', async () => {
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
simpleERC20BalanceAndProxyAllowanceFetcher,
);
exchangeTransferSimulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
exchangeTransferSimulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore, devUtils);
});
it("throws if the user doesn't have enough allowance", async () => {
return expect(
Expand All @@ -113,7 +106,7 @@ describe('ExchangeTransferSimulator', async () => {
txHash = await dummyERC20Token.approve.sendTransactionAsync(erc20ProxyAddress, transferAmount, {
from: sender,
});
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await env.web3Wrapper.awaitTransactionSuccessAsync(txHash);
return expect(
exchangeTransferSimulator.transferFromAsync(
exampleAssetData,
Expand All @@ -129,12 +122,12 @@ describe('ExchangeTransferSimulator', async () => {
txHash = await dummyERC20Token.transfer.sendTransactionAsync(sender, transferAmount, {
from: coinbase,
});
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await env.web3Wrapper.awaitTransactionSuccessAsync(txHash);

txHash = await dummyERC20Token.approve.sendTransactionAsync(erc20ProxyAddress, transferAmount, {
from: sender,
});
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await env.web3Wrapper.awaitTransactionSuccessAsync(txHash);

await exchangeTransferSimulator.transferFromAsync(
exampleAssetData,
Expand All @@ -156,15 +149,15 @@ describe('ExchangeTransferSimulator', async () => {
txHash = await dummyERC20Token.transfer.sendTransactionAsync(sender, transferAmount, {
from: coinbase,
});
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await env.web3Wrapper.awaitTransactionSuccessAsync(txHash);
txHash = await dummyERC20Token.approve.sendTransactionAsync(
erc20ProxyAddress,
constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
{
from: sender,
},
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await env.web3Wrapper.awaitTransactionSuccessAsync(txHash);
await exchangeTransferSimulator.transferFromAsync(
exampleAssetData,
sender,
Expand Down
Loading

0 comments on commit 35099d9

Please sign in to comment.