-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added hardhat deployment scripts for marketplace
- Loading branch information
1 parent
ae66e6b
commit 245dee7
Showing
8 changed files
with
413 additions
and
11 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
packages/deploy/deploy/marketplace/00_deploy_royalties_registry.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {deploy} = deployments; | ||
const {deployer, upgradeAdmin} = await getNamedAccounts(); | ||
|
||
await deploy('RoyaltiesRegistry', { | ||
from: deployer, | ||
contract: | ||
'@sandbox-smart-contracts/marketplace/src/royalties-registry/RoyaltiesRegistry.sol:RoyaltiesRegistry', | ||
proxy: { | ||
owner: upgradeAdmin, | ||
proxyContract: 'OpenZeppelinTransparentProxy', | ||
execute: { | ||
methodName: '__RoyaltiesRegistry_init', | ||
args: [], | ||
}, | ||
upgradeIndex: 0, | ||
}, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['RoyaltiesRegistry', 'RoyaltiesRegistry_deploy']; |
27 changes: 27 additions & 0 deletions
27
packages/deploy/deploy/marketplace/01_deploy_order_validator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {deploy} = deployments; | ||
const {deployer, upgradeAdmin} = await getNamedAccounts(); | ||
|
||
await deploy('OrderValidator', { | ||
from: deployer, | ||
contract: | ||
'@sandbox-smart-contracts/marketplace/src/exchange/OrderValidator.sol:OrderValidator', | ||
proxy: { | ||
owner: upgradeAdmin, | ||
proxyContract: 'OpenZeppelinTransparentProxy', | ||
execute: { | ||
methodName: '__OrderValidator_init_unchained', | ||
args: [false, false, true, false], | ||
}, | ||
upgradeIndex: 0, | ||
}, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['OrderValidator', 'OrderValidator_deploy']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {deploy} = deployments; | ||
const {deployer, upgradeAdmin, exchangeFeeRecipient} = | ||
await getNamedAccounts(); | ||
|
||
let TRUSTED_FORWARDER = await deployments.getOrNull('TRUSTED_FORWARDER'); | ||
if (!TRUSTED_FORWARDER) { | ||
TRUSTED_FORWARDER = await deploy('TRUSTED_FORWARDER', { | ||
from: deployer, | ||
contract: 'TrustedForwarderMock', | ||
log: true, | ||
}); | ||
} | ||
const orderValidator = await deployments.get('OrderValidator'); | ||
const royaltiesRegistry = await deployments.get('RoyaltiesRegistry'); | ||
|
||
// 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'; | ||
|
||
await deploy('Exchange', { | ||
from: deployer, | ||
contract: `@sandbox-smart-contracts/marketplace/src/exchange/${contract}.sol:${contract}`, | ||
proxy: { | ||
owner: upgradeAdmin, | ||
proxyContract: 'OpenZeppelinTransparentProxy', | ||
execute: { | ||
methodName: '__Exchange_init', | ||
args: [ | ||
TRUSTED_FORWARDER.address, | ||
0, | ||
250, | ||
exchangeFeeRecipient, | ||
royaltiesRegistry, | ||
orderValidator.address, | ||
nativeOrder, | ||
metaNative, | ||
], | ||
}, | ||
upgradeIndex: 0, | ||
}, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['Exchange', 'Exchange_deploy']; | ||
func.dependencies = ['RoyaltiesRegistry_deploy', 'OrderValidator_deploy']; |
29 changes: 29 additions & 0 deletions
29
packages/deploy/deploy/marketplace/03_deploy_asset_matcher.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
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', { | ||
from: deployer, | ||
contract: `@sandbox-smart-contracts/marketplace/src/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']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.