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

Redeploy 3.0 contracts #2349

Merged
merged 7 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract MixinDeploymentConstants {
// @TODO SET THESE VALUES FOR DEPLOYMENT

// Mainnet ZrxVault address
address constant private ZRX_VAULT_ADDRESS = address(0xcE2a4B118813cBfa27Ee11cf8E67B101867fa85E);
address constant private ZRX_VAULT_ADDRESS = address(0xBa7f8b5fB1b19c1211c5d49550fcD149177A5Eaf);

// Kovan ZrxVault address
// address constant private ZRX_VAULT_ADDRESS = address(0xf36eabdFE986B35b62c8FD5a98A7f2aEBB79B291);
Expand Down
64 changes: 37 additions & 27 deletions packages/contract-addresses/addresses.json
Original file line number Diff line number Diff line change
@@ -1,95 +1,103 @@
{
"1": {
"exchangeV2": "0x080bf510fcbf18b91105470639e9561022937712",
"exchange": "0xb27f1db0a7e473304a5a06e54bdf035f671400c0",
"exchange": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
"erc20Proxy": "0x95e6f48254609a6ee006f7d493c8e5fb97094cef",
"erc721Proxy": "0xefc70a1b18c432bdc64b596838b4d138f6bc6cad",
"forwarder": "0x132a04f3f6196b499a7ed512c15e002d5dcefa9a",
"forwarder": "0x5ff2c495055d4f6284f317a9c2edb7045497b14f",
"orderValidator": "0x0000000000000000000000000000000000000000",
"zrxToken": "0xe41d2489571d322189246dafa5ebde1f4699f498",
"etherToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetProxyOwner": "0xdffe798c7172dd6deb32baee68af322e8f495ce0",
"zeroExGovernor": "0x7d3455421bbc5ed534a83c88fd80387dc8271392",
"dutchAuction": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x45797531b873fd5e519477a070a955764c1a5b07",
"coordinator": "0x9401f3915c387da331b9b6af5e2a57e580f6a201",
"coordinator": "0x38a795580d0f687e399913a00ddef6a17612c722",
"multiAssetProxy": "0xef701d5389ae74503d633396c4d654eabedc9d78",
"staticCallProxy": "0x3517b88c19508c08650616019062b898ab65ed29",
"erc1155Proxy": "0x7eefbd48fd63d441ec7435d024ec7c5131019add",
"zrxVault": "0xce2a4b118813cbfa27ee11cf8e67b101867fa85e",
"staking": "0xe533d7eb513bc90230ec9069a92eac25e1356beb",
"stakingProxy": "0x5fc73bf8c6158fbe205a5e14126b363ab915b8b1",
"devUtils": "0xf15fbafc74e10a9761b6aefd5d2239f098f8fb1e",
"erc20BridgeProxy": "0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0"
"zrxVault": "0xba7f8b5fb1b19c1211c5d49550fcd149177a5eaf",
"staking": "0x2a17c35ff147b32f13f19f2e311446eeb02503f3",
"stakingProxy": "0xa26e80e7dea86279c6d778d702cc413e6cffa777",
"devUtils": "0xccc2431a7335f21d9268ba62f0b32b0f2efc463f",
"erc20BridgeProxy": "0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0",
"uniswapBridge": "0xa6baaed2053058a3c8f11e0c7a9716304454b09e",
"eth2DaiBridge": "0x0ac2d6f5f5afc669d3ca38f830dad2b4f238ad3f"
},
"3": {
"erc20Proxy": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
"erc721Proxy": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
"zrxToken": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
"etherToken": "0xc778417e063141139fce010982780140aa0cd5ab",
"exchangeV2": "0xbff9493f92a3df4b0429b6d00743b3cfb4c85831",
"exchange": "0xc56388332ddfc98701fefed94535100c6166956c",
"exchange": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x53993733d41a88ae86f77a18a024e5548ee26579",
"forwarder": "0xe66ae6162b3e9067d6ce9e5b9799cca1ba0d09f8",
"forwarder": "0x8f7877418e022f24b37c4827dac9d0a90a5e8ae3",
"orderValidator": "0x0000000000000000000000000000000000000000",
"dutchAuction": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x403cc23e88c17c4652fb904784d1af640a6722d9",
"coordinator": "0xad8464022213a618c96a1178a927a5ed15ad6949",
"coordinator": "0x6ff734d96104965c9c1b0108f83abc46e6e501df",
"multiAssetProxy": "0xab8fbd189c569ccdee3a4d929bb7f557be4028f6",
"staticCallProxy": "0xe1b97e47aa3796276033a5341e884d2ba46b6ac1",
"erc1155Proxy": "0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d",
"devUtils": "0x6bb2fc91a82b55c02b88873958a19e04fbd02090",
"devUtils": "0xa3858baf73430c2fa2339c731e3ffb04ea5e359c",
"zrxVault": "0xffd161026865ad8b4ab28a76840474935eec4dfa",
"staking": "0x3f46b98061a3e1e1f41dff296ec19402c298f8a9",
"staking": "0x986b588e472b712385579d172494fe2685669504",
"stakingProxy": "0xfaabcee42ab6b9c649794ac6c133711071897ee9",
"erc20BridgeProxy": "0x599b340b5045436a99b1f0c718d30f5a0c8519dd"
"erc20BridgeProxy": "0x599b340b5045436a99b1f0c718d30f5a0c8519dd",
"uniswapBridge": "0x0000000000000000000000000000000000000000",
"eth2DaiBridge": "0x0000000000000000000000000000000000000000"
},
"4": {
"exchangeV2": "0xbff9493f92a3df4b0429b6d00743b3cfb4c85831",
"exchange": "0x3afe8aa355e086d898447732cfa5d931cfb2a792",
"exchange": "0x198805e9682fceec29413059b68550f92868c129",
"erc20Proxy": "0x2f5ae4f6106e89b4147651688a92256885c5f410",
"erc721Proxy": "0x7656d773e11ff7383a14dcf09a9c50990481cd10",
"zrxToken": "0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa",
"etherToken": "0xc778417e063141139fce010982780140aa0cd5ab",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x3f46b98061a3e1e1f41dff296ec19402c298f8a9",
"forwarder": "0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291",
"forwarder": "0xa3fd7f18e4529c6affe666df0d8a0653fc5accfa",
"orderValidator": "0x0000000000000000000000000000000000000000",
"dutchAuction": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x1084b6a398e47907bae43fec3ff4b677db6e4fee",
"coordinator": "0x9ae7a6e4e4d58c36b7aa573fc06ce46dd3cb0d44",
"coordinator": "0x70c5385ee5ee4629ef72abd169e888c8b4a12238",
"multiAssetProxy": "0xb34cde0ad3a83d04abebc0b66e75196f22216621",
"staticCallProxy": "0xe1b97e47aa3796276033a5341e884d2ba46b6ac1",
"erc1155Proxy": "0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d",
"devUtils": "0x326a303dc0fe20f43acb8e5dec99154e47f32d01",
"devUtils": "0xfe3b67d48c723988c81fe918da6dd4fb91459d22",
"zrxVault": "0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224",
"staking": "0x344d4f661a82afdd84d31456c291822d90d5dc3a",
"staking": "0x7cbe3c09cba24f26db24d9100ee915fa9fa21f5b",
"stakingProxy": "0xc6ad5277ea225ac05e271eb14a7ebb480cd9dd9f",
"erc20BridgeProxy": "0x31b8653642110f17bdb1f719901d7e7d49b08141"
"erc20BridgeProxy": "0x31b8653642110f17bdb1f719901d7e7d49b08141",
"uniswapBridge": "0x0000000000000000000000000000000000000000",
"eth2DaiBridge": "0x0000000000000000000000000000000000000000"
},
"42": {
"erc20Proxy": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e",
"erc721Proxy": "0x2a9127c745688a165106c11cd4d647d2220af821",
"zrxToken": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa",
"etherToken": "0xd0a1e359811322d97991e03f863a0c30c2cf029c",
"exchangeV2": "0x30589010550762d2f0d06f650d8e8b6ade6dbf4b",
"exchange": "0xca8b1626b3b7a0da722ca9f264c4630c7d34d3b8",
"exchange": "0x4eacd0af335451709e1e7b570b8ea68edec8bc97",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x6ff734d96104965c9c1b0108f83abc46e6e501df",
"forwarder": "0xd6330f9d2073e1889a295dd1dd2e28d42dec4bff",
"forwarder": "0xf6b373c1b783aa435fcdd3a2ce7655f45c311f0a",
"orderValidator": "0x0000000000000000000000000000000000000000",
"dutchAuction": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x09fb99968c016a3ff537bf58fb3d9fe55a7975d5",
"coordinator": "0x10e0b1c2e6065ec7f290c7e3731264f9a2bf2b2d",
"coordinator": "0xd29e59e51e8ab5f94121efaeebd935ca4214e257",
"multiAssetProxy": "0xf6313a772c222f51c28f2304c0703b8cf5428fd8",
"staticCallProxy": "0x48e94bdb9033640d45ea7c721e25f380f8bffa43",
"erc1155Proxy": "0x64517fa2b480ba3678a2a3c0cf08ef7fd4fad36f",
"devUtils": "0x5078321eec0fd8db5d61d25cce3ea2d6379bb5df",
"devUtils": "0x80101f90446d9e19a80109ac2767c8c957debb29",
"zrxVault": "0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291",
"staking": "0x89150f5eed50b3528f79bfb539f29d727f92821c",
"staking": "0x32b06d5611a03737a5f1834a24ccd641033fd89c",
"stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34",
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64"
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64",
"uniswapBridge": "0x0000000000000000000000000000000000000000",
"eth2DaiBridge": "0x0000000000000000000000000000000000000000"
},
"1337": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abandeali1 @dekz do any addresses need to be updated for 1337?

We updated the coordinator server's dependencies today and it caused some strange bugs. We found that downgrading to version 4.4.0-beta.2 of the migrations package resolved the issue.

"erc20Proxy": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
Expand All @@ -112,6 +120,8 @@
"zrxVault": "0x609acc8b356894a937fc58f3411f9528de96ecb1",
"staking": "0xca9717a4a6e8009b3518648c9f3e7676255471a1",
"stakingProxy": "0x4586649629f699f9a4b61d0e962dc3c9025fe488",
"erc20BridgeProxy": "0xf23276778860e420acfc18ebeebf7e829b06965c"
"erc20BridgeProxy": "0xf23276778860e420acfc18ebeebf7e829b06965c",
"uniswapBridge": "0x0000000000000000000000000000000000000000",
"eth2DaiBridge": "0x0000000000000000000000000000000000000000"
}
}
2 changes: 2 additions & 0 deletions packages/contract-addresses/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ContractAddresses {
staking: string;
stakingProxy: string;
erc20BridgeProxy: string;
uniswapBridge: string;
eth2DaiBridge: string;
}

