EP: FeeCollectorController (#59)

* `@0x/contracts-zero-ex`: Govern `FeeCollector`s through a separate `FeeCollectorController` contract.

* `@0x/contracts-integrations`: Fix broken EP protocol fees test.
`@0x/contracts-integrations`: Make this package private.

* `@0x/contract-addresses`: Update ganache snapshot addresses.

* Update contracts/zero-ex/contracts/src/external/FeeCollectorController.sol

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>

* Apply suggestions from code review

Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>

* rebase

Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: mzhu25 <mchl.zhu.96@gmail.com>
This commit is contained in:
Lawrence Forman
2020-12-01 12:17:21 -05:00
committed by GitHub
parent 27e36b112e
commit 475b608338
21 changed files with 280 additions and 43 deletions

View File

@@ -7,6 +7,7 @@ import * as _ from 'lodash';
import { artifacts } from './artifacts';
import { ZERO_BYTES32 } from './constants';
import {
FeeCollectorControllerContract,
FullMigrationContract,
InitialMigrationContract,
IZeroExContract,
@@ -124,6 +125,7 @@ export interface FullFeatureArtifacts extends BootstrapFeatureArtifacts {
signatureValidator: SimpleContractArtifact;
metaTransactions: SimpleContractArtifact;
nativeOrders: SimpleContractArtifact;
feeCollectorController: SimpleContractArtifact;
}
/**
@@ -148,6 +150,7 @@ const DEFAULT_FULL_FEATURES_DEPLOY_CONFIG = {
zeroExAddress: NULL_ADDRESS,
wethAddress: NULL_ADDRESS,
stakingAddress: NULL_ADDRESS,
feeCollectorController: NULL_ADDRESS,
protocolFeeMultiplier: 70e3,
greedyTokensBloomFilter: ZERO_BYTES32,
};
@@ -158,6 +161,7 @@ const DEFAULT_FULL_FEATURES_ARTIFACTS = {
signatureValidator: artifacts.SignatureValidatorFeature,
metaTransactions: artifacts.MetaTransactionsFeature,
nativeOrders: artifacts.NativeOrdersFeature,
feeCollectorController: artifacts.FeeCollectorController,
};
/**
@@ -175,6 +179,16 @@ export async function deployFullFeaturesAsync(
...DEFAULT_FULL_FEATURES_ARTIFACTS,
...featureArtifacts,
};
if (_config.feeCollectorController === NULL_ADDRESS) {
_config.feeCollectorController = (await FeeCollectorControllerContract.deployFrom0xArtifactAsync(
_featureArtifacts.feeCollectorController,
provider,
txDefaults,
artifacts,
_config.wethAddress,
_config.stakingAddress,
)).address;
}
return {
...(await deployBootstrapFeaturesAsync(provider, txDefaults)),
tokenSpender:
@@ -222,6 +236,7 @@ export async function deployFullFeaturesAsync(
_config.zeroExAddress,
_config.wethAddress,
_config.stakingAddress,
_config.feeCollectorController,
_config.protocolFeeMultiplier,
_config.greedyTokensBloomFilter,
)).address,