Skip to content

Commit

Permalink
refactor: deploy xvs separately
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Nov 17, 2023
1 parent 262db17 commit 2d2e9ee
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 86 deletions.
67 changes: 0 additions & 67 deletions deploy/007-deploy-vaults.ts

This file was deleted.

19 changes: 19 additions & 0 deletions deploy/007-deploy-xvs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

await deploy("XVS", {
from: deployer,
args: [deployer],
log: true,
autoMine: true,
});
};

func.tags = ["xvs"];

export default func;
18 changes: 9 additions & 9 deletions deploy/008-deploy-vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
)
: await deployments.get("AccessControlManager");

// Become Implementation of XVSVaultProxy
await xvsVaultProxy._setPendingImplementation(xvsVaultAddress);
await xvsVault._become(xvsVaultProxyAddress);
let txn = await xvsVault.setXvsStore(xvs.address, xvsStore.address);
await txn.wait(1);
txn = await xvsVault.setAccessControl(accessControlManager.address);
await txn.wait(1);
// Become Implementation of XVSVaultProxy
await xvsVaultProxy._setPendingImplementation(xvsVaultAddress);
await xvsVault._become(xvsVaultProxyAddress);

let txn = await xvsVault.setXvsStore(xvs.address, xvsStore.address);
await txn.wait(1);

txn = await xvsVault.setAccessControl(accessControlManager.address);
await txn.wait(1);

// Set new owner to xvs store
await xvsStore.setNewOwner(xvsVaultAddress);
Expand Down
20 changes: 10 additions & 10 deletions deploy/008-configure-vaults.ts → deploy/009-configure-vaults.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { ethers } from 'hardhat';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { getNamedAccounts } = hre;
const { deployer } = await getNamedAccounts();

const accessControlManager = await ethers.getContract('AccessControlManager');
const xvsVault = await ethers.getContract('XVSVault');
const xvs = await ethers.getContract('XVS');
const accessControlManager = await ethers.getContract("AccessControlManager");
const xvsVault = await ethers.getContract("XVSVault");
const xvs = await ethers.getContract("XVS");

const tx = await accessControlManager.giveCallPermission(
ethers.constants.AddressZero,
'add(address,uint256,address,uint256,uint256)',
"add(address,uint256,address,uint256,uint256)",
deployer,
);
await tx.wait();

// Add token pool to xvs vault
const allocPoint = 100;
const token = xvs.address;
const rewardToken = xvs.address;
const rewardPerBlock = '61805555555555555';
const rewardPerBlock = "61805555555555555";
const lockPeriod = 604800;

await xvsVault.add(rewardToken, allocPoint, token, rewardPerBlock, lockPeriod);
};

func.tags = ['xvs-vault'];
func.tags = ["xvs-vault"];

export default func;

0 comments on commit 2d2e9ee

Please sign in to comment.