Skip to content

Commit

Permalink
refactor: use xvs vault proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Oct 19, 2023
1 parent 6292f1b commit d9b5025
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
14 changes: 8 additions & 6 deletions deploy/017-vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,25 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
autoMine: true,
});

const xvsVault = await ethers.getContract('XVSVault');
let xvsVault = await ethers.getContract('XVSVault');
const xvsStore = await ethers.getContract('XVSStore');
const xvsVaultProxy = await ethers.getContract('XVSVaultProxy');
const accessControlManager = await ethers.getContract('AccessControlManager');

// Become Implementation of XVSVaultProxy
await xvsVaultProxy._setPendingImplementation(xvsVaultAddress);
await xvsVault._become(xvsVaultProxyAddress);

xvsVault = await ethers.getContractAt('XVSVault', xvsVaultProxyAddress);

let txn = await xvsVault.setXvsStore(xvsAddress, 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);

// Set new owner to xvs store
await xvsStore.setNewOwner(xvsVaultAddress);
await xvsStore.setNewOwner(xvsVaultProxyAddress);
};

func.tags = ['XVS vault'];
Expand Down
3 changes: 2 additions & 1 deletion deploy/019-configure-vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await getNamedAccounts();

const accessControlManager = await ethers.getContract('AccessControlManager');
const xvsVault = await ethers.getContract('XVSVault');
const xvsVaultProxy = await ethers.getContract('XVSVaultProxy');
const xvsVault = await ethers.getContractAt('XVSVault', xvsVaultProxy.address);
const xvs = await ethers.getContract('XVS');

const tx = await accessControlManager.giveCallPermission(
Expand Down
3 changes: 2 additions & 1 deletion subgraphs/venus-governance/tests/integration/utils/voter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ethers } from 'hardhat';

export async function enfranchiseAccount(account: any, amount: BigNumber) {
const xvs = await ethers.getContract('XVS');
const xvsVault = await ethers.getContract('XVSVault');
const xvsVaultProxy = await ethers.getContract('XVSVaultProxy');
const xvsVault = await ethers.getContractAt('XVSVault', xvsVaultProxy.address);

await xvs.connect(account).approve(xvsVault.address, amount.toFixed());

Expand Down
3 changes: 2 additions & 1 deletion subgraphs/venus-governance/tests/integration/xvsVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe('XVS Vault and Delegation', function () {
signers = await ethers.getSigners();

xvs = await ethers.getContract('XVS');
xvsVault = await ethers.getContract('XVSVault');
const xvsVaultProxy = await ethers.getContract('XVSVaultProxy');
xvsVault = await ethers.getContractAt('XVSVault', xvsVaultProxy.address);

await waitForSubgraphToBeSynced(SYNC_DELAY);
});
Expand Down

0 comments on commit d9b5025

Please sign in to comment.