@0x/migrations: Add affiliateFeeTransformer and exchangeProxyFlashWallet to ganache snapshot migration.

This commit is contained in:
Lawrence Forman 2020-07-02 15:53:50 -04:00
parent 1e8f2f0e83
commit a2db1a3275
2 changed files with 23 additions and 2 deletions

View File

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

View File

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