Skip to content

Commit

Permalink
add moonbeam deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
YouStillAlive committed Sep 12, 2024
1 parent 438cfb0 commit 5d66467
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 7 deletions.
51 changes: 51 additions & 0 deletions scripts/moonbeam.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {
LockDealNFT,
DealProvider,
LockDealProvider,
TimedDealProvider,
VaultManager,
SimpleBuilder
} from "../typechain-types"
import { deploy } from "./utility/deployment"

async function deployMoonbeamContracts(baseURI: string = "") {
const vaultManager: VaultManager = await deploy("VaultManager")

// Deploy LockDealNFT contract
const lockDealNFT: LockDealNFT = await deploy("LockDealNFT", vaultManager.address, baseURI)

// Deploy DealProvider contract
const dealProvider: DealProvider = await deploy("DealProvider", lockDealNFT.address)

// Deploy LockDealProvider contract
const lockProvider: LockDealProvider = await deploy("LockDealProvider", lockDealNFT.address, dealProvider.address)

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

// Deploy Buiders
const simpleBuilder: SimpleBuilder = await deploy("SimpleBuilder", lockDealNFT.address)

let tx = await vaultManager.setTrustee(lockDealNFT.address)
await tx.wait()
await setApprovedContracts(lockDealNFT, [
dealProvider.address,
lockProvider.address,
timedDealProvider.address,
simpleBuilder.address
])
}

const baseURI = process.env.BASEURI || ""

deployMoonbeamContracts(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()
}
}
19 changes: 12 additions & 7 deletions scripts/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ import {
deployAllContracts,
deployLightMigrator,
deployDelayProviderAndMigrator,
deployMoonbeam
} from "./utility/deployment/execute"

const scriptPaths = [
"Moonbeam.ts",
"VaultAndLockDealNFT.ts",
"SimpleProviders.ts",
"RefundProvider.ts",
"RefundAndCollateral.ts",
"Builders.ts",
"LightMigrator.ts",
"DelayVaultProvider.ts",
"DelayVaultProvider.ts"
]

const menuItems = [
Expand All @@ -37,24 +39,27 @@ async function displayMenu() {
await deployAllContracts()
break
case menuItems[1].name:
await deployVaultAndLockDealNFT()
await deployMoonbeam()
break
case menuItems[2].name:
await deploySimpleProviders()
await deployVaultAndLockDealNFT()
break
case menuItems[3].name:
await deployRefundProvider()
await deploySimpleProviders()
break
case menuItems[4].name:
await deployRefundAndCollateral()
await deployRefundProvider()
break
case menuItems[5].name:
await deployBuilders()
await deployRefundAndCollateral()
break
case menuItems[6].name:
await deployLightMigrator()
await deployBuilders()
break
case menuItems[7].name:
await deployLightMigrator()
break
case menuItems[8].name:
await deployDelayProviderAndMigrator()
break
default:
Expand Down
5 changes: 5 additions & 0 deletions scripts/utility/deployment/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ export async function deployDelayProviderAndMigrator() {
export async function deployAllContracts() {
process.env.BASEURI = await getBaseURI();
await executeScript("AllContracts", "scripts/deploy.ts");
}

export async function deployMoonbeam() {
process.env.BASEURI = await getBaseURI();
await executeScript("Moonbeam", "scripts/moonbeam.ts");
}

0 comments on commit 5d66467

Please sign in to comment.