Added Staking and ERC20 Bridge to migrations
This commit is contained in:
parent
db8837f4ce
commit
21fab3ef9f
@ -21,7 +21,7 @@
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output src/generated-wrappers --backend ethers"
|
||||
},
|
||||
"config": {
|
||||
"abis": "../contract-artifacts/artifacts/@(DevUtils|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Token|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|Coordinator|CoordinatorRegistry|Staking|StakingProxy).json"
|
||||
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DevUtils|DutchAuction|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker|ERC1155Proxy|StaticCallProxy|Staking|StakingProxy|TestStaking|ZrxVault|ERC20BridgeProxy).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
1667
packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts
generated
Normal file
1667
packages/abi-gen-wrappers/src/generated-wrappers/erc20_bridge_proxy.ts
generated
Normal file
File diff suppressed because one or more lines are too long
@ -1195,7 +1195,7 @@ export class StakingContract extends BaseContract {
|
||||
name: 'getWethContract',
|
||||
outputs: [
|
||||
{
|
||||
name: 'wethContract',
|
||||
name: '',
|
||||
type: 'address',
|
||||
},
|
||||
],
|
||||
@ -1533,6 +1533,34 @@ export class StakingContract extends BaseContract {
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
name: 'testWethAddress',
|
||||
outputs: [
|
||||
{
|
||||
name: '',
|
||||
type: 'address',
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: true,
|
||||
inputs: [],
|
||||
name: 'testZrxVaultAddress',
|
||||
outputs: [
|
||||
{
|
||||
name: '',
|
||||
type: 'address',
|
||||
},
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
constant: false,
|
||||
inputs: [
|
||||
|
6585
packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts
generated
Normal file
6585
packages/abi-gen-wrappers/src/generated-wrappers/test_staking.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
2719
packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts
generated
Normal file
2719
packages/abi-gen-wrappers/src/generated-wrappers/zrx_vault.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -100,6 +100,30 @@ export {
|
||||
CoordinatorRegistryCoordinatorEndpointSetEventArgs,
|
||||
CoordinatorRegistryContract,
|
||||
} from './generated-wrappers/coordinator_registry';
|
||||
export {
|
||||
ZrxVaultAuthorizedAddressAddedEventArgs,
|
||||
ZrxVaultAuthorizedAddressRemovedEventArgs,
|
||||
ZrxVaultContract,
|
||||
ZrxVaultDepositEventArgs,
|
||||
ZrxVaultEventArgs,
|
||||
ZrxVaultEvents,
|
||||
ZrxVaultInCatastrophicFailureModeEventArgs,
|
||||
ZrxVaultOwnershipTransferredEventArgs,
|
||||
ZrxVaultStakingProxySetEventArgs,
|
||||
ZrxVaultWithdrawEventArgs,
|
||||
ZrxVaultZrxProxySetEventArgs,
|
||||
} from './generated-wrappers/zrx_vault';
|
||||
|
||||
export {
|
||||
ERC20BridgeProxyAuthorizedAddressAddedEventArgs,
|
||||
ERC20BridgeProxyAuthorizedAddressRemovedEventArgs,
|
||||
ERC20BridgeProxyContract,
|
||||
ERC20BridgeProxyEventArgs,
|
||||
ERC20BridgeProxyEvents,
|
||||
} from './generated-wrappers/erc20_bridge_proxy';
|
||||
|
||||
// Note: No need to export other events as this is a StakingContract with more open constructor args
|
||||
export { TestStakingContract } from './generated-wrappers/test_staking';
|
||||
|
||||
export * from '@0x/contract-addresses';
|
||||
export {
|
||||
|
@ -101,17 +101,17 @@
|
||||
"exchange": "0x48bacb9266a570d521063ef5dd96e61686dbe788",
|
||||
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
|
||||
"forwarder": "0x0000000000000000000000000000000000000000",
|
||||
"forwarder": "0xaa86dda78e9434aca114b6676fc742a18d15a1cc",
|
||||
"orderValidator": "0x0000000000000000000000000000000000000000",
|
||||
"dutchAuction": "0x0000000000000000000000000000000000000000",
|
||||
"coordinatorRegistry": "0x1941ff73d1154774d87521d2d0aaad5d19c8df60",
|
||||
"coordinator": "0x0000000000000000000000000000000000000000",
|
||||
"coordinator": "0x0d8b0dd11f5d34ed41d556def5f841900d5b1c6b",
|
||||
"multiAssetProxy": "0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db",
|
||||
"staticCallProxy": "0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f",
|
||||
"devUtils": "0x38ef19fdf8e8415f18c307ed71967e19aac28ba1",
|
||||
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||
"staking": "0x0000000000000000000000000000000000000000",
|
||||
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000"
|
||||
"zrxVault": "0x609acc8b356894a937fc58f3411f9528de96ecb1",
|
||||
"staking": "0xca9717a4a6e8009b3518648c9f3e7676255471a1",
|
||||
"stakingProxy": "0x4586649629f699f9a4b61d0e962dc3c9025fe488",
|
||||
"erc20BridgeProxy": "0xf23276778860e420acfc18ebeebf7e829b06965c"
|
||||
}
|
||||
}
|
||||
|
218
packages/contract-artifacts/artifacts/ERC20BridgeProxy.json
generated
Normal file
218
packages/contract-artifacts/artifacts/ERC20BridgeProxy.json
generated
Normal file
File diff suppressed because one or more lines are too long
844
packages/contract-artifacts/artifacts/TestStaking.json
generated
Normal file
844
packages/contract-artifacts/artifacts/TestStaking.json
generated
Normal file
File diff suppressed because one or more lines are too long
296
packages/contract-artifacts/artifacts/ZrxVault.json
generated
Normal file
296
packages/contract-artifacts/artifacts/ZrxVault.json
generated
Normal file
File diff suppressed because one or more lines are too long
@ -1,27 +1,41 @@
|
||||
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
|
||||
import * as Coordinator from '../artifacts/Coordinator.json';
|
||||
import * as CoordinatorRegistry from '../artifacts/CoordinatorRegistry.json';
|
||||
import * as DevUtils from '../artifacts/DevUtils.json';
|
||||
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
|
||||
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
|
||||
import * as DutchAuction from '../artifacts/DutchAuction.json';
|
||||
import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json';
|
||||
import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json';
|
||||
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
|
||||
import * as ERC20Token from '../artifacts/ERC20Token.json';
|
||||
import * as ERC721Proxy from '../artifacts/ERC721Proxy.json';
|
||||
import * as ERC721Token from '../artifacts/ERC721Token.json';
|
||||
import * as Exchange from '../artifacts/Exchange.json';
|
||||
import * as Forwarder from '../artifacts/Forwarder.json';
|
||||
import * as IAssetProxy from '../artifacts/IAssetProxy.json';
|
||||
|
||||
import * as Staking from '../artifacts/Staking.json';
|
||||
import * as WETH9 from '../artifacts/WETH9.json';
|
||||
|
||||
// Order Utils
|
||||
import * as IValidator from '../artifacts/IValidator.json';
|
||||
import * as IWallet from '../artifacts/IWallet.json';
|
||||
import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json';
|
||||
import * as OrderValidator from '../artifacts/OrderValidator.json';
|
||||
import * as Staking from '../artifacts/Staking.json';
|
||||
|
||||
// Tokens (allowances, transfers, events)
|
||||
import * as ERC20Token from '../artifacts/ERC20Token.json';
|
||||
import * as ERC721Token from '../artifacts/ERC721Token.json';
|
||||
|
||||
// Migrations Testnet/Ganache
|
||||
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
|
||||
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
|
||||
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
|
||||
import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json';
|
||||
import * as StakingProxy from '../artifacts/StakingProxy.json';
|
||||
import * as TestStaking from '../artifacts/TestStaking.json';
|
||||
import * as ZrxVault from '../artifacts/ZrxVault.json';
|
||||
|
||||
// Proxies (Migrations)
|
||||
import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json';
|
||||
import * as ERC20BridgeProxy from '../artifacts/ERC20BridgeProxy.json';
|
||||
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
|
||||
import * as ERC721Proxy from '../artifacts/ERC721Proxy.json';
|
||||
import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json';
|
||||
import * as StaticCallProxy from '../artifacts/StaticCallProxy.json';
|
||||
import * as WETH9 from '../artifacts/WETH9.json';
|
||||
|
||||
// Unknown/Unused
|
||||
import * as DutchAuction from '../artifacts/DutchAuction.json';
|
||||
import * as IAssetProxy from '../artifacts/IAssetProxy.json';
|
||||
import * as OrderValidator from '../artifacts/OrderValidator.json';
|
||||
import * as ZRXToken from '../artifacts/ZRXToken.json';
|
||||
|
||||
export {
|
||||
@ -32,6 +46,7 @@ export {
|
||||
DummyERC721Token,
|
||||
ERC1155Mintable,
|
||||
ERC1155Proxy,
|
||||
ERC20BridgeProxy,
|
||||
ERC20Proxy,
|
||||
ERC20Token,
|
||||
ERC721Proxy,
|
||||
@ -50,4 +65,6 @@ export {
|
||||
CoordinatorRegistry,
|
||||
Staking,
|
||||
StakingProxy,
|
||||
TestStaking,
|
||||
ZrxVault,
|
||||
};
|
||||
|
@ -31,6 +31,9 @@
|
||||
"./artifacts/ERC1155Proxy.json",
|
||||
"./artifacts/StaticCallProxy.json",
|
||||
"./artifacts/Staking.json",
|
||||
"./artifacts/StakingProxy.json"
|
||||
"./artifacts/StakingProxy.json",
|
||||
"./artifacts/TestStaking.json",
|
||||
"./artifacts/ZrxVault.json",
|
||||
"./artifacts/ERC20BridgeProxy.json"
|
||||
]
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { CoordinatorContract, OrderValidatorContract } from '@0x/abi-gen-wrappers';
|
||||
import { CoordinatorContract, OrderValidatorContract, ZrxVaultContract } from '@0x/abi-gen-wrappers';
|
||||
import { ContractAddresses } from '@0x/contract-addresses';
|
||||
import * as artifacts from '@0x/contract-artifacts';
|
||||
import {
|
||||
@ -7,6 +7,7 @@ import {
|
||||
ERC721ProxyContract,
|
||||
MultiAssetProxyContract,
|
||||
StaticCallProxyContract,
|
||||
ERC20BridgeProxyContract,
|
||||
} from '@0x/contracts-asset-proxy';
|
||||
import { CoordinatorRegistryContract } from '@0x/contracts-coordinator';
|
||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||
@ -19,10 +20,10 @@ import { Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from './utils/constants';
|
||||
import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
|
||||
import { TestStakingContract, StakingProxyContract } from '@0x/contracts-staking';
|
||||
|
||||
// HACK (xianny): Copied from @0x/order-utils to get rid of circular dependency
|
||||
/**
|
||||
@ -83,11 +84,15 @@ export async function runMigrationsAsync(
|
||||
);
|
||||
|
||||
// ZRX
|
||||
const zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.ZRXToken,
|
||||
const zrxToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
'0x Protocol Token',
|
||||
'ZRX',
|
||||
new BigNumber(18),
|
||||
new BigNumber(1000000000000000000000000000),
|
||||
);
|
||||
|
||||
// Ether token
|
||||
@ -184,28 +189,6 @@ export async function runMigrationsAsync(
|
||||
encodeERC20AssetData(etherToken.address),
|
||||
);
|
||||
|
||||
// TODO(fabio): Remove orderValidator after @0x/asset-buyer is deleted
|
||||
// OrderValidator
|
||||
const orderValidator = await OrderValidatorContract.deployFrom0xArtifactAsync(
|
||||
artifacts.OrderValidator,
|
||||
provider,
|
||||
txDefaults,
|
||||
artifacts,
|
||||
exchange.address,
|
||||
zrxAssetData,
|
||||
);
|
||||
|
||||
// TODO(fabio): Uncomment dutchAuction once the @0x/contracts-extensions is refactored
|
||||
// for V3
|
||||
// // DutchAuction
|
||||
// const dutchAuction = await DutchAuctionContract.deployFrom0xArtifactAsync(
|
||||
// artifacts.DutchAuction,
|
||||
// provider,
|
||||
// txDefaults,
|
||||
// artifacts,
|
||||
// exchange.address,
|
||||
// );
|
||||
|
||||
// TODO (xianny): figure out how to deploy AssetProxyOwnerContract properly
|
||||
// // Multisigs
|
||||
// const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
|
||||
@ -244,16 +227,11 @@ export async function runMigrationsAsync(
|
||||
|
||||
// Fake the above transactions so our nonce increases and we result with the same addresses
|
||||
// while AssetProxyOwner is disabled (TODO: @dekz remove)
|
||||
const dummyTransactionCount = 6;
|
||||
const dummyTransactionCount = 8;
|
||||
for (let index = 0; index < dummyTransactionCount; index++) {
|
||||
await web3Wrapper.sendTransactionAsync({ to: txDefaults.from, from: txDefaults.from, value: new BigNumber(0) });
|
||||
}
|
||||
|
||||
// Fund the Forwarder with ZRX
|
||||
const zrxDecimals = await zrxToken.decimals().callAsync();
|
||||
const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
|
||||
await zrxToken.transfer(forwarder.address, zrxForwarderAmount).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
// CoordinatorRegistry
|
||||
const coordinatorRegistry = await CoordinatorRegistryContract.deployFrom0xArtifactAsync(
|
||||
artifacts.CoordinatorRegistry,
|
||||
@ -288,6 +266,59 @@ export async function runMigrationsAsync(
|
||||
artifacts,
|
||||
);
|
||||
|
||||
const erc20BridgeProxy = await ERC20BridgeProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.ERC20BridgeProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
await exchange.registerAssetProxy(erc20BridgeProxy.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await erc20BridgeProxy.addAuthorizedAddress(exchange.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await erc20BridgeProxy.addAuthorizedAddress(multiAssetProxy.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await multiAssetProxy.registerAssetProxy(erc20BridgeProxy.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
const zrxProxy = erc20Proxy.address;
|
||||
const zrxVault = await ZrxVaultContract.deployFrom0xArtifactAsync(
|
||||
artifacts.ZrxVault,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
zrxProxy,
|
||||
zrxToken.address,
|
||||
);
|
||||
await erc20Proxy.addAuthorizedAddress(zrxVault.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
// Note we use TestStakingContract as the deployed bytecode of a StakingContract
|
||||
// has the tokens hardcoded
|
||||
const stakingLogic = await TestStakingContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Staking,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
etherToken.address,
|
||||
zrxVault.address,
|
||||
);
|
||||
|
||||
const stakingProxy = await StakingProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.StakingProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
stakingLogic.address,
|
||||
);
|
||||
|
||||
// Reference the Proxy as the StakingContract for setup
|
||||
const stakingDel = await new TestStakingContract(stakingProxy.address, provider, txDefaults);
|
||||
await stakingProxy.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults);
|
||||
await stakingDel.addExchangeAddress(exchange.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await exchange.setProtocolFeeCollectorAddress(stakingProxy.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await exchange.setProtocolFeeMultiplier(new BigNumber(150000)).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
await zrxVault.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults);
|
||||
await zrxVault.setStakingProxy(stakingProxy.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
await stakingLogic.addAuthorizedAddress(txDefaults.from).awaitTransactionSuccessAsync(txDefaults);
|
||||
await stakingLogic.addExchangeAddress(exchange.address).awaitTransactionSuccessAsync(txDefaults);
|
||||
|
||||
const contractAddresses = {
|
||||
erc20Proxy: erc20Proxy.address,
|
||||
erc721Proxy: erc721Proxy.address,
|
||||
@ -297,10 +328,10 @@ export async function runMigrationsAsync(
|
||||
exchange: exchange.address,
|
||||
// TODO (xianny): figure out how to deploy AssetProxyOwnerContract
|
||||
assetProxyOwner: constants.NULL_ADDRESS,
|
||||
erc20BridgeProxy: constants.NULL_ADDRESS,
|
||||
erc20BridgeProxy: erc20BridgeProxy.address,
|
||||
zeroExGovernor: constants.NULL_ADDRESS,
|
||||
forwarder: forwarder.address,
|
||||
orderValidator: orderValidator.address,
|
||||
orderValidator: constants.NULL_ADDRESS,
|
||||
dutchAuction: constants.NULL_ADDRESS,
|
||||
coordinatorRegistry: coordinatorRegistry.address,
|
||||
coordinator: coordinator.address,
|
||||
@ -308,10 +339,9 @@ export async function runMigrationsAsync(
|
||||
staticCallProxy: staticCallProxy.address,
|
||||
devUtils: devUtils.address,
|
||||
exchangeV2: constants.NULL_ADDRESS,
|
||||
zrxVault: constants.NULL_ADDRESS,
|
||||
readOnlyProxy: constants.NULL_ADDRESS,
|
||||
staking: constants.NULL_ADDRESS,
|
||||
stakingProxy: constants.NULL_ADDRESS,
|
||||
zrxVault: zrxVault.address,
|
||||
staking: stakingLogic.address,
|
||||
stakingProxy: stakingProxy.address,
|
||||
};
|
||||
|
||||
return contractAddresses;
|
||||
|
@ -25,8 +25,8 @@ export const erc20TokenInfo: ERC20Token[] = [
|
||||
swarmHash: NULL_BYTES,
|
||||
},
|
||||
{
|
||||
name: 'Digix DAO Token',
|
||||
symbol: 'DGD',
|
||||
name: 'Dai',
|
||||
symbol: 'DAI',
|
||||
decimals: new BigNumber(18),
|
||||
ipfsHash: NULL_BYTES,
|
||||
swarmHash: NULL_BYTES,
|
||||
|
Loading…
x
Reference in New Issue
Block a user