Rename AssetProxyOwner to ZeroExGovernor throughout all contracts packages

This commit is contained in:
Amir Bandeali
2019-10-17 17:19:44 -07:00
parent 5ddc35fdf2
commit c50cbd7a75
11 changed files with 130 additions and 127 deletions

View File

@@ -16,7 +16,7 @@ import {
ExchangeContract,
Ownable,
} from '@0x/contracts-exchange';
import { artifacts as multisigArtifacts, AssetProxyOwnerContract } from '@0x/contracts-multisig';
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
import {
artifacts as stakingArtifacts,
ReadOnlyProxyContract,
@@ -76,7 +76,7 @@ async function batchRegisterAssetProxyAsync(
*/
async function batchTransferOwnershipAsync(
owner: string,
newOwner: AssetProxyOwnerContract,
newOwner: ZeroExGovernorContract,
ownedContracts: Ownable[],
): Promise<void> {
for (const ownedContract of ownedContracts) {
@@ -115,7 +115,7 @@ export class DeploymentManager {
public static protocolFeeMultiplier = new BigNumber(150000);
public assetProxies: AssetProxyContracts;
public assetProxyOwner: AssetProxyOwnerContract;
public governor: ZeroExGovernorContract;
public exchange: ExchangeContract;
public staking: StakingContracts;
public tokens: TokenContracts;
@@ -142,8 +142,8 @@ export class DeploymentManager {
exchangeArtifacts,
new BigNumber(chainId),
);
const assetProxyOwner = await AssetProxyOwnerContract.deployFrom0xArtifactAsync(
multisigArtifacts.AssetProxyOwner,
const governor = await ZeroExGovernorContract.deployFrom0xArtifactAsync(
multisigArtifacts.ZeroExGovernor,
environment.provider,
txDefaults,
multisigArtifacts,
@@ -168,10 +168,10 @@ export class DeploymentManager {
await DeploymentManager._configureExchangeWithStakingAsync(exchange, staking, owner);
// Authorize the asset-proxy owner in the staking proxy and in the zrx vault.
await staking.stakingProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(assetProxyOwner.address, {
await staking.stakingProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(governor.address, {
from: owner,
});
await staking.zrxVault.addAuthorizedAddress.awaitTransactionSuccessAsync(assetProxyOwner.address, {
await staking.zrxVault.addAuthorizedAddress.awaitTransactionSuccessAsync(governor.address, {
from: owner,
});
@@ -180,7 +180,7 @@ export class DeploymentManager {
await staking.zrxVault.removeAuthorizedAddress.awaitTransactionSuccessAsync(owner, { from: owner });
// Transfer complete ownership of the system to the asset proxy owner.
await batchTransferOwnershipAsync(owner, assetProxyOwner, [
await batchTransferOwnershipAsync(owner, governor, [
assetProxies.erc20Proxy,
assetProxies.erc721Proxy,
assetProxies.erc1155Proxy,
@@ -190,7 +190,7 @@ export class DeploymentManager {
staking.stakingProxy,
]);
return new DeploymentManager(assetProxies, assetProxyOwner, exchange, staking, tokens);
return new DeploymentManager(assetProxies, governor, exchange, staking, tokens);
}
/**
@@ -443,13 +443,13 @@ export class DeploymentManager {
private constructor(
assetProxies: AssetProxyContracts,
assetProxyOwner: AssetProxyOwnerContract,
governor: ZeroExGovernorContract,
exchange: ExchangeContract,
staking: StakingContracts,
tokens: TokenContracts,
) {
this.assetProxies = assetProxies;
this.assetProxyOwner = assetProxyOwner;
this.governor = governor;
this.exchange = exchange;
this.staking = staking;
this.tokens = tokens;

View File

@@ -42,14 +42,14 @@ blockchainTests('Deployment Manager', env => {
describe('asset proxy owner', () => {
it('should be owned by `owner`', async () => {
// Ensure that the owners of the asset proxy only contain the owner.
const owners = await deploymentManager.assetProxyOwner.getOwners.callAsync();
const owners = await deploymentManager.governor.getOwners.callAsync();
expect(owners).to.be.deep.eq([owner]);
});
});
describe('asset proxies', () => {
it('should be owned be the asset proxy owner', async () => {
await batchAssertOwnerAsync(deploymentManager.assetProxyOwner.address, [
await batchAssertOwnerAsync(deploymentManager.governor.address, [
deploymentManager.assetProxies.erc1155Proxy,
deploymentManager.assetProxies.erc20Proxy,
deploymentManager.assetProxies.erc721Proxy,
@@ -95,7 +95,7 @@ blockchainTests('Deployment Manager', env => {
describe('exchange', () => {
it('should be owned by the asset proxy owner', async () => {
const exchangeOwner = await deploymentManager.exchange.owner.callAsync();
expect(exchangeOwner).to.be.eq(deploymentManager.assetProxyOwner.address);
expect(exchangeOwner).to.be.eq(deploymentManager.governor.address);
});
/*
@@ -103,7 +103,7 @@ blockchainTests('Deployment Manager', env => {
made an Authorizable contract.
it('should have authorized the asset proxy owner', async () => {
const isAuthorized = await deploymentManager.exchange.owner.callAsync(
deploymentManager.assetProxyOwner.address,
deploymentManager.governor.address,
);
expect(isAuthorized).to.be.true();
});
@@ -123,12 +123,12 @@ blockchainTests('Deployment Manager', env => {
describe('staking', () => {
it('should be owned by the asset proxy owner', async () => {
const stakingOwner = await deploymentManager.staking.stakingProxy.owner.callAsync();
expect(stakingOwner).to.be.eq(deploymentManager.assetProxyOwner.address);
expect(stakingOwner).to.be.eq(deploymentManager.governor.address);
});
it('should have authorized the asset proxy owner in the staking proxy', async () => {
const isAuthorized = await deploymentManager.staking.stakingProxy.authorized.callAsync(
deploymentManager.assetProxyOwner.address,
deploymentManager.governor.address,
);
expect(isAuthorized).to.be.true();
});

View File

@@ -17,7 +17,7 @@ import {
ExchangeProtocolFeeMultiplierEventArgs,
Ownable,
} from '@0x/contracts-exchange';
import { artifacts as multisigArtifacts, AssetProxyOwnerContract } from '@0x/contracts-multisig';
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
import {
artifacts as stakingArtifacts,
constants as stakingConstants,
@@ -43,7 +43,7 @@ blockchainTests('Deployment and Configuration End to End Tests', env => {
let owner: string;
// Contract Instances
let assetProxyOwner: AssetProxyOwnerContract;
let governor: ZeroExGovernorContract;
let erc20Proxy: ERC20ProxyContract;
let erc721Proxy: ERC721ProxyContract;
let erc1155Proxy: ERC1155ProxyContract;
@@ -75,11 +75,11 @@ blockchainTests('Deployment and Configuration End to End Tests', env => {
from: owner,
};
// Deploy AssetProxyOwner. For the purposes of this test, we will assume that
// the AssetProxyOwner does not know what destinations will be needed during
// Deploy ZeroExGovernor. For the purposes of this test, we will assume that
// the ZeroExGovernor does not know what destinations will be needed during
// construction.
assetProxyOwner = await AssetProxyOwnerContract.deployFrom0xArtifactAsync(
multisigArtifacts.AssetProxyOwner,
governor = await ZeroExGovernorContract.deployFrom0xArtifactAsync(
multisigArtifacts.ZeroExGovernor,
env.provider,
txDefaults,
multisigArtifacts,
@@ -387,7 +387,7 @@ blockchainTests('Deployment and Configuration End to End Tests', env => {
expect(isAuthorized).to.be.false();
// Authorize the asset-proxy owner.
receipt = await contract.addAuthorizedAddress.awaitTransactionSuccessAsync(assetProxyOwner.address, {
receipt = await contract.addAuthorizedAddress.awaitTransactionSuccessAsync(governor.address, {
from: owner,
});
@@ -396,21 +396,21 @@ blockchainTests('Deployment and Configuration End to End Tests', env => {
receipt.logs,
AuthorizableEvents.AuthorizedAddressAdded,
);
expect(logs).to.be.deep.eq([{ target: assetProxyOwner.address, caller: owner }]);
expect(logs).to.be.deep.eq([{ target: governor.address, caller: owner }]);
// Ensure that the asset-proxy owner was actually authorized.
isAuthorized = await contract.authorized.callAsync(assetProxyOwner.address);
isAuthorized = await contract.authorized.callAsync(governor.address);
expect(isAuthorized).to.be.true();
}
// Transfers ownership of a contract to the asset-proxy owner, and ensures that the change was actually made.
async function transferOwnershipAndAssertSuccessAsync(contract: Ownable): Promise<void> {
// Transfer ownership to the new owner.
await contract.transferOwnership.awaitTransactionSuccessAsync(assetProxyOwner.address, { from: owner });
await contract.transferOwnership.awaitTransactionSuccessAsync(governor.address, { from: owner });
// Ensure that the owner address has been updated.
const ownerAddress = await contract.owner.callAsync();
expect(ownerAddress).to.be.eq(assetProxyOwner.address);
expect(ownerAddress).to.be.eq(governor.address);
}
it('should transfer authorization of the owner to the asset-proxy owner in the staking contracts', async () => {