Finish ZrxVault and StakingProxy configs without batch transaction

This commit is contained in:
Amir Bandeali
2019-11-07 08:14:12 -08:00
parent eb6bbb6e78
commit a4a2bfdf35
3 changed files with 15 additions and 10 deletions

View File

@@ -150,11 +150,18 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t
logUtils.log('ERC20BridgeProxy configured!');
logUtils.log('Configuring ZrxVault...');
await zrxVault.addAuthorizedAddress.awaitTransactionSuccessAsync(txDefaults.from);
await zrxVault.setStakingProxy.awaitTransactionSuccessAsync(stakingProxy.address);
await zrxVault.removeAuthorizedAddress.awaitTransactionSuccessAsync(txDefaults.from);
await zrxVault.addAuthorizedAddress.awaitTransactionSuccessAsync(governor.address);
await zrxVault.transferOwnership.awaitTransactionSuccessAsync(governor.address);
logUtils.log('ZrxVault configured!');
logUtils.log('Configuring StakingProxy...');
await stakingProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(txDefaults.from);
const staking = new StakingContract(stakingProxy.address, provider, txDefaults);
await staking.addExchangeAddress.awaitTransactionSuccessAsync(exchange.address);
await stakingProxy.removeAuthorizedAddress.awaitTransactionSuccessAsync(txDefaults.from);
await stakingProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(governor.address);
await stakingProxy.transferOwnership.awaitTransactionSuccessAsync(governor.address);
logUtils.log('StakingProxy configured!');
@@ -189,16 +196,6 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t
logUtils.log('Ownership transferred!');
const functionCalls = [
// ZrxVault configs
{
destination: zrxVault.address,
data: zrxVault.setStakingProxy.getABIEncodedTransactionData(stakingProxy.address),
},
// Staking configs
{
destination: stakingProxy.address,
data: stakingLogic.addExchangeAddress.getABIEncodedTransactionData(exchange.address),
},
// AssetProxy configs
{
destination: deployedAddresses.erc20Proxy,

View File

@@ -14,6 +14,10 @@ export interface ConfigsByChain {
}
// 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: {

View File

@@ -14,6 +14,10 @@ export interface TimelockRegistration {
secondsTimeLocked: BigNumber;
}
/**
* Gets the custom timelock configs that correspond the the network of the given provider.
* @param provider Web3 provider instance.
*/
export async function getTimelockRegistrationsAsync(provider: SupportedProvider): Promise<TimelockRegistration[]> {
const web3Wrapper = new Web3Wrapper(provider);
const chainId = await web3Wrapper.getChainIdAsync();