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

Commit

Permalink
Merge development
Browse files Browse the repository at this point in the history
  • Loading branch information
LogvinovLeon committed Feb 1, 2019
2 parents e124464 + 78bdc2d commit 79adf5c
Show file tree
Hide file tree
Showing 23 changed files with 193 additions and 118 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jobs:
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7
- restore_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7
- restore_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7
- restore_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
Expand Down
5 changes: 5 additions & 0 deletions packages/instant/src/assets/icons/usdc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ERC20AssetAmountInput extends React.PureComponent<ERC20AssetAmountI
if (_.isUndefined(numberOfAssetsAvailable)) {
text = 'Loading...';
} else if (numberOfAssetsAvailable === 0) {
text = 'Assets Unavailable';
text = 'Tokens Unavailable';
}
return (
<Flex>
Expand Down
5 changes: 5 additions & 0 deletions packages/instant/src/data/asset_data_network_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ export const assetDataNetworkMapping: AssetDataByNetwork[] = [
[Network.Kovan]: '0xf47261b00000000000000000000000008cb3971b8eb709c14616bd556ff6683019e90d9c',
[Network.Mainnet]: '0xf47261b00000000000000000000000001985365e9f78359a9b6ad760e32412f4a445e862',
},
// USDC
{
[Network.Kovan]: '',
[Network.Mainnet]: '0xf47261b0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
},
];
7 changes: 7 additions & 0 deletions packages/instant/src/data/asset_meta_data_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,11 @@ export const assetMetaDataMap: ObjectMap<AssetMetaData> = {
symbol: 'dai',
name: 'Dai Stablecoin',
},
'0xf47261b0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': {
assetProxyId: AssetProxyId.ERC20,
decimals: 6,
primaryColor: '#2775CA',
symbol: 'usdc',
name: 'USD Coin',
},
};
12 changes: 12 additions & 0 deletions packages/migrations/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
{
"note": "Upgrade the bignumber.js to v8.0.2",
"pr": 1517
},
{
"note": "Removed `owner` in Migrations",
"pr": 1533
},
{
"note": "`txDefaults` parameter now requires the `from` field",
"pr": 1533
},
{
"note": "Convert `from` to lower case when passed in via cli",
"pr": 1533
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion packages/migrations/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ const args = yargs
const provider = new Web3ProviderEngine();
provider.addProvider(rpcSubprovider);
provider.start();
const normalizedFromAddress = (args.from as string).toLowerCase();
const txDefaults = {
from: args.from,
from: normalizedFromAddress,
};
await runMigrationsAsync(provider, txDefaults);
process.exit(0);
Expand Down
54 changes: 17 additions & 37 deletions packages/migrations/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> {
export async function runMigrationsAsync(provider: Provider, txDefaults: TxData): Promise<ContractAddresses> {
const web3Wrapper = new Web3Wrapper(provider);
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
const owner = accounts[0];

// Proxies
const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync(
Expand Down Expand Up @@ -84,48 +82,38 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
);

await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults),
);

// MultiAssetProxy
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, txDefaults),
);

// Register the Asset Proxies to the Exchange
await web3Wrapper.awaitTransactionSuccessAsync(
await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address),
await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address, txDefaults),
);

// Forwarder
Expand Down Expand Up @@ -156,7 +144,8 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
);

// Multisigs
const owners = [accounts[0], accounts[1]];
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
const owners = _.uniq([accounts[0], accounts[1], txDefaults.from]);
const confirmationsRequired = new BigNumber(2);
const secondsRequired = new BigNumber(0);

Expand All @@ -173,19 +162,13 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial

// Transfer Ownership to the Asset Proxy Owner
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
from: owner,
}),
await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
from: owner,
}),
await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
from: owner,
}),
await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, txDefaults),
);

