Merge pull request #2622 from 0xProject/migration/exchange-proxy/affiliate-fee-transformer-initial

Deploy AffiliateFeeTransformer
This commit is contained in:
Lawrence Forman
2020-07-02 23:40:35 -04:00
committed by GitHub
12 changed files with 55 additions and 8 deletions

View File

@@ -5,6 +5,10 @@
{
"note": "Export migration tools",
"pr": 2612
},
{
"note": "Export `AffiliateFeeTransformerContract`",
"pr": 2622
}
]
},

View File

@@ -38,7 +38,7 @@
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"publicInterfaceContracts": "ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnable,ISimpleFunctionRegistry,ITokenSpender,ITransformERC20,FillQuoteTransformer,PayTakerTransformer,WethTransformer,Ownable,SimpleFunctionRegistry,TransformERC20,TokenSpender",
"publicInterfaceContracts": "ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnable,ISimpleFunctionRegistry,ITokenSpender,ITransformERC20,FillQuoteTransformer,PayTakerTransformer,WethTransformer,Ownable,SimpleFunctionRegistry,TransformERC20,TokenSpender,AffiliateFeeTransformer",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|Bootstrap|FillQuoteTransformer|FixinCommon|FlashWallet|FullMigration|IAllowanceTarget|IBootstrap|IERC20Transformer|IExchange|IFeature|IFlashWallet|IOwnable|ISimpleFunctionRegistry|ITestSimpleFunctionRegistryFeature|ITokenSpender|ITransformERC20|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibMigrate|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|Ownable|PayTakerTransformer|SimpleFunctionRegistry|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpender|TransformERC20|Transformer|TransformerDeployer|WethTransformer|ZeroEx).json"
},

View File

@@ -5,6 +5,7 @@
*/
import { ContractArtifact } from 'ethereum-types';
import * as AffiliateFeeTransformer from '../generated-artifacts/AffiliateFeeTransformer.json';
import * as FillQuoteTransformer from '../generated-artifacts/FillQuoteTransformer.json';
import * as FullMigration from '../generated-artifacts/FullMigration.json';
import * as IAllowanceTarget from '../generated-artifacts/IAllowanceTarget.json';
@@ -40,4 +41,5 @@ export const artifacts = {
SimpleFunctionRegistry: SimpleFunctionRegistry as ContractArtifact,
TransformERC20: TransformERC20 as ContractArtifact,
TokenSpender: TokenSpender as ContractArtifact,
AffiliateFeeTransformer: AffiliateFeeTransformer as ContractArtifact,
};

View File

@@ -1,5 +1,6 @@
export { artifacts } from './artifacts';
export {
AffiliateFeeTransformerContract,
FillQuoteTransformerContract,
IOwnableContract,
IOwnableEvents,

View File

@@ -3,6 +3,7 @@
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../generated-wrappers/affiliate_fee_transformer';
export * from '../generated-wrappers/fill_quote_transformer';
export * from '../generated-wrappers/full_migration';
export * from '../generated-wrappers/i_allowance_target';

View File

@@ -3,6 +3,7 @@
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"generated-artifacts/AffiliateFeeTransformer.json",
"generated-artifacts/FillQuoteTransformer.json",
"generated-artifacts/FullMigration.json",
"generated-artifacts/IAllowanceTarget.json",

View File

@@ -46,6 +46,7 @@ describe('ExchangeProxySwapQuoteConsumer', () => {
wethTransformer: getTransformerAddress(TRANSFORMER_DEPLOYER, 1),
payTakerTransformer: getTransformerAddress(TRANSFORMER_DEPLOYER, 2),
fillQuoteTransformer: getTransformerAddress(TRANSFORMER_DEPLOYER, 3),
affiliateFeeTransformer: getTransformerAddress(TRANSFORMER_DEPLOYER, 4),
},
};
let consumer: ExchangeProxySwapQuoteConsumer;

View File

@@ -5,6 +5,10 @@
{
"note": "Update ganache snapshot Exchange Proxy addresses",
"pr": 2612
},
{
"note": "Add EP flash wallet and affiliate fee transformer",
"pr": 2622
}
]
},

View File

