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

[VEN-2245]: XVSVault Upgrade adding integration of the TimeManager contract #145

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
771 changes: 771 additions & 0 deletions simulations/vip-223/vip-223-testnet/abi/xvsVault.json

Large diffs are not rendered by default.

246 changes: 246 additions & 0 deletions simulations/vip-223/vip-223-testnet/abi/xvsVaultProxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
[
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "error",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "info",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "detail",
"type": "uint256"
}
],
"name": "Failure",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oldAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "NewAdmin",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oldImplementation",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "NewImplementation",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oldPendingAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newPendingAdmin",
"type": "address"
}
],
"name": "NewPendingAdmin",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oldPendingImplementation",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newPendingImplementation",
"type": "address"
}
],
"name": "NewPendingImplementation",
"type": "event"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"constant": false,
"inputs": [],
"name": "_acceptAdmin",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "_acceptImplementation",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "newPendingAdmin",
"type": "address"
}
],
"name": "_setPendingAdmin",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "newPendingImplementation",
"type": "address"
}
],
"name": "_setPendingImplementation",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "pendingAdmin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "pendingXVSVaultImplementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
57 changes: 57 additions & 0 deletions simulations/vip-223/vip-223-testnet/simulation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { expect } from "chai";
import { ethers } from "hardhat";

import { expectEvents } from "../../../src/utils";
import { forking, testVip } from "../../../src/vip-framework";
import { checkCorePoolComptroller } from "../../../src/vip-framework/checks/checkCorePoolComptroller";
import { checkXVSVault } from "../../../src/vip-framework/checks/checkXVSVault";
import { vip223Testnet } from "../../../vips/vip-223/vip-223-testnet";
import XVS_VAULT_PROXY_ABI from "./abi/xvsVaultProxy.json";

const XVS_VAULT_PROXY = "0x9aB56bAD2D7631B2A857ccf36d998232A8b82280";
const XVS_VAULT_NEW_IMPLEMENTATION = "0x9801565BE8fe2c9fD12C17992ecDeb510BaF677A";
const XVS_VAULT_OLD_IMPLEMENTATION = "0x0fDBe58BbF3190D21a0589D0A448682D68De66a2";

forking(36346450, () => {
describe("Pre-VIP behavior", async () => {
let xvsVaultProxy: ethers.Contract;
const provider = ethers.provider;

before(async () => {
xvsVaultProxy = new ethers.Contract(XVS_VAULT_PROXY, XVS_VAULT_PROXY_ABI, provider);
});

it("should have the old implementation", async () => {
expect(await xvsVaultProxy.implementation()).to.be.equal(XVS_VAULT_OLD_IMPLEMENTATION);
});

describe("generic tests", async () => {
checkCorePoolComptroller();
checkXVSVault();
});
});

testVip("VIP-223Testnet Upgrdae XVS Vault", vip223Testnet(), {
callbackAfterExecution: async txResponse => {
await expectEvents(txResponse, [XVS_VAULT_PROXY_ABI], ["NewImplementation"], [1]);
},
});

describe("Post-VIP behavior", async () => {
let xvsVaultProxy: ethers.Contract;
const provider = ethers.provider;

before(async () => {
xvsVaultProxy = new ethers.Contract(XVS_VAULT_PROXY, XVS_VAULT_PROXY_ABI, provider);
});

it("should have the new implementation", async () => {
expect(await xvsVaultProxy.implementation()).to.be.equal(XVS_VAULT_NEW_IMPLEMENTATION);
});

describe("generic tests", async () => {
checkCorePoolComptroller();
checkXVSVault();
});
});
});
6 changes: 4 additions & 2 deletions src/networkAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const NETWORK_ADDRESSES = {
ETH_CHAINLINK_FEED: "0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e",
USDT_CHAINLINK_FEED: "0xB97Ad0E74fa7d920791E90258A6E2085088b4320",
CHAINLINK_ORACLE: "0x1B2103441A0A108daD8848D8F5d790e4D402921F",
GENERIC_TEST_USER_ACCOUNT: "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb",
GENERIC_TEST_COMPTROLLER_USER_ACCOUNT: "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb",
GENERIC_TEST_XVS_VAULT_USER_ACCOUNT: "0xB745A2BAc46D68bdECD023C867773627D48fE1A1",
XVS_VAULT_PROXY: bscmainnet_deployed_contracts.contracts.XVSVaultProxy.address,
XVS: bscmainnet_deployed_contracts.contracts.XVS.address,
},
Expand All @@ -25,7 +26,8 @@ export const NETWORK_ADDRESSES = {
USDT_CHAINLINK_FEED: "0xEca2605f0BCF2BA5966372C99837b1F182d3D620",
CHAINLINK_ORACLE: "0xCeA29f1266e880A1482c06eD656cD08C148BaA32",
COMPTROLLER_LENS: "0x350d56985A269C148648207E4Cea9f87656E762a",
GENERIC_TEST_USER_ACCOUNT: "0x80dd0cB9c1EB88356bA5dd39161E391ACcF3FbCa",
GENERIC_TEST_COMPTROLLER_USER_ACCOUNT: "0x80dd0cB9c1EB88356bA5dd39161E391ACcF3FbCa",
GENERIC_TEST_XVS_VAULT_USER_ACCOUNT: "0xB745A2BAc46D68bdECD023C867773627D48fE1A1",
XVS_VAULT_PROXY: bsctestnet_deployed_contracts.contracts.XVSVaultProxy.address,
XVS: bsctestnet_deployed_contracts.contracts.XVS.address,
},
Expand Down
Loading