diff --git a/hardhat.config.ts b/hardhat.config.ts index bf106c3..79beba4 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -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: { diff --git a/scripts/terminal.ts b/scripts/terminal.ts index aac33d0..b29a7b4 100644 --- a/scripts/terminal.ts +++ b/scripts/terminal.ts @@ -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 = [ @@ -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: diff --git a/scripts/utility/deployment/execute.ts b/scripts/utility/deployment/execute.ts index 9cc834b..135bc27 100644 --- a/scripts/utility/deployment/execute.ts +++ b/scripts/utility/deployment/execute.ts @@ -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"); } \ No newline at end of file diff --git a/scripts/withoutRefund.ts b/scripts/withoutRefund.ts new file mode 100644 index 0000000..1b29d06 --- /dev/null +++ b/scripts/withoutRefund.ts @@ -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() + } +}