@@ -37,10 +37,12 @@
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyAllowanceTarget": "0xf740b67da229f2f10bcbd38a7979992fcc71b8eb",
"exchangeProxyTransformerDeployer": "0x80a36559ab9a497fb658325ed771a584eb0f13da",
"exchangeProxyFlashWallet": "0x22f9dcf4647084d6c31b2765f6910cd85c178c18",
"transformers": {
"wethTransformer": "0x7bab5f7299e1ca123bb44eb71e6c89be7e558cc8",
"payTakerTransformer": "0xe8c07a119452b55eee2f999478aab97f3656d841",
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a"
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a",
"affiliateFeeTransformer": "0x9d7174f55b50dad2e417bd567ad2da1ae4eef76d"
}
},
"3": {
@@ -81,10 +83,12 @@
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyAllowanceTarget": "0xf740b67da229f2f10bcbd38a7979992fcc71b8eb",
"exchangeProxyTransformerDeployer": "0x80a36559ab9a497fb658325ed771a584eb0f13da",
"exchangeProxyFlashWallet": "0x22f9dcf4647084d6c31b2765f6910cd85c178c18",
"transformers": {
"wethTransformer": "0x7bab5f7299e1ca123bb44eb71e6c89be7e558cc8",
"payTakerTransformer": "0xe8c07a119452b55eee2f999478aab97f3656d841",
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a"
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a",
"affiliateFeeTransformer": "0x9d7174f55b50dad2e417bd567ad2da1ae4eef76d"
}
},
"4": {
@@ -125,10 +129,12 @@
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyAllowanceTarget": "0xf740b67da229f2f10bcbd38a7979992fcc71b8eb",
"exchangeProxyTransformerDeployer": "0x80a36559ab9a497fb658325ed771a584eb0f13da",
"exchangeProxyFlashWallet": "0x22f9dcf4647084d6c31b2765f6910cd85c178c18",
"transformers": {
"wethTransformer": "0x7bab5f7299e1ca123bb44eb71e6c89be7e558cc8",
"payTakerTransformer": "0xe8c07a119452b55eee2f999478aab97f3656d841",
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a"
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a",
"affiliateFeeTransformer": "0x9d7174f55b50dad2e417bd567ad2da1ae4eef76d"
}
},
"42": {
@@ -169,10 +175,12 @@
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyAllowanceTarget": "0xf740b67da229f2f10bcbd38a7979992fcc71b8eb",
"exchangeProxyTransformerDeployer": "0x80a36559ab9a497fb658325ed771a584eb0f13da",
"exchangeProxyFlashWallet": "0x22f9dcf4647084d6c31b2765f6910cd85c178c18",
"transformers": {
"wethTransformer": "0x7bab5f7299e1ca123bb44eb71e6c89be7e558cc8",
"payTakerTransformer": "0xe8c07a119452b55eee2f999478aab97f3656d841",
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a"
"fillQuoteTransformer": "0x9b81a08ef144e7aa4925f7fd77da1e1b3990e59a",
"affiliateFeeTransformer": "0x9d7174f55b50dad2e417bd567ad2da1ae4eef76d"
}
},
"1337": {
@@ -213,10 +221,12 @@
"exchangeProxy": "0x4b8ce0fa221284de4aaa09be3e7bf6193444b786",
"exchangeProxyAllowanceTarget": "0xd6724bf180441a89d08ea3aeded2c995180b9a04",
"exchangeProxyTransformerDeployer": "0x5409ed021d9299bf6814279a6a1411a7e866a631",
"exchangeProxyFlashWallet": "0xdec8629610e2f4087bd9cc441d10ca8be0c6f6c5",
"transformers": {
"wethTransformer": "0xb125995f5a4766c451cd8c34c4f5cac89b724571",
"payTakerTransformer": "0x10a736a7b223f1fe1050264249d1abb975741e75",
"fillQuoteTransformer": "0x33def1aa867be09809f3a01ce41d5ec1888846c9"
"fillQuoteTransformer": "0x33def1aa867be09809f3a01ce41d5ec1888846c9",
"affiliateFeeTransformer": "0xc7124963ab16c33e5bf421d4c0090116622b3074"
}
}
}

View File

@@ -38,10 +38,12 @@ export interface ContractAddresses {
exchangeProxy: string;
exchangeProxyAllowanceTarget: string;
exchangeProxyTransformerDeployer: string;
exchangeProxyFlashWallet: string;
transformers: {
wethTransformer: string;
payTakerTransformer: string;
fillQuoteTransformer: string;
affiliateFeeTransformer: string;
};
}

View File

@@ -5,6 +5,10 @@
{
"note": "Add Exchange Proxy migration.",
"pr": 2612
},
{
"note": "Add affiliate fee transformer migration and flash wallet address",
"pr": 2622
}
]
},

View File

@@ -30,10 +30,12 @@ import {
ZrxVaultContract,
} from '@0x/contracts-staking';
import {
AffiliateFeeTransformerContract,
artifacts as exchangeProxyArtifacts,
FillQuoteTransformerContract,
fullMigrateAsync as fullMigrateExchangeProxyAsync,
ITokenSpenderContract,
ITransformERC20Contract,
PayTakerTransformerContract,
WethTransformerContract,
} from '@0x/contracts-zero-ex';
@@ -304,9 +306,16 @@ export async function runMigrationsAsync(
// Exchange Proxy //////////////////////////////////////////////////////////
const exchangeProxy = await fullMigrateExchangeProxyAsync(txDefaults.from, provider, txDefaults);
const allowanceTargetAddress = await new ITokenSpenderContract(exchangeProxy.address, provider, txDefaults)
const exchangeProxyAllowanceTargetAddress = await new ITokenSpenderContract(
exchangeProxy.address,
provider,
txDefaults,
)
.getAllowanceTarget()
.callAsync();
const exchangeProxyFlashWalletAddress = await new ITransformERC20Contract(exchangeProxy.address, provider)
.getTransformWallet()
.callAsync();
// Deploy transformers.
const fillQuoteTransformer = await FillQuoteTransformerContract.deployFrom0xArtifactAsync(
@@ -329,6 +338,12 @@ export async function runMigrationsAsync(
allArtifacts,
etherToken.address,
);
const affiliateFeeTransformer = await AffiliateFeeTransformerContract.deployFrom0xArtifactAsync(
exchangeProxyArtifacts.AffiliateFeeTransformer,
provider,
txDefaults,
allArtifacts,
);
const contractAddresses = {
erc20Proxy: erc20Proxy.address,
@@ -366,12 +381,14 @@ export async function runMigrationsAsync(
multiBridge: NULL_ADDRESS,
exchangeProxyGovernor: NULL_ADDRESS,
exchangeProxy: exchangeProxy.address,
exchangeProxyAllowanceTarget: allowanceTargetAddress,
exchangeProxyAllowanceTarget: exchangeProxyAllowanceTargetAddress,
exchangeProxyTransformerDeployer: txDefaults.from,
exchangeProxyFlashWallet: exchangeProxyFlashWalletAddress,
transformers: {
wethTransformer: wethTransformer.address,
payTakerTransformer: payTakerTransformer.address,
fillQuoteTransformer: fillQuoteTransformer.address,
affiliateFeeTransformer: affiliateFeeTransformer.address,
},
};
return contractAddresses;