From 199ad8a7877d1f77fb6d94c26e34256c48096a10 Mon Sep 17 00:00:00 2001 From: Andres Adjimann Date: Fri, 29 Sep 2023 19:07:00 -0300 Subject: [PATCH] fix: fix marketplace deployment --- .../marketplace/03_deploy_asset_matcher.ts | 14 +-------- ...ploy_exchange.ts => 10_deploy_exchange.ts} | 30 +++++++++---------- 2 files changed, 16 insertions(+), 28 deletions(-) rename packages/deploy/deploy/marketplace/{02_deploy_exchange.ts => 10_deploy_exchange.ts} (66%) diff --git a/packages/deploy/deploy/marketplace/03_deploy_asset_matcher.ts b/packages/deploy/deploy/marketplace/03_deploy_asset_matcher.ts index ff497ecbf5..12c6fae7f4 100644 --- a/packages/deploy/deploy/marketplace/03_deploy_asset_matcher.ts +++ b/packages/deploy/deploy/marketplace/03_deploy_asset_matcher.ts @@ -6,25 +6,13 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deploy} = deployments; const {deployer} = await getNamedAccounts(); - // TODO: to be fetched from env? - const deployMeta = process.env.DEPLOY_META; - const exchangeContract = deployMeta ? 'ExchangeMeta' : 'Exchange'; - - const assetMatcher = await deploy('AssetMatcher', { + await deploy('AssetMatcher', { from: deployer, contract: '@sandbox-smart-contracts/marketplace/contracts/exchange/AssetMatcher.sol:AssetMatcher', log: true, skipIfAlreadyDeployed: true, }); - - await deployments.execute( - exchangeContract, - {from: deployer}, - 'setAssetMatcherContract', - assetMatcher.address - ); }; export default func; func.tags = ['AssetMatcher', 'AssetMatcher_deploy']; -func.dependencies = ['Exchange']; diff --git a/packages/deploy/deploy/marketplace/02_deploy_exchange.ts b/packages/deploy/deploy/marketplace/10_deploy_exchange.ts similarity index 66% rename from packages/deploy/deploy/marketplace/02_deploy_exchange.ts rename to packages/deploy/deploy/marketplace/10_deploy_exchange.ts index 0a2d64b729..7b18a0943f 100644 --- a/packages/deploy/deploy/marketplace/02_deploy_exchange.ts +++ b/packages/deploy/deploy/marketplace/10_deploy_exchange.ts @@ -4,7 +4,7 @@ import {DeployFunction} from 'hardhat-deploy/types'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployments, getNamedAccounts} = hre; const {deploy} = deployments; - const {deployer, upgradeAdmin, exchangeFeeRecipient} = + const {deployer, sandAdmin, upgradeAdmin, exchangeFeeRecipient} = await getNamedAccounts(); let TRUSTED_FORWARDER = await deployments.getOrNull('TRUSTED_FORWARDER'); @@ -17,32 +17,28 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { } const orderValidator = await deployments.get('OrderValidator'); const royaltiesRegistry = await deployments.get('RoyaltiesRegistry'); + const assetMatcher = await deployments.get('AssetMatcher'); - // TODO: Do we need oll the combinations of flags ? Can we have two deployments scripts with different tags each ? - // TODO: to be fetched from env? - const deployMeta = process.env.DEPLOY_META; - const nativeOrder = process.env.NATIVE_ORDER; - const metaNative = process.env.META_NATIVE; - - const contract = deployMeta ? 'ExchangeMeta' : 'Exchange'; + const newProtocolFeePrimary = 0; + const newProtocolFeeSecondary = 250; await deploy('Exchange', { from: deployer, - contract: `@sandbox-smart-contracts/marketplace/contracts/exchange/${contract}.sol:${contract}`, + contract: `@sandbox-smart-contracts/marketplace/contracts/exchange/Exchange.sol:Exchange`, proxy: { owner: upgradeAdmin, proxyContract: 'OpenZeppelinTransparentProxy', execute: { methodName: '__Exchange_init', args: [ + sandAdmin, TRUSTED_FORWARDER.address, - 0, - 250, + newProtocolFeePrimary, + newProtocolFeeSecondary, exchangeFeeRecipient, - royaltiesRegistry, + royaltiesRegistry.address, orderValidator.address, - nativeOrder, - metaNative, + assetMatcher.address, ], }, upgradeIndex: 0, @@ -53,4 +49,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { }; export default func; func.tags = ['Exchange', 'Exchange_deploy']; -func.dependencies = ['RoyaltiesRegistry_deploy', 'OrderValidator_deploy']; +func.dependencies = [ + 'RoyaltiesRegistry_deploy', + 'OrderValidator_deploy', + 'AssetMatcher_deploy', +];