@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.",
"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;