Skip to content

Commit

Permalink
feat: add more markets in core testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Sep 14, 2023
1 parent 1436f70 commit b14dbd0
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 5 deletions.
2 changes: 2 additions & 0 deletions simulations/vip-170/vip-170-testnet/simulations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ forking(33043237, () => {
redeemAmount,
vToken,
underlying,
true,
);
const state = await fetchVTokenStorageIL(vToken, user.address);

Expand Down Expand Up @@ -107,6 +108,7 @@ forking(33043237, () => {
redeemAmount,
vToken,
underlying,
true,
);
const state = await fetchVTokenStorageIL(vToken, user.address);

Expand Down
21 changes: 17 additions & 4 deletions simulations/vip-171/vip-171-testnet/simulations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40";
const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327";
const PROTOCOL_SHARE_RESERVE = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f";
const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA";
const TOKEN_HOLDER = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706";

let vToken: ethers.Contract;
let underlying: ethers.Contract;
Expand All @@ -34,11 +35,16 @@ forking(33155924, () => {
before(async () => {
[user] = await ethers.getSigners();
impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3"));
await mine(CORE_MARKETS.length * 4 + 3); // Number of Vip steps
await mine(CORE_MARKETS.length * 4 + 7); // Number of Vip steps
});
for (const market of CORE_MARKETS) {
it(`Save pre VIP storage snapshot of ${market.name}`, async () => {
await setBalance(user.address, ethers.utils.parseEther("5"));
if (!market.isMock) {
user = await initMainnetUser(TOKEN_HOLDER, ethers.utils.parseEther("5"));
} else {
await setBalance(user.address, ethers.utils.parseEther("5"));
}

vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider);
const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider);
underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider);
Expand All @@ -56,6 +62,7 @@ forking(33155924, () => {
redeemAmount,
vToken,
underlying,
market.isMock,
);
const state = await fetchVTokenStorageCore(vToken, user.address);

Expand Down Expand Up @@ -97,7 +104,7 @@ forking(33155924, () => {
txResponse,
[VTOKEN_ABI, ProxyAdminInterface],
["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"],
[6, 6, 6, 6],
[10, 10, 10, 10],
);
},
});
Expand All @@ -112,7 +119,12 @@ forking(33155924, () => {

for (const market of CORE_MARKETS) {
it(`Save post VIP storage snapshot of ${market.name}`, async () => {
await setBalance(user.address, ethers.utils.parseEther("5"));
if (!market.isMock) {
user = await initMainnetUser(TOKEN_HOLDER, ethers.utils.parseEther("5"));
} else {
await setBalance(user.address, ethers.utils.parseEther("5"));
}

vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider);
const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider);
underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider);
Expand All @@ -130,6 +142,7 @@ forking(33155924, () => {
redeemAmount,
vToken,
underlying,
market.isMock,
);
const state = await fetchVTokenStorageCore(vToken, user.address);

Expand Down
3 changes: 2 additions & 1 deletion src/vtokenUpgradesHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const performVTokenBasicActions = async (
redeemAmount: BigNumber,
vToken: ethers.Contract,
underlying: ethers.Contract,
isUnderlyingMock: boolean,
) => {
const underlyingDecimals = await underlying.decimals();
const symbol = await underlying.symbol();
Expand All @@ -139,7 +140,7 @@ export const performVTokenBasicActions = async (
repayAmount = parseUnits("25", 6);
redeemAmount = parseUnits("50", 6);
}
if (process.env.FORK_TESTNET === "true") {
if (process.env.FORK_TESTNET === "true" && isUnderlyingMock) {
try {
await underlying.connect(user).faucet(mintAmount.add(repayAmount));
} catch (error) {
Expand Down
38 changes: 38 additions & 0 deletions vips/vip-171/vip-171-testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,82 @@ interface AssetConfig {
address: string;
reduceReservesBlockDelta: number;
acceptAdmin: boolean;
isMock: boolean; // Defines underlying is MockToken
}

export const CORE_MARKETS: AssetConfig[] = [
{
name: "vETH",
address: "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab",
reduceReservesBlockDelta: 840000,
acceptAdmin: true,
isMock: false,
},

{
name: "vLTC",
address: "0xAfc13BC065ABeE838540823431055D2ea52eBA52",
reduceReservesBlockDelta: 840000,
acceptAdmin: true,
isMock: false,
},

{
name: "VBTC",
address: "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe",
reduceReservesBlockDelta: 840000,
acceptAdmin: true,
isMock: false,
},

{
name: "vXRP",
address: "0x488aB2826a154da01CC4CC16A8C83d4720D3cA2C",
reduceReservesBlockDelta: 840000,
acceptAdmin: true,
isMock: false,
},
{
name: "vSXP",
address: "0x74469281310195A04840Daf6EdF576F559a3dE80",
reduceReservesBlockDelta: 840000,
acceptAdmin: true,
isMock: true,
},
{
name: "vTRX",
address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278",
reduceReservesBlockDelta: 840000,
acceptAdmin: false,
isMock: true,
},
{
name: "vTUSD",
address: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23",
reduceReservesBlockDelta: 840000,
acceptAdmin: false,
isMock: true,
},
{
name: "vUSDC",
address: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7",
reduceReservesBlockDelta: 840000,
acceptAdmin: true,
isMock: true,
},
{
name: "vUSDT",
address: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A",
reduceReservesBlockDelta: 840000,
acceptAdmin: false,
isMock: true,
},
{
name: "vWBETH",
address: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b",
reduceReservesBlockDelta: 840000,
acceptAdmin: false,
isMock: true,
},
];

Expand Down

0 comments on commit b14dbd0

Please sign in to comment.