From 2f69836b35e550a797d9ef7cc7e0aa2a794bd0a2 Mon Sep 17 00:00:00 2001 From: Marc Doerflinger Date: Mon, 17 Jun 2024 11:27:05 +0000 Subject: [PATCH 1/2] update gif-next --- lib/gif-next | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gif-next b/lib/gif-next index bad23b9..2bc6c17 160000 --- a/lib/gif-next +++ b/lib/gif-next @@ -1 +1 @@ -Subproject commit bad23b97ff4f5d86fd60856c1bbde82053021da8 +Subproject commit 2bc6c173c18cc4bb73c465eef9743d8ee701afff From 63f8a950dd7087fc6691994f952d32675640d0df Mon Sep 17 00:00:00 2001 From: Marc Doerflinger Date: Mon, 17 Jun 2024 11:56:50 +0000 Subject: [PATCH 2/2] make deployer work with latest gif-next --- .devcontainer/devcontainer.json | 2 +- scripts/deploy.ts | 26 ++++++++++++++++++++------ scripts/libs/gif_constants.ts | 6 +++--- scripts/run_deployer.ts | 16 +++++++++++----- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 963b3cf..6b7a964 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -37,7 +37,7 @@ }, // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": ["anvil:7545"], + "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. //"postCreateCommand": "sudo chown node node_modules && npm install", diff --git a/scripts/deploy.ts b/scripts/deploy.ts index c787c86..0f37e8f 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -24,12 +24,19 @@ async function main() { const instanceAccessManagerAddress = await instance.getInstanceAccessManager(); const registryAddress = await instance.getRegistry(); const instanceAccessManager = AccessManagerExtendedInitializeable__factory.connect(instanceAccessManagerAddress, instanceOwner); - await executeTx(() => instanceAccessManager.grantRole(DISTRIBUTION_OWNER_ROLE, distributionOwner.address, 0)); - console.log(`Distribution owner role granted to ${distributionOwner.address} at ${instanceAccessManagerAddress}`); - await executeTx(() => instanceAccessManager.grantRole(POOL_OWNER_ROLE, poolOwner.address, 0)); - console.log(`Pool owner role granted to ${poolOwner.address} at ${instanceAccessManagerAddress}`); - await executeTx(() => instanceAccessManager.grantRole(PRODUCT_OWNER_ROLE, productOwner.address, 0)); - console.log(`Product owner role granted to ${productOwner.address} at ${instanceAccessManagerAddress}`); + try { + await executeTx(() => instanceAccessManager.grantRole(DISTRIBUTION_OWNER_ROLE, distributionOwner.address, 0)); + console.log(`Distribution owner role granted to ${distributionOwner.address} at ${instanceAccessManagerAddress}`); + await executeTx(() => instanceAccessManager.grantRole(POOL_OWNER_ROLE, poolOwner.address, 0)); + console.log(`Pool owner role granted to ${poolOwner.address} at ${instanceAccessManagerAddress}`); + await executeTx(() => instanceAccessManager.grantRole(PRODUCT_OWNER_ROLE, productOwner.address, 0)); + console.log(`Product owner role granted to ${productOwner.address} at ${instanceAccessManagerAddress}`); + } catch (error) { + const failure = instanceAccessManager.interface.parseError(error.data); + logger.error(failure?.name); + logger.error(failure?.args); + throw error; + } const { address: usdcMockAddress } = await deployContract( "UsdcMock", @@ -63,6 +70,8 @@ async function main() { poolAddress, distributionAddress, nftIdLibAddress!, + amountLibAddress!, + feeLibAddress!, ); // workaround to get script to stop @@ -179,6 +188,8 @@ async function deployAndRegisterProduct( poolAddress: AddressLike, distributionAddress: AddressLike, nftIdLibAddress: AddressLike, + amountLibAddress: AddressLike, + feeLibAddress: AddressLike, ): Promise<{ product: Product, productNftId: bigint, productAddress: AddressLike }> { const productName = "InsuranceProduct-" + Math.random().toString(16).substring(7); const fee = { @@ -202,6 +213,8 @@ async function deployAndRegisterProduct( ], { libraries: { + AmountLib: amountLibAddress, + FeeLib: feeLibAddress, NftIdLib: nftIdLibAddress, } }); @@ -222,5 +235,6 @@ async function deployAndRegisterProduct( main().catch((error) => { logger.error(error.stack); + logger.error(error.data); process.exit(1); }); \ No newline at end of file diff --git a/scripts/libs/gif_constants.ts b/scripts/libs/gif_constants.ts index 0b1f6ab..637a75e 100644 --- a/scripts/libs/gif_constants.ts +++ b/scripts/libs/gif_constants.ts @@ -1,6 +1,6 @@ -export const DISTRIBUTION_OWNER_ROLE = 2; -export const POOL_OWNER_ROLE = 4; -export const PRODUCT_OWNER_ROLE = 5; +export const DISTRIBUTION_OWNER_ROLE = 13; +export const POOL_OWNER_ROLE = 14; +export const PRODUCT_OWNER_ROLE = 11; export const OBJECT_TYPE_PRODUCT = 110; export const OBJECT_TYPE_DISTRIBUTION = 120; diff --git a/scripts/run_deployer.ts b/scripts/run_deployer.ts index 37dd884..09be37f 100644 --- a/scripts/run_deployer.ts +++ b/scripts/run_deployer.ts @@ -15,7 +15,9 @@ async function main() { const feeLibAddress = process.env.FEELIB_ADDRESS; const nftIdLibAddress = process.env.NFTIDLIB_ADDRESS; const referralLibAddress = process.env.REFERRALLIB_ADDRESS; + const riskIdLibAddress = process.env.RISKIDLIB_ADDRESS; const roleIdLibAddress = process.env.ROLEIDLIB_ADDRESS; + const secondsLibAddress = process.env.SECONDSLIB_ADDRESS; const ufixedLibAddress = process.env.UFIXEDLIB_ADDRESS; const instanceNftId = process.env.INSTANCE_NFTID; @@ -73,18 +75,22 @@ async function main() { const { address: deployerAddress, contract: deployerContract } = await deployContract( "Deployer", distributionOwner, - // [], [ registryAddress!, - instanceNftId, - distributionOwner, "42" ], { "libraries": { + "AmountLib": amountLibAddress, + "FeeLib": feeLibAddress, "DistributionDeployer": distributionLibAddress, "PoolDeployer": poolLibAddress, - "ProductDeployer": productLibAddress + "ProductDeployer": productLibAddress, + "ReferralLib": referralLibAddress, + "RiskIdLib": riskIdLibAddress, + "RoleIdLib": roleIdLibAddress, + "SecondsLib": secondsLibAddress, + "UFixedLib": ufixedLibAddress, } }); @@ -98,11 +104,11 @@ async function main() { const productNftId = await deployer.getProductNftId(); const usdcMockAddress = await deployer.getUsdc(); + logger.info(`USDC mock deployed at ${usdcMockAddress}`); logger.info(`Deployer deployed at ${deployerAddress}`); logger.info(`Distribution deployed at ${distributionAddress} with NFT ID ${distributionNftId}`); logger.info(`Pool deployed at ${poolAddress} with NFT ID ${poolNftId}`); logger.info(`Product deployed at ${productAddress} with NFT ID ${productNftId}`); - logger.info(`USDC mock deployed at ${usdcMockAddress}`); // workaround to get script to stop process.exit(0);