Skip to content

Commit

Permalink
Merge pull request #25 from The-Poolz/manta-network-deploy
Browse files Browse the repository at this point in the history
Remove `DelayVaultProvider` from `All`
  • Loading branch information
Lomet authored Mar 27, 2024
2 parents b4238b7 + 31ad678 commit b6a2c62
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
33 changes: 24 additions & 9 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
CollateralProvider,
RefundProvider,
VaultManager,
SimpleBuilder,
SimpleRefundBuilder,
DelayVaultMigrator,
} from "../typechain-types"
import { v1DelayVault, POOLX } from "./utility/constants"
Expand All @@ -24,13 +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)

// Deploy Migrator contract
const migrator: DelayVaultMigrator = await deploy("DelayVaultMigrator", lockDealNFT.address, v1DelayVault)

// Deploy DelayVaultProvider contract
await deploy("DelayVaultProvider", POOLX, migrator.address, delayVaultSettings(lockProvider.address))
const timedDealProvider: TimedDealProvider = await deploy("TimedDealProvider", lockDealNFT.address, lockProvider.address)

// Deploy CollateralProvider contract
const collateralProvider: CollateralProvider = await deploy(
Expand All @@ -47,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 || ""
Expand All @@ -57,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()
}
}
13 changes: 1 addition & 12 deletions scripts/fileImport.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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)
}
Expand Down

0 comments on commit b6a2c62

Please sign in to comment.