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

add settings #15

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
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
17 changes: 4 additions & 13 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
VaultManager,
DelayVaultMigrator,
} from "../typechain-types"
import { v1DelayVaultTestnet, POOLXTestnet } from "./utility/constants"
import { v1DelayVault, POOLX } from "./utility/constants"
import { deploy, delayVaultSettings } from "./utility/deployment"

async function deployAllContracts(baseURI: string = "") {
Expand All @@ -24,22 +24,13 @@ async function deployAllContracts(baseURI: string = "") {
const lockProvider: LockDealProvider = await deploy("LockDealProvider", lockDealNFT.address, dealProvider.address)

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

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

// Deploy DelayVaultProvider contract
await deploy(
"DelayVaultProvider",
POOLXTestnet,
migrator.address,
delayVaultSettings(dealProvider.address, lockProvider.address, timedDealProvider.address)
)
await deploy("DelayVaultProvider", POOLX, migrator.address, delayVaultSettings(lockProvider.address))

// Deploy CollateralProvider contract
const collateralProvider: CollateralProvider = await deploy(
Expand Down
21 changes: 10 additions & 11 deletions scripts/utility/deployment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ethers } from "hardhat"
import { IDelayVaultProvider } from "../../typechain-types"
import { gasLimit, gasPrice, POOLXTestnet } from "./constants"
import { gasLimit, gasPrice } from "./constants"
import { utils, Wallet } from "ethers"

export const deploy = async <T>(contractName: string, ...args: any[]): Promise<T> => {
Expand All @@ -23,17 +22,17 @@ export async function deployFrom<T>(contractName: string, user: Wallet, ...args:
// ["0x999a76a387ad9d199544cfbafad1673a2c39aa11", [604800, 2419200], "20000000000000000000000"],
// ]

export function delayVaultSettings(dealProvider: string, lockProvider: string, timedDealProvider: string) {
const tier1 = utils.parseUnits("250", 18)
const tier2 = utils.parseUnits("3500", 18)
export function delayVaultSettings(lockProvider: string) {
const tier1 = utils.parseUnits("3499", 18)
const tier2 = utils.parseUnits("19999", 18)
const tier3 = utils.parseUnits("20000", 18)
const ONE_DAY = 86400
const week = ONE_DAY * 7
const startTime = week
const finishTime = week * 4
const tier1Timer = ONE_DAY * 10
const tier2Timer = ONE_DAY * 20
const tier3Timer = ONE_DAY * 30
return [
{ provider: dealProvider, params: [], limit: tier1 },
{ provider: lockProvider, params: [startTime], limit: tier2 },
{ provider: timedDealProvider, params: [startTime, finishTime], limit: tier3 },
{ provider: lockProvider, params: [tier1Timer], limit: tier1 },
{ provider: lockProvider, params: [tier2Timer], limit: tier2 },
{ provider: lockProvider, params: [tier3Timer], limit: tier3 },
]
}