Delete packages/migrations (#488)
* Delete packages/migrations * Remove 0x/migrations from asset-swapper dev dependency * Remove 0x/migrations references
This commit is contained in:
parent
db76da58d7
commit
7f4080e0a2
@ -110,7 +110,7 @@ jobs:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
environment:
|
||||
RUST_ROUTER: "true"
|
||||
RUST_ROUTER: 'true'
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
@ -118,7 +118,6 @@ jobs:
|
||||
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-wrappers-test -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/migrations -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/order-utils -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/asset-swapper -m --serial -c test:circleci
|
||||
- save_cache:
|
||||
|
1
.github/autolabeler.yml
vendored
1
.github/autolabeler.yml
vendored
@ -1,7 +1,6 @@
|
||||
python: ['python-packages']
|
||||
contracts: ['contracts']
|
||||
@0x/contract-addresses: ['packages/contract-addresses']
|
||||
@0x/migrations: ['packages/migrations']
|
||||
@0x/order-utils: ['packages/order-utils']
|
||||
@0x/contract-artifacts: ['packages/contract-artifacts']
|
||||
@0x/contract-wrappers: ['packages/contract-wrappers']
|
||||
|
@ -38,7 +38,6 @@ These packages are all under development. See [/contracts/README.md](/contracts/
|
||||
| [`@0x/protocol-utils`](/packages/protocol-utils) | [](https://www.npmjs.com/package/@0x/protocol-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||
| [`@0x/contract-addresses`](/packages/contract-addresses) | [](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
|
||||
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
|
||||
| [`@0x/migrations`](/packages/migrations) | [](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets |
|
||||
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts | |
|
||||
|
||||
## Usage
|
||||
|
@ -52,10 +52,10 @@
|
||||
},
|
||||
"config": {
|
||||
"contractsPackages": "@0x/contracts-erc20 @0x/contracts-test-utils @0x/contracts-utils @0x/contracts-zero-ex @0x/contracts-treasury",
|
||||
"nonContractPackages": "@0x/migrations @0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test @0x/asset-swapper",
|
||||
"nonContractPackages": "@0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test @0x/asset-swapper",
|
||||
"ignoreTestsForPackages": "",
|
||||
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
|
||||
"packagesWithDocPages": "@0x/contract-wrappers @0x/migrations",
|
||||
"packagesWithDocPages": "@0x/contract-wrappers",
|
||||
"ignoreDependencyVersions": "@types/styled-components @types/node",
|
||||
"ignoreDependencyVersionsForPackage": "contract-wrappers"
|
||||
},
|
||||
|
@ -102,7 +102,6 @@
|
||||
"@0x/contracts-test-utils": "^5.4.21",
|
||||
"@0x/contracts-utils": "^4.8.11",
|
||||
"@0x/mesh-rpc-client": "^9.4.2",
|
||||
"@0x/migrations": "^8.1.19",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
2
packages/migrations/.gitignore
vendored
2
packages/migrations/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*.zip
|
||||
0x_ganache_snapshot
|
@ -1,10 +0,0 @@
|
||||
# Blacklist all files
|
||||
.*
|
||||
*
|
||||
# Whitelist lib
|
||||
!lib/**/*
|
||||
# Blacklist tests and publish scripts
|
||||
/lib/test/*
|
||||
/lib/monorepo_scripts/
|
||||
# Package specific ignore
|
||||
!bin/**/*
|
File diff suppressed because it is too large
Load Diff
@ -1,582 +0,0 @@
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v8.1.19 - _May 19, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.18 - _April 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.17 - _March 31, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.16 - _March 2, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.15 - _February 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.14 - _December 24, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.13 - _December 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.12 - _November 16, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.11 - _November 16, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.10 - _November 3, 2021_
|
||||
|
||||
* Add OtcOrders to fullMigrateAsync (#350)
|
||||
|
||||
## v8.1.9 - _October 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.8 - _October 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.7 - _September 29, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.6 - _September 15, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.5 - _September 8, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.4 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.3 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.2 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.1 - _August 16, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.0 - _August 11, 2021_
|
||||
|
||||
* Add zrxTreasury address (#301)
|
||||
|
||||
## v8.0.12 - _August 6, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.11 - _June 22, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.10 - _June 11, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.9 - _June 2, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.8 - _May 25, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.7 - _May 21, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.6 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.5 - _May 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.4 - _April 30, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.3 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.2 - _April 26, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.1 - _April 12, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.0 - _April 1, 2021_
|
||||
|
||||
* Remove exchangeProxyAllowanceTarget
|
||||
|
||||
## v7.0.1 - _March 17, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v7.0.0 - _February 24, 2021_
|
||||
|
||||
* Major version bump with V4 FQT
|
||||
|
||||
## v6.6.0 - _February 10, 2021_
|
||||
|
||||
* Update `BridgeAdapter` deployment (#104)
|
||||
|
||||
## v6.5.11 - _January 26, 2021_
|
||||
|
||||
* Set BOTH networkId and chainId to 1337 in dockerfile (#118)
|
||||
|
||||
## v6.5.10 - _January 13, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.9 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.8 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.7 - _December 17, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.6 - _December 16, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.5 - _December 16, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.4 - _December 9, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.3 - _December 7, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.2 - _December 3, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.1 - _November 19, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.0 - _November 13, 2020_
|
||||
|
||||
* Add `exchangeProxyLiquidityProviderSandbox` address (#16)
|
||||
|
||||
## v6.4.7 - _November 3, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.4.6 - _November 3, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.4.5 - _November 2, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.4.4 - _October 28, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.4.3 - _October 27, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.4.2 - _October 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.4.1 - _October 21, 2020_
|
||||
|
||||
* Change test protocol fee to 70000. (#2637)
|
||||
* Refactor `migration.ts` a little (#2656)
|
||||
* Add bancorBridge to addresses (#2650)
|
||||
* Update EP migration. (#2657)
|
||||
* Add mooniswap addresses to `BridgeAdapter` deployment (#2692)
|
||||
* Reorder transformer deployments (#2693)
|
||||
|
||||
## v6.4.0 - _July 15, 2020_
|
||||
|
||||
* Add Exchange Proxy migration. (#2612)
|
||||
* Add affiliate fee transformer migration and flash wallet address (#2622)
|
||||
* Add BalancerBridge to returned object in `migration.ts` (#2613)
|
||||
|
||||
## v6.3.0 - _June 24, 2020_
|
||||
|
||||
* Add `dexForwarderBridge` to migration output (#2525)
|
||||
* Add `ERC20BridgeSampler` deployment (#2541)
|
||||
* Added `UniswapV2Bridge` address on Mainnet (#2599)
|
||||
* Return empty Exchange Proxy addresses (#2591)
|
||||
|
||||
## v6.2.4 - _March 3, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.3 - _February 27, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.2 - _February 26, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.1 - _February 25, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.0 - _February 15, 2020_
|
||||
|
||||
* Added `CurveBridge` address (null) (#2483)
|
||||
|
||||
## v6.1.0 - _February 8, 2020_
|
||||
|
||||
* Update `DevUtils` deployment (#2456)
|
||||
* Remove `LibTransactionDecoder` deployment (#2456)
|
||||
* Use contract package artifacts in ganache migrations (#2456)
|
||||
* Update deployment for new DevUtils (#2466)
|
||||
|
||||
## v6.0.2 - _February 6, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.0.1 - _February 4, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.0.0 - _January 22, 2020_
|
||||
|
||||
* Update Forwarder deployment (#2432)
|
||||
|
||||
## v5.1.0 - _January 6, 2020_
|
||||
|
||||
* Added DydxBridge Contract to ContractAddresses (#2401)
|
||||
* Changed docker image command to overwrite any existing snapshot when unzipping the image downloaded from S3. (#2420)
|
||||
|
||||
## v5.0.2 - _December 17, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.0.1 - _December 9, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.0.0 - _December 2, 2019_
|
||||
|
||||
* Deploy Forwarder after Exchange is configured as Staking Proxy is queried (#2368)
|
||||
* Subsequent contract addresses after the Forwarder are now modified (#2368)
|
||||
* Update Exchange, DevUtils, Coordinator, and Forwarder addresses on all networks (#2349)
|
||||
* Update StakingProxy, Staking, and ZrxVault addresses on mainnet (#2349)
|
||||
* Add UniswapBridge and Eth2DaiBridge addresses to schema, add mainnet addresses (#2349)
|
||||
* Deploy Forwarder AFTER staking is hooked up (#2350)
|
||||
* Migrations script no longer deploys DutchAuction since it is not yet upgraded for V3 of the protocol (#2324)
|
||||
* Added `Staking` and `ERC20BridgeProxy` contracts (#2323)
|
||||
* Update all contract deployments to pass the actual chain ID (rather than the network ID) via the newly modified @0x/utils/provider_utils (#2270)
|
||||
* All references to network ID have been removed, and references to chain ID have been introduced instead (#2313)
|
||||
* Update Coordinator and Exchange deployments to pass `chainId` (#1742)
|
||||
|
||||
## v4.4.0-beta.4 - _December 2, 2019_
|
||||
|
||||
* Deploy Forwarder after Exchange is configured as Staking Proxy is queried (#2368)
|
||||
* Subsequent contract addresses after the Forwarder are now modified (#2368)
|
||||
|
||||
## v4.4.0-beta.3 - _November 20, 2019_
|
||||
|
||||
* Update Exchange, DevUtils, Coordinator, and Forwarder addresses on all networks (#2349)
|
||||
* Update StakingProxy, Staking, and ZrxVault addresses on mainnet (#2349)
|
||||
* Add UniswapBridge and Eth2DaiBridge addresses to schema, add mainnet addresses (#2349)
|
||||
* Deploy Forwarder AFTER staking is hooked up (#2350)
|
||||
|
||||
## v4.4.0-beta.2 - _November 17, 2019_
|
||||
|
||||
* Migrations script no longer deploys DutchAuction since it is not yet upgraded for V3 of the protocol (#2324)
|
||||
* Added `Staking` and `ERC20BridgeProxy` contracts (#2323)
|
||||
|
||||
## v4.4.0-beta.1 - _November 7, 2019_
|
||||
|
||||
* Update all contract deployments to pass the actual chain ID (rather than the network ID) via the newly modified @0x/utils/provider_utils (#2270)
|
||||
* All references to network ID have been removed, and references to chain ID have been introduced instead (#2313)
|
||||
|
||||
## v4.4.0-beta.0 - _October 3, 2019_
|
||||
|
||||
* Update Coordinator and Exchange deployments to pass `chainId` (#1742)
|
||||
|
||||
## v4.3.2 - _September 17, 2019_
|
||||
|
||||
* Removed dependency on @0x/order-utils (#2096)
|
||||
|
||||
## v4.3.1 - _September 3, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.3.0 - _August 22, 2019_
|
||||
|
||||
* Added DevUtils to migration script (#2060)
|
||||
|
||||
## v4.2.0 - _August 8, 2019_
|
||||
|
||||
* Added StaticCallAssetProxy and ERC1155AssetProxy (#2021)
|
||||
|
||||
## v4.1.11 - _July 31, 2019_
|
||||
|
||||
* Updated calls to <contract wrapper>.deploy0xArtifactAsync to include log decode dependencies. (#1995)
|
||||
|
||||
## v4.1.10 - _July 24, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.9 - _July 15, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.8 - _July 13, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.7 - _July 13, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.6 - _May 24, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.5 - _May 15, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.4 - _May 14, 2019_
|
||||
|
||||
* Add --pk flag to accept private key when migrating (#1811)
|
||||
|
||||
## v4.1.2 - _May 10, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.0 - _March 21, 2019_
|
||||
|
||||
* Add deployment of `Coordinator` and `CoordinatorRegistry` contracts to migration script (#1689)
|
||||
* Added `startProviderEngine` to `providerUtils`. Preventing excess block polling (#1695)
|
||||
|
||||
## v4.0.4 - _March 20, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.0.3 - _March 1, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.0.2 - _February 27, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.0.1 - _February 26, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.0.0 - _February 25, 2019_
|
||||
|
||||
* Replace Provider param interface with Web3ProviderEngine (#1627)
|
||||
|
||||
## v3.0.4 - _February 9, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.0.3 - _February 7, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.0.2 - _February 7, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.0.1 - _February 6, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.0.0 - _February 5, 2019_
|
||||
|
||||
* Upgrade the bignumber.js to v8.0.2 (#1517)
|
||||
* Removed `owner` in Migrations (#1533)
|
||||
* `txDefaults` parameter now requires the `from` field (#1533)
|
||||
* Convert `from` to lower case when passed in via cli (#1533)
|
||||
|
||||
## v2.4.0 - _January 15, 2019_
|
||||
|
||||
* Added migrations for `MultiAssetProxy` contract (#1503)
|
||||
|
||||
## v2.3.1 - _January 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.3.0 - _January 9, 2019_
|
||||
|
||||
* Added migrations for Dutch Auction contract (#1465)
|
||||
|
||||
## v2.2.2 - _December 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.2.1 - _December 11, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.2.0 - _November 28, 2018_
|
||||
|
||||
* Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way (#1324)
|
||||
* Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed. (#1309)
|
||||
* Fund the Forwarder with ZRX for fees. (#1309)
|
||||
|
||||
## v2.1.0 - _November 21, 2018_
|
||||
|
||||
* Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping (#1301)
|
||||
|
||||
## v2.0.4 - _November 14, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.3 - _November 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.2 - _November 12, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.1 - _November 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.0 - _October 18, 2018_
|
||||
|
||||
* Contract artifacts have been moved to the new @0xproject/contract-artifacts package. v1 migrations have been removed. `runMigrationsAsync` returns the addresses of the contracts that were deployed. (#1105)
|
||||
|
||||
## v1.0.14 - _October 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.13 - _September 28, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.12 - _September 25, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.11 - _September 25, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.10 - _September 21, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.9 - _September 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.8 - _September 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.7 - _September 5, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.6 - _August 27, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.5 - _August 24, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.4 - _August 14, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.1 - _July 23, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _July 19, 2018_
|
||||
|
||||
* Added migrations for 0x Protocol v2
|
||||
|
||||
## v0.0.10 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.9 - _July 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.8 - _June 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.7 - _May 22, 2018_
|
||||
|
||||
* Use AssetProxyOwner instead of MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress (#675)
|
||||
|
||||
## v0.0.6 - _May 22, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.5 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.4 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.3 - _April 18, 2018_
|
||||
|
||||
* Dependencies updated
|
@ -1,15 +0,0 @@
|
||||
FROM mhart/alpine-node:12
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN npm install -g ganache-cli@6.12.1
|
||||
|
||||
ENV MNEMONIC "concert load couple harbor equip island argue ramp clarify fence smart topic"
|
||||
ENV NETWORK_ID 1337
|
||||
ENV CHAIN_ID 1337
|
||||
ENV VERSION "latest"
|
||||
ENV SNAPSHOT_HOST "http://ganache-snapshots.0x.org.s3-website.us-east-2.amazonaws.com"
|
||||
ENV SNAPSHOT_NAME "0x_ganache_snapshot"
|
||||
EXPOSE 8545
|
||||
|
||||
CMD [ "sh", "-c", "echo downloading snapshot version: $VERSION; wget $SNAPSHOT_HOST/$SNAPSHOT_NAME-$VERSION.zip -O snapshot.zip && unzip -o snapshot.zip && ganache-cli --gasLimit 12000000 --allowUnlimitedContractSize=true --db $SNAPSHOT_NAME --noVMErrorsOnRPCResponse -p 8545 --keepAliveTimeout=40000 --networkId \"$NETWORK_ID\" --chainId \"$CHAIN_ID\" -m \"$MNEMONIC\" -h 0.0.0.0"]
|
@ -1,104 +0,0 @@
|
||||
## Migrations
|
||||
|
||||
Migrate the 0x system of smart contracts on the network of your choice using these migrations.
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/migrations yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0x/migrations yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Migrate
|
||||
|
||||
#### V2 smart contracts
|
||||
|
||||
In order to migrate the V2 0x smart contracts to TestRPC/Ganache running at `http://localhost:8545`, run:
|
||||
|
||||
```bash
|
||||
yarn migrate:v2
|
||||
```
|
||||
|
||||
### Publish
|
||||
|
||||
#### 0x Ganache Snapshot
|
||||
|
||||
The 0x Ganache snapshot can be generated and published in this package. In order to build the snapshot for this version of migrations run:
|
||||
|
||||
```bash
|
||||
yarn build:snapshot
|
||||
```
|
||||
|
||||
This will run the migrations in Ganache and output a zip file to be uploaded to the s3 bucket. For example, after running this command you will have created `0x_ganache_snapshot-2.2.2.zip`. To publish the zip file to the s3 bucket run:
|
||||
|
||||
```bash
|
||||
yarn publish:snapshot
|
||||
```
|
||||
|
||||
This snapshot will now be publicly available at http://ganache-snapshots.0x.org.s3.amazonaws.com/0x_ganache_snapshot-latest.zip and also versioned with the package.json version.
|
||||
|
||||
#### 0x Ganache Docker Image
|
||||
|
||||
We also publish a simple docker image which downloads the latest snapshot, extracts and runs Ganache. This is not required to be built when migrations change as it always downloads and runs the latest zip file. If you have made changes to the Dockerfile then a publish of the image is required. To do this run:
|
||||
|
||||
```bash
|
||||
yarn build:snapshot:docker
|
||||
yarn publish:snapshot:docker
|
||||
```
|
||||
|
||||
The result is a published docker image to the 0xorg docker registry. To start the docker image run:
|
||||
|
||||
```bash
|
||||
docker run -p 8545:8545 -ti 0xorg/ganache-cli:latest
|
||||
```
|
||||
|
||||
This will pull the latest zip in the s3 bucket, extract and start Ganache with the snapshot.
|
||||
|
||||
In the event you need a specific version of the published Ganache snapshot run the following specifying the VERSION environment variable:
|
||||
|
||||
```bash
|
||||
docker run -e VERSION=2.2.2 -p 8545:8545 -ti 0xorg/ganache-cli:latest
|
||||
```
|
||||
|
||||
#### Production
|
||||
|
||||
If deploying contract changes to mainnet, `@0x/contract-artifacts` should also be updated and published. The artifacts must be copied from each `contracts/{package-name}/generated-artifacts/{contract}.json`.
|
@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
require('../lib/src/cli.js');
|
@ -1,920 +0,0 @@
|
||||
# Interface: GanacheProvider
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### sendAsync
|
||||
|
||||
▸ **sendAsync**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:14](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L14)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
|
||||
`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
|
||||
|
||||
**Returns:** *void*
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Interface: ContractAddresses
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### assetProxyOwner
|
||||
|
||||
• **assetProxyOwner**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:12](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L12)*
|
||||
|
||||
___
|
||||
|
||||
### coordinator
|
||||
|
||||
• **coordinator**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:18](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L18)*
|
||||
|
||||
___
|
||||
|
||||
### coordinatorRegistry
|
||||
|
||||
• **coordinatorRegistry**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:17](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L17)*
|
||||
|
||||
___
|
||||
|
||||
### devUtils
|
||||
|
||||
• **devUtils**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:22](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L22)*
|
||||
|
||||
___
|
||||
|
||||
### dutchAuction
|
||||
|
||||
• **dutchAuction**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:16](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L16)*
|
||||
|
||||
___
|
||||
|
||||
### erc1155Proxy
|
||||
|
||||
• **erc1155Proxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:21](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L21)*
|
||||
|
||||
___
|
||||
|
||||
### erc20BridgeProxy
|
||||
|
||||
• **erc20BridgeProxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:26](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L26)*
|
||||
|
||||
___
|
||||
|
||||
### erc20Proxy
|
||||
|
||||
• **erc20Proxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:6](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L6)*
|
||||
|
||||
___
|
||||
|
||||
### erc721Proxy
|
||||
|
||||
• **erc721Proxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:7](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L7)*
|
||||
|
||||
___
|
||||
|
||||
### etherToken
|
||||
|
||||
• **etherToken**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:9](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L9)*
|
||||
|
||||
___
|
||||
|
||||
### exchange
|
||||
|
||||
• **exchange**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:11](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L11)*
|
||||
|
||||
___
|
||||
|
||||
### exchangeV2
|
||||
|
||||
• **exchangeV2**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:10](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L10)*
|
||||
|
||||
___
|
||||
|
||||
### forwarder
|
||||
|
||||
• **forwarder**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:14](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L14)*
|
||||
|
||||
___
|
||||
|
||||
### multiAssetProxy
|
||||
|
||||
• **multiAssetProxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:19](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L19)*
|
||||
|
||||
___
|
||||
|
||||
### orderValidator
|
||||
|
||||
• **orderValidator**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:15](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L15)*
|
||||
|
||||
___
|
||||
|
||||
### staking
|
||||
|
||||
• **staking**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:24](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L24)*
|
||||
|
||||
___
|
||||
|
||||
### stakingProxy
|
||||
|
||||
• **stakingProxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:25](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L25)*
|
||||
|
||||
___
|
||||
|
||||
### staticCallProxy
|
||||
|
||||
• **staticCallProxy**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:20](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L20)*
|
||||
|
||||
___
|
||||
|
||||
### zeroExGovernor
|
||||
|
||||
• **zeroExGovernor**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:13](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L13)*
|
||||
|
||||
___
|
||||
|
||||
### zrxToken
|
||||
|
||||
• **zrxToken**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:8](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L8)*
|
||||
|
||||
___
|
||||
|
||||
### zrxVault
|
||||
|
||||
• **zrxVault**: *string*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:23](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L23)*
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Interface: EIP1193Provider
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### isEIP1193
|
||||
|
||||
• **isEIP1193**: *boolean*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:73](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L73)*
|
||||
|
||||
## Methods
|
||||
|
||||
### on
|
||||
|
||||
▸ **on**(`event`: [EIP1193Event](#eip1193event), `listener`: function): *this*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:75](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L75)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **event**: *[EIP1193Event](#eip1193event)*
|
||||
|
||||
▪ **listener**: *function*
|
||||
|
||||
▸ (`result`: any): *void*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`result` | any |
|
||||
|
||||
**Returns:** *this*
|
||||
|
||||
___
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(`method`: string, `params?`: any[]): *`Promise<any>`*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:74](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L74)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`method` | string |
|
||||
`params?` | any[] |
|
||||
|
||||
**Returns:** *`Promise<any>`*
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Interface: JSONRPCRequestPayload
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### id
|
||||
|
||||
• **id**: *number*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:331](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L331)*
|
||||
|
||||
___
|
||||
|
||||
### jsonrpc
|
||||
|
||||
• **jsonrpc**: *string*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:332](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L332)*
|
||||
|
||||
___
|
||||
|
||||
### method
|
||||
|
||||
• **method**: *string*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:330](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L330)*
|
||||
|
||||
___
|
||||
|
||||
### params
|
||||
|
||||
• **params**: *any[]*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:329](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L329)*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: JSONRPCResponseError
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### code
|
||||
|
||||
• **code**: *number*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:337](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L337)*
|
||||
|
||||
___
|
||||
|
||||
### message
|
||||
|
||||
• **message**: *string*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:336](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L336)*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: JSONRPCResponsePayload
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### `Optional` error
|
||||
|
||||
• **error**? : *[JSONRPCResponseError](#class-jsonrpcresponseerror)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:344](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L344)*
|
||||
|
||||
___
|
||||
|
||||
### id
|
||||
|
||||
• **id**: *number*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:342](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L342)*
|
||||
|
||||
___
|
||||
|
||||
### jsonrpc
|
||||
|
||||
• **jsonrpc**: *string*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:343](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L343)*
|
||||
|
||||
___
|
||||
|
||||
### result
|
||||
|
||||
• **result**: *any*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:341](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L341)*
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Interface: TxData
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### `Optional` data
|
||||
|
||||
• **data**? : *undefined | string*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[data](#optional-data)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:394](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L394)*
|
||||
|
||||
___
|
||||
|
||||
### from
|
||||
|
||||
• **from**: *string*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:399](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L399)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` gas
|
||||
|
||||
• **gas**? : *number | string | `BigNumber`*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[gas](#optional-gas)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:392](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L392)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` gasPrice
|
||||
|
||||
• **gasPrice**? : *number | string | `BigNumber`*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[gasPrice](#optional-gasprice)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:393](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L393)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` nonce
|
||||
|
||||
• **nonce**? : *undefined | number*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[nonce](#optional-nonce)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:395](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L395)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` to
|
||||
|
||||
• **to**? : *undefined | string*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[to](#optional-to)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:390](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L390)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` value
|
||||
|
||||
• **value**? : *number | string | `BigNumber`*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[value](#optional-value)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:391](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L391)*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: TxDataPayable
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### `Optional` data
|
||||
|
||||
• **data**? : *undefined | string*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[data](#optional-data)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:394](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L394)*
|
||||
|
||||
___
|
||||
|
||||
### from
|
||||
|
||||
• **from**: *string*
|
||||
|
||||
*Inherited from [TxData](#interface-txdata).[from](#from)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:399](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L399)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` gas
|
||||
|
||||
• **gas**? : *number | string | `BigNumber`*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[gas](#optional-gas)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:392](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L392)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` gasPrice
|
||||
|
||||
• **gasPrice**? : *number | string | `BigNumber`*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[gasPrice](#optional-gasprice)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:393](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L393)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` nonce
|
||||
|
||||
• **nonce**? : *undefined | number*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[nonce](#optional-nonce)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:395](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L395)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` to
|
||||
|
||||
• **to**? : *undefined | string*
|
||||
|
||||
*Inherited from [CallTxDataBase](#interface-calltxdatabase).[to](#optional-to)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:390](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L390)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` value
|
||||
|
||||
• **value**? : *`BigNumber`*
|
||||
|
||||
*Overrides [CallTxDataBase](_ethereum_types_src_index_.calltxdatabase.md).[value](#optional-value)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:443](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L443)*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: Web3JsV1Provider
|
||||
|
||||
Web3.js version 1 provider interface
|
||||
This provider interface was implemented in the pre-1.0Beta releases for Web3.js.
|
||||
This interface allowed sending synchonous requests, support for which was later dropped.
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md)): *[JSONRPCResponsePayload](#class-jsonrpcresponsepayload)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:45](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L45)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
|
||||
|
||||
**Returns:** *[JSONRPCResponsePayload](#class-jsonrpcresponsepayload)*
|
||||
|
||||
___
|
||||
|
||||
### sendAsync
|
||||
|
||||
▸ **sendAsync**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:44](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L44)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
|
||||
`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
|
||||
|
||||
**Returns:** *void*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: Web3JsV2Provider
|
||||
|
||||
Web3.js version 2 provider interface
|
||||
This provider interface was used in a couple of Web3.js 1.0 beta releases
|
||||
before the first attempts to conform to EIP1193
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:54](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L54)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
|
||||
`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
|
||||
|
||||
**Returns:** *void*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: Web3JsV3Provider
|
||||
|
||||
Web3.js version 3 provider interface
|
||||
This provider interface was implemented with the hopes for conforming to the EIP1193 spec,
|
||||
however it does not conform entirely.
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(`method`: string, `params?`: any[]): *`Promise<any>`*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:63](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L63)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`method` | string |
|
||||
`params?` | any[] |
|
||||
|
||||
**Returns:** *`Promise<any>`*
|
||||
|
||||
<hr />
|
||||
|
||||
# Interface: ZeroExProvider
|
||||
|
||||
The interface for the provider used internally by 0x libraries
|
||||
Any property we use from any SupportedProvider should we explicitly
|
||||
add here
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
### `Optional` isMetaMask
|
||||
|
||||
• **isMetaMask**? : *undefined | false | true*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:31](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L31)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` isParity
|
||||
|
||||
• **isParity**? : *undefined | false | true*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:32](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L32)*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` isZeroExProvider
|
||||
|
||||
• **isZeroExProvider**? : *undefined | false | true*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:30](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L30)*
|
||||
|
||||
## Methods
|
||||
|
||||
### `Optional` enable
|
||||
|
||||
▸ **enable**(): *`Promise<void>`*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:34](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L34)*
|
||||
|
||||
**Returns:** *`Promise<void>`*
|
||||
|
||||
___
|
||||
|
||||
### sendAsync
|
||||
|
||||
▸ **sendAsync**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:35](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L35)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
|
||||
`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
|
||||
|
||||
**Returns:** *void*
|
||||
|
||||
___
|
||||
|
||||
### `Optional` stop
|
||||
|
||||
▸ **stop**(): *void*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:33](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L33)*
|
||||
|
||||
**Returns:** *void*
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
### runMigrationsAsync
|
||||
|
||||
▸ **runMigrationsAsync**(`supportedProvider`: [SupportedProvider](#supportedprovider), `txDefaults`: `TxData`): *`Promise<ContractAddresses>`*
|
||||
|
||||
*Defined in [migrations/src/migration.ts:63](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/migrations/src/migration.ts#L63)*
|
||||
|
||||
Creates and deploys all the contracts that are required for the latest
|
||||
version of the 0x protocol.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type | Description |
|
||||
------ | ------ | ------ |
|
||||
`supportedProvider` | [SupportedProvider](#supportedprovider) | Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to. |
|
||||
`txDefaults` | `TxData` | Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter). |
|
||||
|
||||
**Returns:** *`Promise<ContractAddresses>`*
|
||||
|
||||
The addresses of the contracts that were deployed.
|
||||
|
||||
___
|
||||
|
||||
### runMigrationsOnceAsync
|
||||
|
||||
▸ **runMigrationsOnceAsync**(`provider`: `Web3ProviderEngine`, `txDefaults`: `TxData`): *`Promise<ContractAddresses>`*
|
||||
|
||||
*Defined in [migrations/src/migration.ts:321](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/migrations/src/migration.ts#L321)*
|
||||
|
||||
Exactly like runMigrationsAsync but will only run the migrations the first
|
||||
time it is called. Any subsequent calls will return the cached contract
|
||||
addresses.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type | Description |
|
||||
------ | ------ | ------ |
|
||||
`provider` | `Web3ProviderEngine` | Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to. |
|
||||
`txDefaults` | `TxData` | Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter). |
|
||||
|
||||
**Returns:** *`Promise<ContractAddresses>`*
|
||||
|
||||
The addresses of the contracts that were deployed.
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
### getContractAddressesForChainOrThrow
|
||||
|
||||
▸ **getContractAddressesForChainOrThrow**(`chainId`: [ChainId](#enumeration-chainid)): *[ContractAddresses](#interface-contractaddresses)*
|
||||
|
||||
*Defined in [contract-addresses/src/index.ts:45](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/contract-addresses/src/index.ts#L45)*
|
||||
|
||||
Used to get addresses of contracts that have been deployed to either the
|
||||
Ethereum mainnet or a supported testnet. Throws if there are no known
|
||||
contracts deployed on the corresponding chain.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type | Description |
|
||||
------ | ------ | ------ |
|
||||
`chainId` | [ChainId](#enumeration-chainid) | The desired chainId. |
|
||||
|
||||
**Returns:** *[ContractAddresses](#interface-contractaddresses)*
|
||||
|
||||
The set of addresses for contracts which have been deployed on the
|
||||
given chainId.
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
## Type aliases
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### EIP1193Event
|
||||
|
||||
Ƭ **EIP1193Event**: *"accountsChanged" | "networkChanged" | "close" | "connect" | "notification"*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:70](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L70)*
|
||||
|
||||
Interface for providers that conform to EIP 1193
|
||||
Source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md
|
||||
|
||||
___
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### JSONRPCErrorCallback
|
||||
|
||||
Ƭ **JSONRPCErrorCallback**: *function*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:3](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L3)*
|
||||
|
||||
#### Type declaration:
|
||||
|
||||
▸ (`err`: `Error` | null, `result?`: [JSONRPCResponsePayload](#interface-jsonrpcresponsepayload)): *void*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`err` | `Error` \| null |
|
||||
`result?` | [JSONRPCResponsePayload](#interface-jsonrpcresponsepayload) |
|
||||
|
||||
___
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### SupportedProvider
|
||||
|
||||
Ƭ **SupportedProvider**: *[Web3JsProvider](_ethereum_types_src_index_.md#web3jsprovider) | [GanacheProvider](#interface-ganacheprovider) | [EIP1193Provider](#interface-eip1193provider) | [ZeroExProvider](#interface-zeroexprovider)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:9](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L9)*
|
||||
|
||||
Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
|
||||
Read more about Providers in the guides section of the 0x docs.
|
||||
|
||||
___
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Web3JsProvider
|
||||
|
||||
Ƭ **Web3JsProvider**: *[Web3JsV1Provider](#interface-web3jsv1provider) | [Web3JsV2Provider](#interface-web3jsv2provider) | [Web3JsV3Provider](#interface-web3jsv3provider)*
|
||||
|
||||
*Defined in [ethereum-types/src/index.ts:11](https://github.com/0xProject/0x-monorepo/blob/34538f2ce/packages/ethereum-types/src/index.ts#L11)*
|
||||
|
||||
<hr />
|
||||
|
@ -1,104 +0,0 @@
|
||||
{
|
||||
"name": "@0x/migrations",
|
||||
"version": "8.1.19",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "0x smart contract migrations",
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"clean": "shx rm -rf lib ${npm_package_config_snapshot_name} ${npm_package_config_snapshot_name}-*.zip",
|
||||
"prettier": "prettier --check 'src/**/*.{ts,tsx,json}' --config ../../.prettierrc",
|
||||
"lint": "tslint --format stylish --project . && yarn prettier",
|
||||
"fix": "tslint --fix --format stylish --project .",
|
||||
"test": "yarn run_mocha",
|
||||
"test:circleci": "yarn test",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --timeout 30000 --exit",
|
||||
"migrate:v2": "run-s build script:migrate:v2",
|
||||
"migrate:v2:snapshot": "run-s build script:migrate:v2:snapshot",
|
||||
"script:migrate:v2": "node ./lib/src/migrate.js",
|
||||
"script:migrate:v2:snapshot": "node ./lib/src/migrate_snapshot.js",
|
||||
"diff_docs": "git diff --exit-code ./docs",
|
||||
"s3:sync_md_docs": "aws s3 sync ./docs s3://docs-markdown/${npm_package_name}/v${npm_package_version} --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"build:snapshot": "rm -rf ${npm_package_config_snapshot_name} && yarn migrate:v2:snapshot && zip -r \"${npm_package_config_snapshot_name}-${npm_package_version}.zip\" ${npm_package_config_snapshot_name}",
|
||||
"build:snapshot:docker": "docker build --tag ${npm_package_config_docker_snapshot_name}:${npm_package_version} --tag ${npm_package_config_docker_snapshot_name}:latest .",
|
||||
"publish:snapshot": "aws s3 cp ${npm_package_config_snapshot_name}-${npm_package_version}.zip ${npm_package_config_s3_snapshot_bucket} && aws s3 cp ${npm_package_config_s3_snapshot_bucket}/${npm_package_config_snapshot_name}-${npm_package_version}.zip ${npm_package_config_s3_snapshot_bucket}/${npm_package_config_snapshot_name}-latest.zip",
|
||||
"publish:snapshot:docker": "docker push ${npm_package_config_docker_snapshot_name}:latest && docker push ${npm_package_config_docker_snapshot_name}:${npm_package_version}",
|
||||
"test_contract_configs": "node ./lib/test_contract_configs.js",
|
||||
"publish:private": "yarn build && gitpkg publish"
|
||||
},
|
||||
"config": {
|
||||
"s3_snapshot_bucket": "s3://ganache-snapshots.0x.org",
|
||||
"docker_snapshot_name": "0xorg/ganache-cli",
|
||||
"snapshot_name": "0x_ganache_snapshot",
|
||||
"postpublish": {
|
||||
"assets": []
|
||||
}
|
||||
},
|
||||
"bin": {
|
||||
"0x-migrate": "bin/0x-migrate.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"gitpkg": {
|
||||
"registry": "git@github.com:0xProject/gitpkg-registry.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@types/yargs": "^11.0.0",
|
||||
"chai": "^4.0.1",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"gitpkg": "https://github.com/0xProject/gitpkg.git",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3",
|
||||
"web3-provider-engine": "14.0.6",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.14.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-coordinator": "^3.1.38",
|
||||
"@0x/contracts-dev-utils": "^1.3.36",
|
||||
"@0x/contracts-erc1155": "^2.1.37",
|
||||
"@0x/contracts-erc20": "^3.3.30",
|
||||
"@0x/contracts-erc721": "^3.1.37",
|
||||
"@0x/contracts-exchange": "^3.2.38",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.38",
|
||||
"@0x/contracts-extensions": "^6.2.32",
|
||||
"@0x/contracts-multisig": "^4.1.38",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-utils": "^4.8.11",
|
||||
"@0x/contracts-zero-ex": "^0.33.0",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@ledgerhq/hw-app-eth": "^4.3.0",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereumjs-util": "^7.1.0",
|
||||
"ethers": "~4.0.4",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@ledgerhq/hw-transport-node-hid": "^4.3.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4f91bfd907996b2f4dd383778b50c479c2602b56"
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { PrivateKeyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { logUtils, providerUtils } from '@0x/utils';
|
||||
import * as yargs from 'yargs';
|
||||
|
||||
import { runMigrationsAsync } from './migration';
|
||||
|
||||
const args = yargs
|
||||
.option('rpc-url', {
|
||||
describe: 'Endpoint where backing Ethereum JSON RPC interface is available',
|
||||
type: 'string',
|
||||
demandOption: false,
|
||||
default: 'http://localhost:8545',
|
||||
})
|
||||
.option('from', {
|
||||
describe: 'Ethereum address from which to deploy the contracts',
|
||||
type: 'string',
|
||||
demandOption: true,
|
||||
})
|
||||
.option('pk', {
|
||||
describe: 'Private key for the `from` address',
|
||||
type: 'string',
|
||||
})
|
||||
.example(
|
||||
'$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631 --pk 0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
|
||||
'Full usage example',
|
||||
).argv;
|
||||
|
||||
(async () => {
|
||||
const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
|
||||
const provider = new Web3ProviderEngine();
|
||||
|
||||
if (args.pk !== undefined && args.pk !== '') {
|
||||
const pkSubprovider = new PrivateKeyWalletSubprovider(args.pk as string);
|
||||
provider.addProvider(pkSubprovider);
|
||||
}
|
||||
|
||||
provider.addProvider(rpcSubprovider);
|
||||
providerUtils.startProviderEngine(provider);
|
||||
const normalizedFromAddress = (args.from as string).toLowerCase();
|
||||
const txDefaults = {
|
||||
from: normalizedFromAddress,
|
||||
};
|
||||
await runMigrationsAsync(provider, txDefaults);
|
||||
process.exit(0);
|
||||
})().catch(err => {
|
||||
logUtils.log(err);
|
||||
process.exit(1);
|
||||
});
|
@ -1,21 +0,0 @@
|
||||
export {
|
||||
TxData,
|
||||
TxDataPayable,
|
||||
SupportedProvider,
|
||||
Web3JsProvider,
|
||||
GanacheProvider,
|
||||
EIP1193Provider,
|
||||
ZeroExProvider,
|
||||
EIP1193Event,
|
||||
JSONRPCErrorCallback,
|
||||
Web3JsV1Provider,
|
||||
Web3JsV2Provider,
|
||||
Web3JsV3Provider,
|
||||
JSONRPCRequestPayload,
|
||||
JSONRPCResponsePayload,
|
||||
JSONRPCResponseError,
|
||||
} from 'ethereum-types';
|
||||
export { ContractAddresses } from '@0x/contract-addresses';
|
||||
export { runMigrationsAsync, runMigrationsOnceAsync } from './migration';
|
||||
export { migrateOnceAsync } from './migrate_with_test_defaults';
|
||||
export import Web3ProviderEngine = require('web3-provider-engine');
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { devConstants, web3Factory } from '@0x/dev-utils';
|
||||
import { Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { logUtils } from '@0x/utils';
|
||||
|
||||
import { runMigrationsAsync } from './migration';
|
||||
|
||||
(async () => {
|
||||
let providerConfigs;
|
||||
let provider: Web3ProviderEngine;
|
||||
let txDefaults;
|
||||
|
||||
providerConfigs = { shouldUseInProcessGanache: false };
|
||||
provider = web3Factory.getRpcProvider(providerConfigs);
|
||||
txDefaults = {
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
};
|
||||
await runMigrationsAsync(provider, txDefaults);
|
||||
process.exit(0);
|
||||
})().catch(err => {
|
||||
logUtils.log(err);
|
||||
process.exit(1);
|
||||
});
|
@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { devConstants, web3Factory } from '@0x/dev-utils';
|
||||
import { Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { logUtils } from '@0x/utils';
|
||||
import * as fs from 'fs';
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
|
||||
import { runMigrationsAsync } from './migration';
|
||||
|
||||
(async () => {
|
||||
let providerConfigs;
|
||||
let provider: Web3ProviderEngine;
|
||||
let txDefaults;
|
||||
const packageJsonPath = path.join(__dirname, '../..', 'package.json');
|
||||
const packageJsonString = fs.readFileSync(packageJsonPath, 'utf8');
|
||||
const packageJson = JSON.parse(packageJsonString);
|
||||
if (packageJson.config === undefined || packageJson.config.snapshot_name === undefined) {
|
||||
throw new Error(`Did not find 'snapshot_name' key in package.json config`);
|
||||
}
|
||||
|
||||
providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: packageJson.config.snapshot_name };
|
||||
provider = web3Factory.getRpcProvider(providerConfigs);
|
||||
txDefaults = {
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
};
|
||||
await runMigrationsAsync(provider, txDefaults);
|
||||
process.exit(0);
|
||||
})().catch(err => {
|
||||
logUtils.log(err);
|
||||
process.exit(1);
|
||||
});
|
@ -1,18 +0,0 @@
|
||||
import { ContractAddresses } from '@0x/contract-addresses';
|
||||
import { devConstants } from '@0x/dev-utils';
|
||||
import { Web3ProviderEngine } from '@0x/subproviders';
|
||||
|
||||
import { runMigrationsOnceAsync } from './index';
|
||||
|
||||
/**
|
||||
* Configures and runs the migrations exactly once. Any subsequent times this is
|
||||
* called, it returns the cached addresses.
|
||||
* @returns The addresses of contracts that were deployed during the migrations.
|
||||
*/
|
||||
export async function migrateOnceAsync(provider: Web3ProviderEngine): Promise<ContractAddresses> {
|
||||
const txDefaults = {
|
||||
gas: devConstants.GAS_LIMIT,
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
};
|
||||
return runMigrationsOnceAsync(provider, txDefaults);
|
||||
}
|
@ -1,351 +0,0 @@
|
||||
import { ChainId, ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import { artifacts as assetProxyArtifacts, ERC20ProxyContract } from '@0x/contracts-asset-proxy';
|
||||
import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
|
||||
import {
|
||||
artifacts as stakingArtifacts,
|
||||
StakingProxyContract,
|
||||
TestStakingContract,
|
||||
ZrxVaultContract,
|
||||
} from '@0x/contracts-staking';
|
||||
import {
|
||||
AffiliateFeeTransformerContract,
|
||||
artifacts as exchangeProxyArtifacts,
|
||||
EthereumBridgeAdapterContract,
|
||||
FillQuoteTransformerContract,
|
||||
fullMigrateAsync as fullMigrateExchangeProxyAsync,
|
||||
PayTakerTransformerContract,
|
||||
PositiveSlippageFeeTransformerContract,
|
||||
WethTransformerContract,
|
||||
} from '@0x/contracts-zero-ex';
|
||||
import { Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { BigNumber, providerUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { SupportedProvider, TxData } from 'ethereum-types';
|
||||
import { bufferToHex, rlphash } from 'ethereumjs-util';
|
||||
|
||||
import { constants } from './utils/constants';
|
||||
import { erc20TokenInfo } from './utils/token_info';
|
||||
|
||||
const allArtifacts = {
|
||||
...assetProxyArtifacts,
|
||||
...stakingArtifacts,
|
||||
...exchangeProxyArtifacts,
|
||||
...assetProxyArtifacts,
|
||||
};
|
||||
|
||||
const { NULL_ADDRESS } = constants;
|
||||
|
||||
// tslint:disable:custom-no-magic-numbers
|
||||
|
||||
function getDeploymentNonce(deployer: string, address: string): number {
|
||||
for (let i = 0; i < 10000; i++) {
|
||||
const candidate = bufferToHex(rlphash([deployer, i]).slice(12));
|
||||
if (candidate.toLowerCase() === address.toLowerCase()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
throw new Error(`Exhausted all attempts to find ${address} deployed by ${deployer}`);
|
||||
}
|
||||
|
||||
async function deployAtAddressAsync<T>(
|
||||
cb: () => Promise<T>,
|
||||
provider: SupportedProvider,
|
||||
txDefaults: TxData,
|
||||
wantedAddress: string,
|
||||
): Promise<T> {
|
||||
await untilWantedAddressAsync(wantedAddress, provider, txDefaults);
|
||||
return cb();
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases addresses nonce until the deployment of a contract would occur at the wanted address.
|
||||
*/
|
||||
async function untilWantedAddressAsync(
|
||||
wantedAddress: string,
|
||||
provider: SupportedProvider,
|
||||
txDefaults: TxData,
|
||||
offset: number = 0,
|
||||
): Promise<void> {
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const from = txDefaults.from;
|
||||
const currentNonce = await web3Wrapper.getAccountNonceAsync(from);
|
||||
const wantedNonce = getDeploymentNonce(from, wantedAddress);
|
||||
|
||||
if (currentNonce > wantedNonce) {
|
||||
throw new Error(`Current nonce is ${currentNonce} but wanted nonce is ${wantedNonce}`);
|
||||
}
|
||||
for (let i = 0; i < wantedNonce - currentNonce + offset; i++) {
|
||||
await web3Wrapper.sendTransactionAsync({ from, to: from, value: new BigNumber(0) });
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates and deploys all the contracts that are required for the latest
|
||||
* version of the 0x protocol.
|
||||
* @param supportedProvider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
|
||||
* @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(
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: TxData,
|
||||
): Promise<ContractAddresses> {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const expectedAddresses = getContractAddressesForChainOrThrow(ChainId.Ganache);
|
||||
|
||||
const erc20Proxy = await deployAtAddressAsync(
|
||||
() =>
|
||||
ERC20ProxyContract.deployFrom0xArtifactAsync(
|
||||
assetProxyArtifacts.ERC20Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.erc20Proxy,
|
||||
);
|
||||
|
||||
// ZRX
|
||||
const zrxToken = await deployAtAddressAsync(
|
||||
() =>
|
||||
DummyERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
erc20Artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
'0x Protocol Token',
|
||||
'ZRX',
|
||||
new BigNumber(18),
|
||||
new BigNumber(1000000000000000000000000000),
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.zrxToken,
|
||||
);
|
||||
|
||||
// Ether token
|
||||
const etherToken = await deployAtAddressAsync(
|
||||
() => WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults, allArtifacts),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.etherToken,
|
||||
);
|
||||
|
||||
// Dummy ERC20 tokens
|
||||
for (const token of erc20TokenInfo) {
|
||||
const totalSupply = new BigNumber(1000000000000000000000000000);
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
const dummyErc20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
erc20Artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
token.name,
|
||||
token.symbol,
|
||||
token.decimals,
|
||||
totalSupply,
|
||||
);
|
||||
}
|
||||
|
||||
const zrxProxy = erc20Proxy.address;
|
||||
const zrxVault = await deployAtAddressAsync(
|
||||
() =>
|
||||
ZrxVaultContract.deployFrom0xArtifactAsync(
|
||||
stakingArtifacts.ZrxVault,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
zrxProxy,
|
||||
zrxToken.address,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.zrxVault,
|
||||
);
|
||||
|
||||
// Note we use TestStakingContract as the deployed bytecode of a StakingContract
|
||||
// has the tokens hardcoded
|
||||
const stakingLogic = await deployAtAddressAsync(
|
||||
() =>
|
||||
TestStakingContract.deployFrom0xArtifactAsync(
|
||||
stakingArtifacts.TestStaking,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
etherToken.address,
|
||||
zrxVault.address,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.staking,
|
||||
);
|
||||
|
||||
const stakingProxy = await deployAtAddressAsync(
|
||||
() =>
|
||||
StakingProxyContract.deployFrom0xArtifactAsync(
|
||||
stakingArtifacts.StakingProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
stakingLogic.address,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.stakingProxy,
|
||||
);
|
||||
|
||||
await erc20Proxy.addAuthorizedAddress(zrxVault.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
// Reference the Proxy as the StakingContract for setup
|
||||
await new TestStakingContract(stakingProxy.address, provider, txDefaults);
|
||||
await stakingProxy.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
await zrxVault.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults);
|
||||
await zrxVault.setStakingProxy(stakingProxy.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await stakingLogic.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
// Exchange Proxy //////////////////////////////////////////////////////////
|
||||
|
||||
const bridgeAdapter = await EthereumBridgeAdapterContract.deployFrom0xArtifactAsync(
|
||||
exchangeProxyArtifacts.EthereumBridgeAdapter,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
etherToken.address,
|
||||
);
|
||||
|
||||
// HACK: Full migration first deploys a Migrator
|
||||
await untilWantedAddressAsync(expectedAddresses.exchangeProxy, provider, txDefaults, -1);
|
||||
|
||||
const exchangeProxy = await fullMigrateExchangeProxyAsync(txDefaults.from, provider, txDefaults);
|
||||
const exchangeProxyFlashWalletAddress = await exchangeProxy.getTransformWallet().callAsync();
|
||||
|
||||
// Deploy transformers.
|
||||
const wethTransformer = await deployAtAddressAsync(
|
||||
() =>
|
||||
WethTransformerContract.deployFrom0xArtifactAsync(
|
||||
exchangeProxyArtifacts.WethTransformer,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
etherToken.address,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.transformers.wethTransformer,
|
||||
);
|
||||
const payTakerTransformer = await deployAtAddressAsync(
|
||||
() =>
|
||||
PayTakerTransformerContract.deployFrom0xArtifactAsync(
|
||||
exchangeProxyArtifacts.PayTakerTransformer,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.transformers.payTakerTransformer,
|
||||
);
|
||||
const affiliateFeeTransformer = await deployAtAddressAsync(
|
||||
() =>
|
||||
AffiliateFeeTransformerContract.deployFrom0xArtifactAsync(
|
||||
exchangeProxyArtifacts.AffiliateFeeTransformer,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.transformers.affiliateFeeTransformer,
|
||||
);
|
||||
const fillQuoteTransformer = await deployAtAddressAsync(
|
||||
() =>
|
||||
FillQuoteTransformerContract.deployFrom0xArtifactAsync(
|
||||
exchangeProxyArtifacts.FillQuoteTransformer,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
bridgeAdapter.address,
|
||||
exchangeProxy.address,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.transformers.fillQuoteTransformer,
|
||||
);
|
||||
const positiveSlippageFeeTransformer = await deployAtAddressAsync(
|
||||
() =>
|
||||
PositiveSlippageFeeTransformerContract.deployFrom0xArtifactAsync(
|
||||
exchangeProxyArtifacts.PositiveSlippageFeeTransformer,
|
||||
provider,
|
||||
txDefaults,
|
||||
allArtifacts,
|
||||
),
|
||||
provider,
|
||||
txDefaults,
|
||||
expectedAddresses.transformers.positiveSlippageFeeTransformer,
|
||||
);
|
||||
const contractAddresses = {
|
||||
erc20Proxy: erc20Proxy.address,
|
||||
erc721Proxy: NULL_ADDRESS,
|
||||
erc1155Proxy: NULL_ADDRESS,
|
||||
zrxToken: zrxToken.address,
|
||||
etherToken: etherToken.address,
|
||||
exchange: NULL_ADDRESS,
|
||||
assetProxyOwner: NULL_ADDRESS,
|
||||
erc20BridgeProxy: NULL_ADDRESS,
|
||||
zeroExGovernor: NULL_ADDRESS,
|
||||
forwarder: NULL_ADDRESS,
|
||||
coordinatorRegistry: NULL_ADDRESS,
|
||||
coordinator: NULL_ADDRESS,
|
||||
multiAssetProxy: NULL_ADDRESS,
|
||||
staticCallProxy: NULL_ADDRESS,
|
||||
devUtils: NULL_ADDRESS,
|
||||
exchangeV2: NULL_ADDRESS,
|
||||
zrxVault: zrxVault.address,
|
||||
staking: stakingLogic.address,
|
||||
stakingProxy: stakingProxy.address,
|
||||
erc20BridgeSampler: NULL_ADDRESS,
|
||||
chaiBridge: NULL_ADDRESS,
|
||||
dydxBridge: NULL_ADDRESS,
|
||||
godsUnchainedValidator: NULL_ADDRESS,
|
||||
broker: NULL_ADDRESS,
|
||||
chainlinkStopLimit: NULL_ADDRESS,
|
||||
maximumGasPrice: NULL_ADDRESS,
|
||||
dexForwarderBridge: NULL_ADDRESS,
|
||||
exchangeProxyGovernor: NULL_ADDRESS,
|
||||
exchangeProxy: exchangeProxy.address,
|
||||
exchangeProxyTransformerDeployer: txDefaults.from,
|
||||
exchangeProxyFlashWallet: exchangeProxyFlashWalletAddress,
|
||||
exchangeProxyLiquidityProviderSandbox: NULL_ADDRESS,
|
||||
zrxTreasury: NULL_ADDRESS,
|
||||
transformers: {
|
||||
wethTransformer: wethTransformer.address,
|
||||
payTakerTransformer: payTakerTransformer.address,
|
||||
fillQuoteTransformer: fillQuoteTransformer.address,
|
||||
affiliateFeeTransformer: affiliateFeeTransformer.address,
|
||||
positiveSlippageFeeTransformer: positiveSlippageFeeTransformer.address,
|
||||
},
|
||||
};
|
||||
return contractAddresses;
|
||||
}
|
||||
|
||||
let _cachedContractAddresses: ContractAddresses;
|
||||
|
||||
/**
|
||||
* Exactly like runMigrationsAsync but will only run the migrations the first
|
||||
* time it is called. Any subsequent calls will return the cached contract
|
||||
* addresses.
|
||||
* @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
|
||||
* @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: Web3ProviderEngine,
|
||||
txDefaults: TxData,
|
||||
): Promise<ContractAddresses> {
|
||||
if (_cachedContractAddresses !== undefined) {
|
||||
return _cachedContractAddresses;
|
||||
}
|
||||
_cachedContractAddresses = await runMigrationsAsync(provider, txDefaults);
|
||||
return _cachedContractAddresses;
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import { ERC20ProxyContract } from '@0x/contracts-asset-proxy';
|
||||
import { ZeroExGovernorContract } from '@0x/contracts-multisig';
|
||||
import { StakingContract, StakingProxyContract, ZrxVaultContract } from '@0x/contracts-staking';
|
||||
import { EmptyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { logUtils, providerUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { SupportedProvider } from 'ethereum-types';
|
||||
|
||||
import { getConfigsByChainId } from './utils/configs_by_chain';
|
||||
import { getTimelockRegistrationsByChainId } from './utils/timelocks';
|
||||
|
||||
// NOTE: add your own Infura Project ID to RPC urls before running
|
||||
const INFURA_PROJECT_ID = '';
|
||||
|
||||
const networkIdToRpcUrl = {
|
||||
1: `https://mainnet.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||
3: `https://ropsten.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||
4: `https://rinkeby.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||
42: `https://kovan.infura.io/v3/${INFURA_PROJECT_ID}`,
|
||||
};
|
||||
|
||||
// tslint:disable:custom-no-magic-numbers
|
||||
async function testContractConfigsAsync(provider: SupportedProvider): Promise<void> {
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const chainId = await web3Wrapper.getChainIdAsync();
|
||||
const addresses = getContractAddressesForChainOrThrow(chainId);
|
||||
const configs = getConfigsByChainId(chainId);
|
||||
|
||||
function warnIfMismatch(actual: any, expected: any, message: string): void {
|
||||
if (actual !== expected) {
|
||||
logUtils.warn(`${message}: actual: ${actual}, expected: ${expected}, chainId: ${chainId}`);
|
||||
}
|
||||
}
|
||||
|
||||
const erc20Proxy = new ERC20ProxyContract(addresses.erc20Proxy, provider);
|
||||
const erc20BridgeProxy = new ERC20ProxyContract(addresses.erc20BridgeProxy, provider);
|
||||
const governor = new ZeroExGovernorContract(addresses.zeroExGovernor, provider);
|
||||
const stakingProxy = new StakingProxyContract(addresses.stakingProxy, provider);
|
||||
const stakingContract = new StakingContract(addresses.stakingProxy, provider);
|
||||
const zrxVault = new ZrxVaultContract(addresses.zrxVault, provider);
|
||||
|
||||
async function verifyAssetProxyConfigsAsync(): Promise<void> {
|
||||
// Verify ERC20Proxy configs
|
||||
const erc20ProxyOwner = await erc20Proxy.owner().callAsync();
|
||||
warnIfMismatch(erc20ProxyOwner, governor.address, 'Unexpected ERC20Proxy owner');
|
||||
|
||||
const erc20AuthorizedAddresses = await erc20Proxy.getAuthorizedAddresses().callAsync();
|
||||
warnIfMismatch(erc20AuthorizedAddresses.length, 4, 'Unexpected number of authorized addresses in ERC20Proxy');
|
||||
|
||||
const isZrxVaultAuthorizedInER20Proxy = await erc20Proxy.authorized(zrxVault.address).callAsync();
|
||||
warnIfMismatch(isZrxVaultAuthorizedInER20Proxy, true, 'ZrxVault not authorized in ERC20Proxy');
|
||||
|
||||
// Verify ERC20BridgeProxy configs
|
||||
const erc20BridgeProxyOwner = await erc20BridgeProxy.owner().callAsync();
|
||||
warnIfMismatch(erc20BridgeProxyOwner, governor.address, 'Unexpected ERC20BridgeProxy owner');
|
||||
|
||||
const erc20BridgeAuthorizedAddresses = await erc20BridgeProxy.getAuthorizedAddresses().callAsync();
|
||||
warnIfMismatch(
|
||||
erc20BridgeAuthorizedAddresses.length,
|
||||
2,
|
||||
'Unexpected number of authorized addresses in ERC20BridgeProxy',
|
||||
);
|
||||
}
|
||||
|
||||
async function verifyStakingConfigsAsync(): Promise<void> {
|
||||
const stakingLogicAddress = await stakingProxy.stakingContract().callAsync();
|
||||
warnIfMismatch(stakingLogicAddress, addresses.staking, 'Unexpected Staking contract attached to StakingProxy');
|
||||
|
||||
const isExchangeRegistered = await stakingContract.validExchanges(addresses.exchange).callAsync();
|
||||
warnIfMismatch(isExchangeRegistered, true, 'Exchange not registered in StakingProxy');
|
||||
|
||||
const zrxVaultAddress = await stakingContract.getZrxVault().callAsync();
|
||||
warnIfMismatch(zrxVaultAddress, addresses.zrxVault, 'Unexpected ZrxVault set in StakingProxy');
|
||||
|
||||
const wethAddress = await stakingContract.getWethContract().callAsync();
|
||||
warnIfMismatch(wethAddress, addresses.etherToken, 'Unexpected WETH contract set in StakingProxy');
|
||||
|
||||
const stakingProxyOwner = await stakingProxy.owner().callAsync();
|
||||
warnIfMismatch(stakingProxyOwner, addresses.zeroExGovernor, 'Unexpected StakingProxy owner');
|
||||
|
||||
const stakingProxyAuthorizedAddresses = await stakingProxy.getAuthorizedAddresses().callAsync();
|
||||
warnIfMismatch(
|
||||
stakingProxyAuthorizedAddresses.length,
|
||||
1,
|
||||
'Unexpected number of authorized addresses in StakingProxy',
|
||||
);
|
||||
const isGovernorAuthorizedInStakingProxy = await stakingProxy.authorized(addresses.zeroExGovernor).callAsync();
|
||||
warnIfMismatch(isGovernorAuthorizedInStakingProxy, true, 'ZeroExGovernor not authorized in StakingProxy');
|
||||
|
||||
const zrxVaultOwner = await zrxVault.owner().callAsync();
|
||||
warnIfMismatch(zrxVaultOwner, addresses.zeroExGovernor, 'Unexpected ZrxVault owner');
|
||||
|
||||
const zrxVaultAuthorizedAddresses = await zrxVault.getAuthorizedAddresses().callAsync();
|
||||
warnIfMismatch(zrxVaultAuthorizedAddresses.length, 1, 'Unexpected number of authorized addresses in ZrxVault');
|
||||
|
||||
const isGovernorAuthorizedInZrxVault = await zrxVault.authorized(addresses.zeroExGovernor).callAsync();
|
||||
warnIfMismatch(isGovernorAuthorizedInZrxVault, true, 'ZeroExGovernor not authorized in ZrxVault');
|
||||
|
||||
const zrxAssetProxy = await zrxVault.zrxAssetProxy().callAsync();
|
||||
warnIfMismatch(zrxAssetProxy, addresses.erc20Proxy, 'Unexpected ERC20Proxy set in ZrxVault');
|
||||
|
||||
const zrxVaultStakingProxy = await zrxVault.stakingProxyAddress().callAsync();
|
||||
warnIfMismatch(zrxVaultStakingProxy, addresses.stakingProxy, 'Unexpected StakingProxy set in ZrxVault');
|
||||
|
||||
const params = await stakingContract.getParams().callAsync();
|
||||
warnIfMismatch(
|
||||
params[0].toNumber(),
|
||||
configs.staking.epochDurationInSeconds.toNumber(),
|
||||
'Unexpected epoch duration in StakingProxy',
|
||||
);
|
||||
warnIfMismatch(
|
||||
params[1].toString(),
|
||||
configs.staking.rewardDelegatedStakeWeight.toString(),
|
||||
'Unexpected delegated stake weight in StakingProxy',
|
||||
);
|
||||
warnIfMismatch(
|
||||
params[2].toNumber(),
|
||||
configs.staking.minimumPoolStake.toNumber(),
|
||||
'Unexpected minimum pool stake in StakingProxy',
|
||||
);
|
||||
warnIfMismatch(
|
||||
params[3].toString(),
|
||||
configs.staking.cobbDouglasAlphaNumerator.toString(),
|
||||
'Unexpected alpha numerator in StakingProxy',
|
||||
);
|
||||
warnIfMismatch(
|
||||
params[4].toString(),
|
||||
configs.staking.cobbDouglasAlphaDenominator.toString(),
|
||||
'Unexpected alpha denominator in StakingProxy',
|
||||
);
|
||||
}
|
||||
|
||||
async function verifyZeroExGovernorConfigsAsync(): Promise<void> {
|
||||
const timelockRegistrations = getTimelockRegistrationsByChainId(chainId);
|
||||
for (const timelockRegistration of timelockRegistrations) {
|
||||
const actualRegistration = await governor
|
||||
.functionCallTimeLocks(timelockRegistration.functionSelector, timelockRegistration.destination)
|
||||
.callAsync();
|
||||
warnIfMismatch(
|
||||
actualRegistration[0],
|
||||
true,
|
||||
`Function ${timelockRegistration.functionSelector} at address ${timelockRegistration.destination} not registered in ZeroExGovernor`,
|
||||
);
|
||||
warnIfMismatch(
|
||||
actualRegistration[1].toNumber(),
|
||||
timelockRegistration.secondsTimeLocked.toNumber(),
|
||||
`Timelock for function ${timelockRegistration.functionSelector} at address ${timelockRegistration.destination} in ZeroExGovernor`,
|
||||
);
|
||||
}
|
||||
|
||||
const owners = await governor.getOwners().callAsync();
|
||||
warnIfMismatch(
|
||||
owners.length,
|
||||
configs.zeroExGovernor.owners.length,
|
||||
'Unexpected number of owners in ZeroExGovernor',
|
||||
);
|
||||
owners.forEach((owner, i) => {
|
||||
warnIfMismatch(
|
||||
owners[i],
|
||||
configs.zeroExGovernor.owners[i],
|
||||
`Unexpected owner in ZeroExGovernor at index ${i}`,
|
||||
);
|
||||
});
|
||||
|
||||
const secondsTimeLocked = await governor.secondsTimeLocked().callAsync();
|
||||
warnIfMismatch(
|
||||
secondsTimeLocked.toNumber(),
|
||||
configs.zeroExGovernor.secondsTimeLocked.toNumber(),
|
||||
'Unexpected secondsTimeLocked in ZeroExGovernor',
|
||||
);
|
||||
|
||||
const confirmationsRequired = await governor.required().callAsync();
|
||||
warnIfMismatch(
|
||||
confirmationsRequired.toNumber(),
|
||||
configs.zeroExGovernor.required.toNumber(),
|
||||
'Unexpected number of confirmations required in ZeroExGovernor',
|
||||
);
|
||||
}
|
||||
|
||||
await verifyStakingConfigsAsync();
|
||||
await verifyAssetProxyConfigsAsync();
|
||||
await verifyZeroExGovernorConfigsAsync();
|
||||
}
|
||||
|
||||
(async () => {
|
||||
for (const rpcUrl of Object.values(networkIdToRpcUrl)) {
|
||||
const provider = new Web3ProviderEngine();
|
||||
provider.addProvider(new EmptyWalletSubprovider());
|
||||
provider.addProvider(new RPCSubprovider(rpcUrl));
|
||||
providerUtils.startProviderEngine(provider);
|
||||
await testContractConfigsAsync(provider);
|
||||
}
|
||||
})().catch(err => {
|
||||
logUtils.log(err);
|
||||
process.exit(1);
|
||||
});
|
@ -1,154 +0,0 @@
|
||||
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import {
|
||||
artifacts as multisigArtifacts,
|
||||
ZeroExGovernorContract,
|
||||
ZeroExGovernorSubmissionEventArgs,
|
||||
} from '@0x/contracts-multisig';
|
||||
import {
|
||||
artifacts as stakingArtifacts,
|
||||
StakingContract,
|
||||
StakingProxyContract,
|
||||
ZrxVaultContract,
|
||||
} from '@0x/contracts-staking';
|
||||
import { IAuthorizableContract, IOwnableContract } from '@0x/contracts-utils';
|
||||
import { AbiEncoder, BigNumber, logUtils, providerUtils } from '@0x/utils';
|
||||
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 { getTimelockRegistrationsByChainId } from './utils/timelocks';
|
||||
|
||||
async function submitAndExecuteTransactionAsync(
|
||||
governor: ZeroExGovernorContract,
|
||||
destination: string,
|
||||
data: string,
|
||||
): Promise<void> {
|
||||
const { logs } = await governor
|
||||
.submitTransaction(destination, constants.ZERO_AMOUNT, data)
|
||||
.awaitTransactionSuccessAsync();
|
||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||
const txId = (logs[0] as LogWithDecodedArgs<ZeroExGovernorSubmissionEventArgs>).args.transactionId;
|
||||
logUtils.log(`${txId} submitted`);
|
||||
await governor.executeTransaction(txId).awaitTransactionSuccessAsync();
|
||||
logUtils.log(`${txId} executed`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploys all 3.0 contracts and reconfigures existing 2.0 contracts.
|
||||
* @param supportedProvider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
|
||||
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
|
||||
*/
|
||||
export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise<void> {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider));
|
||||
const deployedAddresses = getContractAddressesForChainOrThrow(chainId.toNumber());
|
||||
const configs = getConfigsByChainId(chainId.toNumber());
|
||||
|
||||
// NOTE: This must be deployed before running these migrations, since its address is hard coded in the
|
||||
// staking logic contract.
|
||||
const zrxVault = new ZrxVaultContract(deployedAddresses.zrxVault, provider, txDefaults);
|
||||
|
||||
const stakingLogic = await StakingContract.deployFrom0xArtifactAsync(
|
||||
stakingArtifacts.Staking,
|
||||
provider,
|
||||
txDefaults,
|
||||
stakingArtifacts,
|
||||
);
|
||||
|
||||
const stakingProxy = await StakingProxyContract.deployFrom0xArtifactAsync(
|
||||
stakingArtifacts.StakingProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
stakingArtifacts,
|
||||
stakingLogic.address,
|
||||
);
|
||||
|
||||
const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider, txDefaults);
|
||||
const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider, txDefaults);
|
||||
|
||||
const customTimeLocks = getTimelockRegistrationsByChainId(chainId.toNumber());
|
||||
|
||||
const governor = await ZeroExGovernorContract.deployFrom0xArtifactAsync(
|
||||
multisigArtifacts.ZeroExGovernor,
|
||||
provider,
|
||||
txDefaults,
|
||||
multisigArtifacts,
|
||||
customTimeLocks.map(timeLockInfo => timeLockInfo.functionSelector),
|
||||
customTimeLocks.map(timeLockInfo => timeLockInfo.destination),
|
||||
customTimeLocks.map(timeLockInfo => timeLockInfo.secondsTimeLocked),
|
||||
configs.zeroExGovernor.owners,
|
||||
configs.zeroExGovernor.required,
|
||||
configs.zeroExGovernor.secondsTimeLocked,
|
||||
);
|
||||
|
||||
logUtils.log('Configuring ZrxVault...');
|
||||
await zrxVault.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync();
|
||||
await zrxVault.setStakingProxy(stakingProxy.address).awaitTransactionSuccessAsync();
|
||||
await zrxVault.removeAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync();
|
||||
await zrxVault.addAuthorizedAddress(governor.address).awaitTransactionSuccessAsync();
|
||||
await zrxVault.transferOwnership(governor.address).awaitTransactionSuccessAsync();
|
||||
logUtils.log('ZrxVault configured!');
|
||||
|
||||
logUtils.log('Configuring StakingProxy...');
|
||||
await stakingProxy.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync();
|
||||
await stakingProxy.removeAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync();
|
||||
await stakingProxy.addAuthorizedAddress(governor.address).awaitTransactionSuccessAsync();
|
||||
await stakingProxy.transferOwnership(governor.address).awaitTransactionSuccessAsync();
|
||||
logUtils.log('StakingProxy configured!');
|
||||
|
||||
logUtils.log('Transfering ownership of 2.0 contracts...');
|
||||
const oldAssetProxyOwner = new ZeroExGovernorContract(deployedAddresses.assetProxyOwner, provider, txDefaults);
|
||||
await submitAndExecuteTransactionAsync(
|
||||
oldAssetProxyOwner,
|
||||
deployedAddresses.exchangeV2, // Exchange 2.1 address
|
||||
ownableInterface.transferOwnership(governor.address).getABIEncodedTransactionData(),
|
||||
);
|
||||
await submitAndExecuteTransactionAsync(
|
||||
oldAssetProxyOwner,
|
||||
deployedAddresses.erc20Proxy,
|
||||
ownableInterface.transferOwnership(governor.address).getABIEncodedTransactionData(),
|
||||
);
|
||||
await submitAndExecuteTransactionAsync(
|
||||
oldAssetProxyOwner,
|
||||
deployedAddresses.erc721Proxy,
|
||||
ownableInterface.transferOwnership(governor.address).getABIEncodedTransactionData(),
|
||||
);
|
||||
await submitAndExecuteTransactionAsync(
|
||||
oldAssetProxyOwner,
|
||||
deployedAddresses.erc1155Proxy,
|
||||
ownableInterface.transferOwnership(governor.address).getABIEncodedTransactionData(),
|
||||
);
|
||||
await submitAndExecuteTransactionAsync(
|
||||
oldAssetProxyOwner,
|
||||
deployedAddresses.multiAssetProxy,
|
||||
ownableInterface.transferOwnership(governor.address).getABIEncodedTransactionData(),
|
||||
);
|
||||
logUtils.log('Ownership transferred!');
|
||||
|
||||
const functionCalls = [
|
||||
// AssetProxy configs
|
||||
{
|
||||
destination: deployedAddresses.erc20Proxy,
|
||||
data: authorizableInterface.addAuthorizedAddress(zrxVault.address).getABIEncodedTransactionData(),
|
||||
},
|
||||
];
|
||||
|
||||
const batchTransactionEncoder = AbiEncoder.create('(bytes[],address[],uint256[])');
|
||||
const batchTransactionData = batchTransactionEncoder.encode([
|
||||
functionCalls.map(item => item.data),
|
||||
functionCalls.map(item => item.destination),
|
||||
functionCalls.map(() => constants.ZERO_AMOUNT),
|
||||
]);
|
||||
await submitAndExecuteTransactionAsync(governor, governor.address, batchTransactionData);
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const networkId = 1;
|
||||
const rpcUrl = 'https://mainnet.infura.io/v3/';
|
||||
const provider = await providerFactory.getLedgerProviderAsync(networkId, rpcUrl);
|
||||
await runMigrationsAsync(provider, { from: '0x3b39078f2a3e1512eecc8d6792fdc7f33e1cd2cf', gasPrice: 10000000001 });
|
||||
})().catch(err => {
|
||||
logUtils.log(err);
|
||||
process.exit(1);
|
||||
});
|
@ -1,29 +0,0 @@
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
export interface ERC20Token {
|
||||
address?: string;
|
||||
name: string;
|
||||
symbol: string;
|
||||
decimals: BigNumber;
|
||||
ipfsHash: string;
|
||||
swarmHash: string;
|
||||
}
|
||||
|
||||
export interface ERC721Token {
|
||||
name: string;
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
export enum ContractName {
|
||||
TokenTransferProxy = 'TokenTransferProxy',
|
||||
TokenRegistry = 'TokenRegistry',
|
||||
MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
|
||||
Exchange = 'Exchange',
|
||||
ZRXToken = 'ZRXToken',
|
||||
DummyToken = 'DummyToken',
|
||||
WETH9 = 'WETH9',
|
||||
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
|
||||
AccountLevels = 'AccountLevels',
|
||||
EtherDelta = 'EtherDelta',
|
||||
Arbitrage = 'Arbitrage',
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { constants } from './constants';
|
||||
|
||||
export interface ConfigsByChain {
|
||||
zeroExGovernor: { owners: string[]; secondsTimeLocked: BigNumber; required: BigNumber };
|
||||
staking: {
|
||||
epochDurationInSeconds: BigNumber;
|
||||
rewardDelegatedStakeWeight: number;
|
||||
minimumPoolStake: BigNumber;
|
||||
cobbDouglasAlphaNumerator: number;
|
||||
cobbDouglasAlphaDenominator: number;
|
||||
};
|
||||
}
|
||||
|
||||
// tslint:disable custom-no-magic-numbers
|
||||
/**
|
||||
* Gets configs that correspond to the given chainId.
|
||||
* @param chainId Id of the netowrk.
|
||||
*/
|
||||
export function getConfigsByChainId(chainId: number): ConfigsByChain {
|
||||
const mainnetConfigs = {
|
||||
zeroExGovernor: {
|
||||
owners: [
|
||||
'0x257619b7155d247e43c8b6d90c8c17278ae481f0',
|
||||
'0x5ee2a00f8f01d099451844af7f894f26a57fcbf2',
|
||||
'0x894d623e0e0e8ed12c4a73dada999e275684a37d',
|
||||
],
|
||||
secondsTimeLocked: constants.TWO_WEEKS_IN_SEC,
|
||||
required: new BigNumber(2),
|
||||
},
|
||||
staking: {
|
||||
epochDurationInSeconds: constants.TEN_DAYS_IN_SEC,
|
||||
rewardDelegatedStakeWeight: 10 ** 6 * 0.9,
|
||||
minimumPoolStake: new BigNumber(10).pow(18).times(100),
|
||||
cobbDouglasAlphaNumerator: 2,
|
||||
cobbDouglasAlphaDenominator: 3,
|
||||
},
|
||||
};
|
||||
const testnetConfigs = {
|
||||
zeroExGovernor: {
|
||||
owners: [
|
||||
'0x9df8137872ac09a8fee71d0da5c7539923fb9bf0',
|
||||
'0xcf34d44db312d188789f43a63d11cf2bebb4da15',
|
||||
'0x73fd50f2a6beac9cdac9fe87ef68a18edc415831',
|
||||
],
|
||||
secondsTimeLocked: constants.ZERO_AMOUNT,
|
||||
required: new BigNumber(1),
|
||||
},
|
||||
staking: {
|
||||
epochDurationInSeconds: constants.TEN_DAYS_IN_SEC.dividedToIntegerBy(2),
|
||||
rewardDelegatedStakeWeight: 10 ** 6 * 0.9,
|
||||
minimumPoolStake: new BigNumber(10).pow(18).times(100),
|
||||
cobbDouglasAlphaNumerator: 2,
|
||||
cobbDouglasAlphaDenominator: 3,
|
||||
},
|
||||
};
|
||||
return chainId === constants.MAINNET_CHAIN_ID ? mainnetConfigs : testnetConfigs;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
// tslint:disable custom-no-magic-numbers
|
||||
export const constants = {
|
||||
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||
MAINNET_CHAIN_ID: 1,
|
||||
ZERO_AMOUNT: new BigNumber(0),
|
||||
TWO_WEEKS_IN_SEC: new BigNumber(14)
|
||||
.times(24)
|
||||
.times(60)
|
||||
.times(60),
|
||||
TEN_DAYS_IN_SEC: new BigNumber(10)
|
||||
.times(24)
|
||||
.times(60)
|
||||
.times(60),
|
||||
TWENTY_DAYS_IN_SEC: new BigNumber(20)
|
||||
.times(24)
|
||||
.times(60)
|
||||
.times(60),
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
import { LedgerEthereumClient, LedgerSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { providerUtils } from '@0x/utils';
|
||||
import Eth from '@ledgerhq/hw-app-eth';
|
||||
// tslint:disable:no-implicit-dependencies
|
||||
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid';
|
||||
import { Provider } from 'ethereum-types';
|
||||
|
||||
async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumClient> {
|
||||
const ledgerConnection = await TransportNodeHid.create();
|
||||
const ledgerEthClient = new Eth(ledgerConnection);
|
||||
return ledgerEthClient;
|
||||
}
|
||||
export const providerFactory = {
|
||||
async getLedgerProviderAsync(networkId: number, rpcUrl: string): Promise<Provider> {
|
||||
const provider = new Web3ProviderEngine();
|
||||
const ledgerWalletConfigs = {
|
||||
networkId,
|
||||
ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync,
|
||||
};
|
||||
const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs);
|
||||
provider.addProvider(ledgerSubprovider);
|
||||
provider.addProvider(new RPCSubprovider(rpcUrl));
|
||||
providerUtils.startProviderEngine(provider);
|
||||
return provider;
|
||||
},
|
||||
};
|
@ -1,145 +0,0 @@
|
||||
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
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 { constants } from './constants';
|
||||
|
||||
export interface TimelockRegistration {
|
||||
functionSelector: string;
|
||||
destination: string;
|
||||
secondsTimeLocked: BigNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the custom timelock configs that correspond the the network of the given provider.
|
||||
* @param provider Web3 provider instance.
|
||||
*/
|
||||
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);
|
||||
const stakingProxy = new StakingProxyContract(constants.NULL_ADDRESS, provider);
|
||||
const stakingLogic = new StakingContract(constants.NULL_ADDRESS, provider);
|
||||
|
||||
const noTimelockRegistrations = [
|
||||
// AssetProxy timelocks
|
||||
{
|
||||
destination: deployedAddresses.erc20Proxy,
|
||||
functionSelector: authorizableInterface.getSelector('removeAuthorizedAddress'),
|
||||
secondsTimeLocked: constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.erc20Proxy,
|
||||
functionSelector: authorizableInterface.getSelector('removeAuthorizedAddressAtIndex'),
|
||||
secondsTimeLocked: constants.ZERO_AMOUNT,
|
||||
},
|
||||
// ZrxVault timelocks
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: zrxVault.getSelector('enterCatastrophicFailure'),
|
||||
secondsTimeLocked: constants.ZERO_AMOUNT,
|
||||
},
|
||||
];
|
||||
|
||||
const customTimelockRegistrations = [
|
||||
// ZrxVault timelocks
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: zrxVault.getSelector('setStakingProxy'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: zrxVault.getSelector('setZrxProxy'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: ownableInterface.getSelector('transferOwnership'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: authorizableInterface.getSelector('addAuthorizedAddress'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: authorizableInterface.getSelector('removeAuthorizedAddress'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.zrxVault,
|
||||
functionSelector: authorizableInterface.getSelector('removeAuthorizedAddressAtIndex'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
// StakingProxy timelocks
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: stakingProxy.getSelector('attachStakingContract'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: stakingProxy.getSelector('detachStakingContract'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: stakingLogic.getSelector('setParams'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TEN_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: stakingLogic.getSelector('addExchangeAddress'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: stakingLogic.getSelector('removeExchangeAddress'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: ownableInterface.getSelector('transferOwnership'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: authorizableInterface.getSelector('addAuthorizedAddress'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: authorizableInterface.getSelector('removeAuthorizedAddress'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
{
|
||||
destination: deployedAddresses.stakingProxy,
|
||||
functionSelector: authorizableInterface.getSelector('removeAuthorizedAddressAtIndex'),
|
||||
secondsTimeLocked:
|
||||
chainId === constants.MAINNET_CHAIN_ID ? constants.TWENTY_DAYS_IN_SEC : constants.ZERO_AMOUNT,
|
||||
},
|
||||
];
|
||||
|
||||
return [...noTimelockRegistrations, ...customTimelockRegistrations];
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
import { BigNumber, NULL_BYTES } from '@0x/utils';
|
||||
|
||||
import { ERC20Token, ERC721Token } from '../types';
|
||||
|
||||
export const etherTokenByChain: { [chainId: number]: { address: string } } = {
|
||||
3: {
|
||||
address: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
},
|
||||
4: {
|
||||
address: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
},
|
||||
42: {
|
||||
address: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
},
|
||||
1337: {
|
||||
address: '',
|
||||
},
|
||||
};
|
||||
export const erc20TokenInfo: ERC20Token[] = [
|
||||
{
|
||||
name: 'Augur Reputation Token',
|
||||
symbol: 'REP',
|
||||
decimals: new BigNumber(18),
|
||||
ipfsHash: NULL_BYTES,
|
||||
swarmHash: NULL_BYTES,
|
||||
},
|
||||
{
|
||||
name: 'Dai',
|
||||
symbol: 'DAI',
|
||||
decimals: new BigNumber(18),
|
||||
ipfsHash: NULL_BYTES,
|
||||
swarmHash: NULL_BYTES,
|
||||
},
|
||||
{
|
||||
name: 'Golem Network Token',
|
||||
symbol: 'GNT',
|
||||
decimals: new BigNumber(18),
|
||||
ipfsHash: NULL_BYTES,
|
||||
swarmHash: NULL_BYTES,
|
||||
},
|
||||
{
|
||||
name: 'MakerDAO',
|
||||
symbol: 'MKR',
|
||||
decimals: new BigNumber(18),
|
||||
ipfsHash: NULL_BYTES,
|
||||
swarmHash: NULL_BYTES,
|
||||
},
|
||||
{
|
||||
name: 'Melon Token',
|
||||
symbol: 'MLN',
|
||||
decimals: new BigNumber(18),
|
||||
ipfsHash: NULL_BYTES,
|
||||
swarmHash: NULL_BYTES,
|
||||
},
|
||||
];
|
||||
|
||||
export const erc721TokenInfo: ERC721Token[] = [
|
||||
{
|
||||
name: '0xen ERC721',
|
||||
symbol: '0xen',
|
||||
},
|
||||
];
|
@ -1,24 +0,0 @@
|
||||
import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import { devConstants, web3Factory } from '@0x/dev-utils';
|
||||
import * as chai from 'chai';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
import 'mocha';
|
||||
|
||||
import { runMigrationsAsync } from '../src/migration';
|
||||
|
||||
chai.use(dirtyChai);
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
describe('addresses', () => {
|
||||
it('should contain the same addresses as contract-addresses', async () => {
|
||||
const providerConfigs = { shouldUseInProcessGanache: true };
|
||||
const provider = web3Factory.getRpcProvider(providerConfigs);
|
||||
const txDefaults = {
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
};
|
||||
const migrationAddresses = await runMigrationsAsync(provider, txDefaults);
|
||||
const expectedAddresses = getContractAddressesForChainOrThrow(ChainId.Ganache);
|
||||
expect(migrationAddresses).to.deep.eq(expectedAddresses);
|
||||
});
|
||||
});
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["src/**/*", "test/**/*"]
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../typedoc-tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
}
|
44
yarn.lock
44
yarn.lock
@ -749,23 +749,6 @@
|
||||
ethereum-types "^3.5.0"
|
||||
lodash "^4.17.11"
|
||||
|
||||
"@0x/contracts-coordinator@^3.1.38":
|
||||
version "3.1.38"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-coordinator/-/contracts-coordinator-3.1.38.tgz#88988c104bc8e987675c441a305073f1376f257b"
|
||||
dependencies:
|
||||
"@0x/assert" "^3.0.27"
|
||||
"@0x/base-contract" "^6.4.0"
|
||||
"@0x/contract-addresses" "^6.6.0"
|
||||
"@0x/contracts-exchange" "^3.2.38"
|
||||
"@0x/contracts-test-utils" "^5.4.8"
|
||||
"@0x/contracts-utils" "^4.7.16"
|
||||
"@0x/json-schemas" "^6.1.3"
|
||||
"@0x/types" "^3.3.3"
|
||||
"@0x/typescript-typings" "^5.2.0"
|
||||
"@0x/utils" "^6.4.3"
|
||||
ethereum-types "^3.5.0"
|
||||
http-status-codes "^1.3.2"
|
||||
|
||||
"@0x/contracts-dev-utils@^1.3.36":
|
||||
version "1.3.36"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-dev-utils/-/contracts-dev-utils-1.3.36.tgz#f29304a0d7375001165ef6e66695d14b6a153fd7"
|
||||
@ -789,14 +772,6 @@
|
||||
dependencies:
|
||||
"@0x/base-contract" "^6.4.0"
|
||||
|
||||
"@0x/contracts-exchange-forwarder@^4.2.38":
|
||||
version "4.2.38"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-exchange-forwarder/-/contracts-exchange-forwarder-4.2.38.tgz#ba7ae06012ca526043c7c477851cff72405e80b1"
|
||||
dependencies:
|
||||
"@0x/base-contract" "^6.4.0"
|
||||
"@0x/typescript-typings" "^5.2.0"
|
||||
ethereum-types "^3.5.0"
|
||||
|
||||
"@0x/contracts-exchange-libs@^4.3.37":
|
||||
version "4.3.37"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-exchange-libs/-/contracts-exchange-libs-4.3.37.tgz#9413f76c77f8ec5231f21896a0e9f47cebe38680"
|
||||
@ -823,15 +798,6 @@
|
||||
"@0x/utils" "^6.4.3"
|
||||
lodash "^4.17.11"
|
||||
|
||||
"@0x/contracts-extensions@^6.2.32":
|
||||
version "6.2.32"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-extensions/-/contracts-extensions-6.2.32.tgz#2a2e3cad5a5b69f2aa0e6b62513b2b1acfe421f0"
|
||||
dependencies:
|
||||
"@0x/base-contract" "^6.4.0"
|
||||
"@0x/contracts-test-utils" "^5.4.8"
|
||||
"@0x/typescript-typings" "^5.2.0"
|
||||
ethereum-types "^3.5.0"
|
||||
|
||||
"@0x/contracts-gen@^2.0.46":
|
||||
version "2.0.46"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-gen/-/contracts-gen-2.0.46.tgz#3b840b8a56b67abecb2859c1b8e1db36c309dc11"
|
||||
@ -848,14 +814,6 @@
|
||||
prettier "^1.16.3"
|
||||
to-snake-case "^1.0.0"
|
||||
|
||||
"@0x/contracts-multisig@^4.1.38":
|
||||
version "4.1.38"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-multisig/-/contracts-multisig-4.1.38.tgz#e4357b45fe3d4c56bff144fb267d0bb95b8eb46b"
|
||||
dependencies:
|
||||
"@0x/base-contract" "^6.4.0"
|
||||
"@0x/typescript-typings" "^5.2.0"
|
||||
ethereum-types "^3.5.0"
|
||||
|
||||
"@0x/contracts-staking@^2.0.45":
|
||||
version "2.0.45"
|
||||
resolved "https://registry.yarnpkg.com/@0x/contracts-staking/-/contracts-staking-2.0.45.tgz#48a495d7ab1240cb4859e7a2ae6c1c78511bb6ed"
|
||||
@ -7280,7 +7238,7 @@ http-signature@~1.2.0:
|
||||
jsprim "^1.2.2"
|
||||
sshpk "^1.7.0"
|
||||
|
||||
http-status-codes@^1.3.2, http-status-codes@^1.4.0:
|
||||
http-status-codes@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/http-status-codes/-/http-status-codes-1.4.0.tgz#6e4c15d16ff3a9e2df03b89f3a55e1aae05fb477"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user