Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move console.log to deployed function #4

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,52 @@ import {
LockDealNFT,
DealProvider,
LockDealProvider,
TimedDealProvider,
CollateralProvider,
RefundProvider,
VaultManager,
SimpleBuilder,
SimpleRefundBuilder,
} from "../typechain-types"
import { ethers } from "hardhat"

export const deployed = async <T>(contractName: string, ...args: string[]): Promise<T> => {
const Contract = await ethers.getContractFactory(contractName)
const contract = await Contract.deploy(...args)
console.log(`${contractName} contract deployed to ${contract.address}`)
return contract.deployed() as Promise<T>
}

async function deployAllContracts() {
const vaultManager: VaultManager = await deployed("VaultManager")
console.log(`VaultManager contract deployed to ${vaultManager.address}`)

const baseURI = "https://nft.poolz.finance/test/metadata/"

// Deploy LockDealNFT contract
const lockDealNFT: LockDealNFT = await deployed("LockDealNFT", vaultManager.address, baseURI)
console.log(`LockDealNFT contract deployed to ${lockDealNFT.address} with vaultManager ${vaultManager.address}`)

// Deploy DealProvider contract
const dealProvider: DealProvider = await deployed("DealProvider", lockDealNFT.address)
console.log(`DealProvider contract deployed to ${dealProvider.address} with lockDealNFT ${lockDealNFT.address}`)

// Deploy LockDealProvider contract
const lockProvider: LockDealProvider = await deployed("LockDealProvider", lockDealNFT.address, dealProvider.address)
console.log(`LockDealProvider contract deployed to ${lockProvider.address}`)

// Deploy TimedDealProvider contract
const timedDealProvider: TimedDealProvider = await deployed(
"TimedDealProvider",
lockDealNFT.address,
lockProvider.address
)
console.log(`TimedDealProvider contract deployed to ${timedDealProvider.address}`)
await deployed("TimedDealProvider", lockDealNFT.address, lockProvider.address)

// Deploy CollateralProvider contract
const collateralProvider: CollateralProvider = await deployed(
"CollateralProvider",
lockDealNFT.address,
dealProvider.address
)
console.log(`CollateralProvider contract deployed to ${collateralProvider.address}`)

// Deploy RefundProvider contract
const refundProvider: RefundProvider = await deployed(
"RefundProvider",
lockDealNFT.address,
collateralProvider.address
)
console.log(`RefundProvider contract deployed to ${refundProvider.address}`)

// Deploy Buiders
const simpleBuilder: SimpleBuilder = await deployed("SimpleBuilder", lockDealNFT.address)
console.log("Simple Builder deployed to", simpleBuilder.address)

const simpleRefundBuilder: SimpleRefundBuilder = await deployed(
"SimpleRefundBuilder",
lockDealNFT.address,
refundProvider.address,
collateralProvider.address
)
console.log("Simple Refund Builder deployed to", simpleRefundBuilder.address)
await deployed("SimpleBuilder", lockDealNFT.address)
await deployed("SimpleRefundBuilder", lockDealNFT.address, refundProvider.address, collateralProvider.address)
}

deployAllContracts().catch((error) => {
Expand Down