// Fund the Forwarder with ZRX
Expand Down Expand Up @@ -220,10 +203,7 @@ let _cachedContractAddresses: ContractAddresses;
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsOnceAsync(
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ContractAddresses> {
export async function runMigrationsOnceAsync(provider: Provider, txDefaults: TxData): Promise<ContractAddresses> {
if (!_.isUndefined(_cachedContractAddresses)) {
return _cachedContractAddresses;
}
Expand Down
9 changes: 9 additions & 0 deletions packages/sol-trace/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "2.0.1",
"changes": [
{
"note": "Improve error messages when unable to find matching bytecode",
"pr": 1558
}
]
},
{
"version": "2.0.0",
"changes": [
Expand Down
1 change: 1 addition & 0 deletions packages/sol-trace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@0x/sol-tracing-utils": "^4.0.1",
"@0x/subproviders": "^2.1.11",
"@0x/typescript-typings": "^3.0.8",
"chalk": "^2.3.0",
"ethereum-types": "^1.1.6",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5",
Expand Down
17 changes: 15 additions & 2 deletions packages/sol-trace/src/revert_trace_subprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
TraceCollectionSubprovider,
utils,
} from '@0x/sol-tracing-utils';
import chalk from 'chalk';
import { stripHexPrefix } from 'ethereumjs-util';
import * as _ from 'lodash';
import { getLogger, levels, Logger } from 'loglevel';
Expand Down Expand Up @@ -71,9 +72,21 @@ export class RevertTraceSubprovider extends TraceCollectionSubprovider {
const bytecode = await this._web3Wrapper.getContractCodeAsync(evmCallStackEntry.address);
const contractData = utils.getContractDataIfExists(this._contractsData, bytecode);
if (_.isUndefined(contractData)) {
const shortenHex = (hex: string) => {
/**
* Length choosen so that both error messages are of the same length
* and it's enough data to figure out which artifact has a problem.
*/
const length = 18;
return `${hex.substr(0, length + 2)}...${hex.substr(hex.length - length, length)}`;
};
const errMsg = isContractCreation
? `Unknown contract creation transaction`
: `Transaction to an unknown address: ${evmCallStackEntry.address}`;
? `Unable to find matching bytecode for contract creation ${chalk.bold(
shortenHex(bytecode),
)}, please check your artifacts. Ignoring...`
: `Unable to find matching bytecode for contract address ${chalk.bold(
evmCallStackEntry.address,
)}, please check your artifacts. Ignoring...`;
this._logger.warn(errMsg);
continue;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/sol-tracing-utils/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
{
"note": "Print resasonable error message on bytecode collision",
"pr": 1535
},
{
"note": "Fix the bug in `ASTVisitor` causing the 'cannot read property `range` of `null`' error",
"pr": 1557
},
{
"note": "Improve error messages when unable to find matching bytecode",
"pr": 1558
}
]
},
Expand Down
1 change: 1 addition & 0 deletions packages/sol-tracing-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"ethereum-types": "^1.1.6",
"ethereumjs-util": "^5.1.1",
"glob": "^7.1.2",
"chalk": "^2.3.0",
"istanbul": "^0.4.5",
"lodash": "^4.17.5",
"loglevel": "^1.6.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/sol-tracing-utils/src/ast_visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ export class ASTVisitor {
this._visitStatement(ast);
}
public ExpressionStatement(ast: Parser.ExpressionStatement): void {
this._visitStatement(ast.expression);
if (!_.isNull(ast.expression)) {
this._visitStatement(ast.expression);
}
}
public InlineAssemblyStatement(ast: Parser.InlineAssemblyStatement): void {
this._visitStatement(ast);
Expand Down
17 changes: 15 additions & 2 deletions packages/sol-tracing-utils/src/trace_collector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { promisify } from '@0x/utils';
import chalk from 'chalk';
import { stripHexPrefix } from 'ethereumjs-util';
import * as fs from 'fs';
import { Collector } from 'istanbul';
Expand Down Expand Up @@ -71,9 +72,21 @@ export class TraceCollector {
: (traceInfo as TraceInfoExistingContract).runtimeBytecode;
const contractData = utils.getContractDataIfExists(this._contractsData, bytecode);
if (_.isUndefined(contractData)) {
const shortenHex = (hex: string) => {
/**
* Length chooses so that both error messages are of the same length
* and it's enough data to figure out which artifact has a problem.
*/
const length = 18;
return `${hex.substr(0, length + 2)}...${hex.substr(hex.length - length, length)}`;
};
const errMsg = isContractCreation
? `Unknown contract creation transaction`
: `Transaction to an unknown address: ${traceInfo.address}`;
? `Unable to find matching bytecode for contract creation ${chalk.bold(
shortenHex(bytecode),
)}, please check your artifacts. Ignoring...`
: `Unable to find matching bytecode for contract address ${chalk.bold(
traceInfo.address,
)}, please check your artifacts. Ignoring...`;
this._logger.warn(errMsg);
return;
}
Expand Down
1 change: 1 addition & 0 deletions packages/website/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
content="An Open Protocol For Decentralized Exchange On The Ethereum Blockchain"
/>
<meta property="og:image" content="/images/og_image.png" />
<meta name="google-site-verification" content="0wu9KbpKgGXUhUboLQw-MGtAHJHQ67rMFQN8KrX5I1s" />
<title>0x: The Protocol for Trading Tokens</title>
<link rel="icon" type="image/png" href="/images/favicon/favicon-2-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/images/favicon/favicon-2-16x16.png" sizes="16x16" />
Expand Down
2 changes: 1 addition & 1 deletion packages/website/ts/components/portal/back_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const BackButton = (props: BackButtonProps) => {
<i style={styles.backButtonIcon} className={`zmdi zmdi-arrow-left`} />
</div>
<div style={{ marginLeft: 12, marginRight: 12 }}>
<div style={{ fontSize: 16, color: colors.lightGrey }}>{props.labelText}</div>
<div style={{ fontSize: 16, color: colors.mediumBlue }}>{props.labelText}</div>
</div>
</Island>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion packages/website/ts/components/portal/portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class Portal extends React.Component<PortalProps, PortalState> {
};
return (
<Section
header={<BackButton to={WebsitePaths.Portal} labelText="back to Relayers" />}
header={<BackButton to={WebsitePaths.Portal} labelText="Back to Relayers" />}
body={<Menu selectedPath={routeComponentProps.location.pathname} theme={menuTheme} />}
/>
);
Expand Down
Loading

0 comments on commit 79adf5c

Please sign in to comment.