Deploying 0x on the Matic testnet – Ta Ta
Matic Network is…
… a sidechain based scaling solution for public blockchains. It is based on an adapted implementation of Plasma framework. Matic provides scalability while ensuring a superior user experience in a secured and decentralized manner.
0x is…
… an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets.
This guide will take you through:
- Deploying 0x contracts on Matic testnet
- Starting an exchange on Matic testnet using 0x-launch-kit
You need system-wide installations of
- Python 3
- Node.js 8+
- Yarn 1.9.4+
Clone the 0x-monorepo and install node dependencies
$ git clone https://github.com/0xProject/0x-monorepo.git
$ cd 0x-monorepo/
$ yarn install
Because our Matic testnet provider doesn’t return any address on eth_accounts call, we will need to make this small change to enable migration package deploying the contracts:
- Open
packages/migrations/src/migration.tsfile - Find the line
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync(); - Replace it with
const accounts: string[] = ['0x56F65dCD821c660b4f3E833696747F5D8e3C537B', '0x685A01B16909eC890B548D9DFf6E7ABF4ec0A24e']; - Feel free to change these two addresses with yours, they will be use as owners of
AssetProxyOwnerContract.
Build migrations package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
$ PKG=@0x/migrations yarn build
Deploy the contracts to Matic testnet
$ packages/migrations/bin/0x-migrate.js --rpc-url 'https://testnet2.matic.network' --from $DeployAddress --pk $PrivatekeyForDeployAddress
After few seconds (Matic testnet is really fast!) we should see our deployed contract addresses
transactionHash: ...
ERC20Proxy successfully deployed at ...
transactionHash: ...
ERC721Proxy successfully deployed at ...
transactionHash: ...
ZRXToken successfully deployed at ...
transactionHash: ...
WETH9 successfully deployed at ...
transactionHash: ...
Exchange successfully deployed at ...
transactionHash: ...
...
You can place these addresses to the explorer URL, like this https://explorer.testnet2.matic.network/address/0xf3bcabd8fae29f75be271ebe2499edb4c7c139b7, to make sure the contracts is correctly deployed on Matic.
Open packages/contract-addresses/src/index.ts, append Matic to network id list and put our addresses above to networkToAddresses (view file)
...
export enum NetworkId
...
const networkToAddresses: = ,
};
...
Build contract-addresses package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
$ PKG=@0x/contract-addresses yarn build
Published at Tue, 10 Sep 2019 04:06:59 +0000
Bitcoin Pic Of The Moment
✅ This image from Marco Verch (trendingtopics) is available under Creative Commons 2.0. Please link to the original photo and the license. 📝 License for use outside of the Creative Commons is available by request.
By trendingtopics on 2019-03-27 11:05:23
