From cbcf728730237f285b9420503ba9473ab531edd3 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 2 Aug 2023 18:03:37 +0100 Subject: [PATCH 01/55] feat: simulation and vip for testnet --- .../vip-152/vip-152-testnet/abi/vBNB.json | 1 + .../vip-152/vip-152-testnet/simulation.ts | 48 +++++++++++++++++ vips/vip-152/vip-152-testnet.ts | 53 +++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 simulations/vip-152/vip-152-testnet/abi/vBNB.json create mode 100644 simulations/vip-152/vip-152-testnet/simulation.ts create mode 100644 vips/vip-152/vip-152-testnet.ts diff --git a/simulations/vip-152/vip-152-testnet/abi/vBNB.json b/simulations/vip-152/vip-152-testnet/abi/vBNB.json new file mode 100644 index 000000000..f572dd13b --- /dev/null +++ b/simulations/vip-152/vip-152-testnet/abi/vBNB.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"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":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","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":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","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":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isVToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract VToken","name":"vTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"repayBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"repayBorrowBehalf","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts new file mode 100644 index 000000000..e97655fb0 --- /dev/null +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -0,0 +1,48 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; + +import { forking, testVip } from "../../../src/vip-framework"; +import { vip152Testnet } from "../../../vips/vip-152/vip-152-testnet"; +import vBNB_ABI from "./abi/vBNB.json" + +const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; +const WBNB_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const vBNB_ADMIN_ADDRESS = ""; +const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const VBNBAdmin_IMPLEMENTATION = "0x81d8560bb3686f6578e99f93387CCb9b61F4ddB6"; +const VBNBAdmin_ADDRESS = "0x0CbA1b840cAdBec6cAe82a1c66E5F7C2973767fB" +const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; + +forking(32099629, () => { + const provider = ethers.provider; + + describe("Pre-VIP behavior", async () => { + let vBNB: ethers.Contract; + + before(async () => { + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(CURRENT_ADMIN); + }); + }); + + testVip("VIP-152", vip152Testnet()); + + describe("Post-VIP behavior", async () => { + let vBNB: ethers.Contract; + + before(async () => { + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(VBNBAdmin_ADDRESS); + }); + }); +}); diff --git a/vips/vip-152/vip-152-testnet.ts b/vips/vip-152/vip-152-testnet.ts new file mode 100644 index 000000000..1d5e419e1 --- /dev/null +++ b/vips/vip-152/vip-152-testnet.ts @@ -0,0 +1,53 @@ +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; +const WBNB_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const vBNB_ADMIN_ADDRESS = ""; +const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const VBNBAdmin_IMPLEMENTATION = "0x81d8560bb3686f6578e99f93387CCb9b61F4ddB6"; +const VBNBAdmin_ADDRESS = "0x0CbA1b840cAdBec6cAe82a1c66E5F7C2973767fB" + +export const vip152Testnet = () => { + const meta = { + version: "v2", + title: "Change vBNB admin to vBNBAdmin", + description: ``, + forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin", + againstDescription: "I do not think that Venus Protocol should proceed with setting the vBNB admin", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin", + }; + + return makeProposal( + [ + // this step is only required for testnet because vBNB admin in testnet is an EOA instead of normal timelock + { + target: vBNB_ADDRESS, + signature: "_acceptAdmin()", + params: [], + }, + // this step is to make timelock the admin of vBNBAdmin contract. For this step to work, we must make sure we have + // invoked vBNBAdmin.transferOwnership(timelockAddress) after deploying the vBNBAdmin contract + { + target: VBNBAdmin_ADDRESS, + signature: "acceptOwnership()", + params: [], + }, + { + target: vBNB_ADDRESS, + signature: "_setPendingAdmin(address)", + params: [VBNBAdmin_ADDRESS], + }, + { + target: VBNBAdmin_ADDRESS, + signature: "_acceptAdmin()", + params: [], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From 53c98445b726e5b633c92b70c6e743cb5e01d896 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Thu, 3 Aug 2023 12:56:31 +0100 Subject: [PATCH 02/55] feat: added mainnet vip --- simulations/vip-152/vip-152/abi/vBNB.json | 1 + simulations/vip-152/vip-152/simulation.ts | 46 +++++++++++++++++++++++ vips/vip-152/vip-152-testnet.ts | 1 - vips/vip-152/vip-152.ts | 44 ++++++++++++++++++++++ 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 simulations/vip-152/vip-152/abi/vBNB.json create mode 100644 simulations/vip-152/vip-152/simulation.ts create mode 100644 vips/vip-152/vip-152.ts diff --git a/simulations/vip-152/vip-152/abi/vBNB.json b/simulations/vip-152/vip-152/abi/vBNB.json new file mode 100644 index 000000000..f572dd13b --- /dev/null +++ b/simulations/vip-152/vip-152/abi/vBNB.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"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":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","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":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","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":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isVToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract VToken","name":"vTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"repayBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"repayBorrowBehalf","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts new file mode 100644 index 000000000..fe17d4353 --- /dev/null +++ b/simulations/vip-152/vip-152/simulation.ts @@ -0,0 +1,46 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; + +import { forking, testVip } from "../../../src/vip-framework"; +import vBNB_ABI from "./abi/vBNB.json" +import { vip152 } from "../../../vips/vip-152/vip-152"; + +const COMPTROLLER_ADDRESS = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; +const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; +const VTOKEN_TREASURY_ADDRESS = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; +const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const VBNBAdmin_IMPLEMENTATION = "0xAD50B75ae062c9853725ed88eF1E220C0bC44753"; +const VBNBAdmin_ADDRESS = "0x027a815a6825eE98F3dFe57e10B7f354038DEa67" + +forking(30529081, () => { + const provider = ethers.provider; + + describe("Pre-VIP behavior", async () => { + let vBNB: ethers.Contract; + + before(async () => { + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(NORMAL_TIMELOCK); + }); + }); + + testVip("VIP-152", vip152()); + + describe("Post-VIP behavior", async () => { + let vBNB: ethers.Contract; + + before(async () => { + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(VBNBAdmin_ADDRESS); + }); + }); +}); diff --git a/vips/vip-152/vip-152-testnet.ts b/vips/vip-152/vip-152-testnet.ts index 1d5e419e1..a28bf5c80 100644 --- a/vips/vip-152/vip-152-testnet.ts +++ b/vips/vip-152/vip-152-testnet.ts @@ -5,7 +5,6 @@ const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; const WBNB_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const vBNB_ADMIN_ADDRESS = ""; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const VBNBAdmin_IMPLEMENTATION = "0x81d8560bb3686f6578e99f93387CCb9b61F4ddB6"; diff --git a/vips/vip-152/vip-152.ts b/vips/vip-152/vip-152.ts new file mode 100644 index 000000000..5e7a7dac2 --- /dev/null +++ b/vips/vip-152/vip-152.ts @@ -0,0 +1,44 @@ +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const COMPTROLLER_ADDRESS = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; +const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; +const VTOKEN_TREASURY_ADDRESS = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; +const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const VBNBAdmin_IMPLEMENTATION = "0xAD50B75ae062c9853725ed88eF1E220C0bC44753"; +const VBNBAdmin_ADDRESS = "0x027a815a6825eE98F3dFe57e10B7f354038DEa67" + +export const vip152 = () => { + const meta = { + version: "v2", + title: "Change vBNB admin to vBNBAdmin", + description: ``, + forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin", + againstDescription: "I do not think that Venus Protocol should proceed with setting the vBNB admin", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin", + }; + + return makeProposal( + [ + { + target: VBNBAdmin_ADDRESS, + signature: "acceptOwnership()", + params: [], + }, + { + target: vBNB_ADDRESS, + signature: "_setPendingAdmin(address)", + params: [VBNBAdmin_ADDRESS], + }, + { + target: VBNBAdmin_ADDRESS, + signature: "_acceptAdmin()", + params: [], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From 48a7b59f5a4e18540043cfe62b5b3d91b282c4ef Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 8 Aug 2023 12:43:54 +0100 Subject: [PATCH 03/55] fix: make generate vip work with testnet vips --- simulations/vip-152/vip-152-testnet/simulation.ts | 2 +- simulations/vip-152/vip-152/simulation.ts | 2 +- src/transactions.ts | 1 + vips/{vip-152 => }/vip-152-testnet.ts | 4 ++-- vips/{vip-152 => }/vip-152.ts | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) rename vips/{vip-152 => }/vip-152-testnet.ts (95%) rename vips/{vip-152 => }/vip-152.ts (93%) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index e97655fb0..b23254cb9 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -3,7 +3,7 @@ import { Contract } from "ethers"; import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; -import { vip152Testnet } from "../../../vips/vip-152/vip-152-testnet"; +import { vip152Testnet } from "../../../vips/vip-152-testnet"; import vBNB_ABI from "./abi/vBNB.json" const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index fe17d4353..9455c1e19 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -4,7 +4,7 @@ import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import vBNB_ABI from "./abi/vBNB.json" -import { vip152 } from "../../../vips/vip-152/vip-152"; +import { vip152 } from "../../../vips/vip-152"; const COMPTROLLER_ADDRESS = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; diff --git a/src/transactions.ts b/src/transactions.ts index e61d45028..038de8686 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -6,6 +6,7 @@ const DEFAULT_GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; export const loadProposal = async (num: string) => { const x = await import(`../vips/vip-${num}.ts`); + num = num.replace('-testnet', 'Testnet'); return x[`vip${num}`](); }; diff --git a/vips/vip-152/vip-152-testnet.ts b/vips/vip-152-testnet.ts similarity index 95% rename from vips/vip-152/vip-152-testnet.ts rename to vips/vip-152-testnet.ts index a28bf5c80..80717cee8 100644 --- a/vips/vip-152/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -1,5 +1,5 @@ -import { ProposalType } from "../../src/types"; -import { makeProposal } from "../../src/utils"; +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; diff --git a/vips/vip-152/vip-152.ts b/vips/vip-152.ts similarity index 93% rename from vips/vip-152/vip-152.ts rename to vips/vip-152.ts index 5e7a7dac2..8ef06d5dc 100644 --- a/vips/vip-152/vip-152.ts +++ b/vips/vip-152.ts @@ -1,5 +1,5 @@ -import { ProposalType } from "../../src/types"; -import { makeProposal } from "../../src/utils"; +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; const COMPTROLLER_ADDRESS = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; From f4659d75d35e39265ec991a2b8f134f382173a2e Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 11 Aug 2023 12:36:22 +0100 Subject: [PATCH 04/55] fix: set the correct wbnb address --- simulations/vip-152/vip-152-testnet/simulation.ts | 2 +- vips/vip-152-testnet.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index b23254cb9..e6e2a94cd 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -8,7 +8,7 @@ import vBNB_ABI from "./abi/vBNB.json" const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const WBNB_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADMIN_ADDRESS = ""; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 80717cee8..2d48cd0c4 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -3,7 +3,7 @@ import { makeProposal } from "../src/utils"; const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const WBNB_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; From fc4568ef890c42b6bea6000ba0ac8459cd9b25de Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 11 Aug 2023 15:57:48 +0100 Subject: [PATCH 05/55] fix: updated to new contracts --- simulations/vip-152/vip-152-testnet/simulation.ts | 4 ++-- vips/vip-152-testnet.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index e6e2a94cd..aaa5712ec 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -13,8 +13,8 @@ const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADMIN_ADDRESS = ""; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const VBNBAdmin_IMPLEMENTATION = "0x81d8560bb3686f6578e99f93387CCb9b61F4ddB6"; -const VBNBAdmin_ADDRESS = "0x0CbA1b840cAdBec6cAe82a1c66E5F7C2973767fB" +const VBNBAdmin_IMPLEMENTATION = "0x1Fc2687B20333FaC095C4091179D798B664aBb0f"; +const VBNBAdmin_ADDRESS = "0x4C2AEc2606ac6e5d73Cc58f112fcB3AC4607631e" const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; forking(32099629, () => { diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 2d48cd0c4..8cabc42e3 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -7,8 +7,8 @@ const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const VBNBAdmin_IMPLEMENTATION = "0x81d8560bb3686f6578e99f93387CCb9b61F4ddB6"; -const VBNBAdmin_ADDRESS = "0x0CbA1b840cAdBec6cAe82a1c66E5F7C2973767fB" +const VBNBAdmin_IMPLEMENTATION = "0x1Fc2687B20333FaC095C4091179D798B664aBb0f"; +const VBNBAdmin_ADDRESS = "0x4C2AEc2606ac6e5d73Cc58f112fcB3AC4607631e" export const vip152Testnet = () => { const meta = { From 807973dee42b537c38d50a2c376290b695373889 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 11 Aug 2023 15:58:08 +0100 Subject: [PATCH 06/55] updated block number --- simulations/vip-152/vip-152-testnet/simulation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index aaa5712ec..04f59cf10 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -17,7 +17,7 @@ const VBNBAdmin_IMPLEMENTATION = "0x1Fc2687B20333FaC095C4091179D798B664aBb0f"; const VBNBAdmin_ADDRESS = "0x4C2AEc2606ac6e5d73Cc58f112fcB3AC4607631e" const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; -forking(32099629, () => { +forking(32356124, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { From 40af0f911ee87cb8f78a1a8acafc730ebb37fedf Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 11 Aug 2023 15:59:23 +0100 Subject: [PATCH 07/55] fix: update block number --- simulations/vip-152/vip-152-testnet/simulation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index 04f59cf10..63673e69b 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -17,7 +17,7 @@ const VBNBAdmin_IMPLEMENTATION = "0x1Fc2687B20333FaC095C4091179D798B664aBb0f"; const VBNBAdmin_ADDRESS = "0x4C2AEc2606ac6e5d73Cc58f112fcB3AC4607631e" const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; -forking(32356124, () => { +forking(32356229, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { From a2212b8abcffc3808c1c3bb7be3d2cefe4b82803 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 11 Aug 2023 16:58:47 +0100 Subject: [PATCH 08/55] fix: updated addresses --- simulations/vip-152/vip-152-testnet/simulation.ts | 4 ++-- vips/vip-152-testnet.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index 63673e69b..e37970387 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -13,8 +13,8 @@ const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADMIN_ADDRESS = ""; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const VBNBAdmin_IMPLEMENTATION = "0x1Fc2687B20333FaC095C4091179D798B664aBb0f"; -const VBNBAdmin_ADDRESS = "0x4C2AEc2606ac6e5d73Cc58f112fcB3AC4607631e" +const VBNBAdmin_IMPLEMENTATION = "0x1E465fd12a9527E245aE2E8D93c3eab77B19CD61"; +const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96" const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; forking(32356229, () => { diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 8cabc42e3..22be07634 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -7,8 +7,8 @@ const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const VBNBAdmin_IMPLEMENTATION = "0x1Fc2687B20333FaC095C4091179D798B664aBb0f"; -const VBNBAdmin_ADDRESS = "0x4C2AEc2606ac6e5d73Cc58f112fcB3AC4607631e" +const VBNBAdmin_IMPLEMENTATION = "0x1E465fd12a9527E245aE2E8D93c3eab77B19CD61"; +const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96" export const vip152Testnet = () => { const meta = { From e9a4afc853f69a8a1574afdbb6f2ba3b2ec3ac05 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 26 Sep 2023 20:36:50 +0100 Subject: [PATCH 09/55] feat: wip - vip for psr --- simulations/vip-153/.DS_Store | Bin 0 -> 6148 bytes .../vip-153/vip-153-testnet/abi/PSR.json | 760 ++++++++++++++++++ .../vip-153/vip-153-testnet/simulation.ts | 50 ++ vips/vip-153-testnet.ts | 68 ++ 4 files changed, 878 insertions(+) create mode 100644 simulations/vip-153/.DS_Store create mode 100644 simulations/vip-153/vip-153-testnet/abi/PSR.json create mode 100644 simulations/vip-153/vip-153-testnet/simulation.ts create mode 100644 vips/vip-153-testnet.ts diff --git a/simulations/vip-153/.DS_Store b/simulations/vip-153/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e8bb1882247934a6a259f7c3612aaa6714957df5 GIT binary patch literal 6148 zcmeHKyG{c^3>-s>NED=`+#jHb5dA6&U%(F_2nA9^kP@h`;=A%`89xf5gDRql#*%k- zy&j)#it`zOEk0LsUb@Il^B z{+3nVS!cJ}zO0`&o3*FPq<|EV0#ZNmri^|E<6Q*0vSc literal 0 HcmV?d00001 diff --git a/simulations/vip-153/vip-153-testnet/abi/PSR.json b/simulations/vip-153/vip-153-testnet/abi/PSR.json new file mode 100644 index 000000000..397cb46f7 --- /dev/null +++ b/simulations/vip-153/vip-153-testnet/abi/PSR.json @@ -0,0 +1,760 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_corePoolComptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "_wbnb", + "type": "address" + }, + { + "internalType": "address", + "name": "_vbnb", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTotalPercentage", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "percent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "AssetReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IProtocolShareReserve.IncomeType", + "name": "incomeType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "AssetsReservesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "percentage", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldPercentage", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPercentage", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPoolRegistry", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPoolRegistry", + "type": "address" + } + ], + "name": "PoolRegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPrime", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPrime", + "type": "address" + } + ], + "name": "PrimeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "ReservesUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "CORE_POOL_COMPTROLLER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WBNB", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "percentage", + "type": "uint256" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "internalType": "struct ProtocolShareReserve.DistributionConfig[]", + "name": "configs", + "type": "tuple[]" + } + ], + "name": "addOrUpdateDistributionConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "", + "type": "uint8" + } + ], + "name": "assetsReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "distributionTargets", + "outputs": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "percentage", + "type": "uint256" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getUnreleasedFunds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_accessControlManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_loopsLimit", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + } + ], + "name": "releaseFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolRegistry", + "type": "address" + } + ], + "name": "setPoolRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_prime", + "type": "address" + } + ], + "name": "setPrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalAssetReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDistributions", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "enum IProtocolShareReserve.IncomeType", + "name": "incomeType", + "type": "uint8" + } + ], + "name": "updateAssetsState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts new file mode 100644 index 000000000..6001d6a64 --- /dev/null +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -0,0 +1,50 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; + +import { forking, testVip } from "../../../src/vip-framework"; +import { vip152Testnet } from "../../../vips/vip-152-testnet"; +import PSR_ABI from "./abi/PSR.json" +import { vip153Testnet } from "../../../vips/vip-153-testnet"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +const PSR = "0xf5606e1112fb9b7EC270B45C11a6975FdFDa5D68"; + + +forking(33686556, () => { + const provider = ethers.provider; + + describe("Pre-VIP behavior", async () => { + let psr: ethers.Contract; + + before(async () => { + psr = new ethers.Contract(PSR, PSR_ABI, provider); + }); + + it("config check", async () => { + expect((await psr.totalDistributions())).to.be.equal(0); + }); + + it("ownership check", async () => { + expect((await psr.pendingOwner())).to.be.equal(NORMAL_TIMELOCK); + }); + }); + + testVip("VIP-152", vip153Testnet()); + + describe("Post-VIP behavior", async () => { + let psr: ethers.Contract; + + before(async () => { + psr = new ethers.Contract(PSR, PSR_ABI, provider); + }); + + it("config check", async () => { + expect((await psr.totalDistributions())).to.be.equal(1); + }); + + it("ownership check", async () => { + expect((await psr.pendingOwner())).to.be.equal(NORMAL_TIMELOCK); + }); + }); +}); diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts new file mode 100644 index 000000000..6abd58edc --- /dev/null +++ b/vips/vip-153-testnet.ts @@ -0,0 +1,68 @@ +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; + +const PSR = "0xf5606e1112fb9b7EC270B45C11a6975FdFDa5D68"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +export const vip153Testnet = () => { + const meta = { + version: "v2", + title: "Setup Protocol Share Reserve", + description: ``, + forDescription: "I agree that Venus Protocol should proceed with setting the PSR", + againstDescription: "I do not think that Venus Protocol should proceed with setting the PSR", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the PSR", + }; + + return makeProposal( + [ + { + target: PSR, + signature: "acceptOwnership()", + params: [], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], + }, + { + target: PSR, + signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", + params: [[ + [0, 100, "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"], + ]], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From 13de42363ef2a8729634433f922a4a932ca492ae Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 27 Sep 2023 17:22:53 +0100 Subject: [PATCH 10/55] fix: updated contract addresses --- .../vip-153/vip-153-testnet/abi/PSR.json | 143 ++++++++++++++++-- .../vip-153/vip-153-testnet/simulation.ts | 5 +- vips/vip-153-testnet.ts | 2 +- 3 files changed, 136 insertions(+), 14 deletions(-) diff --git a/simulations/vip-153/vip-153-testnet/abi/PSR.json b/simulations/vip-153/vip-153-testnet/abi/PSR.json index 397cb46f7..59cb25b42 100644 --- a/simulations/vip-153/vip-153-testnet/abi/PSR.json +++ b/simulations/vip-153/vip-153-testnet/abi/PSR.json @@ -152,9 +152,9 @@ }, { "indexed": false, - "internalType": "uint256", + "internalType": "uint8", "name": "percentage", - "type": "uint256" + "type": "uint8" }, { "indexed": false, @@ -177,15 +177,40 @@ }, { "indexed": false, - "internalType": "uint256", + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", "name": "oldPercentage", - "type": "uint256" + "type": "uint8" }, { "indexed": false, - "internalType": "uint256", + "internalType": "uint8", "name": "newPercentage", - "type": "uint256" + "type": "uint8" }, { "indexed": false, @@ -305,6 +330,25 @@ "name": "PoolRegistryUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isPrimeAsset", + "type": "bool" + } + ], + "name": "PrimeAssetUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -407,6 +451,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "bool", + "name": "isPrimeAsset", + "type": "bool" + } + ], + "name": "addOrRemoveAssetFromPrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -417,9 +479,9 @@ "type": "uint8" }, { - "internalType": "uint256", + "internalType": "uint8", "name": "percentage", - "type": "uint256" + "type": "uint8" }, { "internalType": "address", @@ -482,9 +544,9 @@ "type": "uint8" }, { - "internalType": "uint256", + "internalType": "uint8", "name": "percentage", - "type": "uint256" + "type": "uint8" }, { "internalType": "address", @@ -495,6 +557,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "getPercentageDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -547,6 +633,25 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isInPrime", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "maxLoopsLimit", @@ -630,6 +735,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "removeDistributionConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "renounceOwnership", diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index 6001d6a64..f2d2e0cfb 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -3,15 +3,14 @@ import { Contract } from "ethers"; import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; -import { vip152Testnet } from "../../../vips/vip-152-testnet"; import PSR_ABI from "./abi/PSR.json" import { vip153Testnet } from "../../../vips/vip-153-testnet"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const PSR = "0xf5606e1112fb9b7EC270B45C11a6975FdFDa5D68"; +const PSR = "0x24b63EA72aFC326deFA526Ed031aedb6a5E0fA4A"; -forking(33686556, () => { +forking(33711562, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 6abd58edc..6f7ceb484 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -1,7 +1,7 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; -const PSR = "0xf5606e1112fb9b7EC270B45C11a6975FdFDa5D68"; +const PSR = "0x24b63EA72aFC326deFA526Ed031aedb6a5E0fA4A"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; From 84227136a570dfef5b01fba747faa4b747ec3f83 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 27 Sep 2023 17:24:20 +0100 Subject: [PATCH 11/55] fix: fixed simulation --- simulations/vip-153/vip-153-testnet/simulation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index f2d2e0cfb..93fb6a42f 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -43,7 +43,8 @@ forking(33711562, () => { }); it("ownership check", async () => { - expect((await psr.pendingOwner())).to.be.equal(NORMAL_TIMELOCK); + expect((await psr.pendingOwner())).to.be.equal("0x0000000000000000000000000000000000000000"); + expect((await psr.owner())).to.be.equal(NORMAL_TIMELOCK); }); }); }); From 3e35f74bb0e2b746dc38234a6448b0f21bdab774 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 27 Sep 2023 18:39:13 +0100 Subject: [PATCH 12/55] feat: completed simulation for testnet --- .../vip-153/vip-153-testnet/simulation.ts | 28 +++++++++++++++++-- vips/vip-153-testnet.ts | 7 ++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index 93fb6a42f..930c11fb7 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -5,8 +5,10 @@ import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import PSR_ABI from "./abi/PSR.json" import { vip153Testnet } from "../../../vips/vip-153-testnet"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const PSR = "0x24b63EA72aFC326deFA526Ed031aedb6a5E0fA4A"; @@ -39,12 +41,34 @@ forking(33711562, () => { }); it("config check", async () => { - expect((await psr.totalDistributions())).to.be.equal(1); + expect((await psr.totalDistributions())).to.be.equal(4); }); it("ownership check", async () => { expect((await psr.pendingOwner())).to.be.equal("0x0000000000000000000000000000000000000000"); expect((await psr.owner())).to.be.equal(NORMAL_TIMELOCK); }); + + it("configurations", async () => { + let config = await psr.distributionTargets(0); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(1); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(TREASURY); + + config = await psr.distributionTargets(2); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(40); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(3); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(60); + expect(config.destination).to.be.equal(TREASURY); + }); }); }); diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 6f7ceb484..55b8f3674 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -6,6 +6,8 @@ const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; export const vip153Testnet = () => { const meta = { @@ -58,7 +60,10 @@ export const vip153Testnet = () => { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", params: [[ - [0, 100, "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"], + [0, 50, RISK_FUND], + [0, 50, TREASURY], + [1, 40, RISK_FUND], + [1, 60, TREASURY], ]], }, ], From 4171e640ac5a71df8dcba0c000c01c30bca43807 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 27 Sep 2023 19:04:11 +0100 Subject: [PATCH 13/55] fix: added mainnet vip --- simulations/vip-152/vip-152/abi/PSR.json | 883 ++++++++++++++++++++++ simulations/vip-152/vip-152/simulation.ts | 54 +- vips/vip-152.ts | 77 +- vips/vip-153-testnet.ts | 15 + 4 files changed, 1015 insertions(+), 14 deletions(-) create mode 100644 simulations/vip-152/vip-152/abi/PSR.json diff --git a/simulations/vip-152/vip-152/abi/PSR.json b/simulations/vip-152/vip-152/abi/PSR.json new file mode 100644 index 000000000..59cb25b42 --- /dev/null +++ b/simulations/vip-152/vip-152/abi/PSR.json @@ -0,0 +1,883 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_corePoolComptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "_wbnb", + "type": "address" + }, + { + "internalType": "address", + "name": "_vbnb", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTotalPercentage", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "percent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "AssetReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IProtocolShareReserve.IncomeType", + "name": "incomeType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "AssetsReservesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "oldPercentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "newPercentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPoolRegistry", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPoolRegistry", + "type": "address" + } + ], + "name": "PoolRegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isPrimeAsset", + "type": "bool" + } + ], + "name": "PrimeAssetUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPrime", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPrime", + "type": "address" + } + ], + "name": "PrimeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "ReservesUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "CORE_POOL_COMPTROLLER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WBNB", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "bool", + "name": "isPrimeAsset", + "type": "bool" + } + ], + "name": "addOrRemoveAssetFromPrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "internalType": "struct ProtocolShareReserve.DistributionConfig[]", + "name": "configs", + "type": "tuple[]" + } + ], + "name": "addOrUpdateDistributionConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "", + "type": "uint8" + } + ], + "name": "assetsReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "distributionTargets", + "outputs": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "getPercentageDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getUnreleasedFunds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_accessControlManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_loopsLimit", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isInPrime", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + } + ], + "name": "releaseFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "removeDistributionConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolRegistry", + "type": "address" + } + ], + "name": "setPoolRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_prime", + "type": "address" + } + ], + "name": "setPrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalAssetReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDistributions", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "enum IProtocolShareReserve.IncomeType", + "name": "incomeType", + "type": "uint8" + } + ], + "name": "updateAssetsState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 9455c1e19..7dbb9945b 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -4,43 +4,85 @@ import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import vBNB_ABI from "./abi/vBNB.json" +import PSR_ABI from "./abi/PSR.json" import { vip152 } from "../../../vips/vip-152"; -const COMPTROLLER_ADDRESS = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; -const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VTOKEN_TREASURY_ADDRESS = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_IMPLEMENTATION = "0xAD50B75ae062c9853725ed88eF1E220C0bC44753"; const VBNBAdmin_ADDRESS = "0x027a815a6825eE98F3dFe57e10B7f354038DEa67" +const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; +const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; +const PSR = "0xd405300699D91ED1D87544a3237713fAe642EE95"; -forking(30529081, () => { +forking(32114884, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { let vBNB: ethers.Contract; + let psr: ethers.Contract; before(async () => { vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + psr = new ethers.Contract(PSR, PSR_ABI, provider); }); it("validate admin", async () => { expect(await vBNB.admin()).to.be.equal(NORMAL_TIMELOCK); }); + + it("config check", async () => { + expect((await psr.totalDistributions())).to.be.equal(0); + }); + + it("ownership check", async () => { + expect((await psr.pendingOwner())).to.be.equal(NORMAL_TIMELOCK); + }); }); testVip("VIP-152", vip152()); describe("Post-VIP behavior", async () => { let vBNB: ethers.Contract; + let psr: ethers.Contract; before(async () => { vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + psr = new ethers.Contract(PSR, PSR_ABI, provider); }); it("validate admin", async () => { expect(await vBNB.admin()).to.be.equal(VBNBAdmin_ADDRESS); }); + + it("config check", async () => { + expect((await psr.totalDistributions())).to.be.equal(4); + }); + + it("ownership check", async () => { + expect((await psr.pendingOwner())).to.be.equal("0x0000000000000000000000000000000000000000"); + expect((await psr.owner())).to.be.equal(NORMAL_TIMELOCK); + }); + + it("configurations", async () => { + let config = await psr.distributionTargets(0); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(1); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(TREASURY); + + config = await psr.distributionTargets(2); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(40); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(3); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(60); + expect(config.destination).to.be.equal(TREASURY); + }); }); }); diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 8ef06d5dc..ae96be83f 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -1,23 +1,24 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; -const COMPTROLLER_ADDRESS = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; -const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VTOKEN_TREASURY_ADDRESS = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_IMPLEMENTATION = "0xAD50B75ae062c9853725ed88eF1E220C0bC44753"; const VBNBAdmin_ADDRESS = "0x027a815a6825eE98F3dFe57e10B7f354038DEa67" +const PSR = "0xd405300699D91ED1D87544a3237713fAe642EE95"; +const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; +const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; +const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; +const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; export const vip152 = () => { const meta = { version: "v2", - title: "Change vBNB admin to vBNBAdmin", + title: "Change vBNB admin to vBNBAdmin and Setup Protocol Share Reserve", description: ``, - forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin", - againstDescription: "I do not think that Venus Protocol should proceed with setting the vBNB admin", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin", + forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", + againstDescription: "I do not think that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin and setting up PSR", }; return makeProposal( @@ -37,6 +38,66 @@ export const vip152 = () => { signature: "_acceptAdmin()", params: [], }, + { + target: PSR, + signature: "acceptOwnership()", + params: [], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], + }, + { + target: PSR, + signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", + params: [[ + [0, 50, RISK_FUND], + [0, 50, TREASURY], + [1, 40, RISK_FUND], + [1, 60, TREASURY], + ]], + }, ], meta, ProposalType.REGULAR, diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 55b8f3674..57378311b 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -56,6 +56,21 @@ export const vip153Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], + }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From 7a7e81ec79fe3cb321c49a4aff76f940a99b8dc6 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 12:11:07 +0100 Subject: [PATCH 14/55] fix: new contracts deployed and transfer ownership to new vBNBAdmin --- .../vip-145/vip-145-testnet/simulation.ts | 2 +- .../vip-152/vip-152-testnet/simulation.ts | 1 - .../vip-152/vip-152/abi/vBNBAdmin.json | 311 ++++++++++++++++++ simulations/vip-152/vip-152/simulation.ts | 15 +- .../vip-153/vip-153-testnet/abi/vBNB.json | 1 + .../vip-153-testnet/abi/vBNBAdmin.json | 311 ++++++++++++++++++ .../vip-153/vip-153-testnet/simulation.ts | 26 +- vips/vip-152.ts | 9 +- vips/vip-153-testnet.ts | 26 +- 9 files changed, 688 insertions(+), 14 deletions(-) create mode 100644 simulations/vip-152/vip-152/abi/vBNBAdmin.json create mode 100644 simulations/vip-153/vip-153-testnet/abi/vBNB.json create mode 100644 simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json diff --git a/simulations/vip-145/vip-145-testnet/simulation.ts b/simulations/vip-145/vip-145-testnet/simulation.ts index 72c1abb32..1161bb29b 100644 --- a/simulations/vip-145/vip-145-testnet/simulation.ts +++ b/simulations/vip-145/vip-145-testnet/simulation.ts @@ -72,7 +72,7 @@ const ilPoolTokens: ILVTokenConfig[] = [ }, ]; -forking(31522791, () => { +forking(33950193, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index e37970387..7c3533170 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -10,7 +10,6 @@ const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const vBNB_ADMIN_ADDRESS = ""; const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const VBNBAdmin_IMPLEMENTATION = "0x1E465fd12a9527E245aE2E8D93c3eab77B19CD61"; diff --git a/simulations/vip-152/vip-152/abi/vBNBAdmin.json b/simulations/vip-152/vip-152/abi/vBNBAdmin.json new file mode 100644 index 000000000..98816958c --- /dev/null +++ b/simulations/vip-152/vip-152/abi/vBNBAdmin.json @@ -0,0 +1,311 @@ +[ + { + "inputs": [ + { + "internalType": "contract VTokenInterface", + "name": "_vBNB", + "type": "address" + }, + { + "internalType": "contract IWBNB", + "name": "_WBNB", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IProtocolShareReserve", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IProtocolShareReserve", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "ProtocolShareReserveUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "WBNB", + "outputs": [ + { + "internalType": "contract IWBNB", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "_protocolShareReserve", + "type": "address" + }, + { + "internalType": "address", + "name": "accessControlManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "reduceReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "protocolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "contract VTokenInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 7dbb9945b..1bbd18466 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -5,16 +5,17 @@ import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import vBNB_ABI from "./abi/vBNB.json" import PSR_ABI from "./abi/PSR.json" +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json" import { vip152 } from "../../../vips/vip-152"; -const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; +const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VBNBAdmin_ADDRESS = "0x027a815a6825eE98F3dFe57e10B7f354038DEa67" +const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648" const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const PSR = "0xd405300699D91ED1D87544a3237713fAe642EE95"; +const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; -forking(32114884, () => { +forking(32364859, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -44,16 +45,22 @@ forking(32114884, () => { describe("Post-VIP behavior", async () => { let vBNB: ethers.Contract; let psr: ethers.Contract; + let vBNBAdmin: ethers.Contract; before(async () => { vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); psr = new ethers.Contract(PSR, PSR_ABI, provider); + vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, provider); }); it("validate admin", async () => { expect(await vBNB.admin()).to.be.equal(VBNBAdmin_ADDRESS); }); + it("validate PSR", async () => { + expect(await vBNBAdmin.protocolShareReserve()).to.be.equal(PSR); + }); + it("config check", async () => { expect((await psr.totalDistributions())).to.be.equal(4); }); diff --git a/simulations/vip-153/vip-153-testnet/abi/vBNB.json b/simulations/vip-153/vip-153-testnet/abi/vBNB.json new file mode 100644 index 000000000..f572dd13b --- /dev/null +++ b/simulations/vip-153/vip-153-testnet/abi/vBNB.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"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":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","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":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","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":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isVToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract VToken","name":"vTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"repayBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"repayBorrowBehalf","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json b/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json new file mode 100644 index 000000000..98816958c --- /dev/null +++ b/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json @@ -0,0 +1,311 @@ +[ + { + "inputs": [ + { + "internalType": "contract VTokenInterface", + "name": "_vBNB", + "type": "address" + }, + { + "internalType": "contract IWBNB", + "name": "_WBNB", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IProtocolShareReserve", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IProtocolShareReserve", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "ProtocolShareReserveUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "WBNB", + "outputs": [ + { + "internalType": "contract IWBNB", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "_protocolShareReserve", + "type": "address" + }, + { + "internalType": "address", + "name": "accessControlManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "reduceReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "protocolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "contract VTokenInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index 930c11fb7..ec94dc919 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -4,21 +4,27 @@ import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import PSR_ABI from "./abi/PSR.json" +import vBNB_ABI from "./abi/vBNB.json" +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json" import { vip153Testnet } from "../../../vips/vip-153-testnet"; +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const PSR = "0x24b63EA72aFC326deFA526Ed031aedb6a5E0fA4A"; +const PSR = "0xa7D2A407A40A071681CeeEaa9C6C59259eaF0597"; +const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; +const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114" - -forking(33711562, () => { +forking(33950199, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { let psr: ethers.Contract; before(async () => { + await impersonateAccount(PROXY_ADMIN); psr = new ethers.Contract(PSR, PSR_ABI, provider); }); @@ -31,13 +37,17 @@ forking(33711562, () => { }); }); - testVip("VIP-152", vip153Testnet()); + testVip("VIP-153", vip153Testnet()); describe("Post-VIP behavior", async () => { let psr: ethers.Contract; + let vBNB: ethers.Contract; + let vBNBAdmin: ethers.Contract; before(async () => { psr = new ethers.Contract(PSR, PSR_ABI, provider); + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, provider); }); it("config check", async () => { @@ -70,5 +80,13 @@ forking(33711562, () => { expect(config.percentage).to.be.equal(60); expect(config.destination).to.be.equal(TREASURY); }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(VBNBAdmin); + }); + + it("validate PSR", async () => { + expect(await vBNBAdmin.protocolShareReserve()).to.be.equal(PSR); + }); }); }); diff --git a/vips/vip-152.ts b/vips/vip-152.ts index ae96be83f..27e4113f2 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -4,8 +4,8 @@ import { makeProposal } from "../src/utils"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0x027a815a6825eE98F3dFe57e10B7f354038DEa67" -const PSR = "0xd405300699D91ED1D87544a3237713fAe642EE95"; +const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648" +const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; @@ -43,6 +43,11 @@ export const vip152 = () => { signature: "acceptOwnership()", params: [], }, + { + target: VBNBAdmin_ADDRESS, + signature: "setProtocolShareReserve(address)", + params: [PSR], + }, { target: ACM, signature: "giveCallPermission(address,string,address)", diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 57378311b..a4f01035c 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -1,18 +1,20 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; -const PSR = "0x24b63EA72aFC326deFA526Ed031aedb6a5E0fA4A"; +const PSR = "0xa7D2A407A40A071681CeeEaa9C6C59259eaF0597"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const VBNBAdmin = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96" +const NEW_VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; export const vip153Testnet = () => { const meta = { version: "v2", - title: "Setup Protocol Share Reserve", + title: "Upgrade vBNBAdmin and Setup Protocol Share Reserve", description: ``, forDescription: "I agree that Venus Protocol should proceed with setting the PSR", againstDescription: "I do not think that Venus Protocol should proceed with setting the PSR", @@ -21,6 +23,26 @@ export const vip153Testnet = () => { return makeProposal( [ + { + target: NEW_VBNBAdmin, + signature: "acceptOwnership()", + params: [], + }, + { + target: VBNBAdmin, + signature: "_setPendingAdmin(address)", + params: [NEW_VBNBAdmin], + }, + { + target: NEW_VBNBAdmin, + signature: "_acceptAdmin()", + params: [], + }, + { + target: NEW_VBNBAdmin, + signature: "setProtocolShareReserve(address)", + params: [PSR], + }, { target: PSR, signature: "acceptOwnership()", From 53978107f4a739666bcbce7524db59bc0d302670 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 12:19:31 +0100 Subject: [PATCH 15/55] chore: fix lint --- .../vip-152/vip-152-testnet/abi/vBNB.json | 631 +++++++++++++++++- .../vip-152/vip-152-testnet/simulation.ts | 11 +- simulations/vip-152/vip-152/abi/PSR.json | 2 +- simulations/vip-152/vip-152/abi/vBNB.json | 631 +++++++++++++++++- .../vip-152/vip-152/abi/vBNBAdmin.json | 2 +- simulations/vip-152/vip-152/simulation.ts | 27 +- .../vip-153/vip-153-testnet/abi/PSR.json | 2 +- .../vip-153/vip-153-testnet/abi/vBNB.json | 631 +++++++++++++++++- .../vip-153-testnet/abi/vBNBAdmin.json | 2 +- .../vip-153/vip-153-testnet/simulation.ts | 29 +- src/transactions.ts | 2 +- vips/vip-152-testnet.ts | 8 +- vips/vip-152.ts | 22 +- vips/vip-153-testnet.ts | 16 +- 14 files changed, 1947 insertions(+), 69 deletions(-) diff --git a/simulations/vip-152/vip-152-testnet/abi/vBNB.json b/simulations/vip-152/vip-152-testnet/abi/vBNB.json index f572dd13b..2a1d8f4e9 100644 --- a/simulations/vip-152/vip-152-testnet/abi/vBNB.json +++ b/simulations/vip-152/vip-152-testnet/abi/vBNB.json @@ -1 +1,630 @@ -[{"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"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":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","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":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","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":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isVToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract VToken","name":"vTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"repayBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"repayBorrowBehalf","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] +[ + { + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "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": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "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": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "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": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "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": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index 7c3533170..ee57964b4 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -1,19 +1,12 @@ import { expect } from "chai"; -import { Contract } from "ethers"; import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import { vip152Testnet } from "../../../vips/vip-152-testnet"; -import vBNB_ABI from "./abi/vBNB.json" +import vBNB_ABI from "./abi/vBNB.json"; -const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const VBNBAdmin_IMPLEMENTATION = "0x1E465fd12a9527E245aE2E8D93c3eab77B19CD61"; -const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96" +const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96"; const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; forking(32356229, () => { diff --git a/simulations/vip-152/vip-152/abi/PSR.json b/simulations/vip-152/vip-152/abi/PSR.json index 59cb25b42..a762e5750 100644 --- a/simulations/vip-152/vip-152/abi/PSR.json +++ b/simulations/vip-152/vip-152/abi/PSR.json @@ -880,4 +880,4 @@ "stateMutability": "view", "type": "function" } -] \ No newline at end of file +] diff --git a/simulations/vip-152/vip-152/abi/vBNB.json b/simulations/vip-152/vip-152/abi/vBNB.json index f572dd13b..2a1d8f4e9 100644 --- a/simulations/vip-152/vip-152/abi/vBNB.json +++ b/simulations/vip-152/vip-152/abi/vBNB.json @@ -1 +1,630 @@ -[{"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"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":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","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":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","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":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isVToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract VToken","name":"vTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"repayBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"repayBorrowBehalf","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] +[ + { + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "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": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "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": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "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": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "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": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-152/vip-152/abi/vBNBAdmin.json b/simulations/vip-152/vip-152/abi/vBNBAdmin.json index 98816958c..51d761754 100644 --- a/simulations/vip-152/vip-152/abi/vBNBAdmin.json +++ b/simulations/vip-152/vip-152/abi/vBNBAdmin.json @@ -308,4 +308,4 @@ "stateMutability": "payable", "type": "receive" } -] \ No newline at end of file +] diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 1bbd18466..3088d5141 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -1,16 +1,15 @@ import { expect } from "chai"; -import { Contract } from "ethers"; import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; -import vBNB_ABI from "./abi/vBNB.json" -import PSR_ABI from "./abi/PSR.json" -import vBNBAdmin_ABI from "./abi/vBNBAdmin.json" import { vip152 } from "../../../vips/vip-152"; +import PSR_ABI from "./abi/PSR.json"; +import vBNB_ABI from "./abi/vBNB.json"; +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648" +const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; @@ -32,11 +31,11 @@ forking(32364859, () => { }); it("config check", async () => { - expect((await psr.totalDistributions())).to.be.equal(0); + expect(await psr.totalDistributions()).to.be.equal(0); }); it("ownership check", async () => { - expect((await psr.pendingOwner())).to.be.equal(NORMAL_TIMELOCK); + expect(await psr.pendingOwner()).to.be.equal(NORMAL_TIMELOCK); }); }); @@ -62,31 +61,31 @@ forking(32364859, () => { }); it("config check", async () => { - expect((await psr.totalDistributions())).to.be.equal(4); + expect(await psr.totalDistributions()).to.be.equal(4); }); it("ownership check", async () => { - expect((await psr.pendingOwner())).to.be.equal("0x0000000000000000000000000000000000000000"); - expect((await psr.owner())).to.be.equal(NORMAL_TIMELOCK); + expect(await psr.pendingOwner()).to.be.equal("0x0000000000000000000000000000000000000000"); + expect(await psr.owner()).to.be.equal(NORMAL_TIMELOCK); }); it("configurations", async () => { - let config = await psr.distributionTargets(0); + let config = await psr.distributionTargets(0); expect(config.schema).to.be.equal(0); expect(config.percentage).to.be.equal(50); expect(config.destination).to.be.equal(RISK_FUND); - config = await psr.distributionTargets(1); + config = await psr.distributionTargets(1); expect(config.schema).to.be.equal(0); expect(config.percentage).to.be.equal(50); expect(config.destination).to.be.equal(TREASURY); - config = await psr.distributionTargets(2); + config = await psr.distributionTargets(2); expect(config.schema).to.be.equal(1); expect(config.percentage).to.be.equal(40); expect(config.destination).to.be.equal(RISK_FUND); - config = await psr.distributionTargets(3); + config = await psr.distributionTargets(3); expect(config.schema).to.be.equal(1); expect(config.percentage).to.be.equal(60); expect(config.destination).to.be.equal(TREASURY); diff --git a/simulations/vip-153/vip-153-testnet/abi/PSR.json b/simulations/vip-153/vip-153-testnet/abi/PSR.json index 59cb25b42..a762e5750 100644 --- a/simulations/vip-153/vip-153-testnet/abi/PSR.json +++ b/simulations/vip-153/vip-153-testnet/abi/PSR.json @@ -880,4 +880,4 @@ "stateMutability": "view", "type": "function" } -] \ No newline at end of file +] diff --git a/simulations/vip-153/vip-153-testnet/abi/vBNB.json b/simulations/vip-153/vip-153-testnet/abi/vBNB.json index f572dd13b..2a1d8f4e9 100644 --- a/simulations/vip-153/vip-153-testnet/abi/vBNB.json +++ b/simulations/vip-153/vip-153-testnet/abi/vBNB.json @@ -1 +1,630 @@ -[{"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"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":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"vTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","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":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","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":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isVToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"contract VToken","name":"vTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"repayBorrow","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"}],"name":"repayBorrowBehalf","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] +[ + { + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "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": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "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": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "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": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "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": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json b/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json index 98816958c..51d761754 100644 --- a/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json +++ b/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json @@ -308,4 +308,4 @@ "stateMutability": "payable", "type": "receive" } -] \ No newline at end of file +] diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index ec94dc919..5fcfeb85f 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -1,13 +1,12 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; -import { Contract } from "ethers"; import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; -import PSR_ABI from "./abi/PSR.json" -import vBNB_ABI from "./abi/vBNB.json" -import vBNBAdmin_ABI from "./abi/vBNBAdmin.json" import { vip153Testnet } from "../../../vips/vip-153-testnet"; -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; +import PSR_ABI from "./abi/PSR.json"; +import vBNB_ABI from "./abi/vBNB.json"; +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; @@ -15,7 +14,7 @@ const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const PSR = "0xa7D2A407A40A071681CeeEaa9C6C59259eaF0597"; const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114" +const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; forking(33950199, () => { const provider = ethers.provider; @@ -29,11 +28,11 @@ forking(33950199, () => { }); it("config check", async () => { - expect((await psr.totalDistributions())).to.be.equal(0); + expect(await psr.totalDistributions()).to.be.equal(0); }); it("ownership check", async () => { - expect((await psr.pendingOwner())).to.be.equal(NORMAL_TIMELOCK); + expect(await psr.pendingOwner()).to.be.equal(NORMAL_TIMELOCK); }); }); @@ -51,31 +50,31 @@ forking(33950199, () => { }); it("config check", async () => { - expect((await psr.totalDistributions())).to.be.equal(4); + expect(await psr.totalDistributions()).to.be.equal(4); }); it("ownership check", async () => { - expect((await psr.pendingOwner())).to.be.equal("0x0000000000000000000000000000000000000000"); - expect((await psr.owner())).to.be.equal(NORMAL_TIMELOCK); + expect(await psr.pendingOwner()).to.be.equal("0x0000000000000000000000000000000000000000"); + expect(await psr.owner()).to.be.equal(NORMAL_TIMELOCK); }); it("configurations", async () => { - let config = await psr.distributionTargets(0); + let config = await psr.distributionTargets(0); expect(config.schema).to.be.equal(0); expect(config.percentage).to.be.equal(50); expect(config.destination).to.be.equal(RISK_FUND); - config = await psr.distributionTargets(1); + config = await psr.distributionTargets(1); expect(config.schema).to.be.equal(0); expect(config.percentage).to.be.equal(50); expect(config.destination).to.be.equal(TREASURY); - config = await psr.distributionTargets(2); + config = await psr.distributionTargets(2); expect(config.schema).to.be.equal(1); expect(config.percentage).to.be.equal(40); expect(config.destination).to.be.equal(RISK_FUND); - config = await psr.distributionTargets(3); + config = await psr.distributionTargets(3); expect(config.schema).to.be.equal(1); expect(config.percentage).to.be.equal(60); expect(config.destination).to.be.equal(TREASURY); diff --git a/src/transactions.ts b/src/transactions.ts index 038de8686..51896ec26 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -6,7 +6,7 @@ const DEFAULT_GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; export const loadProposal = async (num: string) => { const x = await import(`../vips/vip-${num}.ts`); - num = num.replace('-testnet', 'Testnet'); + num = num.replace("-testnet", "Testnet"); return x[`vip${num}`](); }; diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 22be07634..bb60ed86d 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -1,14 +1,8 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; -const COMPTROLLER_ADDRESS = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const VTOKEN_TREASURY_ADDRESS = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const VBNBAdmin_IMPLEMENTATION = "0x1E465fd12a9527E245aE2E8D93c3eab77B19CD61"; -const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96" +const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96"; export const vip152Testnet = () => { const meta = { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 27e4113f2..a42e0896f 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -4,7 +4,7 @@ import { makeProposal } from "../src/utils"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648" +const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648"; const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; @@ -17,8 +17,10 @@ export const vip152 = () => { title: "Change vBNB admin to vBNBAdmin and Setup Protocol Share Reserve", description: ``, forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", - againstDescription: "I do not think that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin and setting up PSR", + againstDescription: + "I do not think that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", + abstainDescription: + "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin and setting up PSR", }; return makeProposal( @@ -96,12 +98,14 @@ export const vip152 = () => { { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", - params: [[ - [0, 50, RISK_FUND], - [0, 50, TREASURY], - [1, 40, RISK_FUND], - [1, 60, TREASURY], - ]], + params: [ + [ + [0, 50, RISK_FUND], + [0, 50, TREASURY], + [1, 40, RISK_FUND], + [1, 60, TREASURY], + ], + ], }, ], meta, diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index a4f01035c..008253126 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -8,7 +8,7 @@ const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; -const VBNBAdmin = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96" +const VBNBAdmin = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96"; const NEW_VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; export const vip153Testnet = () => { @@ -96,12 +96,14 @@ export const vip153Testnet = () => { { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", - params: [[ - [0, 50, RISK_FUND], - [0, 50, TREASURY], - [1, 40, RISK_FUND], - [1, 60, TREASURY], - ]], + params: [ + [ + [0, 50, RISK_FUND], + [0, 50, TREASURY], + [1, 40, RISK_FUND], + [1, 60, TREASURY], + ], + ], }, ], meta, From e412e1c84925bbb7db7aa681e76155660eb282aa Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 15:26:45 +0100 Subject: [PATCH 16/55] fix: updated block number --- simulations/vip-152/vip-152/simulation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 3088d5141..ada7ec830 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -14,7 +14,7 @@ const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; -forking(32364859, () => { +forking(32368819, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { From aa4b2e33b9ffb7898ade9171b0b173fee86a4b5a Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 16:33:25 +0100 Subject: [PATCH 17/55] fix: redeploy PSR for testnet --- simulations/vip-153/vip-153-testnet/simulation.ts | 4 ++-- vips/vip-153-testnet.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index 5fcfeb85f..1cf1f2391 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -11,12 +11,12 @@ import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const PSR = "0xa7D2A407A40A071681CeeEaa9C6C59259eaF0597"; +const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; -forking(33950199, () => { +forking(33969555, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 008253126..230524930 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -1,7 +1,7 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; -const PSR = "0xa7D2A407A40A071681CeeEaa9C6C59259eaF0597"; +const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; From fba800547f3afecae7de42488f6892518786edca Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 16:46:33 +0100 Subject: [PATCH 18/55] fix: updated psr for mainnet --- simulations/vip-152/vip-152/simulation.ts | 4 ++-- vips/vip-152.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index ada7ec830..f04add82d 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -12,9 +12,9 @@ const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; +const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; -forking(32368819, () => { +forking(32370397, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index a42e0896f..53323d755 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -5,7 +5,7 @@ const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648"; -const PSR = "0x4382Da07e0fFba15CbB3F1013EcD56285542d27f"; +const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; From dee5a00fdfd476c5e9588d0ca79bad03d9f4e024 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 20:03:15 +0100 Subject: [PATCH 19/55] fix: fixed mainnet vip --- simulations/vip-152/vip-152/simulation.ts | 4 ++-- vips/vip-152.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index f04add82d..07eb853bd 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -9,12 +9,12 @@ import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648"; +const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; -forking(32370397, () => { +forking(32374397, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 53323d755..df39d4d32 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -4,12 +4,13 @@ import { makeProposal } from "../src/utils"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0xBC612ec01bB52349De615112F65A3DA66fb02648"; +const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; +const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; export const vip152 = () => { const meta = { @@ -107,6 +108,11 @@ export const vip152 = () => { ], ], }, + { + target: PSR, + signature: "setPoolRegistry(address)", + params: [POOL_REGISTRY], + } ], meta, ProposalType.REGULAR, From 1194af1f9818d3681b58bb4a456d6466f272f696 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 6 Oct 2023 20:12:51 +0100 Subject: [PATCH 20/55] fix: fixed testnet vip --- simulations/vip-153/vip-153-testnet/simulation.ts | 4 ++-- vips/vip-152.ts | 2 +- vips/vip-153-testnet.ts | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts index 1cf1f2391..352da671e 100644 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -14,9 +14,9 @@ const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; +const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; -forking(33969555, () => { +forking(33974057, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index df39d4d32..867a42dd9 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -112,7 +112,7 @@ export const vip152 = () => { target: PSR, signature: "setPoolRegistry(address)", params: [POOL_REGISTRY], - } + }, ], meta, ProposalType.REGULAR, diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 230524930..d79532389 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -8,8 +8,9 @@ const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; -const VBNBAdmin = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96"; -const NEW_VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; +const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; +const NEW_VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; export const vip153Testnet = () => { const meta = { @@ -105,6 +106,11 @@ export const vip153Testnet = () => { ], ], }, + { + target: PSR, + signature: "setPoolRegistry(address)", + params: [POOL_REGISTRY], + }, ], meta, ProposalType.REGULAR, From 3b844fede7c23a7ea62747a68c98c78a34d2471f Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 9 Oct 2023 11:36:23 +0100 Subject: [PATCH 21/55] fix: added tests for reduce reserves --- simulations/vip-152/vip-152/abi/ERC20.json | 295 +++++++++++++++++++++ simulations/vip-152/vip-152/simulation.ts | 19 +- 2 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 simulations/vip-152/vip-152/abi/ERC20.json diff --git a/simulations/vip-152/vip-152/abi/ERC20.json b/simulations/vip-152/vip-152/abi/ERC20.json new file mode 100644 index 000000000..374b04c75 --- /dev/null +++ b/simulations/vip-152/vip-152/abi/ERC20.json @@ -0,0 +1,295 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, + { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, + { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } + ], + "name": "MetaTransactionExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERC712_VERSION", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PREDICATE_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "userAddress", "type": "address" }, + { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, + { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, + { "internalType": "uint8", "name": "sigV", "type": "uint8" } + ], + "name": "executeMetaTransaction", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getChainId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeperator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getNonce", + "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "getRoleMember", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleMemberCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 07eb853bd..608468ced 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -6,6 +6,8 @@ import { vip152 } from "../../../vips/vip-152"; import PSR_ABI from "./abi/PSR.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; +import ERC20_ABI from "./abi/ERC20.json"; +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; @@ -13,6 +15,7 @@ const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; +const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; forking(32374397, () => { const provider = ethers.provider; @@ -45,11 +48,16 @@ forking(32374397, () => { let vBNB: ethers.Contract; let psr: ethers.Contract; let vBNBAdmin: ethers.Contract; + let WBNB: ethers.Contract; before(async () => { + impersonateAccount(NORMAL_TIMELOCK); + const signer = await ethers.getSigner(NORMAL_TIMELOCK); + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); - psr = new ethers.Contract(PSR, PSR_ABI, provider); - vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, provider); + psr = new ethers.Contract(PSR, PSR_ABI, signer); + vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, signer); + WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); }); it("validate admin", async () => { @@ -90,5 +98,12 @@ forking(32374397, () => { expect(config.percentage).to.be.equal(60); expect(config.destination).to.be.equal(TREASURY); }); + + it("reduce reserves", async () => { + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); + await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); + // await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]) + }); }); }); From d1555b83bc5fca7e7c5eafe753cfd2f40737d9ca Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 9 Oct 2023 11:48:40 +0100 Subject: [PATCH 22/55] fix: added events --- simulations/vip-152/vip-152/simulation.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 608468ced..f52ecabad 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -1,13 +1,14 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { ethers } from "hardhat"; +import { expectEvents } from "../../../src/utils"; import { forking, testVip } from "../../../src/vip-framework"; import { vip152 } from "../../../vips/vip-152"; +import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; -import ERC20_ABI from "./abi/ERC20.json"; -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; @@ -42,7 +43,15 @@ forking(32374397, () => { }); }); - testVip("VIP-152", vip152()); + testVip("VIP-152", vip152(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [PSR_ABI], ["DistributionConfigAdded"], [4]); + + await expectEvents(txResponse, [vBNBAdmin_ABI], ["ProtocolShareReserveUpdated"], [1]); + + await expectEvents(txResponse, [PSR_ABI], ["PoolRegistryUpdated"], [1]); + }, + }); describe("Post-VIP behavior", async () => { let vBNB: ethers.Contract; From ecfba64a21bca7ee028c60c4a7f2eb2535c4d8b3 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 9 Oct 2023 18:14:38 +0100 Subject: [PATCH 23/55] fix: wip to upgrade risk fund --- simulations/vip-152/vip-152/simulation.ts | 4 +- simulations/vip-154/.DS_Store | Bin 0 -> 6148 bytes .../vip-154/vip-153-testnet/abi/ERC20.json | 295 ++++++ .../vip-154/vip-153-testnet/abi/PSR.json | 883 ++++++++++++++++++ .../vip-154/vip-153-testnet/abi/vBNB.json | 630 +++++++++++++ .../vip-153-testnet/abi/vBNBAdmin.json | 311 ++++++ .../vip-154/vip-153-testnet/simulation.ts | 51 + vips/vip-152.ts | 6 + vips/vip-154-testnet.ts | 28 + 9 files changed, 2206 insertions(+), 2 deletions(-) create mode 100644 simulations/vip-154/.DS_Store create mode 100644 simulations/vip-154/vip-153-testnet/abi/ERC20.json create mode 100644 simulations/vip-154/vip-153-testnet/abi/PSR.json create mode 100644 simulations/vip-154/vip-153-testnet/abi/vBNB.json create mode 100644 simulations/vip-154/vip-153-testnet/abi/vBNBAdmin.json create mode 100644 simulations/vip-154/vip-153-testnet/simulation.ts create mode 100644 vips/vip-154-testnet.ts diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index f52ecabad..66d24595b 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -18,7 +18,7 @@ const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; -forking(32374397, () => { +forking(32457987, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -112,7 +112,7 @@ forking(32374397, () => { expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); - // await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]) + await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]) }); }); }); diff --git a/simulations/vip-154/.DS_Store b/simulations/vip-154/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e8bb1882247934a6a259f7c3612aaa6714957df5 GIT binary patch literal 6148 zcmeHKyG{c^3>-s>NED=`+#jHb5dA6&U%(F_2nA9^kP@h`;=A%`89xf5gDRql#*%k- zy&j)#it`zOEk0LsUb@Il^B z{+3nVS!cJ}zO0`&o3*FPq<|EV0#ZNmri^|E<6Q*0vSc literal 0 HcmV?d00001 diff --git a/simulations/vip-154/vip-153-testnet/abi/ERC20.json b/simulations/vip-154/vip-153-testnet/abi/ERC20.json new file mode 100644 index 000000000..374b04c75 --- /dev/null +++ b/simulations/vip-154/vip-153-testnet/abi/ERC20.json @@ -0,0 +1,295 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, + { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, + { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } + ], + "name": "MetaTransactionExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERC712_VERSION", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PREDICATE_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "userAddress", "type": "address" }, + { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, + { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, + { "internalType": "uint8", "name": "sigV", "type": "uint8" } + ], + "name": "executeMetaTransaction", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getChainId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeperator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getNonce", + "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "getRoleMember", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleMemberCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-154/vip-153-testnet/abi/PSR.json b/simulations/vip-154/vip-153-testnet/abi/PSR.json new file mode 100644 index 000000000..a762e5750 --- /dev/null +++ b/simulations/vip-154/vip-153-testnet/abi/PSR.json @@ -0,0 +1,883 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_corePoolComptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "_wbnb", + "type": "address" + }, + { + "internalType": "address", + "name": "_vbnb", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTotalPercentage", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "percent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "AssetReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum IProtocolShareReserve.IncomeType", + "name": "incomeType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "AssetsReservesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "oldPercentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "newPercentage", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "DistributionConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPoolRegistry", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPoolRegistry", + "type": "address" + } + ], + "name": "PoolRegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isPrimeAsset", + "type": "bool" + } + ], + "name": "PrimeAssetUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPrime", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPrime", + "type": "address" + } + ], + "name": "PrimeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "ReservesUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "CORE_POOL_COMPTROLLER", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WBNB", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "bool", + "name": "isPrimeAsset", + "type": "bool" + } + ], + "name": "addOrRemoveAssetFromPrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "internalType": "struct ProtocolShareReserve.DistributionConfig[]", + "name": "configs", + "type": "tuple[]" + } + ], + "name": "addOrUpdateDistributionConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "", + "type": "uint8" + } + ], + "name": "assetsReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "distributionTargets", + "outputs": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "percentage", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + } + ], + "name": "getPercentageDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getUnreleasedFunds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_accessControlManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_loopsLimit", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isInPrime", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + } + ], + "name": "releaseFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ProtocolShareReserve.Schema", + "name": "schema", + "type": "uint8" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "removeDistributionConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolRegistry", + "type": "address" + } + ], + "name": "setPoolRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_prime", + "type": "address" + } + ], + "name": "setPrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "totalAssetReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDistributions", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "enum IProtocolShareReserve.IncomeType", + "name": "incomeType", + "type": "uint8" + } + ], + "name": "updateAssetsState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-154/vip-153-testnet/abi/vBNB.json b/simulations/vip-154/vip-153-testnet/abi/vBNB.json new file mode 100644 index 000000000..2a1d8f4e9 --- /dev/null +++ b/simulations/vip-154/vip-153-testnet/abi/vBNB.json @@ -0,0 +1,630 @@ +[ + { + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "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": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "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": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "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": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "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": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "mint", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrow", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], + "name": "repayBorrowBehalf", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-154/vip-153-testnet/abi/vBNBAdmin.json b/simulations/vip-154/vip-153-testnet/abi/vBNBAdmin.json new file mode 100644 index 000000000..51d761754 --- /dev/null +++ b/simulations/vip-154/vip-153-testnet/abi/vBNBAdmin.json @@ -0,0 +1,311 @@ +[ + { + "inputs": [ + { + "internalType": "contract VTokenInterface", + "name": "_vBNB", + "type": "address" + }, + { + "internalType": "contract IWBNB", + "name": "_WBNB", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IProtocolShareReserve", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IProtocolShareReserve", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "ProtocolShareReserveUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "WBNB", + "outputs": [ + { + "internalType": "contract IWBNB", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "_protocolShareReserve", + "type": "address" + }, + { + "internalType": "address", + "name": "accessControlManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "reduceReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolShareReserve", + "name": "protocolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "contract VTokenInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/simulations/vip-154/vip-153-testnet/simulation.ts b/simulations/vip-154/vip-153-testnet/simulation.ts new file mode 100644 index 000000000..79d5bf0bb --- /dev/null +++ b/simulations/vip-154/vip-153-testnet/simulation.ts @@ -0,0 +1,51 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + +import { forking, testVip } from "../../../src/vip-framework"; +import { vip154Testnet } from "../../../vips/vip-154-testnet"; +import PSR_ABI from "./abi/PSR.json"; +import vBNB_ABI from "./abi/vBNB.json"; +import ERC20_ABI from "./abi/ERC20.json"; +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; + +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; +const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; +const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; + +forking(33974057, () => { + const provider = ethers.provider; + + describe("Pre-VIP behavior", async () => {}); + + testVip("VIP-154", vip154Testnet()); + + describe("Post-VIP behavior", async () => { + let psr: ethers.Contract; + let vBNB: ethers.Contract; + let vBNBAdmin: ethers.Contract; + let WBNB: ethers.Contract; + + before(async () => { + impersonateAccount(NORMAL_TIMELOCK); + const signer = await ethers.getSigner(NORMAL_TIMELOCK); + + psr = new ethers.Contract(PSR, PSR_ABI, signer); + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, signer); + vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, provider); + WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); + }); + + it("reduce reserves", async () => { + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); + await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); + await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]) + }); + }); +}); diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 867a42dd9..169b47579 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -11,6 +11,7 @@ const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; +const NEW_RISK_FUND_IMPLEMENTATION = "0x470443271a416214841a617cbFB8b2f060dDb830"; export const vip152 = () => { const meta = { @@ -26,6 +27,11 @@ export const vip152 = () => { return makeProposal( [ + { + target: RISK_FUND, + signature: "upgradeTo(address)", + params: [NEW_RISK_FUND_IMPLEMENTATION], + }, { target: VBNBAdmin_ADDRESS, signature: "acceptOwnership()", diff --git a/vips/vip-154-testnet.ts b/vips/vip-154-testnet.ts new file mode 100644 index 000000000..8e7ae4957 --- /dev/null +++ b/vips/vip-154-testnet.ts @@ -0,0 +1,28 @@ +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; + +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const NEW_RISK_FUND_IMPLEMENTATION = "0x50B26c741Db8F45b24498575C203c862Fe70d934"; + +export const vip154Testnet = () => { + const meta = { + version: "v2", + title: "Upgrade Risk Fund", + description: ``, + forDescription: "I agree that Venus Protocol should proceed with upgrading Risk Fund", + againstDescription: "I do not think that Venus Protocol should proceed with upgrading Risk Fund", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with upgrading Risk Fund", + }; + + return makeProposal( + [ + { + target: RISK_FUND, + signature: "upgradeTo(address)", + params: [NEW_RISK_FUND_IMPLEMENTATION], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From e3546d0de51a7396758eeeaee494cd561135835f Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 9 Oct 2023 18:23:42 +0100 Subject: [PATCH 24/55] fix: fixed mainnet testnet --- vips/vip-152.ts | 7 ++++--- vips/vip-154-testnet.ts | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 169b47579..7707e4121 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -12,6 +12,7 @@ const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; const NEW_RISK_FUND_IMPLEMENTATION = "0x470443271a416214841a617cbFB8b2f060dDb830"; +const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4" export const vip152 = () => { const meta = { @@ -28,9 +29,9 @@ export const vip152 = () => { return makeProposal( [ { - target: RISK_FUND, - signature: "upgradeTo(address)", - params: [NEW_RISK_FUND_IMPLEMENTATION], + target: PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], }, { target: VBNBAdmin_ADDRESS, diff --git a/vips/vip-154-testnet.ts b/vips/vip-154-testnet.ts index 8e7ae4957..57a1b68e8 100644 --- a/vips/vip-154-testnet.ts +++ b/vips/vip-154-testnet.ts @@ -3,6 +3,7 @@ import { makeProposal } from "../src/utils"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const NEW_RISK_FUND_IMPLEMENTATION = "0x50B26c741Db8F45b24498575C203c862Fe70d934"; +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91" export const vip154Testnet = () => { const meta = { @@ -17,9 +18,9 @@ export const vip154Testnet = () => { return makeProposal( [ { - target: RISK_FUND, - signature: "upgradeTo(address)", - params: [NEW_RISK_FUND_IMPLEMENTATION], + target: PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], }, ], meta, From 75540890eac1c77c45d36e566596c8b7b56e7400 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 9 Oct 2023 18:43:32 +0100 Subject: [PATCH 25/55] fix: testnet vip fixed --- .../abi/ERC20.json | 0 .../abi/PSR.json | 0 .../abi/vBNB.json | 0 .../abi/vBNBAdmin.json | 0 .../simulation.ts | 20 +++++++++++-------- 5 files changed, 12 insertions(+), 8 deletions(-) rename simulations/vip-154/{vip-153-testnet => vip-154-testnet}/abi/ERC20.json (100%) rename simulations/vip-154/{vip-153-testnet => vip-154-testnet}/abi/PSR.json (100%) rename simulations/vip-154/{vip-153-testnet => vip-154-testnet}/abi/vBNB.json (100%) rename simulations/vip-154/{vip-153-testnet => vip-154-testnet}/abi/vBNBAdmin.json (100%) rename simulations/vip-154/{vip-153-testnet => vip-154-testnet}/simulation.ts (69%) diff --git a/simulations/vip-154/vip-153-testnet/abi/ERC20.json b/simulations/vip-154/vip-154-testnet/abi/ERC20.json similarity index 100% rename from simulations/vip-154/vip-153-testnet/abi/ERC20.json rename to simulations/vip-154/vip-154-testnet/abi/ERC20.json diff --git a/simulations/vip-154/vip-153-testnet/abi/PSR.json b/simulations/vip-154/vip-154-testnet/abi/PSR.json similarity index 100% rename from simulations/vip-154/vip-153-testnet/abi/PSR.json rename to simulations/vip-154/vip-154-testnet/abi/PSR.json diff --git a/simulations/vip-154/vip-153-testnet/abi/vBNB.json b/simulations/vip-154/vip-154-testnet/abi/vBNB.json similarity index 100% rename from simulations/vip-154/vip-153-testnet/abi/vBNB.json rename to simulations/vip-154/vip-154-testnet/abi/vBNB.json diff --git a/simulations/vip-154/vip-153-testnet/abi/vBNBAdmin.json b/simulations/vip-154/vip-154-testnet/abi/vBNBAdmin.json similarity index 100% rename from simulations/vip-154/vip-153-testnet/abi/vBNBAdmin.json rename to simulations/vip-154/vip-154-testnet/abi/vBNBAdmin.json diff --git a/simulations/vip-154/vip-153-testnet/simulation.ts b/simulations/vip-154/vip-154-testnet/simulation.ts similarity index 69% rename from simulations/vip-154/vip-153-testnet/simulation.ts rename to simulations/vip-154/vip-154-testnet/simulation.ts index 79d5bf0bb..98eb89ac0 100644 --- a/simulations/vip-154/vip-153-testnet/simulation.ts +++ b/simulations/vip-154/vip-154-testnet/simulation.ts @@ -13,12 +13,12 @@ const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; -const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; +const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -forking(33974057, () => { +forking(34058573, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => {}); @@ -37,15 +37,19 @@ forking(33974057, () => { psr = new ethers.Contract(PSR, PSR_ABI, signer); vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, signer); - vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, provider); - WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); + vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, signer); + WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, signer); }); it("reduce reserves", async () => { - expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); - await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); - expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); - await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]) + expect(await WBNB.balanceOf(PSR)).to.be.equal("100000"); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); + await vBNBAdmin.reduceReserves("100"); + expect(await WBNB.balanceOf(PSR)).to.be.equal("100100"); + await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]) + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("50050"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000050050"); }); }); }); From 64ce405754db0ec189625d125b02c7616c42064b Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 9 Oct 2023 19:13:36 +0100 Subject: [PATCH 26/55] fix: mainnet vip tests --- simulations/vip-152/vip-152/simulation.ts | 13 +++++++++-- .../vip-154/vip-154-testnet/simulation.ts | 22 ++++++++++++++----- src/vip-framework/index.ts | 2 +- vips/vip-152.ts | 2 +- vips/vip-154-testnet.ts | 2 +- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 66d24595b..a125c6268 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -17,8 +17,9 @@ const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -forking(32457987, () => { +forking(32459234, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -112,7 +113,15 @@ forking(32457987, () => { expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); - await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]) + await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]); + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113267"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113267"); + await vBNBAdmin.reduceReserves("100"); + expect(await WBNB.balanceOf(PSR)).to.be.equal(100); + await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113317"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113317"); }); }); }); diff --git a/simulations/vip-154/vip-154-testnet/simulation.ts b/simulations/vip-154/vip-154-testnet/simulation.ts index 98eb89ac0..1e522f39f 100644 --- a/simulations/vip-154/vip-154-testnet/simulation.ts +++ b/simulations/vip-154/vip-154-testnet/simulation.ts @@ -4,9 +4,9 @@ import { ethers } from "hardhat"; import { forking, testVip } from "../../../src/vip-framework"; import { vip154Testnet } from "../../../vips/vip-154-testnet"; +import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import vBNB_ABI from "./abi/vBNB.json"; -import ERC20_ABI from "./abi/ERC20.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; @@ -19,15 +19,27 @@ const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; forking(34058573, () => { - const provider = ethers.provider; + describe("Pre-VIP behavior", async () => { + let WBNB: ethers.Contract; + + before(async () => { + impersonateAccount(NORMAL_TIMELOCK); + const signer = await ethers.getSigner(NORMAL_TIMELOCK); + + WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, signer); + }); - describe("Pre-VIP behavior", async () => {}); + it("reduce reserves", async () => { + expect(await WBNB.balanceOf(PSR)).to.be.equal("100000"); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); + }); + }); testVip("VIP-154", vip154Testnet()); describe("Post-VIP behavior", async () => { let psr: ethers.Contract; - let vBNB: ethers.Contract; let vBNBAdmin: ethers.Contract; let WBNB: ethers.Contract; @@ -47,7 +59,7 @@ forking(34058573, () => { expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); await vBNBAdmin.reduceReserves("100"); expect(await WBNB.balanceOf(PSR)).to.be.equal("100100"); - await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]) + await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("50050"); expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000050050"); }); diff --git a/src/vip-framework/index.ts b/src/vip-framework/index.ts index 513542553..29a2335cf 100644 --- a/src/vip-framework/index.ts +++ b/src/vip-framework/index.ts @@ -16,7 +16,7 @@ let DELAY_BLOCKS = { }; const VOTING_PERIOD = 28800; -let DEFAULT_PROPOSER_ADDRESS = "0x55A9f5374Af30E3045FB491f1da3C2E8a74d168D"; +let DEFAULT_PROPOSER_ADDRESS = "0x97a32d4506f6a35de68e0680859cdf41d077a9a9"; let GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; let NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 7707e4121..a50a27f50 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -12,7 +12,7 @@ const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; const NEW_RISK_FUND_IMPLEMENTATION = "0x470443271a416214841a617cbFB8b2f060dDb830"; -const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4" +const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; export const vip152 = () => { const meta = { diff --git a/vips/vip-154-testnet.ts b/vips/vip-154-testnet.ts index 57a1b68e8..84c63eb7f 100644 --- a/vips/vip-154-testnet.ts +++ b/vips/vip-154-testnet.ts @@ -3,7 +3,7 @@ import { makeProposal } from "../src/utils"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const NEW_RISK_FUND_IMPLEMENTATION = "0x50B26c741Db8F45b24498575C203c862Fe70d934"; -const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91" +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; export const vip154Testnet = () => { const meta = { From 3191cf1ea37e2573caa4a9e58bb8834c6f3bf330 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 10 Oct 2023 14:12:03 +0100 Subject: [PATCH 27/55] fix: fixed mainnet vip --- simulations/vip-152/vip-152/abi/ProxyAdmin.json | 1 + simulations/vip-152/vip-152/simulation.ts | 16 ++++++++++++++-- vips/vip-152.ts | 14 +++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 simulations/vip-152/vip-152/abi/ProxyAdmin.json diff --git a/simulations/vip-152/vip-152/abi/ProxyAdmin.json b/simulations/vip-152/vip-152/abi/ProxyAdmin.json new file mode 100644 index 000000000..89fe9e59c --- /dev/null +++ b/simulations/vip-152/vip-152/abi/ProxyAdmin.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}] diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index a125c6268..078989c3d 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -9,17 +9,19 @@ import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; +import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; +const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; +const PSR = "0x99C0a8b68fAA4F1245Cd007E16CE4c5Eb2dB2415"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -forking(32459234, () => { +forking(32481975, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -59,6 +61,7 @@ forking(32459234, () => { let psr: ethers.Contract; let vBNBAdmin: ethers.Contract; let WBNB: ethers.Contract; + let proxyAdmin: ethers.Contract; before(async () => { impersonateAccount(NORMAL_TIMELOCK); @@ -68,6 +71,7 @@ forking(32459234, () => { psr = new ethers.Contract(PSR, PSR_ABI, signer); vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, signer); WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); + proxyAdmin = new ethers.Contract(PROXY_ADMIN, PROXY_ADMIN_ABI, provider); }); it("validate admin", async () => { @@ -123,5 +127,13 @@ forking(32459234, () => { expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113317"); expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113317"); }); + + it("validate proxy admin", async () => { + expect(await proxyAdmin.getProxyAdmin(VBNBAdmin_ADDRESS)).to.be.equal(PROXY_ADMIN); + expect(await proxyAdmin.getProxyAdmin(PSR)).to.be.equal(PROXY_ADMIN); + expect(await proxyAdmin.getProxyAdmin(RISK_FUND)).to.be.equal(PROXY_ADMIN); + + expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); + }) }); }); diff --git a/vips/vip-152.ts b/vips/vip-152.ts index a50a27f50..499f56e7e 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -5,7 +5,7 @@ const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; -const PSR = "0x4E5A49Ce81993504327a848167d76212b7a341E2"; +const PSR = "0x99C0a8b68fAA4F1245Cd007E16CE4c5Eb2dB2415"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; @@ -13,6 +13,8 @@ const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; const NEW_RISK_FUND_IMPLEMENTATION = "0x470443271a416214841a617cbFB8b2f060dDb830"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; +const PSR_PROXY_ADMIN = "0x2b19f7301A5c1D90bD83DEe10e33dC3B7A3C0460"; +const VBNBAdmin_PROXY_ADMIN = "0x3f918bA9446552AB184C6Ffd2e2fcB1FA5ee1e59"; export const vip152 = () => { const meta = { @@ -53,6 +55,11 @@ export const vip152 = () => { signature: "acceptOwnership()", params: [], }, + { + target: VBNBAdmin_PROXY_ADMIN, + signature: "changeProxyAdmin(address,address)", + params: [VBNBAdmin_ADDRESS, PROXY_ADMIN], + }, { target: VBNBAdmin_ADDRESS, signature: "setProtocolShareReserve(address)", @@ -103,6 +110,11 @@ export const vip152 = () => { signature: "giveCallPermission(address,string,address)", params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], }, + { + target: PSR_PROXY_ADMIN, + signature: "changeProxyAdmin(address,address)", + params: [PSR, PROXY_ADMIN], + }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From 74c9cbc7b148a3c701375087f439a94c0e414c48 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 10 Oct 2023 14:34:31 +0100 Subject: [PATCH 28/55] fix: update risk fund implementation --- simulations/vip-152/vip-152/simulation.ts | 2 +- vips/vip-152.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 078989c3d..918afeb6e 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -21,7 +21,7 @@ const PSR = "0x99C0a8b68fAA4F1245Cd007E16CE4c5Eb2dB2415"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -forking(32481975, () => { +forking(32482549, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 499f56e7e..65abcdcf0 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -11,7 +11,7 @@ const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; -const NEW_RISK_FUND_IMPLEMENTATION = "0x470443271a416214841a617cbFB8b2f060dDb830"; +const NEW_RISK_FUND_IMPLEMENTATION = "0x0E8Ef0EC1e0C109c5B5249CcefB703A414835eaC"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; const PSR_PROXY_ADMIN = "0x2b19f7301A5c1D90bD83DEe10e33dC3B7A3C0460"; const VBNBAdmin_PROXY_ADMIN = "0x3f918bA9446552AB184C6Ffd2e2fcB1FA5ee1e59"; From 8e030ce25e9d9bb0bb28512f2c424290437130ba Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 10 Oct 2023 15:05:29 +0100 Subject: [PATCH 29/55] fix: added new VIP for testnet --- .../vip-154-testnet/abi/ProxyAdmin.json | 1 + .../vip-154/vip-154-testnet/simulation.ts | 72 +++++++++++--- vips/vip-154-testnet.ts | 98 ++++++++++++++++++- 3 files changed, 156 insertions(+), 15 deletions(-) create mode 100644 simulations/vip-154/vip-154-testnet/abi/ProxyAdmin.json diff --git a/simulations/vip-154/vip-154-testnet/abi/ProxyAdmin.json b/simulations/vip-154/vip-154-testnet/abi/ProxyAdmin.json new file mode 100644 index 000000000..89fe9e59c --- /dev/null +++ b/simulations/vip-154/vip-154-testnet/abi/ProxyAdmin.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}] diff --git a/simulations/vip-154/vip-154-testnet/simulation.ts b/simulations/vip-154/vip-154-testnet/simulation.ts index 1e522f39f..4fcaf0b79 100644 --- a/simulations/vip-154/vip-154-testnet/simulation.ts +++ b/simulations/vip-154/vip-154-testnet/simulation.ts @@ -8,17 +8,19 @@ import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; +import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; -const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; -const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; -const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -forking(34058573, () => { +forking(34082979, () => { describe("Pre-VIP behavior", async () => { let WBNB: ethers.Contract; @@ -29,8 +31,8 @@ forking(34058573, () => { WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, signer); }); - it("reduce reserves", async () => { - expect(await WBNB.balanceOf(PSR)).to.be.equal("100000"); + it("WBNB balances", async () => { + expect(await WBNB.balanceOf(PSR)).to.be.equal("0"); expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); }); @@ -42,6 +44,8 @@ forking(34058573, () => { let psr: ethers.Contract; let vBNBAdmin: ethers.Contract; let WBNB: ethers.Contract; + let vBNB: ethers.Contract; + let proxyAdmin: ethers.Contract; before(async () => { impersonateAccount(NORMAL_TIMELOCK); @@ -51,17 +55,61 @@ forking(34058573, () => { vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, signer); vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, signer); WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, signer); + proxyAdmin = new ethers.Contract(PROXY_ADMIN, PROXY_ADMIN_ABI, signer); + }); + + it("ownership check", async () => { + expect(await psr.pendingOwner()).to.be.equal("0x0000000000000000000000000000000000000000"); + expect(await psr.owner()).to.be.equal(NORMAL_TIMELOCK); + }); + + it("configurations", async () => { + let config = await psr.distributionTargets(0); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(1); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(TREASURY); + + config = await psr.distributionTargets(2); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(40); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(3); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(60); + expect(config.destination).to.be.equal(TREASURY); }); it("reduce reserves", async () => { - expect(await WBNB.balanceOf(PSR)).to.be.equal("100000"); + expect(await WBNB.balanceOf(PSR)).to.be.equal("0"); expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); await vBNBAdmin.reduceReserves("100"); - expect(await WBNB.balanceOf(PSR)).to.be.equal("100100"); + expect(await WBNB.balanceOf(PSR)).to.be.equal("100"); await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("50050"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000050050"); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("50"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000050"); }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(VBNBAdmin); + }); + + it("validate PSR", async () => { + expect(await vBNBAdmin.protocolShareReserve()).to.be.equal(PSR); + }); + + it("validate proxy admin", async () => { + expect(await proxyAdmin.getProxyAdmin(VBNBAdmin)).to.be.equal(PROXY_ADMIN); + expect(await proxyAdmin.getProxyAdmin(PSR)).to.be.equal(PROXY_ADMIN); + expect(await proxyAdmin.getProxyAdmin(RISK_FUND)).to.be.equal(PROXY_ADMIN); + + expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); + }) }); }); diff --git a/vips/vip-154-testnet.ts b/vips/vip-154-testnet.ts index 84c63eb7f..a02bdb999 100644 --- a/vips/vip-154-testnet.ts +++ b/vips/vip-154-testnet.ts @@ -2,13 +2,23 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; -const NEW_RISK_FUND_IMPLEMENTATION = "0x50B26c741Db8F45b24498575C203c862Fe70d934"; +const NEW_RISK_FUND_IMPLEMENTATION = "0x1E7DEC93C77740c2bB46daf87ef42056E388dA14"; const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; +const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const PSR_PROXY_ADMIN = "0xF77810085c7F6323bB19dddaE2d62793E5AE2e3b"; +const VBNBAdmin_PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; export const vip154Testnet = () => { const meta = { version: "v2", - title: "Upgrade Risk Fund", + title: "Upgrade Risk Fund, Deploy new PSR and Change admin of vBNBAdmin", description: ``, forDescription: "I agree that Venus Protocol should proceed with upgrading Risk Fund", againstDescription: "I do not think that Venus Protocol should proceed with upgrading Risk Fund", @@ -22,8 +32,90 @@ export const vip154Testnet = () => { signature: "upgrade(address,address)", params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], }, + { + target: VBNBAdmin, + signature: "setProtocolShareReserve(address)", + params: [PSR], + }, + { + target: PSR, + signature: "acceptOwnership()", + params: [], + }, + { + target: VBNBAdmin_PROXY_ADMIN, + signature: "changeProxyAdmin(address,address)", + params: [VBNBAdmin, PROXY_ADMIN], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], + }, + { + target: PSR_PROXY_ADMIN, + signature: "changeProxyAdmin(address,address)", + params: [PSR, PROXY_ADMIN], + }, + { + target: PSR, + signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", + params: [ + [ + [0, 50, RISK_FUND], + [0, 50, TREASURY], + [1, 40, RISK_FUND], + [1, 60, TREASURY], + ], + ], + }, + { + target: PSR, + signature: "setPoolRegistry(address)", + params: [POOL_REGISTRY], + }, ], meta, ProposalType.REGULAR, ); -}; +}; \ No newline at end of file From 64c32cce3318c90412b457a8e9d905dfee5e4bca Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 10 Oct 2023 16:32:14 +0100 Subject: [PATCH 30/55] fix: vip to reset vBNBAdmin --- .../vip-153/vip-153-testnet/simulation.ts | 91 ------ simulations/{vip-153 => vip-155}/.DS_Store | Bin .../vip-155/vip-155-testnet/abi/ERC20.json | 295 ++++++++++++++++++ .../vip-155-testnet}/abi/PSR.json | 0 .../vip-155-testnet/abi/ProxyAdmin.json | 1 + .../vip-155-testnet}/abi/vBNB.json | 0 .../vip-155-testnet}/abi/vBNBAdmin.json | 0 .../vip-155/vip-155-testnet/simulation.ts | 30 ++ vips/vip-153-testnet.ts | 118 ------- vips/vip-155-testnet.ts | 34 ++ 10 files changed, 360 insertions(+), 209 deletions(-) delete mode 100644 simulations/vip-153/vip-153-testnet/simulation.ts rename simulations/{vip-153 => vip-155}/.DS_Store (100%) create mode 100644 simulations/vip-155/vip-155-testnet/abi/ERC20.json rename simulations/{vip-153/vip-153-testnet => vip-155/vip-155-testnet}/abi/PSR.json (100%) create mode 100644 simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json rename simulations/{vip-153/vip-153-testnet => vip-155/vip-155-testnet}/abi/vBNB.json (100%) rename simulations/{vip-153/vip-153-testnet => vip-155/vip-155-testnet}/abi/vBNBAdmin.json (100%) create mode 100644 simulations/vip-155/vip-155-testnet/simulation.ts delete mode 100644 vips/vip-153-testnet.ts create mode 100644 vips/vip-155-testnet.ts diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts deleted file mode 100644 index 352da671e..000000000 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; -import { expect } from "chai"; -import { ethers } from "hardhat"; - -import { forking, testVip } from "../../../src/vip-framework"; -import { vip153Testnet } from "../../../vips/vip-153-testnet"; -import PSR_ABI from "./abi/PSR.json"; -import vBNB_ABI from "./abi/vBNB.json"; -import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; - -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; -const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; -const PROXY_ADMIN = "0xce10739590001705F7FF231611ba4A48B2820327"; -const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; - -forking(33974057, () => { - const provider = ethers.provider; - - describe("Pre-VIP behavior", async () => { - let psr: ethers.Contract; - - before(async () => { - await impersonateAccount(PROXY_ADMIN); - psr = new ethers.Contract(PSR, PSR_ABI, provider); - }); - - it("config check", async () => { - expect(await psr.totalDistributions()).to.be.equal(0); - }); - - it("ownership check", async () => { - expect(await psr.pendingOwner()).to.be.equal(NORMAL_TIMELOCK); - }); - }); - - testVip("VIP-153", vip153Testnet()); - - describe("Post-VIP behavior", async () => { - let psr: ethers.Contract; - let vBNB: ethers.Contract; - let vBNBAdmin: ethers.Contract; - - before(async () => { - psr = new ethers.Contract(PSR, PSR_ABI, provider); - vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); - vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, provider); - }); - - it("config check", async () => { - expect(await psr.totalDistributions()).to.be.equal(4); - }); - - it("ownership check", async () => { - expect(await psr.pendingOwner()).to.be.equal("0x0000000000000000000000000000000000000000"); - expect(await psr.owner()).to.be.equal(NORMAL_TIMELOCK); - }); - - it("configurations", async () => { - let config = await psr.distributionTargets(0); - expect(config.schema).to.be.equal(0); - expect(config.percentage).to.be.equal(50); - expect(config.destination).to.be.equal(RISK_FUND); - - config = await psr.distributionTargets(1); - expect(config.schema).to.be.equal(0); - expect(config.percentage).to.be.equal(50); - expect(config.destination).to.be.equal(TREASURY); - - config = await psr.distributionTargets(2); - expect(config.schema).to.be.equal(1); - expect(config.percentage).to.be.equal(40); - expect(config.destination).to.be.equal(RISK_FUND); - - config = await psr.distributionTargets(3); - expect(config.schema).to.be.equal(1); - expect(config.percentage).to.be.equal(60); - expect(config.destination).to.be.equal(TREASURY); - }); - - it("validate admin", async () => { - expect(await vBNB.admin()).to.be.equal(VBNBAdmin); - }); - - it("validate PSR", async () => { - expect(await vBNBAdmin.protocolShareReserve()).to.be.equal(PSR); - }); - }); -}); diff --git a/simulations/vip-153/.DS_Store b/simulations/vip-155/.DS_Store similarity index 100% rename from simulations/vip-153/.DS_Store rename to simulations/vip-155/.DS_Store diff --git a/simulations/vip-155/vip-155-testnet/abi/ERC20.json b/simulations/vip-155/vip-155-testnet/abi/ERC20.json new file mode 100644 index 000000000..374b04c75 --- /dev/null +++ b/simulations/vip-155/vip-155-testnet/abi/ERC20.json @@ -0,0 +1,295 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, + { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, + { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } + ], + "name": "MetaTransactionExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERC712_VERSION", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PREDICATE_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "userAddress", "type": "address" }, + { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, + { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, + { "internalType": "uint8", "name": "sigV", "type": "uint8" } + ], + "name": "executeMetaTransaction", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getChainId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeperator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getNonce", + "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "getRoleMember", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleMemberCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-153/vip-153-testnet/abi/PSR.json b/simulations/vip-155/vip-155-testnet/abi/PSR.json similarity index 100% rename from simulations/vip-153/vip-153-testnet/abi/PSR.json rename to simulations/vip-155/vip-155-testnet/abi/PSR.json diff --git a/simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json b/simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json new file mode 100644 index 000000000..89fe9e59c --- /dev/null +++ b/simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}] diff --git a/simulations/vip-153/vip-153-testnet/abi/vBNB.json b/simulations/vip-155/vip-155-testnet/abi/vBNB.json similarity index 100% rename from simulations/vip-153/vip-153-testnet/abi/vBNB.json rename to simulations/vip-155/vip-155-testnet/abi/vBNB.json diff --git a/simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json b/simulations/vip-155/vip-155-testnet/abi/vBNBAdmin.json similarity index 100% rename from simulations/vip-153/vip-153-testnet/abi/vBNBAdmin.json rename to simulations/vip-155/vip-155-testnet/abi/vBNBAdmin.json diff --git a/simulations/vip-155/vip-155-testnet/simulation.ts b/simulations/vip-155/vip-155-testnet/simulation.ts new file mode 100644 index 000000000..360f1e395 --- /dev/null +++ b/simulations/vip-155/vip-155-testnet/simulation.ts @@ -0,0 +1,30 @@ +import { expect } from "chai"; + +import { forking, testVip } from "../../../src/vip-framework"; +import { vip155Testnet } from "../../../vips/vip-155-testnet"; +import vBNB_ABI from "./abi/vBNB.json"; +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; + +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; + +forking(34084829, () => { + const provider = ethers.provider; + + describe("Pre-VIP behavior", async () => { + }); + + testVip("VIP-154", vip155Testnet()); + + describe("Post-VIP behavior", async () => { + let vBNB: ethers.Contract; + before(async () => { + impersonateAccount(NORMAL_TIMELOCK); + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + }); + + it("validate admin", async () => { + expect(await vBNB.admin()).to.be.equal(NORMAL_TIMELOCK); + }); + }); +}); diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts deleted file mode 100644 index d79532389..000000000 --- a/vips/vip-153-testnet.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; - -const PSR = "0xB46BDd025F8FB78eD5174155F74Cb452DF15d6D4"; -const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; -const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; -const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; -const VBNBAdmin = "0x7Ef464ac0BE8A0dC1e90185bf92a20e769f3B114"; -const NEW_VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; -const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; - -export const vip153Testnet = () => { - const meta = { - version: "v2", - title: "Upgrade vBNBAdmin and Setup Protocol Share Reserve", - description: ``, - forDescription: "I agree that Venus Protocol should proceed with setting the PSR", - againstDescription: "I do not think that Venus Protocol should proceed with setting the PSR", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the PSR", - }; - - return makeProposal( - [ - { - target: NEW_VBNBAdmin, - signature: "acceptOwnership()", - params: [], - }, - { - target: VBNBAdmin, - signature: "_setPendingAdmin(address)", - params: [NEW_VBNBAdmin], - }, - { - target: NEW_VBNBAdmin, - signature: "_acceptAdmin()", - params: [], - }, - { - target: NEW_VBNBAdmin, - signature: "setProtocolShareReserve(address)", - params: [PSR], - }, - { - target: PSR, - signature: "acceptOwnership()", - params: [], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], - }, - { - target: PSR, - signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", - params: [ - [ - [0, 50, RISK_FUND], - [0, 50, TREASURY], - [1, 40, RISK_FUND], - [1, 60, TREASURY], - ], - ], - }, - { - target: PSR, - signature: "setPoolRegistry(address)", - params: [POOL_REGISTRY], - }, - ], - meta, - ProposalType.REGULAR, - ); -}; diff --git a/vips/vip-155-testnet.ts b/vips/vip-155-testnet.ts new file mode 100644 index 000000000..95ad966d7 --- /dev/null +++ b/vips/vip-155-testnet.ts @@ -0,0 +1,34 @@ +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; + +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; + +export const vip155Testnet = () => { + const meta = { + version: "v2", + title: "Reset vBNB Admin", + description: ``, + forDescription: "I agree that Venus Protocol should proceed with reset of vBNB Admin", + againstDescription: "I do not think that Venus Protocol should proceed with reset of vBNB Admin", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with reset of vBNB Admin", + }; + + return makeProposal( + [ + { + target: VBNBAdmin, + signature: "_setPendingAdmin(address)", + params: [NORMAL_TIMELOCK], + }, + { + target: vBNB_ADDRESS, + signature: "_acceptAdmin()", + params: [], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; \ No newline at end of file From 8a726b279700ed02b9a46709e3d2104de8edfa08 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 10 Oct 2023 16:38:39 +0100 Subject: [PATCH 31/55] fix: wip - create new testnet vip --- .../vip-152-testnet}/abi/ERC20.json | 0 .../vip-152-testnet}/abi/PSR.json | 0 .../vip-152-testnet}/abi/ProxyAdmin.json | 0 .../vip-152-testnet}/abi/vBNBAdmin.json | 0 .../vip-152/vip-152-testnet/simulation.ts | 111 ++- simulations/vip-154/.DS_Store | Bin 6148 -> 0 bytes .../vip-154/vip-154-testnet/abi/vBNB.json | 630 ------------------ .../vip-154/vip-154-testnet/simulation.ts | 115 ---- vips/vip-152-testnet.ts | 121 +++- vips/vip-154-testnet.ts | 121 ---- 10 files changed, 212 insertions(+), 886 deletions(-) rename simulations/{vip-154/vip-154-testnet => vip-152/vip-152-testnet}/abi/ERC20.json (100%) rename simulations/{vip-154/vip-154-testnet => vip-152/vip-152-testnet}/abi/PSR.json (100%) rename simulations/{vip-154/vip-154-testnet => vip-152/vip-152-testnet}/abi/ProxyAdmin.json (100%) rename simulations/{vip-154/vip-154-testnet => vip-152/vip-152-testnet}/abi/vBNBAdmin.json (100%) delete mode 100644 simulations/vip-154/.DS_Store delete mode 100644 simulations/vip-154/vip-154-testnet/abi/vBNB.json delete mode 100644 simulations/vip-154/vip-154-testnet/simulation.ts delete mode 100644 vips/vip-154-testnet.ts diff --git a/simulations/vip-154/vip-154-testnet/abi/ERC20.json b/simulations/vip-152/vip-152-testnet/abi/ERC20.json similarity index 100% rename from simulations/vip-154/vip-154-testnet/abi/ERC20.json rename to simulations/vip-152/vip-152-testnet/abi/ERC20.json diff --git a/simulations/vip-154/vip-154-testnet/abi/PSR.json b/simulations/vip-152/vip-152-testnet/abi/PSR.json similarity index 100% rename from simulations/vip-154/vip-154-testnet/abi/PSR.json rename to simulations/vip-152/vip-152-testnet/abi/PSR.json diff --git a/simulations/vip-154/vip-154-testnet/abi/ProxyAdmin.json b/simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json similarity index 100% rename from simulations/vip-154/vip-154-testnet/abi/ProxyAdmin.json rename to simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json diff --git a/simulations/vip-154/vip-154-testnet/abi/vBNBAdmin.json b/simulations/vip-152/vip-152-testnet/abi/vBNBAdmin.json similarity index 100% rename from simulations/vip-154/vip-154-testnet/abi/vBNBAdmin.json rename to simulations/vip-152/vip-152-testnet/abi/vBNBAdmin.json diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index ee57964b4..c8afde920 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -1,40 +1,139 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { ethers } from "hardhat"; +import { expectEvents } from "../../../src/utils"; import { forking, testVip } from "../../../src/vip-framework"; -import { vip152Testnet } from "../../../vips/vip-152-testnet"; +import ERC20_ABI from "./abi/ERC20.json"; +import PSR_ABI from "./abi/PSR.json"; import vBNB_ABI from "./abi/vBNB.json"; +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; +import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; +import { vip152Testnet } from "../../../vips/vip-152-testnet"; +const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; +const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96"; -const CURRENT_ADMIN = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; -forking(32356229, () => { +forking(32482549, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { let vBNB: ethers.Contract; + let psr: ethers.Contract; before(async () => { vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + psr = new ethers.Contract(PSR, PSR_ABI, provider); }); it("validate admin", async () => { - expect(await vBNB.admin()).to.be.equal(CURRENT_ADMIN); + expect(await vBNB.admin()).to.be.equal(NORMAL_TIMELOCK); + }); + + it("config check", async () => { + expect(await psr.totalDistributions()).to.be.equal(0); + }); + + it("ownership check", async () => { + expect(await psr.pendingOwner()).to.be.equal(NORMAL_TIMELOCK); }); }); - testVip("VIP-152", vip152Testnet()); + testVip("VIP-152", vip152Testnet(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [PSR_ABI], ["DistributionConfigAdded"], [4]); + + await expectEvents(txResponse, [vBNBAdmin_ABI], ["ProtocolShareReserveUpdated"], [1]); + + await expectEvents(txResponse, [PSR_ABI], ["PoolRegistryUpdated"], [1]); + }, + }); describe("Post-VIP behavior", async () => { let vBNB: ethers.Contract; + let psr: ethers.Contract; + let vBNBAdmin: ethers.Contract; + let WBNB: ethers.Contract; + let proxyAdmin: ethers.Contract; before(async () => { + impersonateAccount(NORMAL_TIMELOCK); + const signer = await ethers.getSigner(NORMAL_TIMELOCK); + vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + psr = new ethers.Contract(PSR, PSR_ABI, signer); + vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, signer); + WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); + proxyAdmin = new ethers.Contract(PROXY_ADMIN, PROXY_ADMIN_ABI, provider); }); it("validate admin", async () => { expect(await vBNB.admin()).to.be.equal(VBNBAdmin_ADDRESS); }); + + it("validate PSR", async () => { + expect(await vBNBAdmin.protocolShareReserve()).to.be.equal(PSR); + }); + + it("config check", async () => { + expect(await psr.totalDistributions()).to.be.equal(4); + }); + + it("ownership check", async () => { + expect(await psr.pendingOwner()).to.be.equal("0x0000000000000000000000000000000000000000"); + expect(await psr.owner()).to.be.equal(NORMAL_TIMELOCK); + }); + + it("configurations", async () => { + let config = await psr.distributionTargets(0); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(1); + expect(config.schema).to.be.equal(0); + expect(config.percentage).to.be.equal(50); + expect(config.destination).to.be.equal(TREASURY); + + config = await psr.distributionTargets(2); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(40); + expect(config.destination).to.be.equal(RISK_FUND); + + config = await psr.distributionTargets(3); + expect(config.schema).to.be.equal(1); + expect(config.percentage).to.be.equal(60); + expect(config.destination).to.be.equal(TREASURY); + }); + + it("reduce reserves", async () => { + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); + await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); + await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]); + expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113267"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113267"); + await vBNBAdmin.reduceReserves("100"); + expect(await WBNB.balanceOf(PSR)).to.be.equal(100); + await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113317"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113317"); + }); + + it("validate proxy admin", async () => { + expect(await proxyAdmin.getProxyAdmin(VBNBAdmin_ADDRESS)).to.be.equal(PROXY_ADMIN); + expect(await proxyAdmin.getProxyAdmin(PSR)).to.be.equal(PROXY_ADMIN); + expect(await proxyAdmin.getProxyAdmin(RISK_FUND)).to.be.equal(PROXY_ADMIN); + + expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); + }) }); }); diff --git a/simulations/vip-154/.DS_Store b/simulations/vip-154/.DS_Store deleted file mode 100644 index e8bb1882247934a6a259f7c3612aaa6714957df5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyG{c^3>-s>NED=`+#jHb5dA6&U%(F_2nA9^kP@h`;=A%`89xf5gDRql#*%k- zy&j)#it`zOEk0LsUb@Il^B z{+3nVS!cJ}zO0`&o3*FPq<|EV0#ZNmri^|E<6Q*0vSc diff --git a/simulations/vip-154/vip-154-testnet/abi/vBNB.json b/simulations/vip-154/vip-154-testnet/abi/vBNB.json deleted file mode 100644 index 2a1d8f4e9..000000000 --- a/simulations/vip-154/vip-154-testnet/abi/vBNB.json +++ /dev/null @@ -1,630 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, - { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, - { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" }, - { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, - { "internalType": "address payable", "name": "admin_", "type": "address" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } - ], - "name": "AccrueInterest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } - ], - "name": "Borrow", - "type": "event" - }, - { - "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": "liquidator", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } - ], - "name": "LiquidateBorrow", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } - ], - "name": "Mint", - "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": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } - ], - "name": "NewComptroller", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract InterestRateModel", - "name": "oldInterestRateModel", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", - "type": "address" - } - ], - "name": "NewMarketInterestRateModel", - "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": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } - ], - "name": "NewReserveFactor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } - ], - "name": "Redeem", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } - ], - "name": "RepayBorrow", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } - ], - "name": "ReservesAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } - ], - "name": "ReservesReduced", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Transfer", - "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": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], - "name": "_reduceReserves", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], - "name": "_setComptroller", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], - "name": "_setInterestRateModel", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], - "name": "_setPendingAdmin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], - "name": "_setReserveFactor", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "accrualBlockNumber", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "accrueInterest", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "admin", - "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], - "name": "balanceOfUnderlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], - "name": "borrow", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "borrowBalanceCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "borrowBalanceStored", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "comptroller", - "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "getAccountSnapshot", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, - { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, - { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" }, - { "internalType": "uint8", "name": "decimals_", "type": "uint8" } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestRateModel", - "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isVToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } - ], - "name": "liquidateBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "mint", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "pendingAdmin", - "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], - "name": "redeem", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], - "name": "redeemUnderlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "repayBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], - "name": "repayBorrowBehalf", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reserveFactorMantissa", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "liquidator", "type": "address" }, - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } - ], - "name": "seize", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "supplyRatePerBlock", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "totalBorrowsCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalReserves", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "dst", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "src", "type": "address" }, - { "internalType": "address", "name": "dst", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/simulations/vip-154/vip-154-testnet/simulation.ts b/simulations/vip-154/vip-154-testnet/simulation.ts deleted file mode 100644 index 4fcaf0b79..000000000 --- a/simulations/vip-154/vip-154-testnet/simulation.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; -import { expect } from "chai"; -import { ethers } from "hardhat"; - -import { forking, testVip } from "../../../src/vip-framework"; -import { vip154Testnet } from "../../../vips/vip-154-testnet"; -import ERC20_ABI from "./abi/ERC20.json"; -import PSR_ABI from "./abi/PSR.json"; -import vBNB_ABI from "./abi/vBNB.json"; -import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; -import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; - -const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; -const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; -const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; - -forking(34082979, () => { - describe("Pre-VIP behavior", async () => { - let WBNB: ethers.Contract; - - before(async () => { - impersonateAccount(NORMAL_TIMELOCK); - const signer = await ethers.getSigner(NORMAL_TIMELOCK); - - WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, signer); - }); - - it("WBNB balances", async () => { - expect(await WBNB.balanceOf(PSR)).to.be.equal("0"); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); - }); - }); - - testVip("VIP-154", vip154Testnet()); - - describe("Post-VIP behavior", async () => { - let psr: ethers.Contract; - let vBNBAdmin: ethers.Contract; - let WBNB: ethers.Contract; - let vBNB: ethers.Contract; - let proxyAdmin: ethers.Contract; - - before(async () => { - impersonateAccount(NORMAL_TIMELOCK); - const signer = await ethers.getSigner(NORMAL_TIMELOCK); - - psr = new ethers.Contract(PSR, PSR_ABI, signer); - vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, signer); - vBNBAdmin = new ethers.Contract(VBNBAdmin, vBNBAdmin_ABI, signer); - WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, signer); - proxyAdmin = new ethers.Contract(PROXY_ADMIN, PROXY_ADMIN_ABI, signer); - }); - - it("ownership check", async () => { - expect(await psr.pendingOwner()).to.be.equal("0x0000000000000000000000000000000000000000"); - expect(await psr.owner()).to.be.equal(NORMAL_TIMELOCK); - }); - - it("configurations", async () => { - let config = await psr.distributionTargets(0); - expect(config.schema).to.be.equal(0); - expect(config.percentage).to.be.equal(50); - expect(config.destination).to.be.equal(RISK_FUND); - - config = await psr.distributionTargets(1); - expect(config.schema).to.be.equal(0); - expect(config.percentage).to.be.equal(50); - expect(config.destination).to.be.equal(TREASURY); - - config = await psr.distributionTargets(2); - expect(config.schema).to.be.equal(1); - expect(config.percentage).to.be.equal(40); - expect(config.destination).to.be.equal(RISK_FUND); - - config = await psr.distributionTargets(3); - expect(config.schema).to.be.equal(1); - expect(config.percentage).to.be.equal(60); - expect(config.destination).to.be.equal(TREASURY); - }); - - it("reduce reserves", async () => { - expect(await WBNB.balanceOf(PSR)).to.be.equal("0"); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); - await vBNBAdmin.reduceReserves("100"); - expect(await WBNB.balanceOf(PSR)).to.be.equal("100"); - await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("50"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000050"); - }); - - it("validate admin", async () => { - expect(await vBNB.admin()).to.be.equal(VBNBAdmin); - }); - - it("validate PSR", async () => { - expect(await vBNBAdmin.protocolShareReserve()).to.be.equal(PSR); - }); - - it("validate proxy admin", async () => { - expect(await proxyAdmin.getProxyAdmin(VBNBAdmin)).to.be.equal(PROXY_ADMIN); - expect(await proxyAdmin.getProxyAdmin(PSR)).to.be.equal(PROXY_ADMIN); - expect(await proxyAdmin.getProxyAdmin(RISK_FUND)).to.be.equal(PROXY_ADMIN); - - expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); - }) - }); -}); diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index bb60ed86d..d00eb61f7 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -1,44 +1,137 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const NEW_RISK_FUND_IMPLEMENTATION = "0x1E7DEC93C77740c2bB46daf87ef42056E388dA14"; +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; +const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const PSR_PROXY_ADMIN = "0xF77810085c7F6323bB19dddaE2d62793E5AE2e3b"; +const VBNBAdmin_PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const VBNBAdmin_ADDRESS = "0x7575D142AAb97229e5928f94c03da39b34Bb0E96"; export const vip152Testnet = () => { const meta = { version: "v2", - title: "Change vBNB admin to vBNBAdmin", + title: "Change vBNB admin to vBNBAdmin and Setup Protocol Share Reserve", description: ``, - forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin", - againstDescription: "I do not think that Venus Protocol should proceed with setting the vBNB admin", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin", + forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", + againstDescription: + "I do not think that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", + abstainDescription: + "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin and setting up PSR", }; return makeProposal( [ - // this step is only required for testnet because vBNB admin in testnet is an EOA instead of normal timelock { - target: vBNB_ADDRESS, - signature: "_acceptAdmin()", - params: [], + target: PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], }, - // this step is to make timelock the admin of vBNBAdmin contract. For this step to work, we must make sure we have - // invoked vBNBAdmin.transferOwnership(timelockAddress) after deploying the vBNBAdmin contract { - target: VBNBAdmin_ADDRESS, + target: VBNBAdmin, signature: "acceptOwnership()", params: [], }, { target: vBNB_ADDRESS, signature: "_setPendingAdmin(address)", - params: [VBNBAdmin_ADDRESS], + params: [VBNBAdmin], }, { - target: VBNBAdmin_ADDRESS, + target: VBNBAdmin, signature: "_acceptAdmin()", params: [], }, + { + target: PSR, + signature: "acceptOwnership()", + params: [], + }, + { + target: VBNBAdmin_PROXY_ADMIN, + signature: "changeProxyAdmin(address,address)", + params: [VBNBAdmin, PROXY_ADMIN], + }, + { + target: VBNBAdmin, + signature: "setProtocolShareReserve(address)", + params: [PSR], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], + }, + { + target: PSR_PROXY_ADMIN, + signature: "changeProxyAdmin(address,address)", + params: [PSR, PROXY_ADMIN], + }, + { + target: PSR, + signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", + params: [ + [ + [0, 50, RISK_FUND], + [0, 50, TREASURY], + [1, 40, RISK_FUND], + [1, 60, TREASURY], + ], + ], + }, + { + target: PSR, + signature: "setPoolRegistry(address)", + params: [POOL_REGISTRY], + }, ], meta, ProposalType.REGULAR, diff --git a/vips/vip-154-testnet.ts b/vips/vip-154-testnet.ts deleted file mode 100644 index a02bdb999..000000000 --- a/vips/vip-154-testnet.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; - -const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; -const NEW_RISK_FUND_IMPLEMENTATION = "0x1E7DEC93C77740c2bB46daf87ef42056E388dA14"; -const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; -const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; -const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; -const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; -const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; -const PSR_PROXY_ADMIN = "0xF77810085c7F6323bB19dddaE2d62793E5AE2e3b"; -const VBNBAdmin_PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; - -export const vip154Testnet = () => { - const meta = { - version: "v2", - title: "Upgrade Risk Fund, Deploy new PSR and Change admin of vBNBAdmin", - description: ``, - forDescription: "I agree that Venus Protocol should proceed with upgrading Risk Fund", - againstDescription: "I do not think that Venus Protocol should proceed with upgrading Risk Fund", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with upgrading Risk Fund", - }; - - return makeProposal( - [ - { - target: PROXY_ADMIN, - signature: "upgrade(address,address)", - params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], - }, - { - target: VBNBAdmin, - signature: "setProtocolShareReserve(address)", - params: [PSR], - }, - { - target: PSR, - signature: "acceptOwnership()", - params: [], - }, - { - target: VBNBAdmin_PROXY_ADMIN, - signature: "changeProxyAdmin(address,address)", - params: [VBNBAdmin, PROXY_ADMIN], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], - }, - { - target: PSR_PROXY_ADMIN, - signature: "changeProxyAdmin(address,address)", - params: [PSR, PROXY_ADMIN], - }, - { - target: PSR, - signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", - params: [ - [ - [0, 50, RISK_FUND], - [0, 50, TREASURY], - [1, 40, RISK_FUND], - [1, 60, TREASURY], - ], - ], - }, - { - target: PSR, - signature: "setPoolRegistry(address)", - params: [POOL_REGISTRY], - }, - ], - meta, - ProposalType.REGULAR, - ); -}; \ No newline at end of file From 08ae6619676833a523c3030a7afea00738e8ffd5 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 10 Oct 2023 17:53:19 +0100 Subject: [PATCH 32/55] fix: vip for testnet completed --- .../vip-152-testnet/abi/ProxyAdmin.json | 77 +- .../vip-152/vip-152-testnet/simulation.ts | 31 +- .../vip-152/vip-152/abi/ProxyAdmin.json | 77 +- simulations/vip-152/vip-152/simulation.ts | 4 +- simulations/vip-155/.DS_Store | Bin 6148 -> 0 bytes .../vip-155/vip-155-testnet/abi/ERC20.json | 295 ------ .../vip-155/vip-155-testnet/abi/PSR.json | 883 ------------------ .../vip-155-testnet/abi/ProxyAdmin.json | 1 - .../vip-155/vip-155-testnet/abi/vBNB.json | 630 ------------- .../vip-155-testnet/abi/vBNBAdmin.json | 311 ------ .../vip-155/vip-155-testnet/simulation.ts | 30 - vips/vip-152-testnet.ts | 5 - vips/vip-155-testnet.ts | 34 - 13 files changed, 168 insertions(+), 2210 deletions(-) delete mode 100644 simulations/vip-155/.DS_Store delete mode 100644 simulations/vip-155/vip-155-testnet/abi/ERC20.json delete mode 100644 simulations/vip-155/vip-155-testnet/abi/PSR.json delete mode 100644 simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json delete mode 100644 simulations/vip-155/vip-155-testnet/abi/vBNB.json delete mode 100644 simulations/vip-155/vip-155-testnet/abi/vBNBAdmin.json delete mode 100644 simulations/vip-155/vip-155-testnet/simulation.ts delete mode 100644 vips/vip-155-testnet.ts diff --git a/simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json b/simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json index 89fe9e59c..9801cfcc7 100644 --- a/simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json +++ b/simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json @@ -1 +1,76 @@ -[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}] +[ + { + "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "changeProxyAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }], + "name": "getProxyAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }], + "name": "getProxyImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "implementation", "type": "address" } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "implementation", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "upgradeAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index c8afde920..62e66a36a 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -4,24 +4,24 @@ import { ethers } from "hardhat"; import { expectEvents } from "../../../src/utils"; import { forking, testVip } from "../../../src/vip-framework"; +import { vip152Testnet } from "../../../vips/vip-152-testnet"; import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; +import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; -import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; -import { vip152Testnet } from "../../../vips/vip-152-testnet"; -const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; -const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; -const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const VBNBAdmin_ADDRESS = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; +const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -forking(32482549, () => { +forking(34086327, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -115,17 +115,14 @@ forking(32482549, () => { it("reduce reserves", async () => { expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); - await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); - expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); - await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]); - expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113267"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113267"); - await vBNBAdmin.reduceReserves("100"); + await vBNBAdmin.reduceReserves(100); expect(await WBNB.balanceOf(PSR)).to.be.equal(100); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("0"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000000"); await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113317"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113317"); + expect(await WBNB.balanceOf(PSR)).to.be.equal(0); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("50"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("100000000000000050"); }); it("validate proxy admin", async () => { @@ -134,6 +131,6 @@ forking(32482549, () => { expect(await proxyAdmin.getProxyAdmin(RISK_FUND)).to.be.equal(PROXY_ADMIN); expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); - }) + }); }); }); diff --git a/simulations/vip-152/vip-152/abi/ProxyAdmin.json b/simulations/vip-152/vip-152/abi/ProxyAdmin.json index 89fe9e59c..9801cfcc7 100644 --- a/simulations/vip-152/vip-152/abi/ProxyAdmin.json +++ b/simulations/vip-152/vip-152/abi/ProxyAdmin.json @@ -1 +1,76 @@ -[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}] +[ + { + "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "changeProxyAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }], + "name": "getProxyAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }], + "name": "getProxyImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "implementation", "type": "address" } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "implementation", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "upgradeAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 918afeb6e..594aa5f5d 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -7,9 +7,9 @@ import { forking, testVip } from "../../../src/vip-framework"; import { vip152 } from "../../../vips/vip-152"; import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; +import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; -import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; @@ -134,6 +134,6 @@ forking(32482549, () => { expect(await proxyAdmin.getProxyAdmin(RISK_FUND)).to.be.equal(PROXY_ADMIN); expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); - }) + }); }); }); diff --git a/simulations/vip-155/.DS_Store b/simulations/vip-155/.DS_Store deleted file mode 100644 index e8bb1882247934a6a259f7c3612aaa6714957df5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyG{c^3>-s>NED=`+#jHb5dA6&U%(F_2nA9^kP@h`;=A%`89xf5gDRql#*%k- zy&j)#it`zOEk0LsUb@Il^B z{+3nVS!cJ}zO0`&o3*FPq<|EV0#ZNmri^|E<6Q*0vSc diff --git a/simulations/vip-155/vip-155-testnet/abi/ERC20.json b/simulations/vip-155/vip-155-testnet/abi/ERC20.json deleted file mode 100644 index 374b04c75..000000000 --- a/simulations/vip-155/vip-155-testnet/abi/ERC20.json +++ /dev/null @@ -1,295 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, - { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, - { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } - ], - "name": "MetaTransactionExecuted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, - { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ERC712_VERSION", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PREDICATE_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "userAddress", "type": "address" }, - { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, - { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, - { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, - { "internalType": "uint8", "name": "sigV", "type": "uint8" } - ], - "name": "executeMetaTransaction", - "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getChainId", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainSeperator", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], - "name": "getNonce", - "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], - "name": "getRoleAdmin", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "uint256", "name": "index", "type": "uint256" } - ], - "name": "getRoleMember", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], - "name": "getRoleMemberCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "hasRole", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "user", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/simulations/vip-155/vip-155-testnet/abi/PSR.json b/simulations/vip-155/vip-155-testnet/abi/PSR.json deleted file mode 100644 index a762e5750..000000000 --- a/simulations/vip-155/vip-155-testnet/abi/PSR.json +++ /dev/null @@ -1,883 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_corePoolComptroller", - "type": "address" - }, - { - "internalType": "address", - "name": "_wbnb", - "type": "address" - }, - { - "internalType": "address", - "name": "_vbnb", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidAddress", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidTotalPercentage", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "loopsLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requiredLoops", - "type": "uint256" - } - ], - "name": "MaxLoopsLimitExceeded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "calledContract", - "type": "address" - }, - { - "internalType": "string", - "name": "methodSignature", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "percent", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "AssetReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "enum IProtocolShareReserve.IncomeType", - "name": "incomeType", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - } - ], - "name": "AssetsReservesUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "percentage", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - } - ], - "name": "DistributionConfigAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "percentage", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - } - ], - "name": "DistributionConfigRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "oldPercentage", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "newPercentage", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - } - ], - "name": "DistributionConfigUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldMaxLoopsLimit", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newmaxLoopsLimit", - "type": "uint256" - } - ], - "name": "MaxLoopsLimitUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldAccessControlManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAccessControlManager", - "type": "address" - } - ], - "name": "NewAccessControlManager", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferStarted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldPoolRegistry", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newPoolRegistry", - "type": "address" - } - ], - "name": "PoolRegistryUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isPrimeAsset", - "type": "bool" - } - ], - "name": "PrimeAssetUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldPrime", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newPrime", - "type": "address" - } - ], - "name": "PrimeUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "oldBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "ReservesUpdated", - "type": "event" - }, - { - "inputs": [], - "name": "CORE_POOL_COMPTROLLER", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "WBNB", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "contract IAccessControlManagerV8", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "bool", - "name": "isPrimeAsset", - "type": "bool" - } - ], - "name": "addOrRemoveAssetFromPrime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "percentage", - "type": "uint8" - }, - { - "internalType": "address", - "name": "destination", - "type": "address" - } - ], - "internalType": "struct ProtocolShareReserve.DistributionConfig[]", - "name": "configs", - "type": "tuple[]" - } - ], - "name": "addOrUpdateDistributionConfigs", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "enum ProtocolShareReserve.Schema", - "name": "", - "type": "uint8" - } - ], - "name": "assetsReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "distributionTargets", - "outputs": [ - { - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "percentage", - "type": "uint8" - }, - { - "internalType": "address", - "name": "destination", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - } - ], - "name": "getPercentageDistribution", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - }, - { - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getUnreleasedFunds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_accessControlManager", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_loopsLimit", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isInPrime", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxLoopsLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "poolRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "prime", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "internalType": "address[]", - "name": "assets", - "type": "address[]" - } - ], - "name": "releaseFunds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ProtocolShareReserve.Schema", - "name": "schema", - "type": "uint8" - }, - { - "internalType": "address", - "name": "destination", - "type": "address" - } - ], - "name": "removeDistributionConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "accessControlManager_", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_poolRegistry", - "type": "address" - } - ], - "name": "setPoolRegistry", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_prime", - "type": "address" - } - ], - "name": "setPrime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalAssetReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalDistributions", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "enum IProtocolShareReserve.IncomeType", - "name": "incomeType", - "type": "uint8" - } - ], - "name": "updateAssetsState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "vBNB", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json b/simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json deleted file mode 100644 index 89fe9e59c..000000000 --- a/simulations/vip-155/vip-155-testnet/abi/ProxyAdmin.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}] diff --git a/simulations/vip-155/vip-155-testnet/abi/vBNB.json b/simulations/vip-155/vip-155-testnet/abi/vBNB.json deleted file mode 100644 index 2a1d8f4e9..000000000 --- a/simulations/vip-155/vip-155-testnet/abi/vBNB.json +++ /dev/null @@ -1,630 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, - { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, - { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" }, - { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, - { "internalType": "address payable", "name": "admin_", "type": "address" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } - ], - "name": "AccrueInterest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } - ], - "name": "Borrow", - "type": "event" - }, - { - "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": "liquidator", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } - ], - "name": "LiquidateBorrow", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } - ], - "name": "Mint", - "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": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } - ], - "name": "NewComptroller", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract InterestRateModel", - "name": "oldInterestRateModel", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", - "type": "address" - } - ], - "name": "NewMarketInterestRateModel", - "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": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } - ], - "name": "NewReserveFactor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } - ], - "name": "Redeem", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } - ], - "name": "RepayBorrow", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } - ], - "name": "ReservesAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } - ], - "name": "ReservesReduced", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Transfer", - "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": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], - "name": "_reduceReserves", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], - "name": "_setComptroller", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], - "name": "_setInterestRateModel", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], - "name": "_setPendingAdmin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], - "name": "_setReserveFactor", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "accrualBlockNumber", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "accrueInterest", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "admin", - "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], - "name": "balanceOfUnderlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], - "name": "borrow", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "borrowBalanceCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "borrowBalanceStored", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowIndex", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "comptroller", - "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "getAccountSnapshot", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, - { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, - { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" }, - { "internalType": "uint8", "name": "decimals_", "type": "uint8" } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "interestRateModel", - "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isVToken", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" } - ], - "name": "liquidateBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "mint", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "pendingAdmin", - "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], - "name": "redeem", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], - "name": "redeemUnderlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "repayBorrow", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "borrower", "type": "address" }], - "name": "repayBorrowBehalf", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "reserveFactorMantissa", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "liquidator", "type": "address" }, - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } - ], - "name": "seize", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "supplyRatePerBlock", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "totalBorrowsCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalReserves", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "dst", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "src", "type": "address" }, - { "internalType": "address", "name": "dst", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/simulations/vip-155/vip-155-testnet/abi/vBNBAdmin.json b/simulations/vip-155/vip-155-testnet/abi/vBNBAdmin.json deleted file mode 100644 index 51d761754..000000000 --- a/simulations/vip-155/vip-155-testnet/abi/vBNBAdmin.json +++ /dev/null @@ -1,311 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract VTokenInterface", - "name": "_vBNB", - "type": "address" - }, - { - "internalType": "contract IWBNB", - "name": "_WBNB", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "calledContract", - "type": "address" - }, - { - "internalType": "string", - "name": "methodSignature", - "type": "string" - } - ], - "name": "Unauthorized", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldAccessControlManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAccessControlManager", - "type": "address" - } - ], - "name": "NewAccessControlManager", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferStarted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IProtocolShareReserve", - "name": "oldProtocolShareReserve", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IProtocolShareReserve", - "name": "newProtocolShareReserve", - "type": "address" - } - ], - "name": "ProtocolShareReserveUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reduceAmount", - "type": "uint256" - } - ], - "name": "ReservesReduced", - "type": "event" - }, - { - "stateMutability": "payable", - "type": "fallback" - }, - { - "inputs": [], - "name": "WBNB", - "outputs": [ - { - "internalType": "contract IWBNB", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "accessControlManager", - "outputs": [ - { - "internalType": "contract IAccessControlManagerV8", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IProtocolShareReserve", - "name": "_protocolShareReserve", - "type": "address" - }, - { - "internalType": "address", - "name": "accessControlManager", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "protocolShareReserve", - "outputs": [ - { - "internalType": "contract IProtocolShareReserve", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reduceAmount", - "type": "uint256" - } - ], - "name": "reduceReserves", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "accessControlManager_", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IProtocolShareReserve", - "name": "protocolShareReserve_", - "type": "address" - } - ], - "name": "setProtocolShareReserve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "vBNB", - "outputs": [ - { - "internalType": "contract VTokenInterface", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/simulations/vip-155/vip-155-testnet/simulation.ts b/simulations/vip-155/vip-155-testnet/simulation.ts deleted file mode 100644 index 360f1e395..000000000 --- a/simulations/vip-155/vip-155-testnet/simulation.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { expect } from "chai"; - -import { forking, testVip } from "../../../src/vip-framework"; -import { vip155Testnet } from "../../../vips/vip-155-testnet"; -import vBNB_ABI from "./abi/vBNB.json"; -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; - -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; - -forking(34084829, () => { - const provider = ethers.provider; - - describe("Pre-VIP behavior", async () => { - }); - - testVip("VIP-154", vip155Testnet()); - - describe("Post-VIP behavior", async () => { - let vBNB: ethers.Contract; - before(async () => { - impersonateAccount(NORMAL_TIMELOCK); - vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); - }); - - it("validate admin", async () => { - expect(await vBNB.admin()).to.be.equal(NORMAL_TIMELOCK); - }); - }); -}); diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index d00eb61f7..91d911a1e 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -35,11 +35,6 @@ export const vip152Testnet = () => { signature: "upgrade(address,address)", params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], }, - { - target: VBNBAdmin, - signature: "acceptOwnership()", - params: [], - }, { target: vBNB_ADDRESS, signature: "_setPendingAdmin(address)", diff --git a/vips/vip-155-testnet.ts b/vips/vip-155-testnet.ts deleted file mode 100644 index 95ad966d7..000000000 --- a/vips/vip-155-testnet.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; - -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; -const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; - -export const vip155Testnet = () => { - const meta = { - version: "v2", - title: "Reset vBNB Admin", - description: ``, - forDescription: "I agree that Venus Protocol should proceed with reset of vBNB Admin", - againstDescription: "I do not think that Venus Protocol should proceed with reset of vBNB Admin", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with reset of vBNB Admin", - }; - - return makeProposal( - [ - { - target: VBNBAdmin, - signature: "_setPendingAdmin(address)", - params: [NORMAL_TIMELOCK], - }, - { - target: vBNB_ADDRESS, - signature: "_acceptAdmin()", - params: [], - }, - ], - meta, - ProposalType.REGULAR, - ); -}; \ No newline at end of file From 1ddfbd5d4ff2d91a4ae39fc69110811eb81f3558 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 11 Oct 2023 15:42:46 +0100 Subject: [PATCH 33/55] fix: updated testnet vip --- .../vip-152/vip-152-testnet/simulation.ts | 9 +++---- vips/vip-152-testnet.ts | 26 +++++-------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index 62e66a36a..ba7aa2db9 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -11,17 +11,17 @@ import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; -const VBNBAdmin_ADDRESS = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; +const VBNBAdmin_ADDRESS = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; const CORE_POOL_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; +const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -forking(34086327, () => { +forking(34112000, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -49,9 +49,6 @@ forking(34086327, () => { testVip("VIP-152", vip152Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [PSR_ABI], ["DistributionConfigAdded"], [4]); - - await expectEvents(txResponse, [vBNBAdmin_ABI], ["ProtocolShareReserveUpdated"], [1]); - await expectEvents(txResponse, [PSR_ABI], ["PoolRegistryUpdated"], [1]); }, }); diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 91d911a1e..0707b185d 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -4,16 +4,14 @@ import { makeProposal } from "../src/utils"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const NEW_RISK_FUND_IMPLEMENTATION = "0x1E7DEC93C77740c2bB46daf87ef42056E388dA14"; const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const PSR = "0x9B34c7aDCEa239b83Ef364627071Be7665bcb2E9"; +const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; -const VBNBAdmin = "0x78459C0a0Fe91d382322D09FF4F86A10dbAF78a4"; -const PSR_PROXY_ADMIN = "0xF77810085c7F6323bB19dddaE2d62793E5AE2e3b"; -const VBNBAdmin_PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const VBNBAdmin = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; export const vip152Testnet = () => { @@ -35,6 +33,11 @@ export const vip152Testnet = () => { signature: "upgrade(address,address)", params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], }, + { + target: VBNBAdmin, + signature: "acceptOwnership()", + params: [], + }, { target: vBNB_ADDRESS, signature: "_setPendingAdmin(address)", @@ -50,16 +53,6 @@ export const vip152Testnet = () => { signature: "acceptOwnership()", params: [], }, - { - target: VBNBAdmin_PROXY_ADMIN, - signature: "changeProxyAdmin(address,address)", - params: [VBNBAdmin, PROXY_ADMIN], - }, - { - target: VBNBAdmin, - signature: "setProtocolShareReserve(address)", - params: [PSR], - }, { target: ACM, signature: "giveCallPermission(address,string,address)", @@ -105,11 +98,6 @@ export const vip152Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], }, - { - target: PSR_PROXY_ADMIN, - signature: "changeProxyAdmin(address,address)", - params: [PSR, PROXY_ADMIN], - }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From d985c76056cd1fddc45c8fa6157e00d0f1aeda55 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 11 Oct 2023 15:51:42 +0100 Subject: [PATCH 34/55] fix: updated mainnet vip --- simulations/vip-152/vip-152/simulation.ts | 11 ++++------- vips/vip-152.ts | 21 ++------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 594aa5f5d..b268fed0c 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -14,14 +14,14 @@ import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; +const VBNBAdmin_ADDRESS = "0x1b73Be3D91d3E32AE617234C0118f47eA1d44Ed1"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const PSR = "0x99C0a8b68fAA4F1245Cd007E16CE4c5Eb2dB2415"; +const PSR = "0x09272ee826C5293bde7dA3C6767176994653E94C"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -forking(32482549, () => { +forking(32512704, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -49,9 +49,6 @@ forking(32482549, () => { testVip("VIP-152", vip152(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [PSR_ABI], ["DistributionConfigAdded"], [4]); - - await expectEvents(txResponse, [vBNBAdmin_ABI], ["ProtocolShareReserveUpdated"], [1]); - await expectEvents(txResponse, [PSR_ABI], ["PoolRegistryUpdated"], [1]); }, }); @@ -117,7 +114,7 @@ forking(32482549, () => { expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); - await psr.releaseFunds("0xfD36E2c2a6789Db23113685031d7F16329158384", [WBNB_ADDRESS]); + await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113267"); expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113267"); diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 65abcdcf0..3f53fba36 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -4,8 +4,8 @@ import { makeProposal } from "../src/utils"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0x2b11a94DA41a5cAcAa6e1E3F23139cED805808b5"; -const PSR = "0x99C0a8b68fAA4F1245Cd007E16CE4c5Eb2dB2415"; +const VBNBAdmin_ADDRESS = "0x1b73Be3D91d3E32AE617234C0118f47eA1d44Ed1"; +const PSR = "0x09272ee826C5293bde7dA3C6767176994653E94C"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; @@ -13,8 +13,6 @@ const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; const NEW_RISK_FUND_IMPLEMENTATION = "0x0E8Ef0EC1e0C109c5B5249CcefB703A414835eaC"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; -const PSR_PROXY_ADMIN = "0x2b19f7301A5c1D90bD83DEe10e33dC3B7A3C0460"; -const VBNBAdmin_PROXY_ADMIN = "0x3f918bA9446552AB184C6Ffd2e2fcB1FA5ee1e59"; export const vip152 = () => { const meta = { @@ -55,16 +53,6 @@ export const vip152 = () => { signature: "acceptOwnership()", params: [], }, - { - target: VBNBAdmin_PROXY_ADMIN, - signature: "changeProxyAdmin(address,address)", - params: [VBNBAdmin_ADDRESS, PROXY_ADMIN], - }, - { - target: VBNBAdmin_ADDRESS, - signature: "setProtocolShareReserve(address)", - params: [PSR], - }, { target: ACM, signature: "giveCallPermission(address,string,address)", @@ -110,11 +98,6 @@ export const vip152 = () => { signature: "giveCallPermission(address,string,address)", params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], }, - { - target: PSR_PROXY_ADMIN, - signature: "changeProxyAdmin(address,address)", - params: [PSR, PROXY_ADMIN], - }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From 40232f9584a1bd2e3a04b8bd5e571c3a0849e964 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 11 Oct 2023 15:52:45 +0100 Subject: [PATCH 35/55] fix: reverted proposer address --- src/vip-framework/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vip-framework/index.ts b/src/vip-framework/index.ts index 29a2335cf..513542553 100644 --- a/src/vip-framework/index.ts +++ b/src/vip-framework/index.ts @@ -16,7 +16,7 @@ let DELAY_BLOCKS = { }; const VOTING_PERIOD = 28800; -let DEFAULT_PROPOSER_ADDRESS = "0x97a32d4506f6a35de68e0680859cdf41d077a9a9"; +let DEFAULT_PROPOSER_ADDRESS = "0x55A9f5374Af30E3045FB491f1da3C2E8a74d168D"; let GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; let NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; From 96d2e3b7e7ec55a2752a705a91af4ea7c20336fc Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Thu, 12 Oct 2023 12:38:03 +0100 Subject: [PATCH 36/55] fix: revert block number change --- simulations/vip-145/vip-145-testnet/simulation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-145/vip-145-testnet/simulation.ts b/simulations/vip-145/vip-145-testnet/simulation.ts index 1161bb29b..72c1abb32 100644 --- a/simulations/vip-145/vip-145-testnet/simulation.ts +++ b/simulations/vip-145/vip-145-testnet/simulation.ts @@ -72,7 +72,7 @@ const ilPoolTokens: ILVTokenConfig[] = [ }, ]; -forking(33950193, () => { +forking(31522791, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { From 5e53028a1f2cf31bad984322f23a48442f4ecfa2 Mon Sep 17 00:00:00 2001 From: Narayan Prusty <7037606+narayanprusty@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:38:49 +0100 Subject: [PATCH 37/55] fix: use await Co-authored-by: Jesus Lanchas --- simulations/vip-152/vip-152/simulation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index b268fed0c..6532d0286 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -61,7 +61,7 @@ forking(32512704, () => { let proxyAdmin: ethers.Contract; before(async () => { - impersonateAccount(NORMAL_TIMELOCK); + await impersonateAccount(NORMAL_TIMELOCK); const signer = await ethers.getSigner(NORMAL_TIMELOCK); vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); From 91003f04d4f42fce83d7bdb4ae13abecf814a454 Mon Sep 17 00:00:00 2001 From: Narayan Prusty <7037606+narayanprusty@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:38:58 +0100 Subject: [PATCH 38/55] fix: use await Co-authored-by: Jesus Lanchas --- simulations/vip-152/vip-152-testnet/simulation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-152/vip-152-testnet/simulation.ts index ba7aa2db9..a653c1774 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-152/vip-152-testnet/simulation.ts @@ -61,7 +61,7 @@ forking(34112000, () => { let proxyAdmin: ethers.Contract; before(async () => { - impersonateAccount(NORMAL_TIMELOCK); + await impersonateAccount(NORMAL_TIMELOCK); const signer = await ethers.getSigner(NORMAL_TIMELOCK); vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); From 0d5bd4bdde539423705c289a0e2506f667b39db5 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Thu, 12 Oct 2023 12:51:28 +0100 Subject: [PATCH 39/55] fix: use random account to reduce reserves --- simulations/vip-152/vip-152/simulation.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 6532d0286..1a0c41545 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -20,6 +20,7 @@ const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x09272ee826C5293bde7dA3C6767176994653E94C"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const RANDOM_ADDRESS = "0x0BAC492386862aD3dF4B666Bc096b0505BB694Da" forking(32512704, () => { const provider = ethers.provider; @@ -61,8 +62,8 @@ forking(32512704, () => { let proxyAdmin: ethers.Contract; before(async () => { - await impersonateAccount(NORMAL_TIMELOCK); - const signer = await ethers.getSigner(NORMAL_TIMELOCK); + await impersonateAccount(RANDOM_ADDRESS); + const signer = await ethers.getSigner(RANDOM_ADDRESS); vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); psr = new ethers.Contract(PSR, PSR_ABI, signer); From b41c799256d58e81a3b8b2f1ae66098768199919 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Thu, 12 Oct 2023 13:23:45 +0100 Subject: [PATCH 40/55] fix: added tests for risk fund reserves --- simulations/vip-152/vip-152/abi/RiskFund.json | 756 ++++++++++++++++++ simulations/vip-152/vip-152/simulation.ts | 36 +- 2 files changed, 791 insertions(+), 1 deletion(-) create mode 100644 simulations/vip-152/vip-152/abi/RiskFund.json diff --git a/simulations/vip-152/vip-152/abi/RiskFund.json b/simulations/vip-152/vip-152/abi/RiskFund.json new file mode 100644 index 000000000..275f972b9 --- /dev/null +++ b/simulations/vip-152/vip-152/abi/RiskFund.json @@ -0,0 +1,756 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ApproveFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "AssetsReservesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldConvertibleBaseAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newConvertibleBaseAsset", + "type": "address" + } + ], + "name": "ConvertibleBaseAssetUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMinAmountToConvert", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinAmountToConvert", + "type": "uint256" + } + ], + "name": "MinAmountToConvertUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPancakeSwapRouter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPancakeSwapRouter", + "type": "address" + } + ], + "name": "PancakeSwapRouterUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPoolRegistry", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPoolRegistry", + "type": "address" + } + ], + "name": "PoolRegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldShortfallContract", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newShortfallContract", + "type": "address" + } + ], + "name": "ShortfallContractUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "markets", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amountsOutMin", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalAmount", + "type": "uint256" + } + ], + "name": "SwappedPoolsAssets", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "SweepToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TransferredReserveForAuction", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "assetsReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "convertibleBaseAsset", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getPoolAssetReserve", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + } + ], + "name": "getPoolsBaseAssetReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pancakeSwapRouter_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minAmountToConvert_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "convertibleBaseAsset_", + "type": "address" + }, + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "loopsLimit_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minAmountToConvert", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pancakeSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_convertibleBaseAsset", + "type": "address" + } + ], + "name": "setConvertibleBaseAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "minAmountToConvert_", + "type": "uint256" + } + ], + "name": "setMinAmountToConvert", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pancakeSwapRouter_", + "type": "address" + } + ], + "name": "setPancakeSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolRegistry_", + "type": "address" + } + ], + "name": "setPoolRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "shortfallContractAddress_", + "type": "address" + } + ], + "name": "setShortfallContractAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shortfall", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "markets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amountsOutMin", + "type": "uint256[]" + }, + { + "internalType": "address[][]", + "name": "paths", + "type": "address[][]" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapPoolsAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "sweepToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferReserveForAuction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "updateAssetsState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 1a0c41545..855eb5b73 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -8,6 +8,7 @@ import { vip152 } from "../../../vips/vip-152"; import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; +import RISK_FUND_ABI from "./abi/RiskFund.json"; import vBNB_ABI from "./abi/vBNB.json"; import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; @@ -20,7 +21,24 @@ const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const PSR = "0x09272ee826C5293bde7dA3C6767176994653E94C"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -const RANDOM_ADDRESS = "0x0BAC492386862aD3dF4B666Bc096b0505BB694Da" +const RANDOM_ADDRESS = "0x0BAC492386862aD3dF4B666Bc096b0505BB694Da"; + +const reserves = { + "0x0782b6d8c4551b9760e74c0545a9bcd90bdc41e5": "113920863202075023885", + "0xd17479997f34dd9156deef8f95a52d81d265be9c": "392463934353680646351", + "0x55d398326f99059ff775485246999027b3197955": "373825185381094571409", + "0x52f24a5e03aee338da5fd9df68d2b6fae1178827": "2896097128072106647", + "0x965f527d9159dce6288a2219db51fc6eef120dd1": "1871488197629226650316", + "0x4b0f1812e5df2a09796481ff14017e6005508003": "19595449578386658", + "0x12bb890508c125661e03b09ec06e404bc9289040": "316724376165504616820380", + "0xfb5b838b6cfeedc2873ab27866079ac55363d37e": "177082682555785184", + "0x1bdd3cf7f79cfb8edbb955f20ad99211551ba275": "586310324618600173", + "0xc2e9d07f66a89c44062459a47a0d2dc038e4fb16": "208417030571862242", + "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c": "593600150889113267", + "0x352cb5e19b12fc216548a2677bd0fce83bae434b": "1392507212379014539551354602", + "0xce7de646e7208a4ef112cb6ed5038fa6cc6b12e3": "1833688639", + "0xaef0d72a118ce24fee3cd1d43d383897d05b4e99": "1412410526598519969216500", +}; forking(32512704, () => { const provider = ethers.provider; @@ -28,10 +46,12 @@ forking(32512704, () => { describe("Pre-VIP behavior", async () => { let vBNB: ethers.Contract; let psr: ethers.Contract; + let riskFund: ethers.Contract; before(async () => { vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); psr = new ethers.Contract(PSR, PSR_ABI, provider); + riskFund = new ethers.Contract(RISK_FUND, RISK_FUND_ABI, provider); }); it("validate admin", async () => { @@ -45,6 +65,12 @@ forking(32512704, () => { it("ownership check", async () => { expect(await psr.pendingOwner()).to.be.equal(NORMAL_TIMELOCK); }); + + it("risk fund reserve", async () => { + for (const [token, amount] of Object.entries(reserves)) { + expect(await riskFund.assetsReserves(token)).to.be.equal(amount); + } + }); }); testVip("VIP-152", vip152(), { @@ -60,6 +86,7 @@ forking(32512704, () => { let vBNBAdmin: ethers.Contract; let WBNB: ethers.Contract; let proxyAdmin: ethers.Contract; + let riskFund: ethers.Contract; before(async () => { await impersonateAccount(RANDOM_ADDRESS); @@ -70,6 +97,7 @@ forking(32512704, () => { vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, signer); WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); proxyAdmin = new ethers.Contract(PROXY_ADMIN, PROXY_ADMIN_ABI, provider); + riskFund = new ethers.Contract(RISK_FUND, RISK_FUND_ABI, provider); }); it("validate admin", async () => { @@ -111,6 +139,12 @@ forking(32512704, () => { expect(config.destination).to.be.equal(TREASURY); }); + it("risk fund reserve", async () => { + for (const [token, amount] of Object.entries(reserves)) { + expect(await riskFund.assetsReserves(token)).to.be.equal(amount); + } + }); + it("reduce reserves", async () => { expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); await vBNBAdmin.reduceReserves(ethers.utils.parseEther("1")); From 70f44eb2de5f366894a00c8e8da7b5e26e69b769 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 13 Oct 2023 12:01:45 +0100 Subject: [PATCH 41/55] fix: updated testnet VIP --- simulations/vip-152/vip-152/simulation.ts | 6 +++--- vips/vip-152.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index 855eb5b73..b10c69251 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -15,10 +15,10 @@ import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VBNBAdmin_ADDRESS = "0x1b73Be3D91d3E32AE617234C0118f47eA1d44Ed1"; +const VBNBAdmin_ADDRESS = "0x45cc62b15478F7D0461d7aD5071c51aAdEdB616D"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const PSR = "0x09272ee826C5293bde7dA3C6767176994653E94C"; +const PSR = "0x3DA3619EE1FE1031051c3d0dfFe252a145F2630D"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const RANDOM_ADDRESS = "0x0BAC492386862aD3dF4B666Bc096b0505BB694Da"; @@ -40,7 +40,7 @@ const reserves = { "0xaef0d72a118ce24fee3cd1d43d383897d05b4e99": "1412410526598519969216500", }; -forking(32512704, () => { +forking(32565560, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 3f53fba36..a574fa063 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -4,8 +4,8 @@ import { makeProposal } from "../src/utils"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0x1b73Be3D91d3E32AE617234C0118f47eA1d44Ed1"; -const PSR = "0x09272ee826C5293bde7dA3C6767176994653E94C"; +const VBNBAdmin_ADDRESS = "0x45cc62b15478F7D0461d7aD5071c51aAdEdB616D"; +const PSR = "0x3DA3619EE1FE1031051c3d0dfFe252a145F2630D"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; From 0b3ec49a1fd747a54f8499c5f45d95bd01bdf435 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 13 Oct 2023 12:08:22 +0100 Subject: [PATCH 42/55] fix: testnet vip to upgrade PSR --- .../vip-153/vip-153-testnet/abi/PSR.json | 1 + .../vip-153/vip-153-testnet/simulation.ts | 62 +++++++++++++++++++ vips/vip-153.ts | 31 ++++++++++ 3 files changed, 94 insertions(+) create mode 100644 simulations/vip-153/vip-153-testnet/abi/PSR.json create mode 100644 simulations/vip-153/vip-153-testnet/simulation.ts create mode 100644 vips/vip-153.ts diff --git a/simulations/vip-153/vip-153-testnet/abi/PSR.json b/simulations/vip-153/vip-153-testnet/abi/PSR.json new file mode 100644 index 000000000..bb37305b8 --- /dev/null +++ b/simulations/vip-153/vip-153-testnet/abi/PSR.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"_corePoolComptroller","type":"address"},{"internalType":"address","name":"_wbnb","type":"address"},{"internalType":"address","name":"_vbnb","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidTotalPercentage","type":"error"},{"inputs":[{"internalType":"uint256","name":"loopsLimit","type":"uint256"},{"internalType":"uint256","name":"requiredLoops","type":"uint256"}],"name":"MaxLoopsLimitExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"calledContract","type":"address"},{"internalType":"string","name":"methodSignature","type":"string"}],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"percent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AssetReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptroller","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"enum IProtocolShareReserve.IncomeType","name":"incomeType","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"AssetsReservesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint8","name":"percentage","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint8","name":"percentage","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint8","name":"oldPercentage","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"newPercentage","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxLoopsLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newmaxLoopsLimit","type":"uint256"}],"name":"MaxLoopsLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAccessControlManager","type":"address"},{"indexed":false,"internalType":"address","name":"newAccessControlManager","type":"address"}],"name":"NewAccessControlManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldPoolRegistry","type":"address"},{"indexed":true,"internalType":"address","name":"newPoolRegistry","type":"address"}],"name":"PoolRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"bool","name":"isPrimeAsset","type":"bool"}],"name":"PrimeAssetUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldPrime","type":"address"},{"indexed":true,"internalType":"address","name":"newPrime","type":"address"}],"name":"PrimeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptroller","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"ReservesUpdated","type":"event"},{"inputs":[],"name":"CORE_POOL_COMPTROLLER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERCENT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accessControlManager","outputs":[{"internalType":"contract IAccessControlManagerV8","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bool","name":"isPrimeAsset","type":"bool"}],"name":"addOrRemoveAssetFromPrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"uint8","name":"percentage","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"internalType":"struct ProtocolShareReserve.DistributionConfig[]","name":"configs","type":"tuple[]"}],"name":"addOrUpdateDistributionConfigs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"","type":"uint8"}],"name":"assetsReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributionTargets","outputs":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"uint8","name":"percentage","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"destination","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"getPercentageDistribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"address","name":"asset","type":"address"}],"name":"getUnreleasedFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_accessControlManager","type":"address"},{"internalType":"uint256","name":"_loopsLimit","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isInPrime","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLoopsLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"address[]","name":"assets","type":"address[]"}],"name":"releaseFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"name":"removeDistributionConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"accessControlManager_","type":"address"}],"name":"setAccessControlManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolRegistry","type":"address"}],"name":"setPoolRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_prime","type":"address"}],"name":"setPrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalAssetReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDistributions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"enum IProtocolShareReserve.IncomeType","name":"incomeType","type":"uint8"}],"name":"updateAssetsState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts new file mode 100644 index 000000000..affefa8c4 --- /dev/null +++ b/simulations/vip-153/vip-153-testnet/simulation.ts @@ -0,0 +1,62 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + +import { forking, testVip } from "../../../src/vip-framework"; +import ERC20_ABI from "./abi/ERC20.json"; +import PSR_ABI from "./abi/PSR.json"; +import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; +import vBNB_ABI from "./abi/vBNB.json"; +import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; +import { vip153Testnet } from "../../../vips/vip-153"; + +const VBNBAdmin_ADDRESS = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; +const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; + +forking(34165973, () => { + const provider = ethers.provider; + + describe("Pre-VIP behavior", async () => { + let psr: ethers.Contract; + + before(async () => { + psr = new ethers.Contract(PSR, PSR_ABI, provider); + }); + + it("config check", async () => { + expect(await psr.totalDistributions()).to.be.equal(4); + }); + + it("max percent", async () => { + await expect(psr.MAX_PERCENT()).to.be.reverted + }); + }); + + testVip("VIP-153", vip153Testnet(), { + callbackAfterExecution: async txResponse => { + }, + }); + + describe("Post-VIP behavior", async () => { + let psr: ethers.Contract; + + before(async () => { + await impersonateAccount(NORMAL_TIMELOCK); + const signer = await ethers.getSigner(NORMAL_TIMELOCK); + + psr = new ethers.Contract(PSR, PSR_ABI, signer); + }); + + it("config check", async () => { + expect(await psr.totalDistributions()).to.be.equal(4); + }); + + it("max percent", async () => { + expect(await psr.MAX_PERCENT()).to.be.equal(100) + }); + }); +}); diff --git a/vips/vip-153.ts b/vips/vip-153.ts new file mode 100644 index 000000000..3942226af --- /dev/null +++ b/vips/vip-153.ts @@ -0,0 +1,31 @@ +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; + +const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; +const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; +const NEW_PSR_IMPL = "0xd3A3941F1d74218f73cAbf7FD513C9aA6F410397"; + +export const vip153Testnet = () => { + const meta = { + version: "v2", + title: "Upgrade PSR", + description: ``, + forDescription: "I agree that Venus Protocol should proceed with upgraing the PSR", + againstDescription: + "I do not think that Venus Protocol should proceed with upgraing the PSR", + abstainDescription: + "I am indifferent to whether Venus Protocol proceeds with upgraing the PSR", + }; + + return makeProposal( + [ + { + target: PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [PSR, NEW_PSR_IMPL], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From 2cb9a565ede07b953217304ebb63cee4bf42b2fa Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Fri, 13 Oct 2023 13:45:00 +0100 Subject: [PATCH 43/55] fix: remove vip --- .../vip-153/vip-153-testnet/abi/PSR.json | 1 - .../vip-153/vip-153-testnet/simulation.ts | 62 ------------------- vips/vip-153.ts | 31 ---------- 3 files changed, 94 deletions(-) delete mode 100644 simulations/vip-153/vip-153-testnet/abi/PSR.json delete mode 100644 simulations/vip-153/vip-153-testnet/simulation.ts delete mode 100644 vips/vip-153.ts diff --git a/simulations/vip-153/vip-153-testnet/abi/PSR.json b/simulations/vip-153/vip-153-testnet/abi/PSR.json deleted file mode 100644 index bb37305b8..000000000 --- a/simulations/vip-153/vip-153-testnet/abi/PSR.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"_corePoolComptroller","type":"address"},{"internalType":"address","name":"_wbnb","type":"address"},{"internalType":"address","name":"_vbnb","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidTotalPercentage","type":"error"},{"inputs":[{"internalType":"uint256","name":"loopsLimit","type":"uint256"},{"internalType":"uint256","name":"requiredLoops","type":"uint256"}],"name":"MaxLoopsLimitExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"calledContract","type":"address"},{"internalType":"string","name":"methodSignature","type":"string"}],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"percent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AssetReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptroller","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"enum IProtocolShareReserve.IncomeType","name":"incomeType","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"AssetsReservesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint8","name":"percentage","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint8","name":"percentage","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint8","name":"oldPercentage","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"newPercentage","type":"uint8"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"DistributionConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxLoopsLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newmaxLoopsLimit","type":"uint256"}],"name":"MaxLoopsLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAccessControlManager","type":"address"},{"indexed":false,"internalType":"address","name":"newAccessControlManager","type":"address"}],"name":"NewAccessControlManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldPoolRegistry","type":"address"},{"indexed":true,"internalType":"address","name":"newPoolRegistry","type":"address"}],"name":"PoolRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"bool","name":"isPrimeAsset","type":"bool"}],"name":"PrimeAssetUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldPrime","type":"address"},{"indexed":true,"internalType":"address","name":"newPrime","type":"address"}],"name":"PrimeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptroller","type":"address"},{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"ReservesUpdated","type":"event"},{"inputs":[],"name":"CORE_POOL_COMPTROLLER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERCENT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accessControlManager","outputs":[{"internalType":"contract IAccessControlManagerV8","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bool","name":"isPrimeAsset","type":"bool"}],"name":"addOrRemoveAssetFromPrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"uint8","name":"percentage","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"internalType":"struct ProtocolShareReserve.DistributionConfig[]","name":"configs","type":"tuple[]"}],"name":"addOrUpdateDistributionConfigs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"","type":"uint8"}],"name":"assetsReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributionTargets","outputs":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"uint8","name":"percentage","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"destination","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"}],"name":"getPercentageDistribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"address","name":"destination","type":"address"},{"internalType":"address","name":"asset","type":"address"}],"name":"getUnreleasedFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_accessControlManager","type":"address"},{"internalType":"uint256","name":"_loopsLimit","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isInPrime","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLoopsLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"address[]","name":"assets","type":"address[]"}],"name":"releaseFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ProtocolShareReserve.Schema","name":"schema","type":"uint8"},{"internalType":"address","name":"destination","type":"address"}],"name":"removeDistributionConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"accessControlManager_","type":"address"}],"name":"setAccessControlManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolRegistry","type":"address"}],"name":"setPoolRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_prime","type":"address"}],"name":"setPrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalAssetReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDistributions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"comptroller","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"enum IProtocolShareReserve.IncomeType","name":"incomeType","type":"uint8"}],"name":"updateAssetsState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/simulations/vip-153/vip-153-testnet/simulation.ts b/simulations/vip-153/vip-153-testnet/simulation.ts deleted file mode 100644 index affefa8c4..000000000 --- a/simulations/vip-153/vip-153-testnet/simulation.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; -import { expect } from "chai"; -import { ethers } from "hardhat"; - -import { forking, testVip } from "../../../src/vip-framework"; -import ERC20_ABI from "./abi/ERC20.json"; -import PSR_ABI from "./abi/PSR.json"; -import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; -import vBNB_ABI from "./abi/vBNB.json"; -import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; -import { vip153Testnet } from "../../../vips/vip-153"; - -const VBNBAdmin_ADDRESS = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; -const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; - -forking(34165973, () => { - const provider = ethers.provider; - - describe("Pre-VIP behavior", async () => { - let psr: ethers.Contract; - - before(async () => { - psr = new ethers.Contract(PSR, PSR_ABI, provider); - }); - - it("config check", async () => { - expect(await psr.totalDistributions()).to.be.equal(4); - }); - - it("max percent", async () => { - await expect(psr.MAX_PERCENT()).to.be.reverted - }); - }); - - testVip("VIP-153", vip153Testnet(), { - callbackAfterExecution: async txResponse => { - }, - }); - - describe("Post-VIP behavior", async () => { - let psr: ethers.Contract; - - before(async () => { - await impersonateAccount(NORMAL_TIMELOCK); - const signer = await ethers.getSigner(NORMAL_TIMELOCK); - - psr = new ethers.Contract(PSR, PSR_ABI, signer); - }); - - it("config check", async () => { - expect(await psr.totalDistributions()).to.be.equal(4); - }); - - it("max percent", async () => { - expect(await psr.MAX_PERCENT()).to.be.equal(100) - }); - }); -}); diff --git a/vips/vip-153.ts b/vips/vip-153.ts deleted file mode 100644 index 3942226af..000000000 --- a/vips/vip-153.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; - -const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; -const NEW_PSR_IMPL = "0xd3A3941F1d74218f73cAbf7FD513C9aA6F410397"; - -export const vip153Testnet = () => { - const meta = { - version: "v2", - title: "Upgrade PSR", - description: ``, - forDescription: "I agree that Venus Protocol should proceed with upgraing the PSR", - againstDescription: - "I do not think that Venus Protocol should proceed with upgraing the PSR", - abstainDescription: - "I am indifferent to whether Venus Protocol proceeds with upgraing the PSR", - }; - - return makeProposal( - [ - { - target: PROXY_ADMIN, - signature: "upgrade(address,address)", - params: [PSR, NEW_PSR_IMPL], - }, - ], - meta, - ProposalType.REGULAR, - ); -}; From 640be07f1ecabe0e915ab178439f62078e8aa502 Mon Sep 17 00:00:00 2001 From: narayanprusty Date: Fri, 13 Oct 2023 23:33:38 +0100 Subject: [PATCH 44/55] fix: added vip for prime permissions --- vips/vip-153-testnet.ts | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 vips/vip-153-testnet.ts diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts new file mode 100644 index 000000000..c7121ea4d --- /dev/null +++ b/vips/vip-153-testnet.ts @@ -0,0 +1,77 @@ +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; + +const ACCOUNT = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const PRIME = "0x4e446d6Fe16c4e95eEAd7f963C9312Cf4c280270" + + +export const vip153Testnet = () => { + const meta = { + version: "v2", + title: "Allow Shared Account access to Prime and PLP", + description: ``, + forDescription: "I agree that Venus Protocol should proceed", + againstDescription: + "I do not think that Venus Protocol should proceed ", + abstainDescription: + "I am indifferent to whether Venus Protocol proceeds ", + }; + + return makeProposal( + [ + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "updateAlpha(uint128,uint128)", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "updateMultipliers(address,uint256,uint256)", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "addMarket(address,uint256,uint256)", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "setLimit(uint256,uint256)", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "issue(bool,address[])", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "burn(address)", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "togglePause()", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "pauseFundsTransfer()", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "resumeFundsTransfer()", ACCOUNT], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PRIME, "setTokensDistributionSpeed(address[],uint256[])", ACCOUNT], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From 8906a56bd5ff54715a4202cfdb396f395d66ee5c Mon Sep 17 00:00:00 2001 From: narayanprusty Date: Fri, 13 Oct 2023 23:35:43 +0100 Subject: [PATCH 45/55] fix: fixed permissions --- vips/vip-153-testnet.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index c7121ea4d..9d2122cbb 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -4,7 +4,7 @@ import { makeProposal } from "../src/utils"; const ACCOUNT = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const PRIME = "0x4e446d6Fe16c4e95eEAd7f963C9312Cf4c280270" - +const PLP = "0x2B8e226a462138250df2551bb499ad71218c4353"; export const vip153Testnet = () => { const meta = { @@ -58,17 +58,17 @@ export const vip153Testnet = () => { { target: ACM, signature: "giveCallPermission(address,string,address)", - params: [PRIME, "pauseFundsTransfer()", ACCOUNT], + params: [PLP, "pauseFundsTransfer()", ACCOUNT], }, { target: ACM, signature: "giveCallPermission(address,string,address)", - params: [PRIME, "resumeFundsTransfer()", ACCOUNT], + params: [PLP, "resumeFundsTransfer()", ACCOUNT], }, { target: ACM, signature: "giveCallPermission(address,string,address)", - params: [PRIME, "setTokensDistributionSpeed(address[],uint256[])", ACCOUNT], + params: [PLP, "setTokensDistributionSpeed(address[],uint256[])", ACCOUNT], }, ], meta, From 9a5b5dcde2711c218800b94d3decb96fed90306e Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 16 Oct 2023 18:42:46 +0100 Subject: [PATCH 46/55] fix: updated mainnet vip with new config and address --- simulations/vip-152/vip-152/simulation.ts | 22 +++++++++++----------- vips/vip-152.ts | 12 ++++++------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-152/vip-152/simulation.ts index b10c69251..37b6a9ec3 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-152/vip-152/simulation.ts @@ -15,13 +15,13 @@ import vBNBAdmin_ABI from "./abi/vBNBAdmin.json"; const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; const vBNB_ADDRESS = "0xa07c5b74c9b40447a954e1466938b865b6bbea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const VBNBAdmin_ADDRESS = "0x45cc62b15478F7D0461d7aD5071c51aAdEdB616D"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; -const PSR = "0x3DA3619EE1FE1031051c3d0dfFe252a145F2630D"; const WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CORE_POOL_COMPTROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const RANDOM_ADDRESS = "0x0BAC492386862aD3dF4B666Bc096b0505BB694Da"; +const VBNBAdmin_ADDRESS = "0x9A7890534d9d91d473F28cB97962d176e2B65f1d"; +const PSR = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; const reserves = { "0x0782b6d8c4551b9760e74c0545a9bcd90bdc41e5": "113920863202075023885", @@ -40,7 +40,7 @@ const reserves = { "0xaef0d72a118ce24fee3cd1d43d383897d05b4e99": "1412410526598519969216500", }; -forking(32565560, () => { +forking(32659660, () => { const provider = ethers.provider; describe("Pre-VIP behavior", async () => { @@ -120,22 +120,22 @@ forking(32565560, () => { it("configurations", async () => { let config = await psr.distributionTargets(0); expect(config.schema).to.be.equal(0); - expect(config.percentage).to.be.equal(50); + expect(config.percentage).to.be.equal(40); expect(config.destination).to.be.equal(RISK_FUND); config = await psr.distributionTargets(1); expect(config.schema).to.be.equal(0); - expect(config.percentage).to.be.equal(50); + expect(config.percentage).to.be.equal(60); expect(config.destination).to.be.equal(TREASURY); config = await psr.distributionTargets(2); expect(config.schema).to.be.equal(1); - expect(config.percentage).to.be.equal(40); + expect(config.percentage).to.be.equal(50); expect(config.destination).to.be.equal(RISK_FUND); config = await psr.distributionTargets(3); expect(config.schema).to.be.equal(1); - expect(config.percentage).to.be.equal(60); + expect(config.percentage).to.be.equal(50); expect(config.destination).to.be.equal(TREASURY); }); @@ -151,13 +151,13 @@ forking(32565560, () => { expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("1")); await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); expect(await WBNB.balanceOf(PSR)).to.be.equal(ethers.utils.parseEther("0")); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113267"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113267"); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("993600150889113267"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1193600150889113267"); await vBNBAdmin.reduceReserves("100"); expect(await WBNB.balanceOf(PSR)).to.be.equal(100); await psr.releaseFunds(CORE_POOL_COMPTROLLER, [WBNB_ADDRESS]); - expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("1093600150889113317"); - expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1093600150889113317"); + expect(await WBNB.balanceOf(RISK_FUND)).to.be.equal("993600150889113307"); + expect(await WBNB.balanceOf(TREASURY)).to.be.equal("1193600150889113327"); }); it("validate proxy admin", async () => { diff --git a/vips/vip-152.ts b/vips/vip-152.ts index a574fa063..7f42b924d 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -4,8 +4,8 @@ import { makeProposal } from "../src/utils"; const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0x45cc62b15478F7D0461d7aD5071c51aAdEdB616D"; -const PSR = "0x3DA3619EE1FE1031051c3d0dfFe252a145F2630D"; +const VBNBAdmin_ADDRESS = "0x9A7890534d9d91d473F28cB97962d176e2B65f1d"; +const PSR = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; @@ -103,10 +103,10 @@ export const vip152 = () => { signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", params: [ [ - [0, 50, RISK_FUND], - [0, 50, TREASURY], - [1, 40, RISK_FUND], - [1, 60, TREASURY], + [0, 40, RISK_FUND], + [0, 60, TREASURY], + [1, 50, RISK_FUND], + [1, 50, TREASURY], ], ], }, From db88e2da09f5097b1fd1115fe403abd12755ec0f Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Mon, 16 Oct 2023 18:48:39 +0100 Subject: [PATCH 47/55] fix: added testnet vip --- vips/vip-153-testnet.ts | 71 +++++++++++++---------------------------- 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index 9d2122cbb..f9dfdc0d0 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -1,15 +1,16 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; -const ACCOUNT = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; -const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; -const PRIME = "0x4e446d6Fe16c4e95eEAd7f963C9312Cf4c280270" -const PLP = "0x2B8e226a462138250df2551bb499ad71218c4353"; +const VBNBAdmin_ADDRESS = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; +const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; +const PSR = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; +const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; export const vip153Testnet = () => { const meta = { version: "v2", - title: "Allow Shared Account access to Prime and PLP", + title: "Use new PSR and Add New Config", description: ``, forDescription: "I agree that Venus Protocol should proceed", againstDescription: @@ -21,54 +22,26 @@ export const vip153Testnet = () => { return makeProposal( [ { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "updateAlpha(uint128,uint128)", ACCOUNT], + target: VBNBAdmin_ADDRESS, + signature: "setProtocolShareReserve(address)", + params: [PSR], }, { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "updateMultipliers(address,uint256,uint256)", ACCOUNT], + target: PSR, + signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", + params: [ + [ + [0, 40, RISK_FUND], + [0, 60, TREASURY], + [1, 50, RISK_FUND], + [1, 50, TREASURY], + ], + ], }, { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "addMarket(address,uint256,uint256)", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "setLimit(uint256,uint256)", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "issue(bool,address[])", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "burn(address)", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PRIME, "togglePause()", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PLP, "pauseFundsTransfer()", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PLP, "resumeFundsTransfer()", ACCOUNT], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PLP, "setTokensDistributionSpeed(address[],uint256[])", ACCOUNT], + target: PSR, + signature: "setPoolRegistry(address)", + params: [POOL_REGISTRY], }, ], meta, From d0491b61c38049eb4020023cd74eb81514ae5718 Mon Sep 17 00:00:00 2001 From: Narayan Prusty <7037606+narayanprusty@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:08:01 +0100 Subject: [PATCH 48/55] fix: remove prime permissions Co-authored-by: Jesus Lanchas --- vips/vip-152-testnet.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 0707b185d..8c6816022 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -83,21 +83,6 @@ export const vip152Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], - }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From d12e06d27a799ff4552aad5fb7110b09dcfb5cea Mon Sep 17 00:00:00 2001 From: Narayan Prusty <7037606+narayanprusty@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:08:20 +0100 Subject: [PATCH 49/55] fix: update distribution config Co-authored-by: Jesus Lanchas --- vips/vip-152-testnet.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 8c6816022..97e7cc773 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -88,10 +88,10 @@ export const vip152Testnet = () => { signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", params: [ [ - [0, 50, RISK_FUND], - [0, 50, TREASURY], - [1, 40, RISK_FUND], - [1, 60, TREASURY], + [0, 40, RISK_FUND], + [0, 60, TREASURY], + [1, 50, RISK_FUND], + [1, 50, TREASURY], ], ], }, From 2479dc26f15bb3cb7a05c3c189ecda5a7c5e6c7c Mon Sep 17 00:00:00 2001 From: Narayan Prusty <7037606+narayanprusty@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:08:35 +0100 Subject: [PATCH 50/55] fix: remove prime permissions Co-authored-by: Jesus Lanchas --- vips/vip-152.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/vips/vip-152.ts b/vips/vip-152.ts index 7f42b924d..5b4474b5e 100644 --- a/vips/vip-152.ts +++ b/vips/vip-152.ts @@ -83,21 +83,6 @@ export const vip152 = () => { signature: "giveCallPermission(address,string,address)", params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrRemoveAssetFromPrime(address,bool)", NORMAL_TIMELOCK], - }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From 5b82c75c59235f4104faf0fc5e9258a65f3c17c7 Mon Sep 17 00:00:00 2001 From: Narayan Prusty <7037606+narayanprusty@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:08:57 +0100 Subject: [PATCH 51/55] fix: update PSR address Co-authored-by: Jesus Lanchas --- vips/vip-152-testnet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vips/vip-152-testnet.ts b/vips/vip-152-testnet.ts index 97e7cc773..c382df906 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-152-testnet.ts @@ -4,7 +4,7 @@ import { makeProposal } from "../src/utils"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const NEW_RISK_FUND_IMPLEMENTATION = "0x1E7DEC93C77740c2bB46daf87ef42056E388dA14"; const PROXY_ADMIN = "0x7877fFd62649b6A1557B55D4c20fcBaB17344C91"; -const PSR = "0xF1d8bcED87d5e077e662160490797cd2B5494d4A"; +const PSR = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; From 1383ef81db867c0b767e9186d3c29cb5222f466c Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 17 Oct 2023 13:22:30 +0100 Subject: [PATCH 52/55] fix: accept ownership --- vips/vip-153-testnet.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts index f9dfdc0d0..1cd4a7a4f 100644 --- a/vips/vip-153-testnet.ts +++ b/vips/vip-153-testnet.ts @@ -26,6 +26,11 @@ export const vip153Testnet = () => { signature: "setProtocolShareReserve(address)", params: [PSR], }, + { + target: PSR, + signature: "acceptOwnership()", + params: [], + }, { target: PSR, signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", From ffc36949d3af454a0aa8c51e6e63f2a09e52e03c Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Tue, 17 Oct 2023 15:05:06 +0100 Subject: [PATCH 53/55] fix: removed vip --- vips/vip-153-testnet.ts | 55 ----------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 vips/vip-153-testnet.ts diff --git a/vips/vip-153-testnet.ts b/vips/vip-153-testnet.ts deleted file mode 100644 index 1cd4a7a4f..000000000 --- a/vips/vip-153-testnet.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; - -const VBNBAdmin_ADDRESS = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; -const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; -const PSR = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; -const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; -const POOL_REGISTRY = "0xC85491616Fa949E048F3aAc39fbf5b0703800667"; - -export const vip153Testnet = () => { - const meta = { - version: "v2", - title: "Use new PSR and Add New Config", - description: ``, - forDescription: "I agree that Venus Protocol should proceed", - againstDescription: - "I do not think that Venus Protocol should proceed ", - abstainDescription: - "I am indifferent to whether Venus Protocol proceeds ", - }; - - return makeProposal( - [ - { - target: VBNBAdmin_ADDRESS, - signature: "setProtocolShareReserve(address)", - params: [PSR], - }, - { - target: PSR, - signature: "acceptOwnership()", - params: [], - }, - { - target: PSR, - signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", - params: [ - [ - [0, 40, RISK_FUND], - [0, 60, TREASURY], - [1, 50, RISK_FUND], - [1, 50, TREASURY], - ], - ], - }, - { - target: PSR, - signature: "setPoolRegistry(address)", - params: [POOL_REGISTRY], - }, - ], - meta, - ProposalType.REGULAR, - ); -}; From 5a1b251cf52f4d75983f79100ddae12d60ff1211 Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Thu, 19 Oct 2023 12:27:52 +0200 Subject: [PATCH 54/55] feat: add description for VIP setting VBNBAdmin --- .../vip-189-testnet}/abi/ERC20.json | 0 .../vip-189-testnet}/abi/PSR.json | 0 .../vip-189-testnet}/abi/ProxyAdmin.json | 0 .../vip-189-testnet}/abi/vBNB.json | 0 .../vip-189-testnet}/abi/vBNBAdmin.json | 0 .../vip-189-testnet}/simulation.ts | 4 +- .../vip-189}/abi/ERC20.json | 0 .../vip-152 => vip-189/vip-189}/abi/PSR.json | 0 .../vip-189}/abi/ProxyAdmin.json | 0 .../vip-189}/abi/RiskFund.json | 0 .../vip-152 => vip-189/vip-189}/abi/vBNB.json | 0 .../vip-189}/abi/vBNBAdmin.json | 0 .../vip-152 => vip-189/vip-189}/simulation.ts | 4 +- vips/vip-152.ts | 107 ------------ .../vip-189-testnet.ts} | 6 +- vips/vip-189/vip-189.ts | 153 ++++++++++++++++++ 16 files changed, 160 insertions(+), 114 deletions(-) rename simulations/{vip-152/vip-152-testnet => vip-189/vip-189-testnet}/abi/ERC20.json (100%) rename simulations/{vip-152/vip-152-testnet => vip-189/vip-189-testnet}/abi/PSR.json (100%) rename simulations/{vip-152/vip-152-testnet => vip-189/vip-189-testnet}/abi/ProxyAdmin.json (100%) rename simulations/{vip-152/vip-152-testnet => vip-189/vip-189-testnet}/abi/vBNB.json (100%) rename simulations/{vip-152/vip-152-testnet => vip-189/vip-189-testnet}/abi/vBNBAdmin.json (100%) rename simulations/{vip-152/vip-152-testnet => vip-189/vip-189-testnet}/simulation.ts (97%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/abi/ERC20.json (100%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/abi/PSR.json (100%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/abi/ProxyAdmin.json (100%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/abi/RiskFund.json (100%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/abi/vBNB.json (100%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/abi/vBNBAdmin.json (100%) rename simulations/{vip-152/vip-152 => vip-189/vip-189}/simulation.ts (98%) delete mode 100644 vips/vip-152.ts rename vips/{vip-152-testnet.ts => vip-189/vip-189-testnet.ts} (96%) create mode 100644 vips/vip-189/vip-189.ts diff --git a/simulations/vip-152/vip-152-testnet/abi/ERC20.json b/simulations/vip-189/vip-189-testnet/abi/ERC20.json similarity index 100% rename from simulations/vip-152/vip-152-testnet/abi/ERC20.json rename to simulations/vip-189/vip-189-testnet/abi/ERC20.json diff --git a/simulations/vip-152/vip-152-testnet/abi/PSR.json b/simulations/vip-189/vip-189-testnet/abi/PSR.json similarity index 100% rename from simulations/vip-152/vip-152-testnet/abi/PSR.json rename to simulations/vip-189/vip-189-testnet/abi/PSR.json diff --git a/simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json b/simulations/vip-189/vip-189-testnet/abi/ProxyAdmin.json similarity index 100% rename from simulations/vip-152/vip-152-testnet/abi/ProxyAdmin.json rename to simulations/vip-189/vip-189-testnet/abi/ProxyAdmin.json diff --git a/simulations/vip-152/vip-152-testnet/abi/vBNB.json b/simulations/vip-189/vip-189-testnet/abi/vBNB.json similarity index 100% rename from simulations/vip-152/vip-152-testnet/abi/vBNB.json rename to simulations/vip-189/vip-189-testnet/abi/vBNB.json diff --git a/simulations/vip-152/vip-152-testnet/abi/vBNBAdmin.json b/simulations/vip-189/vip-189-testnet/abi/vBNBAdmin.json similarity index 100% rename from simulations/vip-152/vip-152-testnet/abi/vBNBAdmin.json rename to simulations/vip-189/vip-189-testnet/abi/vBNBAdmin.json diff --git a/simulations/vip-152/vip-152-testnet/simulation.ts b/simulations/vip-189/vip-189-testnet/simulation.ts similarity index 97% rename from simulations/vip-152/vip-152-testnet/simulation.ts rename to simulations/vip-189/vip-189-testnet/simulation.ts index a653c1774..c4defd0d1 100644 --- a/simulations/vip-152/vip-152-testnet/simulation.ts +++ b/simulations/vip-189/vip-189-testnet/simulation.ts @@ -4,7 +4,7 @@ import { ethers } from "hardhat"; import { expectEvents } from "../../../src/utils"; import { forking, testVip } from "../../../src/vip-framework"; -import { vip152Testnet } from "../../../vips/vip-152-testnet"; +import { vip189Testnet } from "../../../vips/vip-189/vip-189-testnet"; import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; @@ -46,7 +46,7 @@ forking(34112000, () => { }); }); - testVip("VIP-152", vip152Testnet(), { + testVip("VIP-189", vip189Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [PSR_ABI], ["DistributionConfigAdded"], [4]); await expectEvents(txResponse, [PSR_ABI], ["PoolRegistryUpdated"], [1]); diff --git a/simulations/vip-152/vip-152/abi/ERC20.json b/simulations/vip-189/vip-189/abi/ERC20.json similarity index 100% rename from simulations/vip-152/vip-152/abi/ERC20.json rename to simulations/vip-189/vip-189/abi/ERC20.json diff --git a/simulations/vip-152/vip-152/abi/PSR.json b/simulations/vip-189/vip-189/abi/PSR.json similarity index 100% rename from simulations/vip-152/vip-152/abi/PSR.json rename to simulations/vip-189/vip-189/abi/PSR.json diff --git a/simulations/vip-152/vip-152/abi/ProxyAdmin.json b/simulations/vip-189/vip-189/abi/ProxyAdmin.json similarity index 100% rename from simulations/vip-152/vip-152/abi/ProxyAdmin.json rename to simulations/vip-189/vip-189/abi/ProxyAdmin.json diff --git a/simulations/vip-152/vip-152/abi/RiskFund.json b/simulations/vip-189/vip-189/abi/RiskFund.json similarity index 100% rename from simulations/vip-152/vip-152/abi/RiskFund.json rename to simulations/vip-189/vip-189/abi/RiskFund.json diff --git a/simulations/vip-152/vip-152/abi/vBNB.json b/simulations/vip-189/vip-189/abi/vBNB.json similarity index 100% rename from simulations/vip-152/vip-152/abi/vBNB.json rename to simulations/vip-189/vip-189/abi/vBNB.json diff --git a/simulations/vip-152/vip-152/abi/vBNBAdmin.json b/simulations/vip-189/vip-189/abi/vBNBAdmin.json similarity index 100% rename from simulations/vip-152/vip-152/abi/vBNBAdmin.json rename to simulations/vip-189/vip-189/abi/vBNBAdmin.json diff --git a/simulations/vip-152/vip-152/simulation.ts b/simulations/vip-189/vip-189/simulation.ts similarity index 98% rename from simulations/vip-152/vip-152/simulation.ts rename to simulations/vip-189/vip-189/simulation.ts index 37b6a9ec3..d88017681 100644 --- a/simulations/vip-152/vip-152/simulation.ts +++ b/simulations/vip-189/vip-189/simulation.ts @@ -4,7 +4,7 @@ import { ethers } from "hardhat"; import { expectEvents } from "../../../src/utils"; import { forking, testVip } from "../../../src/vip-framework"; -import { vip152 } from "../../../vips/vip-152"; +import { vip189 } from "../../../vips/vip-189/vip-189"; import ERC20_ABI from "./abi/ERC20.json"; import PSR_ABI from "./abi/PSR.json"; import PROXY_ADMIN_ABI from "./abi/ProxyAdmin.json"; @@ -73,7 +73,7 @@ forking(32659660, () => { }); }); - testVip("VIP-152", vip152(), { + testVip("VIP-189", vip189(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [PSR_ABI], ["DistributionConfigAdded"], [4]); await expectEvents(txResponse, [PSR_ABI], ["PoolRegistryUpdated"], [1]); diff --git a/vips/vip-152.ts b/vips/vip-152.ts deleted file mode 100644 index 5b4474b5e..000000000 --- a/vips/vip-152.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; - -const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; -const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const VBNBAdmin_ADDRESS = "0x9A7890534d9d91d473F28cB97962d176e2B65f1d"; -const PSR = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; -const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; -const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; -const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; -const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; -const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; -const NEW_RISK_FUND_IMPLEMENTATION = "0x0E8Ef0EC1e0C109c5B5249CcefB703A414835eaC"; -const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; - -export const vip152 = () => { - const meta = { - version: "v2", - title: "Change vBNB admin to vBNBAdmin and Setup Protocol Share Reserve", - description: ``, - forDescription: "I agree that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", - againstDescription: - "I do not think that Venus Protocol should proceed with setting the vBNB admin and setting up PSR", - abstainDescription: - "I am indifferent to whether Venus Protocol proceeds with setting the vBNB admin and setting up PSR", - }; - - return makeProposal( - [ - { - target: PROXY_ADMIN, - signature: "upgrade(address,address)", - params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], - }, - { - target: VBNBAdmin_ADDRESS, - signature: "acceptOwnership()", - params: [], - }, - { - target: vBNB_ADDRESS, - signature: "_setPendingAdmin(address)", - params: [VBNBAdmin_ADDRESS], - }, - { - target: VBNBAdmin_ADDRESS, - signature: "_acceptAdmin()", - params: [], - }, - { - target: PSR, - signature: "acceptOwnership()", - params: [], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], - }, - { - target: PSR, - signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", - params: [ - [ - [0, 40, RISK_FUND], - [0, 60, TREASURY], - [1, 50, RISK_FUND], - [1, 50, TREASURY], - ], - ], - }, - { - target: PSR, - signature: "setPoolRegistry(address)", - params: [POOL_REGISTRY], - }, - ], - meta, - ProposalType.REGULAR, - ); -}; diff --git a/vips/vip-152-testnet.ts b/vips/vip-189/vip-189-testnet.ts similarity index 96% rename from vips/vip-152-testnet.ts rename to vips/vip-189/vip-189-testnet.ts index c382df906..02c051dc1 100644 --- a/vips/vip-152-testnet.ts +++ b/vips/vip-189/vip-189-testnet.ts @@ -1,5 +1,5 @@ -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; const RISK_FUND = "0x487CeF72dacABD7E12e633bb3B63815a386f7012"; const NEW_RISK_FUND_IMPLEMENTATION = "0x1E7DEC93C77740c2bB46daf87ef42056E388dA14"; @@ -14,7 +14,7 @@ const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; const VBNBAdmin = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; const vBNB_ADDRESS = "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c"; -export const vip152Testnet = () => { +export const vip189Testnet = () => { const meta = { version: "v2", title: "Change vBNB admin to vBNBAdmin and Setup Protocol Share Reserve", diff --git a/vips/vip-189/vip-189.ts b/vips/vip-189/vip-189.ts new file mode 100644 index 000000000..9fb8da69e --- /dev/null +++ b/vips/vip-189/vip-189.ts @@ -0,0 +1,153 @@ +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const vBNB_ADDRESS = "0xA07c5b74C9B40447a954e1466938b865b6BBea36"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; +const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const VBNBAdmin_ADDRESS = "0x9A7890534d9d91d473F28cB97962d176e2B65f1d"; +const PSR = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const RISK_FUND = "0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42"; +const TREASURY = "0xf322942f644a996a617bd29c16bd7d231d9f35e9"; +const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; +const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; +const POOL_REGISTRY = "0x9F7b01A536aFA00EF10310A162877fd792cD0666"; +const NEW_RISK_FUND_IMPLEMENTATION = "0x0E8Ef0EC1e0C109c5B5249CcefB703A414835eaC"; +const PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; + +export const vip189 = () => { + const meta = { + version: "v2", + title: "VIP-189 Automatic income allocation: deployment stage 1", + description: `#### Summary + +If passed, this VIP will change the admin of the [VBNB market in the Core pool](https://bscscan.com/address/0xA07c5b74C9B40447a954e1466938b865b6BBea36), from the [Normal Timelock](https://bscscan.com/address/0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396) contract to the new contract [VBNBAdmin](https://bscscan.com/address/0x9A7890534d9d91d473F28cB97962d176e2B65f1d). Moreover, it will upgrade the implementation of the [RiskFund](https://bscscan.com/address/0xdF31a28D68A2AB381D42b380649Ead7ae2A76E42) contract, to support funds from the Core pool. + +#### Description + +This VIP is part of the proposal [Automatic Income Allocation & Token Converter](https://community.venus.io/t/automatic-income-allocation-token-converter/3702), published in the Venus community forum. At this time, it only affects the reserves generated by the VBNB market in the Core pool as the BNB contract is not upgradable and need to be dealt with separately. + +The new VBNBAdmin will be authorized to reduce the reserves of the VBNB market, and send them to the new [ProtocolShareReserve](https://bscscan.com/address/0xCa01D5A9A248a830E9D93231e791B1afFed7c446) contract, where distribution rules are configured following the [protocol tokenomics](https://docs-v4.venus.io/governance/tokenomics): + +- 40% to the RiskFund contract +- 40% to the [Venus Treasury](https://bscscan.com/address/0xf322942f644a996a617bd29c16bd7d231d9f35e9) contract +- 10% to the Venus Prime Program. This 10% will be sent temporarily to the Venus Treasury, until the Venus Prime contract is ready. +- 10% for the XVS Vault rewards. This 10% will be sent temporarily to the Venus Treasury, until the [Token Converter contracts](https://community.venus.io/t/automatic-income-allocation-token-converter/3702) are ready. + +With this change, BNB reserve transfers will be performed in a permissionless fashion. + +Moreover, VBNBAdmin wraps the BNB reserves into [WBNB](https://bscscan.com/address/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c), so the downstream contracts do not have to deal with native tokens anymore, simplifying the logic. + +There will be a second stage for the Automatic Income Allocation, proposed in the following days, where the markets of the Core pool and the markets of the Isolated pools will start using this new ProtocolShareReserve contract. + +The owner of the VBNBAdmin contract is the Normal Timelock. The owner of the new ProtocolShareReserve contract is also the Normal Timelock. + +**Security and additional considerations** + +We applied the following security procedures for this upgrade: + +- **VBNB configuration post upgrade**: in a simulation environment, validating the configuration of the VBNB contract is the expected one after the VIP +- **Reduce reserves from the VBNB contract**: in a simulation environment, validating the BNB reserves are distributed as expected to the different destinations: RiskFund and Venus Treasury +- **Deployment on testnet**: the same VBNBAdmin and ProtocolShareReserve contracts were deployed and configured to testnet, and used in the Venus Protocol testnet deployment +- **Audit: Quantstamp, Certik, Peckshield and Fairyproof have audited the deployed code** + +**Audit reports** + +- [Quantstamp audit report (2023/09/13)](https://github.com/VenusProtocol/venus-protocol/blob/9ef8901dfef84a11338751881fd10a2d36c576ad/audits/058_automatic_income_allocation_quantstamp_20230913.pdf) +- [Certik audit audit report (2023/09/12)](https://github.com/VenusProtocol/venus-protocol/blob/90f913fd345c24c60efa613ab5ab7e633b7aa07a/audits/059_automatic_income_allocation_certik_20230912.pdf) +- [Peckshield audit report (2023/08/12)](https://github.com/VenusProtocol/venus-protocol/blob/90f913fd345c24c60efa613ab5ab7e633b7aa07a/audits/054_automatic_income_allocation_peckshield_20230812.pdf) +- [Fairyproof audit report (2023/08/03)](https://github.com/VenusProtocol/venus-protocol/blob/90f913fd345c24c60efa613ab5ab7e633b7aa07a/audits/050_automatic_income_allocation_fairyproof_20230803.pdf) + +**Deployed contracts on main net** + +- [VBNBAdmin](https://bscscan.com/address/0x9A7890534d9d91d473F28cB97962d176e2B65f1d) +- New [ProtocolShareReserve](https://bscscan.com/address/0xCa01D5A9A248a830E9D93231e791B1afFed7c446) + +**References** + +- [Pull request with the VBNBAdmin contract](https://github.com/VenusProtocol/venus-protocol/pull/289) +- [Simulation post upgrade](https://github.com/VenusProtocol/vips/pull/53) +- [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation)`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + { + target: PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [RISK_FUND, NEW_RISK_FUND_IMPLEMENTATION], + }, + { + target: VBNBAdmin_ADDRESS, + signature: "acceptOwnership()", + params: [], + }, + { + target: vBNB_ADDRESS, + signature: "_setPendingAdmin(address)", + params: [VBNBAdmin_ADDRESS], + }, + { + target: VBNBAdmin_ADDRESS, + signature: "_acceptAdmin()", + params: [], + }, + { + target: PSR, + signature: "acceptOwnership()", + params: [], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "addOrUpdateDistributionConfigs(DistributionConfig[])", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", CRITICAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", FAST_TRACK_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [PSR, "removeDistributionConfig(Schema,address)", NORMAL_TIMELOCK], + }, + { + target: PSR, + signature: "addOrUpdateDistributionConfigs((uint8,uint8,address)[])", + params: [ + [ + [0, 40, RISK_FUND], + [0, 60, TREASURY], + [1, 50, RISK_FUND], + [1, 50, TREASURY], + ], + ], + }, + { + target: PSR, + signature: "setPoolRegistry(address)", + params: [POOL_REGISTRY], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From a3d33177787640fe812c2766392ca36a3f68def2 Mon Sep 17 00:00:00 2001 From: narayanprusty Date: Thu, 19 Oct 2023 13:56:02 +0100 Subject: [PATCH 55/55] feat: added tests to check permission --- simulations/vip-189/vip-189/simulation.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/simulations/vip-189/vip-189/simulation.ts b/simulations/vip-189/vip-189/simulation.ts index d88017681..d407449a1 100644 --- a/simulations/vip-189/vip-189/simulation.ts +++ b/simulations/vip-189/vip-189/simulation.ts @@ -87,12 +87,16 @@ forking(32659660, () => { let WBNB: ethers.Contract; let proxyAdmin: ethers.Contract; let riskFund: ethers.Contract; + let vBNBFallback: ethers.Contract; before(async () => { await impersonateAccount(RANDOM_ADDRESS); + await impersonateAccount(NORMAL_TIMELOCK); const signer = await ethers.getSigner(RANDOM_ADDRESS); + const timelock = await ethers.getSigner(NORMAL_TIMELOCK); vBNB = new ethers.Contract(vBNB_ADDRESS, vBNB_ABI, provider); + vBNBFallback = new ethers.Contract(VBNBAdmin_ADDRESS, vBNB_ABI, timelock); psr = new ethers.Contract(PSR, PSR_ABI, signer); vBNBAdmin = new ethers.Contract(VBNBAdmin_ADDRESS, vBNBAdmin_ABI, signer); WBNB = new ethers.Contract(WBNB_ADDRESS, ERC20_ABI, provider); @@ -167,5 +171,16 @@ forking(32659660, () => { expect(await proxyAdmin.owner()).to.be.equal(NORMAL_TIMELOCK); }); + + it("check permissions", async () => { + expect(await vBNB.reserveFactorMantissa()).to.be.equal("250000000000000000"); + expect(await vBNB.pendingAdmin()).to.be.equal("0x0000000000000000000000000000000000000000"); + + await vBNBFallback._setReserveFactor(100); + await vBNBFallback._setPendingAdmin(NORMAL_TIMELOCK); + + expect(await vBNB.reserveFactorMantissa()).to.be.equal(100); + expect(await vBNB.pendingAdmin()).to.be.equal(NORMAL_TIMELOCK); + }); }); });