export enum ChainId {
Expand Down
17 changes: 17 additions & 0 deletions packages/migrations/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
[
{
"version": "4.4.0-beta.3",
"changes": [
{
"note": "Update Exchange, DevUtils, Coordinator, and Forwarder addresses on all networks",
"pr": 2349
},
{
"note": "Update StakingProxy, Staking, and ZrxVault addresses on mainnet",
"pr": 2349
},
{
"note": "Add UniswapBridge and Eth2DaiBridge addresses to schema, add mainnet addresses",
"pr": 2349
}
]
},
{
"version": "4.4.0-beta.2",
"changes": [
Expand Down
2 changes: 2 additions & 0 deletions packages/migrations/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ export async function runMigrationsAsync(
zrxVault: zrxVault.address,
staking: stakingLogic.address,
stakingProxy: stakingProxy.address,
uniswapBridge: constants.NULL_ADDRESS,
eth2DaiBridge: constants.NULL_ADDRESS,
};

return contractAddresses;
Expand Down
4 changes: 2 additions & 2 deletions packages/migrations/src/test_contract_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { SupportedProvider } from 'ethereum-types';

import { getConfigsByChainId } from './utils/configs_by_chain';
import { getTimelockRegistrationsAsync } from './utils/timelocks';
import { getTimelockRegistrationsByChainId } from './utils/timelocks';

// NOTE: add your own Infura Project ID to RPC urls before running
const INFURA_PROJECT_ID = '';
Expand Down Expand Up @@ -324,7 +324,7 @@ async function testContractConfigsAsync(provider: SupportedProvider): Promise<vo
}

async function verifyZeroExGovernorConfigsAsync(): Promise<void> {
const timelockRegistrations = await getTimelockRegistrationsAsync(provider);
const timelockRegistrations = getTimelockRegistrationsByChainId(chainId);
for (const timelockRegistration of timelockRegistrations) {
const actualRegistration = await governor
.functionCallTimeLocks(timelockRegistration.functionSelector, timelockRegistration.destination)
Expand Down
27 changes: 23 additions & 4 deletions packages/migrations/src/testnet_migrations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
import { artifacts as assetProxyArtifacts, ERC20BridgeProxyContract } from '@0x/contracts-asset-proxy';
import {
artifacts as assetProxyArtifacts,
ERC20BridgeProxyContract,
Eth2DaiBridgeContract,
UniswapBridgeContract,
} from '@0x/contracts-asset-proxy';
import { artifacts as coordinatorArtifacts, CoordinatorContract } from '@0x/contracts-coordinator';
import { artifacts as devUtilsArtifacts, DevUtilsContract } from '@0x/contracts-dev-utils';
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
Expand All @@ -22,7 +27,7 @@ import { LogWithDecodedArgs, SupportedProvider, TxData } from 'ethereum-types';
import { getConfigsByChainId } from './utils/configs_by_chain';
import { constants } from './utils/constants';
import { providerFactory } from './utils/provider_factory';
import { getTimelockRegistrationsAsync } from './utils/timelocks';
import { getTimelockRegistrationsByChainId } from './utils/timelocks';

async function submitAndExecuteTransactionAsync(
governor: ZeroExGovernorContract,
Expand Down Expand Up @@ -84,10 +89,24 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t
assetProxyArtifacts,
);

await UniswapBridgeContract.deployFrom0xArtifactAsync(
assetProxyArtifacts.UniswapBridge,
provider,
txDefaults,
assetProxyArtifacts,
);

await Eth2DaiBridgeContract.deployFrom0xArtifactAsync(
assetProxyArtifacts.Eth2DaiBridge,
provider,
txDefaults,
assetProxyArtifacts,
);

const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider, txDefaults);
const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider, txDefaults);

const customTimeLocks = await getTimelockRegistrationsAsync(provider);
const customTimeLocks = getTimelockRegistrationsByChainId(chainId.toNumber());

const governor = await ZeroExGovernorContract.deployFrom0xArtifactAsync(
multisigArtifacts.ZeroExGovernor,
Expand Down Expand Up @@ -235,7 +254,7 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t
const networkId = 1;
const rpcUrl = 'https://mainnet.infura.io/v3/';
const provider = await providerFactory.getLedgerProviderAsync(networkId, rpcUrl);
await runMigrationsAsync(provider, { from: '0x3b39078f2a3e1512eecc8d6792fdc7f33e1cd2cf', gasPrice: 10000000000 });
await runMigrationsAsync(provider, { from: '0x3b39078f2a3e1512eecc8d6792fdc7f33e1cd2cf', gasPrice: 10000000001 });
})().catch(err => {
logUtils.log(err);
process.exit(1);
Expand Down
14 changes: 6 additions & 8 deletions packages/migrations/src/utils/timelocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
import { ExchangeContract } from '@0x/contracts-exchange';
import { StakingContract, StakingProxyContract, ZrxVaultContract } from '@0x/contracts-staking';
import { IAuthorizableContract, IOwnableContract } from '@0x/contracts-utils';
import { Web3ProviderEngine } from '@0x/subproviders';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { SupportedProvider } from 'ethereum-types';

import { constants } from './constants';

Expand All @@ -18,11 +17,10 @@ export interface TimelockRegistration {
* Gets the custom timelock configs that correspond the the network of the given provider.
* @param provider Web3 provider instance.
*/
export async function getTimelockRegistrationsAsync(provider: SupportedProvider): Promise<TimelockRegistration[]> {
const web3Wrapper = new Web3Wrapper(provider);
const chainId = await web3Wrapper.getChainIdAsync();
export function getTimelockRegistrationsByChainId(chainId: number): TimelockRegistration[] {
const deployedAddresses = getContractAddressesForChainOrThrow(chainId);

const provider = new Web3ProviderEngine();
const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider);
const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider);
const zrxVault = new ZrxVaultContract(constants.NULL_ADDRESS, provider);
Expand Down Expand Up @@ -91,7 +89,7 @@ export async function getTimelockRegistrationsAsync(provider: SupportedProvider)
// Exchange timelocks

{
destination: exchange.address,
destination: deployedAddresses.exchange,
functionSelector: exchange.getSelector('detachProtocolFeeCollector'),
secondsTimeLocked: constants.ZERO_AMOUNT,
},
Expand Down Expand Up @@ -192,13 +190,13 @@ export async function getTimelockRegistrationsAsync(provider: SupportedProvider)
},
// Exchange timelocks
{
destination: exchange.address,
destination: deployedAddresses.exchange,
functionSelector: exchange.getSelector('setProtocolFeeMultiplier'),
secondsTimeLocked:
chainId === constants.MAINNET_CHAIN_ID ? constants.TEN_DAYS_IN_SEC : constants.ZERO_AMOUNT,
},
{
destination: exchange.address,
destination: deployedAddresses.exchange,
functionSelector: exchange.getSelector('setProtocolFeeCollectorAddress'),
secondsTimeLocked:
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
Expand Down