diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index 6c22f6556..759ec6ea0 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -58,6 +58,7 @@ forking(33043237, () => { redeemAmount, vToken, underlying, + true, ); const state = await fetchVTokenStorageIL(vToken, user.address); @@ -107,6 +108,7 @@ forking(33043237, () => { redeemAmount, vToken, underlying, + true, ); const state = await fetchVTokenStorageIL(vToken, user.address); diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index 9c3db6519..c1db515ac 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -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; @@ -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); @@ -56,6 +62,7 @@ forking(33155924, () => { redeemAmount, vToken, underlying, + market.isMock, ); const state = await fetchVTokenStorageCore(vToken, user.address); @@ -97,7 +104,7 @@ forking(33155924, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [6, 6, 6, 6], + [10, 10, 10, 10], ); }, }); @@ -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); @@ -130,6 +142,7 @@ forking(33155924, () => { redeemAmount, vToken, underlying, + market.isMock, ); const state = await fetchVTokenStorageCore(vToken, user.address); diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts index 18fa4198e..eae34e997 100644 --- a/src/vtokenUpgradesHelper.ts +++ b/src/vtokenUpgradesHelper.ts @@ -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(); @@ -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) { diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index 9936b72fb..75cb7051a 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -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, }, ];