Skip to content

Commit

Permalink
Merge pull request #37 from The-Poolz/moonbeam
Browse files Browse the repository at this point in the history
add menu item `deploy core contracts without refund` 1642919062
  • Loading branch information
YouStillAlive authored Sep 27, 2024
2 parents 438cfb0 + c644d84 commit 9e27ffb
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '@nomicfoundation/hardhat-chai-matchers';
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
solidity: {
version: "0.8.24",
version: "0.8.26",
settings: {
evmVersion: 'istanbul',
optimizer: {
Expand Down
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,
deployWithoutRefund
} from "./utility/deployment/execute"

const scriptPaths = [
"withoutRefund.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 deployWithoutRefund()
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 deployWithoutRefund() {
process.env.BASEURI = await getBaseURI();
await executeScript("deploy core contracts without Refund", "scripts/withoutRefund.ts");
}
51 changes: 51 additions & 0 deletions scripts/withoutRefund.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 deployAllContractsWithoutRefund(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 || ""

deployAllContractsWithoutRefund(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()
}
}

0 comments on commit 9e27ffb

Please sign in to comment.