From 8c5fbac63ce0a0a09366c44ea4e19ae37dab8c1f Mon Sep 17 00:00:00 2001 From: Andrew Dmytrenko Date: Mon, 4 Mar 2024 12:39:44 +0200 Subject: [PATCH 1/2] manta network deploy preparation --- scripts/deploy.ts | 6 ------ scripts/fileImport.ts | 13 +------------ 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/scripts/deploy.ts b/scripts/deploy.ts index 0107abd..bd69a3c 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -26,12 +26,6 @@ async function deployAllContracts(baseURI: string = "") { // Deploy TimedDealProvider contract await deploy("TimedDealProvider", lockDealNFT.address, lockProvider.address) - // Deploy Migrator contract - const migrator: DelayVaultMigrator = await deploy("DelayVaultMigrator", lockDealNFT.address, v1DelayVault) - - // Deploy DelayVaultProvider contract - await deploy("DelayVaultProvider", POOLX, migrator.address, delayVaultSettings(lockProvider.address)) - // Deploy CollateralProvider contract const collateralProvider: CollateralProvider = await deploy( "CollateralProvider", diff --git a/scripts/fileImport.ts b/scripts/fileImport.ts index 25ce44f..3644509 100644 --- a/scripts/fileImport.ts +++ b/scripts/fileImport.ts @@ -1,5 +1,5 @@ import { downloadAndExtractZip } from "@poolzfinance/poolz-helper-v2" -import { cleanUpFolders, replaceFileContents, removeFolderRecursively } from "@poolzfinance/poolz-helper-v2" +import { cleanUpFolders, removeFolderRecursively } from "@poolzfinance/poolz-helper-v2" import { existsSync } from "fs" async function downloadAndExtractZipAll() { @@ -17,19 +17,8 @@ async function downloadAndExtractZipAll() { "https://github.com/The-Poolz/VaultManager/archive/refs/heads/master.zip", contractsFolder ) - await downloadAndExtractZip( - "https://github.com/The-Poolz/LockDealNFT.DelayVaultProvider/archive/refs/heads/master.zip", - contractsFolder - ) await cleanUpFolders("contracts/LockDealNFT") await cleanUpFolders("contracts/VaultManager") - await cleanUpFolders("contracts/LockDealNFT.DelayVaultProvider") - await replaceFileContents( - "contracts/LockDealNFT.DelayVaultProvider/contracts/interfaces", - "../LockDealNFT", - "../../../LockDealNFT" - ) - await replaceFileContents("contracts/LockDealNFT.DelayVaultProvider/", '"./LockDealNFT', `"../../LockDealNFT`) } catch (error) { console.error("An error occurred during download and compile:", error) } From 31ad6783afcf77c062b26de213df5f52884c4a98 Mon Sep 17 00:00:00 2001 From: Andrew Dmytrenko <68740472+YouStillAlive@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:53:38 +0200 Subject: [PATCH 2/2] add initial setup after deployment script (#24) --- scripts/deploy.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/deploy.ts b/scripts/deploy.ts index bd69a3c..f265bc7 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -6,6 +6,8 @@ import { CollateralProvider, RefundProvider, VaultManager, + SimpleBuilder, + SimpleRefundBuilder, DelayVaultMigrator, } from "../typechain-types" import { v1DelayVault, POOLX } from "./utility/constants" @@ -24,7 +26,7 @@ async function deployAllContracts(baseURI: string = "") { const lockProvider: LockDealProvider = await deploy("LockDealProvider", lockDealNFT.address, dealProvider.address) // Deploy TimedDealProvider contract - await deploy("TimedDealProvider", lockDealNFT.address, lockProvider.address) + const timedDealProvider: TimedDealProvider = await deploy("TimedDealProvider", lockDealNFT.address, lockProvider.address) // Deploy CollateralProvider contract const collateralProvider: CollateralProvider = await deploy( @@ -41,8 +43,20 @@ async function deployAllContracts(baseURI: string = "") { ) // Deploy Buiders - await deploy("SimpleBuilder", lockDealNFT.address) - await deploy("SimpleRefundBuilder", lockDealNFT.address, refundProvider.address, collateralProvider.address) + const simpleBuilder: SimpleBuilder = await deploy("SimpleBuilder", lockDealNFT.address) + const simpleRefundBuilder: SimpleRefundBuilder = await deploy("SimpleRefundBuilder", lockDealNFT.address, refundProvider.address, collateralProvider.address) + + let tx = await vaultManager.setTrustee(lockDealNFT.address) + await tx.wait() + await setApprovedContracts(lockDealNFT, [ + dealProvider.address, + lockProvider.address, + timedDealProvider.address, + collateralProvider.address, + refundProvider.address, + simpleBuilder.address, + simpleRefundBuilder.address, + ]) } const baseURI = process.env.BASEURI || "" @@ -51,3 +65,10 @@ deployAllContracts(baseURI).catch((error) => { console.error(error) process.exitCode = 1 }) + +async function setApprovedContracts(lockDealNFT: LockDealNFT, contracts: string[]) { + for (const contract of contracts) { + const tx = await lockDealNFT.setApprovedContract(contract, true) + await tx.wait() + } +}