Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Make SaveWrapper stateless (that is, aside from being `Ownable`) so it can be flexible about assets supported - Define pattern for discrete Hardhat tasks with params - Disable some eslint rules
- Loading branch information
1 parent
fed3f2a
commit 247afab
Showing
10 changed files
with
440 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import "ts-node/register" | ||
import "tsconfig-paths/register" | ||
import { task, types } from "hardhat/config" | ||
import { DEAD_ADDRESS } from "@utils/constants" | ||
|
||
import { params } from "./taskUtils" | ||
import { AssetProxy__factory, BoostedSavingsVault__factory } from "../types/generated" | ||
|
||
task("BoostedSavingsVault.deploy", "Deploys a BoostedSavingsVault") | ||
.addParam("nexus", "Nexus address", undefined, params.address, false) | ||
.addParam("proxyAdmin", "ProxyAdmin address", undefined, params.address, false) | ||
.addParam("rewardsDistributor", "RewardsDistributor address", undefined, params.address, false) | ||
.addParam("stakingToken", "Staking token address", undefined, params.address, false) | ||
.addParam("rewardsToken", "Rewards token address", undefined, params.address, false) | ||
.addParam("vaultName", "Vault name", undefined, types.string, false) | ||
.addParam("vaultSymbol", "Vault symbol", undefined, types.string, false) | ||
.addParam("boostCoefficient", "Boost coefficient", (45).toString(), types.string, false) | ||
.addParam("priceCoefficient", "Price coefficient", (1e18).toString(), types.string, false) | ||
.setAction( | ||
async ( | ||
{ | ||
boostCoefficient, | ||
nexus, | ||
priceCoefficient, | ||
proxyAdmin, | ||
rewardsDistributor, | ||
rewardsToken, | ||
vaultName, | ||
vaultSymbol, | ||
stakingToken, | ||
}: { | ||
boostCoefficient: string | ||
nexus: string | ||
priceCoefficient: string | ||
proxyAdmin: string | ||
rewardsDistributor: string | ||
rewardsToken: string | ||
vaultName: string | ||
vaultSymbol: string | ||
stakingToken: string | ||
}, | ||
{ ethers }, | ||
) => { | ||
const [deployer] = await ethers.getSigners() | ||
|
||
const implementation = await new BoostedSavingsVault__factory(deployer).deploy( | ||
nexus, | ||
stakingToken, | ||
DEAD_ADDRESS, | ||
priceCoefficient, | ||
boostCoefficient, | ||
rewardsToken, | ||
) | ||
const receipt = await implementation.deployTransaction.wait() | ||
console.log(`Deployed Vault Implementation to ${implementation.address}. gas used ${receipt.gasUsed}`) | ||
|
||
const data = implementation.interface.encodeFunctionData("initialize", [rewardsDistributor, vaultName, vaultSymbol]) | ||
|
||
const assetProxy = await new AssetProxy__factory(deployer).deploy(implementation.address, proxyAdmin, data) | ||
const assetProxyDeployReceipt = await assetProxy.deployTransaction.wait() | ||
|
||
await new BoostedSavingsVault__factory(deployer).attach(assetProxy.address) | ||
|
||
console.log(`Deployed Vault Proxy to ${assetProxy.address}. gas used ${assetProxyDeployReceipt.gasUsed}`) | ||
}, | ||
) | ||
|
||
export {} |
Oops, something went wrong.