From b2972dc7cf21be796c15c7f53b9a94a476258e86 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Tue, 5 Sep 2023 15:07:15 +0530 Subject: [PATCH 01/32] feat: simulation for IL-testnet upgrades of AIA --- .../vip-170-testnet/abi/BEACON_ABI.json | 51 ++ .../vip-170-testnet/abi/COMPTROLLER.json | 769 ++++++++++++++++ .../vip-170-testnet/abi/MOCK_TOKEN_ABI.json | 155 ++++ .../vip-170-testnet/abi/VTOKEN_ABI.json | 830 ++++++++++++++++++ .../vip-170/vip-170-testnet/simulations.ts | 212 +++++ vips/vip-170/vip-170-testnet.ts | 164 ++++ 6 files changed, 2181 insertions(+) create mode 100644 simulations/vip-170/vip-170-testnet/abi/BEACON_ABI.json create mode 100644 simulations/vip-170/vip-170-testnet/abi/COMPTROLLER.json create mode 100644 simulations/vip-170/vip-170-testnet/abi/MOCK_TOKEN_ABI.json create mode 100644 simulations/vip-170/vip-170-testnet/abi/VTOKEN_ABI.json create mode 100644 simulations/vip-170/vip-170-testnet/simulations.ts create mode 100644 vips/vip-170/vip-170-testnet.ts diff --git a/simulations/vip-170/vip-170-testnet/abi/BEACON_ABI.json b/simulations/vip-170/vip-170-testnet/abi/BEACON_ABI.json new file mode 100644 index 000000000..fe7f3e52f --- /dev/null +++ b/simulations/vip-170/vip-170-testnet/abi/BEACON_ABI.json @@ -0,0 +1,51 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "implementation_", "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" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "implementation", + "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": "address", "name": "newImplementation", "type": "address" }], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-170/vip-170-testnet/abi/COMPTROLLER.json b/simulations/vip-170/vip-170-testnet/abi/COMPTROLLER.json new file mode 100644 index 000000000..f8d85ef31 --- /dev/null +++ b/simulations/vip-170/vip-170-testnet/abi/COMPTROLLER.json @@ -0,0 +1,769 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "poolRegistry_", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "enum ComptrollerStorage.Action", "name": "action", "type": "uint8" } + ], + "name": "ActionPaused", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "BorrowCapExceeded", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "expectedLessThanOrEqualTo", "type": "uint256" }, + { "internalType": "uint256", "name": "actual", "type": "uint256" } + ], + "name": "CollateralExceedsThreshold", + "type": "error" + }, + { "inputs": [], "name": "ComptrollerMismatch", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "collateralToSeize", "type": "uint256" }, + { "internalType": "uint256", "name": "availableCollateral", "type": "uint256" } + ], + "name": "InsufficientCollateral", + "type": "error" + }, + { "inputs": [], "name": "InsufficientLiquidity", "type": "error" }, + { "inputs": [], "name": "InsufficientShortfall", "type": "error" }, + { "inputs": [], "name": "InvalidCollateralFactor", "type": "error" }, + { "inputs": [], "name": "InvalidLiquidationThreshold", "type": "error" }, + { + "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], + "name": "MarketAlreadyListed", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "MarketNotCollateral", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "loopsLimit", "type": "uint256" }, + { "internalType": "uint256", "name": "requiredLoops", "type": "uint256" } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "expectedGreaterThan", "type": "uint256" }, + { "internalType": "uint256", "name": "actual", "type": "uint256" } + ], + "name": "MinimalCollateralViolated", + "type": "error" + }, + { "inputs": [], "name": "NonzeroBorrowBalance", "type": "error" }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "PriceError", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "SnapshotError", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "SupplyCapExceeded", + "type": "error" + }, + { "inputs": [], "name": "TooMuchRepay", "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": [ + { "internalType": "address", "name": "expectedSender", "type": "address" }, + { "internalType": "address", "name": "actualSender", "type": "address" } + ], + "name": "UnexpectedSender", + "type": "error" + }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "enum ComptrollerStorage.Action", "name": "action", "type": "uint8" }, + { "indexed": false, "internalType": "bool", "name": "pauseState", "type": "bool" } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "MarketSupported", + "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": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newBorrowCap", "type": "uint256" } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldCloseFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldCollateralFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldLiquidationIncentiveMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newLiquidationIncentiveMantissa", "type": "uint256" } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldLiquidationThresholdMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newLiquidationThresholdMantissa", "type": "uint256" } + ], + "name": "NewLiquidationThreshold", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMinLiquidatableCollateral", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMinLiquidatableCollateral", "type": "uint256" } + ], + "name": "NewMinLiquidatableCollateral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "rewardsDistributor", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "rewardToken", "type": "address" } + ], + "name": "NewRewardsDistributor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSupplyCap", "type": "uint256" } + ], + "name": "NewSupplyCap", + "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" + }, + { "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" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "accountAssets", + "outputs": [{ "internalType": "contract VToken", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "enum ComptrollerStorage.Action", "name": "action", "type": "uint8" } + ], + "name": "actionPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract RewardsDistributor", "name": "_rewardsDistributor", "type": "address" }], + "name": "addRewardsDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allMarkets", + "outputs": [{ "internalType": "contract VToken", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "borrowCaps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "contract VToken", "name": "vToken", "type": "address" } + ], + "name": "checkMembership", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address[]", "name": "vTokens", "type": "address[]" }], + "name": "enterMarkets", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vTokenAddress", "type": "address" }], + "name": "exitMarket", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "shortfall", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllMarkets", + "outputs": [{ "internalType": "contract VToken[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAssetsIn", + "outputs": [{ "internalType": "contract VToken[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getBorrowingPower", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "shortfall", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "vTokenModify", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "shortfall", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardDistributors", + "outputs": [{ "internalType": "contract RewardsDistributor[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "getRewardsByMarket", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "rewardToken", "type": "address" }, + { "internalType": "uint256", "name": "supplySpeed", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowSpeed", "type": "uint256" } + ], + "internalType": "struct ComptrollerStorage.RewardSpeeds[]", + "name": "rewardSpeeds", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "healAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "loopLimit", "type": "uint256" }, + { "internalType": "address", "name": "accessControlManager", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isComptroller", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "isDeprecated", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "isMarketListed", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { + "components": [ + { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "contract VToken", "name": "vTokenBorrowed", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "internalType": "struct ComptrollerStorage.LiquidationOrder[]", + "name": "orders", + "type": "tuple[]" + } + ], + "name": "liquidateAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "tokensToSeize", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "markets", + "outputs": [ + { "internalType": "bool", "name": "isListed", "type": "bool" }, + { "internalType": "uint256", "name": "collateralFactorMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidationThresholdMantissa", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLiquidatableCollateral", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [{ "internalType": "contract ResilientOracleInterface", "name": "", "type": "address" }], + "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": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "preBorrowHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "bool", "name": "skipLiquidityCheck", "type": "bool" } + ], + "name": "preLiquidateHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "preMintHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "redeemer", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "preRedeemHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" } + ], + "name": "preRepayHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "seizerContract", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" } + ], + "name": "preSeizeHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "transferTokens", "type": "uint256" } + ], + "name": "preTransferHook", + "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 VToken[]", "name": "marketsList", "type": "address[]" }, + { "internalType": "enum ComptrollerStorage.Action[]", "name": "actionsList", "type": "uint8[]" }, + { "internalType": "bool", "name": "paused", "type": "bool" } + ], + "name": "setActionsPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" }], + "name": "setCloseFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "newLiquidationThresholdMantissa", "type": "uint256" } + ], + "name": "setCollateralFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newLiquidationIncentiveMantissa", "type": "uint256" }], + "name": "setLiquidationIncentive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract VToken[]", "name": "vTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "newBorrowCaps", "type": "uint256[]" } + ], + "name": "setMarketBorrowCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract VToken[]", "name": "vTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "newSupplyCaps", "type": "uint256[]" } + ], + "name": "setMarketSupplyCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "limit", "type": "uint256" }], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newMinLiquidatableCollateral", "type": "uint256" }], + "name": "setMinLiquidatableCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract ResilientOracleInterface", "name": "newOracle", "type": "address" }], + "name": "setPriceOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "supplyCaps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "supportMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "updatePrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-170/vip-170-testnet/abi/MOCK_TOKEN_ABI.json b/simulations/vip-170/vip-170-testnet/abi/MOCK_TOKEN_ABI.json new file mode 100644 index 000000000..1d69e8f66 --- /dev/null +++ b/simulations/vip-170/vip-170-testnet/abi/MOCK_TOKEN_ABI.json @@ -0,0 +1,155 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "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": 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": [ + { "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": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "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": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "allocateTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-170/vip-170-testnet/abi/VTOKEN_ABI.json b/simulations/vip-170/vip-170-testnet/abi/VTOKEN_ABI.json new file mode 100644 index 000000000..e1dd2dd92 --- /dev/null +++ b/simulations/vip-170/vip-170-testnet/abi/VTOKEN_ABI.json @@ -0,0 +1,830 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [{ "internalType": "uint256", "name": "actualAddAmount", "type": "uint256" }], + "name": "AddReservesFactorFreshCheck", + "type": "error" + }, + { "inputs": [], "name": "BorrowCashNotAvailable", "type": "error" }, + { "inputs": [], "name": "BorrowFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "ForceLiquidateBorrowUnauthorized", "type": "error" }, + { "inputs": [], "name": "HealBorrowUnauthorized", "type": "error" }, + { + "inputs": [{ "internalType": "uint256", "name": "errorCode", "type": "uint256" }], + "name": "LiquidateAccrueCollateralInterestFailed", + "type": "error" + }, + { "inputs": [], "name": "LiquidateCloseAmountIsUintMax", "type": "error" }, + { "inputs": [], "name": "LiquidateCloseAmountIsZero", "type": "error" }, + { "inputs": [], "name": "LiquidateCollateralFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "LiquidateFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "LiquidateLiquidatorIsBorrower", "type": "error" }, + { "inputs": [], "name": "LiquidateSeizeLiquidatorIsBorrower", "type": "error" }, + { "inputs": [], "name": "MintFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "ProtocolSeizeShareTooBig", "type": "error" }, + { "inputs": [], "name": "RedeemFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "RedeemTransferOutNotPossible", "type": "error" }, + { "inputs": [], "name": "ReduceReservesCashNotAvailable", "type": "error" }, + { "inputs": [], "name": "ReduceReservesCashValidation", "type": "error" }, + { "inputs": [], "name": "ReduceReservesFreshCheck", "type": "error" }, + { "inputs": [], "name": "RepayBorrowFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "SetInterestRateModelFreshCheck", "type": "error" }, + { "inputs": [], "name": "SetReserveFactorBoundsCheck", "type": "error" }, + { "inputs": [], "name": "SetReserveFactorFreshCheck", "type": "error" }, + { "inputs": [], "name": "TransferNotAllowed", "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": 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": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtOld", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtNew", "type": "uint256" } + ], + "name": "BadDebtIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "badDebtOld", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtNew", "type": "uint256" } + ], + "name": "BadDebtRecovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "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": true, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "HealBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "liquidator", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBalance", "type": "uint256" } + ], + "name": "Mint", + "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": "contract ComptrollerInterface", "name": "oldComptroller", "type": "address" }, + { "indexed": true, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldProtocolSeizeShareMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newProtocolSeizeShareMantissa", "type": "uint256" } + ], + "name": "NewProtocolSeizeShare", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldProtocolShareReserve", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newProtocolShareReserve", "type": "address" } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReduceReservesBlockDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReduceReservesBlockDelta", "type": "uint256" } + ], + "name": "NewReduceReservesBlockDelta", + "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": true, "internalType": "address", "name": "oldShortfall", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newShortfall", "type": "address" } + ], + "name": "NewShortfallContract", + "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": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "ProtocolSeize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBalance", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": true, "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": true, "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": true, "internalType": "address", "name": "protocolShareReserve", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "SpreadReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "token", "type": "address" }], + "name": "SweepToken", + "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" + }, + { + "inputs": [], + "name": "NO_ERROR", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "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": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "addReserves", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "badDebt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "recoveredAmount_", "type": "uint256" }], + "name": "badDebtRecovered", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "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": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "bool", "name": "skipLiquidityCheck", "type": "bool" } + ], + "name": "forceLiquidateBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "vTokenBalance", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowBalance", "type": "uint256" }, + { "internalType": "uint256", "name": "exchangeRate", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "payer", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "healBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "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": "underlying_", "type": "address" }, + { "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", "name": "admin_", "type": "address" }, + { "internalType": "address", "name": "accessControlManager_", "type": "address" }, + { + "components": [ + { "internalType": "address", "name": "shortfall", "type": "address" }, + { "internalType": "address payable", "name": "protocolShareReserve", "type": "address" } + ], + "internalType": "struct VTokenInterface.RiskManagementInit", + "name": "riskManagement", + "type": "tuple" + }, + { "internalType": "uint256", "name": "reserveFactorMantissa_", "type": "uint256" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "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": "protocolSeizeShareMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolShareReserve", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "reduceReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "setInterestRateModel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newProtocolSeizeShareMantissa_", "type": "uint256" }], + "name": "setProtocolSeizeShare", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address payable", "name": "protocolShareReserve_", "type": "address" }], + "name": "setProtocolShareReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_newReduceReservesBlockDelta", "type": "uint256" }], + "name": "setReduceReservesBlockDelta", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "setReserveFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "shortfall_", "type": "address" }], + "name": "setShortfallContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shortfall", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract IERC20Upgradeable", "name": "token", "type": "address" }], + "name": "sweepToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "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" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts new file mode 100644 index 000000000..a88b16bf6 --- /dev/null +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -0,0 +1,212 @@ +import { mine } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { BigNumber } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { IL_ASSETS, vip170Testnet } from "../../../vips/vip-170/vip-170-testnet"; +import BEACON_ABI from "./abi/BEACON_ABI.json"; +import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; +import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; +import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; + +const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; +const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +interface storageLayout { + name: string; + symbol: string; + decimals: number; + owner: string; + comptroller: string; + interestRateModel: string; + reserveFactorMantissa: BigNumber; + accrualBlockNumber: BigNumber; + borrowIndex: BigNumber; + totalBorrows: BigNumber; + totalSupply: BigNumber; + underlying: string; + accountBalance: BigNumber; + borrowBalance: BigNumber; + borrowRatePerBlock: BigNumber; + pendingOwner: string; + protocolShareReserve: string; + shortfall: string; + supplyRatePerBlock: BigNumber; +} +async function fetchStorage(vToken: ethers.Contract, user: string) { + const name = await vToken.name(); + const symbol = await vToken.symbol(); + const decimals = await vToken.decimals(); + const owner = await vToken.owner(); + const comptroller = await vToken.comptroller(); + const interestRateModel = await vToken.interestRateModel(); + const reserveFactorMantissa = await vToken.reserveFactorMantissa(); + const accrualBlockNumber = await vToken.accrualBlockNumber(); + const borrowIndex = await vToken.borrowIndex(); + const totalBorrows = await vToken.totalBorrows(); + const totalSupply = await vToken.totalSupply(); + const underlying = await vToken.underlying(); + const accountBalance = await vToken.callStatic.balanceOf(user); + const borrowBalance = await vToken.callStatic.borrowBalanceStored(user); + const borrowRatePerBlock = await vToken.borrowRatePerBlock(); + const pendingOwner = await vToken.pendingOwner(); + const protocolShareReserve = await vToken.protocolShareReserve(); + const shortfall = await vToken.shortfall(); + const supplyRatePerBlock = await vToken.supplyRatePerBlock(); + + return { + name, + symbol, + decimals, + owner, + comptroller, + interestRateModel, + reserveFactorMantissa, + accrualBlockNumber, + borrowIndex, + totalBorrows, + totalSupply, + underlying, + accountBalance, + borrowBalance, + borrowRatePerBlock, + pendingOwner, + protocolShareReserve, + shortfall, + supplyRatePerBlock, + }; +} + +let vToken: ethers.Contract; +let underlying: ethers.Contract; +let user: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; +const postVipStorage: storageLayout[] = []; +const preVipStorage: storageLayout[] = []; +const provider = ethers.provider; +let mintAmount = parseUnits("200", 18); +let borrowAmount = parseUnits("50", 18); +let repayAmount = parseUnits("50", 18); +let redeemAmount = parseUnits("50", 18); +forking(33043237, () => { + describe("pre VIP", async () => { + before(async () => { + [user] = await ethers.getSigners(); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await mine(4); + }); + for (const asset of IL_ASSETS) { + it(`Save pre VIP storage snapshot of ${asset.name}`, async () => { + vToken = new ethers.Contract(asset.address, VTOKEN_ABI, provider); + + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(asset.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); + + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + const underlyingDecimals = await underlying.decimals(); + const symbol = await underlying.symbol(); + + if (symbol == "WBNB") { + mintAmount = parseUnits("0.9", 18); + borrowAmount = parseUnits("0.5", 18); + repayAmount = parseUnits("0.25", 18); + redeemAmount = parseUnits("0.5", 18); + await underlying.connect(user).deposit({ value: mintAmount }); + } else if (underlyingDecimals == 18) { + await underlying.connect(user).faucet(mintAmount.add(repayAmount)); + } else { + mintAmount = parseUnits("200", 6); + borrowAmount = parseUnits("50", 6); + repayAmount = parseUnits("25", 6); + redeemAmount = parseUnits("50", 6); + await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); + } + + await underlying.connect(user).approve(asset.address, mintAmount.add(repayAmount)); + + await vToken.connect(user).mint(mintAmount); + await vToken.connect(user).borrow(borrowAmount); + await vToken.connect(user).repayBorrow(repayAmount); + await vToken.connect(user).redeemUnderlying(redeemAmount); + const state = await fetchStorage(vToken, user.address); + preVipStorage.push(state); + }); + } + }); +}); + +forking(33043237, () => { + testVip("VIP-170 VToken Upgrade of AIA", vip170Testnet(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 22]); + }, + }); +}); + +forking(33043237, () => { + describe("pre VIP", async () => { + before(async () => { + await pretendExecutingVip(vip170Testnet()); + [user] = await ethers.getSigners(); + }); + + for (const asset of IL_ASSETS) { + it(`Save post VIP storage snapshot of ${asset.name}`, async () => { + vToken = new ethers.Contract(asset.address, VTOKEN_ABI, provider); + + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + // await comptroller.connect(user).enterMarkets([asset.address]); + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(asset.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); + + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + const underlyingDecimals = await underlying.decimals(); + const symbol = await underlying.symbol(); + + if (symbol == "WBNB") { + mintAmount = parseUnits("0.9", 18); + borrowAmount = parseUnits("0.5", 18); + repayAmount = parseUnits("0.25", 18); + redeemAmount = parseUnits("0.5", 18); + await underlying.connect(user).deposit({ value: mintAmount }); + } else if (underlyingDecimals == 18) { + await underlying.connect(user).faucet(mintAmount.add(repayAmount)); + } else { + mintAmount = parseUnits("200", 6); + borrowAmount = parseUnits("50", 6); + repayAmount = parseUnits("25", 6); + redeemAmount = parseUnits("50", 6); + await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); + } + + await underlying.connect(user).approve(asset.address, mintAmount.add(repayAmount)); + + await vToken.connect(user).mint(mintAmount); + await vToken.connect(user).borrow(borrowAmount); + await vToken.connect(user).repayBorrow(repayAmount); + await vToken.connect(user).redeemUnderlying(redeemAmount); + const state = await fetchStorage(vToken, user.address); + postVipStorage.push(state); + }); + } + + it("Should match pre and post storage", async () => { + for (let i = 0; i < preVipStorage.length; i++) { + expect(preVipStorage[i]).to.deep.equal(postVipStorage[i]); + } + }); + + it("Should change implementation", async () => { + const beacon = new ethers.Contract(VTOKEN_BEACON, BEACON_ABI, provider); + expect(await beacon.implementation()).equals(NEW_IMPL_VTOKEN); + }); + }); +}); diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts new file mode 100644 index 000000000..d921d6d2f --- /dev/null +++ b/vips/vip-170/vip-170-testnet.ts @@ -0,0 +1,164 @@ +import { ethers } from "hardhat"; + +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; +const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; +const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +interface AssetConfig { + name: string; + address: string; + reduceReservesBlockDelta: number; +} + +export const IL_ASSETS: AssetConfig[] = [ + { + name: "vWIN_Tron", + address: "0xEe543D5de2Dbb5b07675Fc72831A2f1812428393", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDD_Tron", + address: "0xD804F74fe21290d213c46610ab171f7c2EeEBDE7", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDT_Tron", + address: "0x712774CBFFCBD60e9825871CcEFF2F917442b2c3", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vTRX_Tron", + address: "0x410286c43a525E1DCC7468a9B091C111C8324cd1", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vWBNB_LiquidStakedBNB", + address: "0x231dED0Dfc99634e52EE1a1329586bc970d773b3", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vBTT_Tron", + address: "0x47793540757c6E6D84155B33cd8D9535CFdb9334", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vBNBx_LiquidStakedBNB", + address: "0x644A149853E5507AdF3e682218b8AC86cdD62951", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vstkBNB_LiquidStakedBNB", + address: "0x75aa42c832a8911B77219DbeBABBB40040d16987", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vankrBNB_LiquidStakedBNB", + address: "0x57a664Dd7f1dE19545fEE9c86C949e3BF43d6D47", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vFLOKI_GameFi", + address: "0xef470AbC365F88e4582D8027172a392C473A5B53", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDD_GameFi", + address: "0xdeDf3B2bcF25d0023115fd71a0F8221C91C92B1a", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vRACA_GameFi", + address: "0x1958035231E125830bA5d17D168cEa07Bb42184a", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vankrBNB_DeFi", + address: "0xe507B30C41E9e375BCe05197c1e09fc9ee40c0f6", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDD_DeFi", + address: "0xa109DE0abaeefC521Ec29D89eA42E64F37A6882E", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vANKR_DeFi", + address: "0xb677e080148368EeeE70fA3865d07E92c6500174", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vBSW_DeFi", + address: "0x5e68913fbbfb91af30366ab1B21324410b49a308", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vALPACA_DeFi", + address: "0xb7caC5Ef82cb7f9197ee184779bdc52c5490C02a", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vHAY", + address: "0x170d3b2da05cc2124334240fB34ad1359e34C562", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDD", + address: "0x899dDf81DfbbF5889a16D075c352F2b959Dd24A4", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDT", + address: "0x3338988d0beb4419Acb8fE624218754053362D06", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDT_DeFi", + address: "0x80CC30811e362aC9aB857C3d7875CbcCc0b65750", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDT_GameFi", + address: "0x0bFE4e0B8A2a096A27e5B18b078d25be57C08634", + reduceReservesBlockDelta: 8640000, + }, +]; + +export const vip170Testnet = () => { + const meta = { + version: "v2", + title: "VIP-170 VToken Upgrade of AIA", + description: `upgrade the implementation of the DeFi Comptroller contract, with a new version adding the feature to remove a market from the Comptroller + execute the new function on the Comptroller contract associated with the DeFi pool, to remove the vBIFI market.`, + forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", + againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + }; + + return makeProposal( + [ + { + target: VTOKEN_BEACON, + signature: "upgradeTo(address)", + params: [NEW_IMPL_VTOKEN], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + }, + ...IL_ASSETS.map(asset => { + return { + target: asset.address, + signature: "setReduceReservesBlockDelta(uint256)", + params: [asset.reduceReservesBlockDelta], + }; + }), + ], + meta, + ProposalType.REGULAR, + ); +}; From b21d646ed6c15674eab7ff84b3673560c550bb99 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:22:28 +0530 Subject: [PATCH 02/32] feat: add helper to perform basic actions and fetch storage of vtoken --- src/vtokenUpgradesHelper.ts | 113 ++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 src/vtokenUpgradesHelper.ts diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts new file mode 100644 index 000000000..c3f4d628f --- /dev/null +++ b/src/vtokenUpgradesHelper.ts @@ -0,0 +1,113 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { BigNumber, Signer } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; + +export interface storageLayout { + name: string; + symbol: string; + decimals: number; + owner: string; + comptroller: string; + interestRateModel: string; + reserveFactorMantissa: BigNumber; + accrualBlockNumber: BigNumber; + borrowIndex: BigNumber; + totalBorrows: BigNumber; + totalSupply: BigNumber; + underlying: string; + accountBalance: BigNumber; + borrowBalance: BigNumber; + borrowRatePerBlock: BigNumber; + pendingOwner: string; + protocolShareReserve: string; + shortfall: string; + supplyRatePerBlock: BigNumber; +} + +export const fetchStorage = async (vToken: ethers.Contract, user: string) => { + const name = await vToken.name(); + const symbol = await vToken.symbol(); + const decimals = await vToken.decimals(); + const owner = await vToken.owner(); + const comptroller = await vToken.comptroller(); + const interestRateModel = await vToken.interestRateModel(); + const reserveFactorMantissa = await vToken.reserveFactorMantissa(); + const accrualBlockNumber = await vToken.accrualBlockNumber(); + const borrowIndex = await vToken.borrowIndex(); + const totalBorrows = await vToken.totalBorrows(); + const totalSupply = await vToken.totalSupply(); + const underlying = await vToken.underlying(); + const accountBalance = await vToken.callStatic.balanceOf(user); + const borrowBalance = await vToken.callStatic.borrowBalanceStored(user); + const borrowRatePerBlock = await vToken.borrowRatePerBlock(); + const pendingOwner = await vToken.pendingOwner(); + const protocolShareReserve = await vToken.protocolShareReserve(); + const shortfall = await vToken.shortfall(); + const supplyRatePerBlock = await vToken.supplyRatePerBlock(); + + return { + name, + symbol, + decimals, + owner, + comptroller, + interestRateModel, + reserveFactorMantissa, + accrualBlockNumber, + borrowIndex, + totalBorrows, + totalSupply, + underlying, + accountBalance, + borrowBalance, + borrowRatePerBlock, + pendingOwner, + protocolShareReserve, + shortfall, + supplyRatePerBlock, + }; +}; + +export const performVTokenBasicActions = async ( + marketAddress: string, + user: SignerWithAddress, + impersonatedTimelock: Signer, + mintAmount: BigNumber, + borrowAmount: BigNumber, + repayAmount: BigNumber, + redeemAmount: BigNumber, + vToken: ethers.Contract, + underlying: ethers.Contract, + comptroller: ethers.Contract, +) => { + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(marketAddress, parseUnits("0.8", 18), parseUnits("0.9", 18)); + const underlyingDecimals = await underlying.decimals(); + const symbol = await underlying.symbol(); + + await comptroller.connect(impersonatedTimelock).setMarketBorrowCaps([marketAddress], [parseUnits("2", 38)]); + await comptroller.connect(impersonatedTimelock).setMarketSupplyCaps([marketAddress], [parseUnits("2", 38)]); + + if (symbol === "WBNB") { + mintAmount = parseUnits("1", 18); + borrowAmount = parseUnits("0.5", 18); + repayAmount = parseUnits("0.25", 18); + redeemAmount = parseUnits("0.5", 18); + await underlying.connect(user).deposit({ value: mintAmount }); + } else if (underlyingDecimals === 18) { + await underlying.connect(user).faucet(mintAmount.add(repayAmount)); + } else { + mintAmount = parseUnits("200", 6); + borrowAmount = parseUnits("50", 6); + repayAmount = parseUnits("25", 6); + redeemAmount = parseUnits("50", 6); + await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); + } + await underlying.connect(user).approve(marketAddress, mintAmount.add(repayAmount)); + + await vToken.connect(user).mint(mintAmount); + await vToken.connect(user).borrow(borrowAmount); + await vToken.connect(user).repayBorrow(repayAmount); + await vToken.connect(user).redeemUnderlying(redeemAmount); +}; From 235ff26c112a421052508511016631588abbc2a5 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:23:15 +0530 Subject: [PATCH 03/32] feat: add steps for setting protocol share reserve --- .../vip-170/vip-170-testnet/simulations.ts | 186 +++++------------- vips/vip-170/vip-170-testnet.ts | 70 ++++--- 2 files changed, 85 insertions(+), 171 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index a88b16bf6..75153fc38 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -1,13 +1,13 @@ -import { mine } from "@nomicfoundation/hardhat-network-helpers"; +import { mine, setBalance } from "@nomicfoundation/hardhat-network-helpers"; import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { expect } from "chai"; -import { BigNumber } from "ethers"; import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { IL_ASSETS, vip170Testnet } from "../../../vips/vip-170/vip-170-testnet"; +import { fetchStorage, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { IL_MARKETS, vip170Testnet } from "../../../vips/vip-170/vip-170-testnet"; import BEACON_ABI from "./abi/BEACON_ABI.json"; import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; @@ -16,71 +16,7 @@ import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; - -interface storageLayout { - name: string; - symbol: string; - decimals: number; - owner: string; - comptroller: string; - interestRateModel: string; - reserveFactorMantissa: BigNumber; - accrualBlockNumber: BigNumber; - borrowIndex: BigNumber; - totalBorrows: BigNumber; - totalSupply: BigNumber; - underlying: string; - accountBalance: BigNumber; - borrowBalance: BigNumber; - borrowRatePerBlock: BigNumber; - pendingOwner: string; - protocolShareReserve: string; - shortfall: string; - supplyRatePerBlock: BigNumber; -} -async function fetchStorage(vToken: ethers.Contract, user: string) { - const name = await vToken.name(); - const symbol = await vToken.symbol(); - const decimals = await vToken.decimals(); - const owner = await vToken.owner(); - const comptroller = await vToken.comptroller(); - const interestRateModel = await vToken.interestRateModel(); - const reserveFactorMantissa = await vToken.reserveFactorMantissa(); - const accrualBlockNumber = await vToken.accrualBlockNumber(); - const borrowIndex = await vToken.borrowIndex(); - const totalBorrows = await vToken.totalBorrows(); - const totalSupply = await vToken.totalSupply(); - const underlying = await vToken.underlying(); - const accountBalance = await vToken.callStatic.balanceOf(user); - const borrowBalance = await vToken.callStatic.borrowBalanceStored(user); - const borrowRatePerBlock = await vToken.borrowRatePerBlock(); - const pendingOwner = await vToken.pendingOwner(); - const protocolShareReserve = await vToken.protocolShareReserve(); - const shortfall = await vToken.shortfall(); - const supplyRatePerBlock = await vToken.supplyRatePerBlock(); - - return { - name, - symbol, - decimals, - owner, - comptroller, - interestRateModel, - reserveFactorMantissa, - accrualBlockNumber, - borrowIndex, - totalBorrows, - totalSupply, - underlying, - accountBalance, - borrowBalance, - borrowRatePerBlock, - pendingOwner, - protocolShareReserve, - shortfall, - supplyRatePerBlock, - }; -} +const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; let vToken: ethers.Contract; let underlying: ethers.Contract; @@ -89,53 +25,38 @@ let impersonatedTimelock: SignerWithAddress; const postVipStorage: storageLayout[] = []; const preVipStorage: storageLayout[] = []; const provider = ethers.provider; -let mintAmount = parseUnits("200", 18); -let borrowAmount = parseUnits("50", 18); -let repayAmount = parseUnits("50", 18); -let redeemAmount = parseUnits("50", 18); +const mintAmount = parseUnits("200", 18); +const borrowAmount = parseUnits("50", 18); +const repayAmount = parseUnits("50", 18); +const redeemAmount = parseUnits("50", 18); forking(33043237, () => { - describe("pre VIP", async () => { + describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(4); + await mine(IL_MARKETS.length * 2 + 2); // Number of Vip steps }); - for (const asset of IL_ASSETS) { - it(`Save pre VIP storage snapshot of ${asset.name}`, async () => { - vToken = new ethers.Contract(asset.address, VTOKEN_ABI, provider); - + for (const market of IL_MARKETS) { + it(`Save pre VIP storage snapshot of ${market.name}`, async () => { + await setBalance(user.address, ethers.utils.parseEther("5")); + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); - await comptroller - .connect(impersonatedTimelock) - .setCollateralFactor(asset.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); - underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - const underlyingDecimals = await underlying.decimals(); - const symbol = await underlying.symbol(); - - if (symbol == "WBNB") { - mintAmount = parseUnits("0.9", 18); - borrowAmount = parseUnits("0.5", 18); - repayAmount = parseUnits("0.25", 18); - redeemAmount = parseUnits("0.5", 18); - await underlying.connect(user).deposit({ value: mintAmount }); - } else if (underlyingDecimals == 18) { - await underlying.connect(user).faucet(mintAmount.add(repayAmount)); - } else { - mintAmount = parseUnits("200", 6); - borrowAmount = parseUnits("50", 6); - repayAmount = parseUnits("25", 6); - redeemAmount = parseUnits("50", 6); - await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); - } - await underlying.connect(user).approve(asset.address, mintAmount.add(repayAmount)); - - await vToken.connect(user).mint(mintAmount); - await vToken.connect(user).borrow(borrowAmount); - await vToken.connect(user).repayBorrow(repayAmount); - await vToken.connect(user).redeemUnderlying(redeemAmount); + await performVTokenBasicActions( + market.address, + user, + impersonatedTimelock, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + comptroller, + ); const state = await fetchStorage(vToken, user.address); + delete state.protocolShareReserve; preVipStorage.push(state); }); } @@ -151,49 +72,34 @@ forking(33043237, () => { }); forking(33043237, () => { - describe("pre VIP", async () => { + describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip170Testnet()); [user] = await ethers.getSigners(); }); - for (const asset of IL_ASSETS) { - it(`Save post VIP storage snapshot of ${asset.name}`, async () => { - vToken = new ethers.Contract(asset.address, VTOKEN_ABI, provider); - + for (const market of IL_MARKETS) { + it(`Save post VIP storage snapshot of ${market.name}`, async () => { + await setBalance(user.address, ethers.utils.parseEther("5")); + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); - // await comptroller.connect(user).enterMarkets([asset.address]); - await comptroller - .connect(impersonatedTimelock) - .setCollateralFactor(asset.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); - underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - const underlyingDecimals = await underlying.decimals(); - const symbol = await underlying.symbol(); - - if (symbol == "WBNB") { - mintAmount = parseUnits("0.9", 18); - borrowAmount = parseUnits("0.5", 18); - repayAmount = parseUnits("0.25", 18); - redeemAmount = parseUnits("0.5", 18); - await underlying.connect(user).deposit({ value: mintAmount }); - } else if (underlyingDecimals == 18) { - await underlying.connect(user).faucet(mintAmount.add(repayAmount)); - } else { - mintAmount = parseUnits("200", 6); - borrowAmount = parseUnits("50", 6); - repayAmount = parseUnits("25", 6); - redeemAmount = parseUnits("50", 6); - await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); - } - - await underlying.connect(user).approve(asset.address, mintAmount.add(repayAmount)); - await vToken.connect(user).mint(mintAmount); - await vToken.connect(user).borrow(borrowAmount); - await vToken.connect(user).repayBorrow(repayAmount); - await vToken.connect(user).redeemUnderlying(redeemAmount); + await performVTokenBasicActions( + market.address, + user, + impersonatedTimelock, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + comptroller, + ); const state = await fetchStorage(vToken, user.address); + delete state.protocolShareReserve; + expect(await vToken.protocolShareReserve()).equals(TREASURY); postVipStorage.push(state); }); } diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index d921d6d2f..4af22e2f2 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -7,6 +7,7 @@ const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; interface AssetConfig { name: string; @@ -14,7 +15,22 @@ interface AssetConfig { reduceReservesBlockDelta: number; } -export const IL_ASSETS: AssetConfig[] = [ +export const IL_MARKETS: AssetConfig[] = [ + { + name: "vHAY", + address: "0x170d3b2da05cc2124334240fB34ad1359e34C562", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDD", + address: "0x899dDf81DfbbF5889a16D075c352F2b959Dd24A4", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDT", + address: "0x3338988d0beb4419Acb8fE624218754053362D06", + reduceReservesBlockDelta: 8640000, + }, { name: "vWIN_Tron", address: "0xEe543D5de2Dbb5b07675Fc72831A2f1812428393", @@ -36,13 +52,13 @@ export const IL_ASSETS: AssetConfig[] = [ reduceReservesBlockDelta: 8640000, }, { - name: "vWBNB_LiquidStakedBNB", - address: "0x231dED0Dfc99634e52EE1a1329586bc970d773b3", + name: "vBTT_Tron", + address: "0x47793540757c6E6D84155B33cd8D9535CFdb9334", reduceReservesBlockDelta: 8640000, }, { - name: "vBTT_Tron", - address: "0x47793540757c6E6D84155B33cd8D9535CFdb9334", + name: "vWBNB_LiquidStakedBNB", + address: "0x231dED0Dfc99634e52EE1a1329586bc970d773b3", reduceReservesBlockDelta: 8640000, }, { @@ -75,6 +91,16 @@ export const IL_ASSETS: AssetConfig[] = [ address: "0x1958035231E125830bA5d17D168cEa07Bb42184a", reduceReservesBlockDelta: 8640000, }, + { + name: "vUSDT_GameFi", + address: "0x0bFE4e0B8A2a096A27e5B18b078d25be57C08634", + reduceReservesBlockDelta: 8640000, + }, + { + name: "vUSDT_DeFi", + address: "0x80CC30811e362aC9aB857C3d7875CbcCc0b65750", + reduceReservesBlockDelta: 8640000, + }, { name: "vankrBNB_DeFi", address: "0xe507B30C41E9e375BCe05197c1e09fc9ee40c0f6", @@ -100,31 +126,6 @@ export const IL_ASSETS: AssetConfig[] = [ address: "0xb7caC5Ef82cb7f9197ee184779bdc52c5490C02a", reduceReservesBlockDelta: 8640000, }, - { - name: "vHAY", - address: "0x170d3b2da05cc2124334240fB34ad1359e34C562", - reduceReservesBlockDelta: 8640000, - }, - { - name: "vUSDD", - address: "0x899dDf81DfbbF5889a16D075c352F2b959Dd24A4", - reduceReservesBlockDelta: 8640000, - }, - { - name: "vUSDT", - address: "0x3338988d0beb4419Acb8fE624218754053362D06", - reduceReservesBlockDelta: 8640000, - }, - { - name: "vUSDT_DeFi", - address: "0x80CC30811e362aC9aB857C3d7875CbcCc0b65750", - reduceReservesBlockDelta: 8640000, - }, - { - name: "vUSDT_GameFi", - address: "0x0bFE4e0B8A2a096A27e5B18b078d25be57C08634", - reduceReservesBlockDelta: 8640000, - }, ]; export const vip170Testnet = () => { @@ -150,13 +151,20 @@ export const vip170Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, - ...IL_ASSETS.map(asset => { + ...IL_MARKETS.map(asset => { return { target: asset.address, signature: "setReduceReservesBlockDelta(uint256)", params: [asset.reduceReservesBlockDelta], }; }), + ...IL_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setProtocolShareReserve(address)", + params: [TREASURY], + }; + }), ], meta, ProposalType.REGULAR, From e104d947647e26d62894a3dba54d5363a59d42fb Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:36:07 +0530 Subject: [PATCH 04/32] fix: fetch total reserve from vtokens --- simulations/vip-170/vip-170-testnet/simulations.ts | 6 ++++++ src/vtokenUpgradesHelper.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index 75153fc38..db4bb4a76 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -56,7 +56,10 @@ forking(33043237, () => { comptroller, ); const state = await fetchStorage(vToken, user.address); + delete state.protocolShareReserve; + delete state.totalReserves; + preVipStorage.push(state); }); } @@ -98,7 +101,10 @@ forking(33043237, () => { comptroller, ); const state = await fetchStorage(vToken, user.address); + delete state.protocolShareReserve; + delete state.totalReserves; + expect(await vToken.protocolShareReserve()).equals(TREASURY); postVipStorage.push(state); }); diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts index c3f4d628f..ef2a45dc6 100644 --- a/src/vtokenUpgradesHelper.ts +++ b/src/vtokenUpgradesHelper.ts @@ -14,6 +14,7 @@ export interface storageLayout { borrowIndex: BigNumber; totalBorrows: BigNumber; totalSupply: BigNumber; + totalReserves: BigNumber; underlying: string; accountBalance: BigNumber; borrowBalance: BigNumber; @@ -36,6 +37,7 @@ export const fetchStorage = async (vToken: ethers.Contract, user: string) => { const borrowIndex = await vToken.borrowIndex(); const totalBorrows = await vToken.totalBorrows(); const totalSupply = await vToken.totalSupply(); + const totalReserves = await vToken.totalReserves(); const underlying = await vToken.underlying(); const accountBalance = await vToken.callStatic.balanceOf(user); const borrowBalance = await vToken.callStatic.borrowBalanceStored(user); @@ -57,6 +59,7 @@ export const fetchStorage = async (vToken: ethers.Contract, user: string) => { borrowIndex, totalBorrows, totalSupply, + totalReserves, underlying, accountBalance, borrowBalance, From 1f9eefc597a767ad6e8c63cbde27ad5ea902fea5 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:04:44 +0530 Subject: [PATCH 05/32] feat: addd core VToken upgrades helper --- src/vtokenUpgradesHelper.ts | 68 +++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts index ef2a45dc6..18fa4198e 100644 --- a/src/vtokenUpgradesHelper.ts +++ b/src/vtokenUpgradesHelper.ts @@ -1,5 +1,5 @@ import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { BigNumber, Signer } from "ethers"; +import { BigNumber } from "ethers"; import { parseUnits } from "ethers/lib/utils"; export interface storageLayout { @@ -25,7 +25,7 @@ export interface storageLayout { supplyRatePerBlock: BigNumber; } -export const fetchStorage = async (vToken: ethers.Contract, user: string) => { +export const fetchVTokenStorageIL = async (vToken: ethers.Contract, user: string) => { const name = await vToken.name(); const symbol = await vToken.symbol(); const decimals = await vToken.decimals(); @@ -71,42 +71,82 @@ export const fetchStorage = async (vToken: ethers.Contract, user: string) => { }; }; +export const fetchVTokenStorageCore = async (vToken: ethers.Contract, user: string) => { + const name = await vToken.name(); + const symbol = await vToken.symbol(); + const decimals = await vToken.decimals(); + const owner = await vToken.admin(); + const comptroller = await vToken.comptroller(); + const interestRateModel = await vToken.interestRateModel(); + const reserveFactorMantissa = await vToken.reserveFactorMantissa(); + const accrualBlockNumber = await vToken.accrualBlockNumber(); + const borrowIndex = await vToken.borrowIndex(); + const totalBorrows = await vToken.totalBorrows(); + const totalSupply = await vToken.totalSupply(); + const totalReserves = await vToken.totalReserves(); + const underlying = await vToken.underlying(); + const accountBalance = await vToken.callStatic.balanceOf(user); + const borrowBalance = await vToken.callStatic.borrowBalanceStored(user); + const borrowRatePerBlock = await vToken.borrowRatePerBlock(); + const pendingOwner = await vToken.pendingAdmin(); + const supplyRatePerBlock = await vToken.supplyRatePerBlock(); + + return { + name, + symbol, + decimals, + owner, + comptroller, + interestRateModel, + reserveFactorMantissa, + accrualBlockNumber, + borrowIndex, + totalBorrows, + totalSupply, + totalReserves, + underlying, + accountBalance, + borrowBalance, + borrowRatePerBlock, + pendingOwner, + supplyRatePerBlock, + }; +}; + export const performVTokenBasicActions = async ( marketAddress: string, user: SignerWithAddress, - impersonatedTimelock: Signer, mintAmount: BigNumber, borrowAmount: BigNumber, repayAmount: BigNumber, redeemAmount: BigNumber, vToken: ethers.Contract, underlying: ethers.Contract, - comptroller: ethers.Contract, ) => { - await comptroller - .connect(impersonatedTimelock) - .setCollateralFactor(marketAddress, parseUnits("0.8", 18), parseUnits("0.9", 18)); const underlyingDecimals = await underlying.decimals(); const symbol = await underlying.symbol(); - await comptroller.connect(impersonatedTimelock).setMarketBorrowCaps([marketAddress], [parseUnits("2", 38)]); - await comptroller.connect(impersonatedTimelock).setMarketSupplyCaps([marketAddress], [parseUnits("2", 38)]); - if (symbol === "WBNB") { mintAmount = parseUnits("1", 18); borrowAmount = parseUnits("0.5", 18); repayAmount = parseUnits("0.25", 18); redeemAmount = parseUnits("0.5", 18); await underlying.connect(user).deposit({ value: mintAmount }); - } else if (underlyingDecimals === 18) { - await underlying.connect(user).faucet(mintAmount.add(repayAmount)); - } else { + } + if (underlyingDecimals == 6) { mintAmount = parseUnits("200", 6); borrowAmount = parseUnits("50", 6); repayAmount = parseUnits("25", 6); redeemAmount = parseUnits("50", 6); - await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); } + if (process.env.FORK_TESTNET === "true") { + try { + await underlying.connect(user).faucet(mintAmount.add(repayAmount)); + } catch (error) { + await underlying.connect(user).allocateTo(user.address, mintAmount.add(repayAmount)); + } + } + await underlying.connect(user).approve(marketAddress, mintAmount.add(repayAmount)); await vToken.connect(user).mint(mintAmount); From 8097ae69f8da11fd86b2ccc710c2baeee3561872 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:05:08 +0530 Subject: [PATCH 06/32] fix: IL vtoken upgrade simulation --- .../vip-170/vip-170-testnet/simulations.ts | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index db4bb4a76..ba81db342 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -6,7 +6,7 @@ import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { fetchStorage, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { fetchVTokenStorageIL, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; import { IL_MARKETS, vip170Testnet } from "../../../vips/vip-170/vip-170-testnet"; import BEACON_ABI from "./abi/BEACON_ABI.json"; import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; @@ -43,19 +43,23 @@ forking(33043237, () => { const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + await comptroller.connect(impersonatedTimelock).setMarketBorrowCaps([market.address], [parseUnits("2", 38)]); + await comptroller.connect(impersonatedTimelock).setMarketSupplyCaps([market.address], [parseUnits("2", 38)]); + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(market.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); + await performVTokenBasicActions( market.address, user, - impersonatedTimelock, mintAmount, borrowAmount, repayAmount, redeemAmount, vToken, underlying, - comptroller, ); - const state = await fetchStorage(vToken, user.address); + const state = await fetchVTokenStorageIL(vToken, user.address); delete state.protocolShareReserve; delete state.totalReserves; @@ -67,7 +71,7 @@ forking(33043237, () => { }); forking(33043237, () => { - testVip("VIP-170 VToken Upgrade of AIA", vip170Testnet(), { + testVip("VIP-170 IL VToken Upgrade of AIA", vip170Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 22]); }, @@ -88,19 +92,23 @@ forking(33043237, () => { const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + await comptroller.connect(impersonatedTimelock).setMarketBorrowCaps([market.address], [parseUnits("2", 38)]); + await comptroller.connect(impersonatedTimelock).setMarketSupplyCaps([market.address], [parseUnits("2", 38)]); + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(market.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); + await performVTokenBasicActions( market.address, user, - impersonatedTimelock, mintAmount, borrowAmount, repayAmount, redeemAmount, vToken, underlying, - comptroller, ); - const state = await fetchStorage(vToken, user.address); + const state = await fetchVTokenStorageIL(vToken, user.address); delete state.protocolShareReserve; delete state.totalReserves; From 4520086875d29b8b568435a6f8e426686747eb1e Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:17:12 +0530 Subject: [PATCH 07/32] chore: update vip description --- vips/vip-170/vip-170-testnet.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index 4af22e2f2..e443eec5b 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -132,8 +132,7 @@ export const vip170Testnet = () => { const meta = { version: "v2", title: "VIP-170 VToken Upgrade of AIA", - description: `upgrade the implementation of the DeFi Comptroller contract, with a new version adding the feature to remove a market from the Comptroller - execute the new function on the Comptroller contract associated with the DeFi pool, to remove the vBIFI market.`, + description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", From 0ab3618b3a637c7a139a407e1e5916c6f0975918 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:17:44 +0530 Subject: [PATCH 08/32] feat: add core VTokens AIA upgrade simulations --- .../vip-171-testnet/abi/COMPTROLLER.json | 2782 +++++++++++++++++ .../vip-171-testnet/abi/MOCK_TOKEN_ABI.json | 155 + .../vip-171-testnet/abi/VTOKEN_ABI.json | 820 +++++ .../vip-171/vip-171-testnet/simulations.ts | 155 + vips/vip-171/vip-171-testnet.ts | 129 + 5 files changed, 4041 insertions(+) create mode 100644 simulations/vip-171/vip-171-testnet/abi/COMPTROLLER.json create mode 100644 simulations/vip-171/vip-171-testnet/abi/MOCK_TOKEN_ABI.json create mode 100644 simulations/vip-171/vip-171-testnet/abi/VTOKEN_ABI.json create mode 100644 simulations/vip-171/vip-171-testnet/simulations.ts create mode 100644 vips/vip-171/vip-171-testnet.ts diff --git a/simulations/vip-171/vip-171-testnet/abi/COMPTROLLER.json b/simulations/vip-171/vip-171-testnet/abi/COMPTROLLER.json new file mode 100644 index 000000000..fb2b4582e --- /dev/null +++ b/simulations/vip-171/vip-171-testnet/abi/COMPTROLLER.json @@ -0,0 +1,2782 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum ComptrollerV9Storage.Action", + "name": "action", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "ActionProtocolPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowDelegatedBorrows", + "type": "bool" + } + ], + "name": "DelegateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusBorrowIndex", + "type": "uint256" + } + ], + "name": "DistributedBorrowerVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "supplier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusSupplyIndex", + "type": "uint256" + } + ], + "name": "DistributedSupplierVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DistributedVAIVaultVenus", + "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": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "NewAccessControl", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldComptrollerLens", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newComptrollerLens", + "type": "address" + } + ], + "name": "NewComptrollerLens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldLiquidatorContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newLiquidatorContract", + "type": "address" + } + ], + "name": "NewLiquidatorContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPauseGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "NewPauseGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSupplyCap", + "type": "uint256" + } + ], + "name": "NewSupplyCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryAddress", + "type": "address" + } + ], + "name": "NewTreasuryAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryGuardian", + "type": "address" + } + ], + "name": "NewTreasuryGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldTreasuryPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTreasuryPercent", + "type": "uint256" + } + ], + "name": "NewTreasuryPercent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VAIControllerInterface", + "name": "oldVAIController", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract VAIControllerInterface", + "name": "newVAIController", + "type": "address" + } + ], + "name": "NewVAIController", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVAIMintRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVAIMintRate", + "type": "uint256" + } + ], + "name": "NewVAIMintRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releaseStartBlock_", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releaseInterval_", + "type": "uint256" + } + ], + "name": "NewVAIVaultInfo", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVenusVAIVaultRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVenusVAIVaultRate", + "type": "uint256" + } + ], + "name": "NewVenusVAIVaultRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "VenusBorrowSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "VenusGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "VenusSupplySpeedUpdated", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract Unitroller", + "name": "unitroller", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "_grantXVS", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "_setAccessControl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "markets", + "type": "address[]" + }, + { + "internalType": "enum ComptrollerV9Storage.Action[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "_setActionsPaused", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCloseFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCollateralFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "comptrollerLens_", + "type": "address" + } + ], + "name": "_setComptrollerLens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "_setLiquidationIncentive", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newLiquidatorContract_", + "type": "address" + } + ], + "name": "_setLiquidatorContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newSupplyCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketSupplyCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "_setPauseGuardian", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "newOracle", + "type": "address" + } + ], + "name": "_setPriceOracle", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setProtocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newTreasuryGuardian", + "type": "address" + }, + { + "internalType": "address", + "name": "newTreasuryAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newTreasuryPercent", + "type": "uint256" + } + ], + "name": "_setTreasuryData", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "vaiController_", + "type": "address" + } + ], + "name": "_setVAIController", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newVAIMintRate", + "type": "uint256" + } + ], + "name": "_setVAIMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "releaseStartBlock_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minReleaseAmount_", + "type": "uint256" + } + ], + "name": "_setVAIVaultInfo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "supplySpeeds", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "borrowSpeeds", + "type": "uint256[]" + } + ], + "name": "_setVenusSpeeds", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "venusVAIVaultRate_", + "type": "uint256" + } + ], + "name": "_setVenusVAIVaultRate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "_supportMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum ComptrollerV9Storage.Action", + "name": "action", + "type": "uint8" + } + ], + "name": "actionPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedDelegates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "checkMembership", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "collateral", + "type": "bool" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimVenusAsCollateral", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerLens", + "outputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "enterMarkets", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenAddress", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "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": "getAllMarkets", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAssetsIn", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenModify", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { + "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": "getXVSAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getXVSVTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "liquidateBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "liquidateBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateVAICalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidatorContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "bool", + "name": "isListed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "collateralFactorMantissa", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isVenus", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minReleaseAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "mintVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualMintAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "mintVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mintedVAIs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract PriceOracle", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "releaseStartBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "releaseToVault", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowerIndex", + "type": "uint256" + } + ], + "name": "repayBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "repayVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "setMintedVAIOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryPercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowBorrows", + "type": "bool" + } + ], + "name": "updateDelegate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiController", + "outputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiVaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusInitialIndex", + "outputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplySpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusVAIVaultRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-171/vip-171-testnet/abi/MOCK_TOKEN_ABI.json b/simulations/vip-171/vip-171-testnet/abi/MOCK_TOKEN_ABI.json new file mode 100644 index 000000000..1d69e8f66 --- /dev/null +++ b/simulations/vip-171/vip-171-testnet/abi/MOCK_TOKEN_ABI.json @@ -0,0 +1,155 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "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": 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": [ + { "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": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "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": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "allocateTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-171/vip-171-testnet/abi/VTOKEN_ABI.json b/simulations/vip-171/vip-171-testnet/abi/VTOKEN_ABI.json new file mode 100644 index 000000000..a7ae900ba --- /dev/null +++ b/simulations/vip-171/vip-171-testnet/abi/VTOKEN_ABI.json @@ -0,0 +1,820 @@ +[ + { "inputs": [], "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAccessControlAddress", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAccessControlAddress", "type": "address" } + ], + "name": "NewAccessControlManager", + "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": true, "internalType": "address", "name": "oldProtocolShareReserve", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newProtocolShareReserve", "type": "address" } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReduceReservesBlockDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReduceReservesBlockDelta", "type": "uint256" } + ], + "name": "NewReduceReservesBlockDelta", + "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "feeAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "RedeemFee", + "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": "protocolShareReserve", "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" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "_becomeImplementation", + "outputs": [], + "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": [], + "name": "_resignImplementation", + "outputs": [], + "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": "accessControlManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "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": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "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": 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": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "protocolShareReserve", + "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": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": false, + "inputs": [{ "internalType": "address", "name": "newAccessControlManagerAddress", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "protcolShareReserve_", "type": "address" }], + "name": "setProtocolShareReserve", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReduceReservesBlockDelta_", "type": "uint256" }], + "name": "setReduceReservesBlockDelta", + "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" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts new file mode 100644 index 000000000..171b47b0c --- /dev/null +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -0,0 +1,155 @@ +import { mine, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { fetchVTokenStorageCore, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { CORE_MARKETS, vip171Testnet } from "../../../vips/vip-171/vip-171-testnet"; +import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; +import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; +import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; + +const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; + +let vToken: ethers.Contract; +let underlying: ethers.Contract; +let user: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; +const postVipStorage: storageLayout[] = []; +const preVipStorage: storageLayout[] = []; +const provider = ethers.provider; +const mintAmount = parseUnits("200", 18); +const borrowAmount = parseUnits("50", 18); +const repayAmount = parseUnits("50", 18); +const redeemAmount = parseUnits("50", 18); + +forking(33155924, () => { + describe("Pre VIP simulations", async () => { + before(async () => { + [user] = await ethers.getSigners(); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await mine(CORE_MARKETS.length * 4 + 4); // Number of Vip steps + }); + for (const market of CORE_MARKETS) { + it(`Save pre VIP storage snapshot of ${market.name}`, async () => { + await setBalance(user.address, ethers.utils.parseEther("5")); + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.8", 18)); + + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + ); + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + preVipStorage.push(state); + }); + } + }); +}); + +forking(33155924, () => { + const ProxyAdminInterface = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "oldImplementation", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "newImplementation", + type: "address", + }, + ], + name: "NewImplementation", + type: "event", + }, + ]; + testVip("VIP-171 Core VToken Upgrade of AIA", vip171Testnet(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [VTOKEN_ABI, ProxyAdminInterface], + ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], + [6, 6, 6, 6], + ); + }, + }); +}); + +forking(33155924, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip171Testnet()); + [user] = await ethers.getSigners(); + }); + + for (const market of CORE_MARKETS) { + it(`Save post VIP storage snapshot of ${market.name}`, async () => { + await setBalance(user.address, ethers.utils.parseEther("5")); + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.8", 18)); + + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + ); + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + expect(await vToken.implementation()).equals(NEW_VBEP20_DELEGATE_IMPL); + expect(await vToken.protocolShareReserve()).equals(TREASURY); + expect(await vToken.accessControlManager()).equals(ACCESS_CONTROL_MANAGER); + expect(await vToken.admin()).equals(NORMAL_TIMELOCK); + + postVipStorage.push(state); + }); + } + + it("Should match pre and post storage", async () => { + for (let i = 0; i < preVipStorage.length; i++) { + expect(preVipStorage[i]).to.deep.equal(postVipStorage[i]); + } + }); + }); +}); diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts new file mode 100644 index 000000000..bf34f9ff2 --- /dev/null +++ b/vips/vip-171/vip-171-testnet.ts @@ -0,0 +1,129 @@ +import { ethers } from "hardhat"; + +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; +const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; + +interface AssetConfig { + name: string; + address: string; + reduceReservesBlockDelta: number; + acceptAdmin: boolean; +} + +export const CORE_MARKETS: AssetConfig[] = [ + { + name: "vSXP", + address: "0x74469281310195A04840Daf6EdF576F559a3dE80", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + }, + { + name: "vTRX", + address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", + reduceReservesBlockDelta: 840000, + acceptAdmin: false, + }, + { + name: "vTUSD", + address: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", + reduceReservesBlockDelta: 840000, + acceptAdmin: false, + }, + { + name: "vUSDC", + address: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + }, + { + name: "vUSDT", + address: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", + reduceReservesBlockDelta: 840000, + acceptAdmin: false, + }, + { + name: "vWBETH", + address: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", + reduceReservesBlockDelta: 840000, + acceptAdmin: false, + }, +]; + +function filterAssets(assets: AssetConfig[]) { + return assets.filter(asset => asset.acceptAdmin); +} + +const MARKETS_WITH_ACCEPT_ADMIN = filterAssets(CORE_MARKETS); + +export const vip171Testnet = () => { + const meta = { + version: "v2", + title: "VIP-171 VToken Upgrade of AIA", + description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, + forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", + againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + }; + + return makeProposal( + [ + ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { + return { + target: asset.address, + signature: "_acceptAdmin()", + params: [], + }; + }), + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "_setImplementation(address,bool,bytes)", + params: [NEW_VBEP20_DELEGATE_IMPL, false, "0x"], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setAccessControlManager(address)", + params: [ACCESS_CONTROL_MANAGER], + }; + }), + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setProtocolShareReserve(address)", NORMAL_TIMELOCK], + }, + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setReduceReservesBlockDelta(uint256)", + params: [asset.reduceReservesBlockDelta], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setProtocolShareReserve(address)", + params: [TREASURY], + }; + }), + ], + meta, + ProposalType.REGULAR, + ); +}; From 1436f703f232b11457297b8a6a1ba97bc64f5269 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:25:24 +0530 Subject: [PATCH 09/32] fix: remove unnecessary action and fix variable name --- simulations/vip-170/vip-170-testnet/simulations.ts | 4 ++-- simulations/vip-171/vip-171-testnet/simulations.ts | 6 +++--- vips/vip-170/vip-170-testnet.ts | 4 ++-- vips/vip-171/vip-171-testnet.ts | 10 ++-------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index ba81db342..6c22f6556 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -16,7 +16,7 @@ import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; let vToken: ethers.Contract; let underlying: ethers.Contract; @@ -113,7 +113,7 @@ forking(33043237, () => { delete state.protocolShareReserve; delete state.totalReserves; - expect(await vToken.protocolShareReserve()).equals(TREASURY); + expect(await vToken.protocolShareReserve()).equals(PROTOCOL_SHARE_RESERVE); postVipStorage.push(state); }); } diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index 171b47b0c..9c3db6519 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -14,7 +14,7 @@ import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const TREASURY = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; let vToken: ethers.Contract; @@ -34,7 +34,7 @@ forking(33155924, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 4); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 3); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -138,7 +138,7 @@ forking(33155924, () => { delete state.owner; expect(await vToken.implementation()).equals(NEW_VBEP20_DELEGATE_IMPL); - expect(await vToken.protocolShareReserve()).equals(TREASURY); + expect(await vToken.protocolShareReserve()).equals(PROTOCOL_SHARE_RESERVE); expect(await vToken.accessControlManager()).equals(ACCESS_CONTROL_MANAGER); expect(await vToken.admin()).equals(NORMAL_TIMELOCK); diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index e443eec5b..c4153dd19 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -7,7 +7,7 @@ const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; interface AssetConfig { name: string; @@ -161,7 +161,7 @@ export const vip170Testnet = () => { return { target: asset.address, signature: "setProtocolShareReserve(address)", - params: [TREASURY], + params: [PROTOCOL_SHARE_RESERVE], }; }), ], diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index bf34f9ff2..9936b72fb 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -6,7 +6,7 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const TREASURY = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; interface AssetConfig { name: string; @@ -101,12 +101,6 @@ export const vip171Testnet = () => { params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setProtocolShareReserve(address)", NORMAL_TIMELOCK], - }, - ...CORE_MARKETS.map(asset => { return { target: asset.address, @@ -119,7 +113,7 @@ export const vip171Testnet = () => { return { target: asset.address, signature: "setProtocolShareReserve(address)", - params: [TREASURY], + params: [PROTOCOL_SHARE_RESERVE], }; }), ], From b14dbd0f1bdbf039afc0def2690aa63f99018b55 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:20:55 +0530 Subject: [PATCH 10/32] feat: add more markets in core testnet --- .../vip-170/vip-170-testnet/simulations.ts | 2 + .../vip-171/vip-171-testnet/simulations.ts | 21 ++++++++-- src/vtokenUpgradesHelper.ts | 3 +- vips/vip-171/vip-171-testnet.ts | 38 +++++++++++++++++++ 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index 6c22f6556..759ec6ea0 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -58,6 +58,7 @@ forking(33043237, () => { redeemAmount, vToken, underlying, + true, ); const state = await fetchVTokenStorageIL(vToken, user.address); @@ -107,6 +108,7 @@ forking(33043237, () => { redeemAmount, vToken, underlying, + true, ); const state = await fetchVTokenStorageIL(vToken, user.address); diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index 9c3db6519..c1db515ac 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -16,6 +16,7 @@ const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const TOKEN_HOLDER = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; let vToken: ethers.Contract; let underlying: ethers.Contract; @@ -34,11 +35,16 @@ forking(33155924, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 3); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 7); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { - await setBalance(user.address, ethers.utils.parseEther("5")); + if (!market.isMock) { + user = await initMainnetUser(TOKEN_HOLDER, ethers.utils.parseEther("5")); + } else { + await setBalance(user.address, ethers.utils.parseEther("5")); + } + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); @@ -56,6 +62,7 @@ forking(33155924, () => { redeemAmount, vToken, underlying, + market.isMock, ); const state = await fetchVTokenStorageCore(vToken, user.address); @@ -97,7 +104,7 @@ forking(33155924, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [6, 6, 6, 6], + [10, 10, 10, 10], ); }, }); @@ -112,7 +119,12 @@ forking(33155924, () => { for (const market of CORE_MARKETS) { it(`Save post VIP storage snapshot of ${market.name}`, async () => { - await setBalance(user.address, ethers.utils.parseEther("5")); + if (!market.isMock) { + user = await initMainnetUser(TOKEN_HOLDER, ethers.utils.parseEther("5")); + } else { + await setBalance(user.address, ethers.utils.parseEther("5")); + } + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); @@ -130,6 +142,7 @@ forking(33155924, () => { redeemAmount, vToken, underlying, + market.isMock, ); const state = await fetchVTokenStorageCore(vToken, user.address); diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts index 18fa4198e..eae34e997 100644 --- a/src/vtokenUpgradesHelper.ts +++ b/src/vtokenUpgradesHelper.ts @@ -122,6 +122,7 @@ export const performVTokenBasicActions = async ( redeemAmount: BigNumber, vToken: ethers.Contract, underlying: ethers.Contract, + isUnderlyingMock: boolean, ) => { const underlyingDecimals = await underlying.decimals(); const symbol = await underlying.symbol(); @@ -139,7 +140,7 @@ export const performVTokenBasicActions = async ( repayAmount = parseUnits("25", 6); redeemAmount = parseUnits("50", 6); } - if (process.env.FORK_TESTNET === "true") { + if (process.env.FORK_TESTNET === "true" && isUnderlyingMock) { try { await underlying.connect(user).faucet(mintAmount.add(repayAmount)); } catch (error) { diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index 9936b72fb..75cb7051a 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -13,44 +13,82 @@ interface AssetConfig { address: string; reduceReservesBlockDelta: number; acceptAdmin: boolean; + isMock: boolean; // Defines underlying is MockToken } export const CORE_MARKETS: AssetConfig[] = [ + { + name: "vETH", + address: "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + isMock: false, + }, + + { + name: "vLTC", + address: "0xAfc13BC065ABeE838540823431055D2ea52eBA52", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + isMock: false, + }, + + { + name: "VBTC", + address: "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + isMock: false, + }, + + { + name: "vXRP", + address: "0x488aB2826a154da01CC4CC16A8C83d4720D3cA2C", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + isMock: false, + }, { name: "vSXP", address: "0x74469281310195A04840Daf6EdF576F559a3dE80", reduceReservesBlockDelta: 840000, acceptAdmin: true, + isMock: true, }, { name: "vTRX", address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", reduceReservesBlockDelta: 840000, acceptAdmin: false, + isMock: true, }, { name: "vTUSD", address: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", reduceReservesBlockDelta: 840000, acceptAdmin: false, + isMock: true, }, { name: "vUSDC", address: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", reduceReservesBlockDelta: 840000, acceptAdmin: true, + isMock: true, }, { name: "vUSDT", address: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", reduceReservesBlockDelta: 840000, acceptAdmin: false, + isMock: true, }, { name: "vWBETH", address: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", reduceReservesBlockDelta: 840000, acceptAdmin: false, + isMock: true, }, ]; From a06055ba979b3676f875370a3dbf66ab2c9e8508 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:26:08 +0530 Subject: [PATCH 11/32] feat: grant permissisons to timelocks --- .../vip-170/vip-170-testnet/simulations.ts | 2 +- .../vip-171/vip-171-testnet/simulations.ts | 2 +- vips/vip-170/vip-170-testnet.ts | 59 +++++++- vips/vip-171/vip-171-testnet.ts | 141 +++++++++++++++++- 4 files changed, 192 insertions(+), 12 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index 759ec6ea0..bf74f953c 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -34,7 +34,7 @@ forking(33043237, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(IL_MARKETS.length * 2 + 2); // Number of Vip steps + await mine(IL_MARKETS.length * 2 + 10); // Number of Vip steps }); for (const market of IL_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index c1db515ac..a07c1277d 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(33155924, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 7); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 28); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index c4153dd19..a931dda15 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -7,6 +7,8 @@ const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; interface AssetConfig { @@ -141,14 +143,63 @@ export const vip170Testnet = () => { return makeProposal( [ { - target: VTOKEN_BEACON, - signature: "upgradeTo(address)", - params: [NEW_IMPL_VTOKEN], + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, + { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setInterestRateModel(address)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setInterestRateModel(address)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setInterestRateModel(address)", CRITICAL_TIMELOCK], + }, + + { + target: VTOKEN_BEACON, + signature: "upgradeTo(address)", + params: [NEW_IMPL_VTOKEN], }, ...IL_MARKETS.map(asset => { return { diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index 75cb7051a..ad6319a8e 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -6,7 +6,10 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; interface AssetConfig { name: string; @@ -110,6 +113,138 @@ export const vip171Testnet = () => { return makeProposal( [ + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint256[],bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint256[],bool)", CRITICAL_TIMELOCK], + }, + ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { return { target: asset.address, @@ -133,12 +268,6 @@ export const vip171Testnet = () => { }; }), - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], - }, - ...CORE_MARKETS.map(asset => { return { target: asset.address, From 06e3d759ce672bfd68552c59c73d331dd0a47adf Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:13:32 +0530 Subject: [PATCH 12/32] feat: add xvs market upgrades --- simulations/vip-171/vip-171-testnet/simulations.ts | 2 +- vips/vip-171/vip-171-testnet.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index a07c1277d..250a5267e 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -104,7 +104,7 @@ forking(33155924, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [10, 10, 10, 10], + [11, 11, 11, 11], ); }, }); diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index ad6319a8e..90e1196c2 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -93,6 +93,13 @@ export const CORE_MARKETS: AssetConfig[] = [ acceptAdmin: false, isMock: true, }, + { + name: "vXVS", + address: "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", + reduceReservesBlockDelta: 840000, + acceptAdmin: true, + isMock: false, + }, ]; function filterAssets(assets: AssetConfig[]) { From 38c3c32c8e9c297af2f2c64c9efedf0b9af7527a Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:57:48 +0530 Subject: [PATCH 13/32] fix: simulations --- .../vip-170/vip-170-testnet/simulations.ts | 2 +- .../vip-171/vip-171-testnet/simulations.ts | 2 +- vips/vip-170/vip-170-testnet.ts | 37 ------------------- 3 files changed, 2 insertions(+), 39 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index bf74f953c..f835fe368 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -34,7 +34,7 @@ forking(33043237, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(IL_MARKETS.length * 2 + 10); // Number of Vip steps + await mine(IL_MARKETS.length * 2 + 4); // Number of Vip steps }); for (const market of IL_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index 250a5267e..fb1ea7149 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(33155924, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 28); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 29); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index a931dda15..f5d5c5e42 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -159,43 +159,6 @@ export const vip170Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", NORMAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReserveFactor(uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setInterestRateModel(address)", NORMAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setInterestRateModel(address)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setInterestRateModel(address)", CRITICAL_TIMELOCK], - }, - { target: VTOKEN_BEACON, signature: "upgradeTo(address)", From bdeb43a62ea2cf0b28363d5f495bb562346308f7 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:07:04 +0530 Subject: [PATCH 14/32] fix: func signature --- vips/vip-171/vip-171-testnet.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index 90e1196c2..6e466e506 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -243,13 +243,13 @@ export const vip171Testnet = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint256[],bool)", FAST_TRACK_TIMELOCK], + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], }, { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint256[],bool)", CRITICAL_TIMELOCK], + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], }, ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { From 2cad31697b31b4330ca1ba429b1edb83136265a9 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:36:21 +0530 Subject: [PATCH 15/32] chore: update address of PSR and fix simulations --- simulations/vip-170/vip-170-testnet/simulations.ts | 8 ++++---- simulations/vip-171/vip-171-testnet/simulations.ts | 12 ++++++------ vips/vip-170/vip-170-testnet.ts | 2 +- vips/vip-171/vip-171-testnet.ts | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index f835fe368..e74c9afb8 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -16,7 +16,7 @@ import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const PROTOCOL_SHARE_RESERVE = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; let vToken: ethers.Contract; let underlying: ethers.Contract; @@ -29,7 +29,7 @@ const mintAmount = parseUnits("200", 18); const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(33043237, () => { +forking(34334626, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -71,7 +71,7 @@ forking(33043237, () => { }); }); -forking(33043237, () => { +forking(34334626, () => { testVip("VIP-170 IL VToken Upgrade of AIA", vip170Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 22]); @@ -79,7 +79,7 @@ forking(33043237, () => { }); }); -forking(33043237, () => { +forking(34334626, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip170Testnet()); diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index fb1ea7149..de896748d 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -14,7 +14,7 @@ import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const PROTOCOL_SHARE_RESERVE = "0x8b293600C50D6fbdc6Ed4251cc75ECe29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const TOKEN_HOLDER = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; @@ -30,7 +30,7 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(33155924, () => { +forking(34259644, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -51,7 +51,7 @@ forking(33155924, () => { await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.8", 18)); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.9", 18)); await performVTokenBasicActions( market.address, @@ -76,7 +76,7 @@ forking(33155924, () => { }); }); -forking(33155924, () => { +forking(34259644, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -110,7 +110,7 @@ forking(33155924, () => { }); }); -forking(33155924, () => { +forking(34259644, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip171Testnet()); @@ -131,7 +131,7 @@ forking(33155924, () => { await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.8", 18)); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.9", 18)); await performVTokenBasicActions( market.address, diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index f5d5c5e42..d79104ba2 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -9,7 +9,7 @@ const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; -const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; interface AssetConfig { name: string; diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index 6e466e506..d9a37a62c 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -8,7 +8,7 @@ const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; -const PROTOCOL_SHARE_RESERVE = "0x8b293600c50d6fbdc6ed4251cc75ece29880276f"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; interface AssetConfig { From af09fb00273c1ff846a5c74d45c6c17b0d6216b9 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Mon, 23 Oct 2023 19:58:12 +0530 Subject: [PATCH 16/32] add more markets and update impl address in core and il vip --- .../vip-170/vip-170-testnet/simulations.ts | 8 +- .../vip-171/vip-171-testnet/simulations.ts | 62 ++++++++------- src/vtokenUpgradesHelper.ts | 18 +++++ vips/vip-170/vip-170-testnet.ts | 71 +++++++++++------ vips/vip-171/vip-171-testnet.ts | 76 +++++++++++++++---- 5 files changed, 165 insertions(+), 70 deletions(-) diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-170/vip-170-testnet/simulations.ts index e74c9afb8..de222ca8f 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-170/vip-170-testnet/simulations.ts @@ -14,7 +14,7 @@ import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; -const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; +const NEW_IMPL_VTOKEN = "0xcA408D716011169645Aa94ddc5665043C33df814"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; @@ -29,7 +29,7 @@ const mintAmount = parseUnits("200", 18); const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34334626, () => { +forking(34455768, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -71,7 +71,7 @@ forking(34334626, () => { }); }); -forking(34334626, () => { +forking(34455768, () => { testVip("VIP-170 IL VToken Upgrade of AIA", vip170Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 22]); @@ -79,7 +79,7 @@ forking(34334626, () => { }); }); -forking(34334626, () => { +forking(34455768, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip170Testnet()); diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-171/vip-171-testnet/simulations.ts index de896748d..617776333 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-171/vip-171-testnet/simulations.ts @@ -12,7 +12,7 @@ import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; -const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; +const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; @@ -30,7 +30,7 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34259644, () => { +forking(34452659, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -51,19 +51,22 @@ forking(34259644, () => { await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.9", 18)); - - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + if (market.name != "vBUSD") { + // Several actions are paused in vBUSD + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -76,7 +79,7 @@ forking(34259644, () => { }); }); -forking(34259644, () => { +forking(34452659, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -110,7 +113,7 @@ forking(34259644, () => { }); }); -forking(34259644, () => { +forking(34452659, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip171Testnet()); @@ -133,17 +136,20 @@ forking(34259644, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.9", 18)); - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); + if (market.name != "vBUSD") { + // Several actions are paused in vBUSD + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts index eae34e997..28ee03259 100644 --- a/src/vtokenUpgradesHelper.ts +++ b/src/vtokenUpgradesHelper.ts @@ -1,4 +1,5 @@ import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; import { BigNumber } from "ethers"; import { parseUnits } from "ethers/lib/utils"; @@ -148,10 +149,27 @@ export const performVTokenBasicActions = async ( } } + let previousBalance = await vToken.balanceOf(user.address); + let previousBorrowBalance = await vToken.borrowBalanceStored(user.address); + + // Approve market await underlying.connect(user).approve(marketAddress, mintAmount.add(repayAmount)); + // Mint tokens await vToken.connect(user).mint(mintAmount); + expect(await vToken.balanceOf(user.address)).to.be.greaterThan(previousBalance); + previousBalance = await vToken.balanceOf(user.address); + + // Borrow tokens await vToken.connect(user).borrow(borrowAmount); + expect(await vToken.borrowBalanceStored(user.address)).to.be.greaterThan(previousBorrowBalance); + previousBorrowBalance = await vToken.borrowBalanceStored(user.address); + + // Repay borrowed tokens await vToken.connect(user).repayBorrow(repayAmount); + expect(await vToken.borrowBalanceStored(user.address)).to.be.lessThan(previousBorrowBalance); + + // Redeem tokens await vToken.connect(user).redeemUnderlying(redeemAmount); + expect(await vToken.balanceOf(user.address)).to.be.lessThan(previousBalance); }; diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-170/vip-170-testnet.ts index d79104ba2..4d28e786c 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-170/vip-170-testnet.ts @@ -4,7 +4,7 @@ import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; -const NEW_IMPL_VTOKEN = "0x37130dd8181477Be3dDe8b22A32FE302ca602BA7"; +const NEW_IMPL_VTOKEN = "0xca408d716011169645aa94ddc5665043c33df814"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; @@ -21,112 +21,137 @@ export const IL_MARKETS: AssetConfig[] = [ { name: "vHAY", address: "0x170d3b2da05cc2124334240fB34ad1359e34C562", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDD", address: "0x899dDf81DfbbF5889a16D075c352F2b959Dd24A4", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDT", address: "0x3338988d0beb4419Acb8fE624218754053362D06", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, + }, + { + name: "vagEUR", + address: "0x4E1D35166776825402d50AfE4286c500027211D1", + reduceReservesBlockDelta: 100, }, { name: "vWIN_Tron", address: "0xEe543D5de2Dbb5b07675Fc72831A2f1812428393", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDD_Tron", address: "0xD804F74fe21290d213c46610ab171f7c2EeEBDE7", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDT_Tron", address: "0x712774CBFFCBD60e9825871CcEFF2F917442b2c3", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vTRX_Tron", address: "0x410286c43a525E1DCC7468a9B091C111C8324cd1", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vBTT_Tron", address: "0x47793540757c6E6D84155B33cd8D9535CFdb9334", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vWBNB_LiquidStakedBNB", address: "0x231dED0Dfc99634e52EE1a1329586bc970d773b3", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vBNBx_LiquidStakedBNB", address: "0x644A149853E5507AdF3e682218b8AC86cdD62951", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vstkBNB_LiquidStakedBNB", address: "0x75aa42c832a8911B77219DbeBABBB40040d16987", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vankrBNB_LiquidStakedBNB", address: "0x57a664Dd7f1dE19545fEE9c86C949e3BF43d6D47", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, + }, + { + name: "vUSDT_LiquidStakedBNB", + address: "0x2197d02cC9cd1ad51317A0a85A656a0c82383A7c", + reduceReservesBlockDelta: 100, + }, + { + name: "vUSDD_LiquidStakedBNB", + address: "0xD5b20708d8f0FcA52cb609938D0594C4e32E5DaD", + reduceReservesBlockDelta: 100, + }, + { + name: "vSnBNB_LiquidStakedBNB", + address: "0xeffE7874C345aE877c1D893cd5160DDD359b24dA", + reduceReservesBlockDelta: 100, }, { name: "vFLOKI_GameFi", address: "0xef470AbC365F88e4582D8027172a392C473A5B53", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDD_GameFi", address: "0xdeDf3B2bcF25d0023115fd71a0F8221C91C92B1a", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vRACA_GameFi", address: "0x1958035231E125830bA5d17D168cEa07Bb42184a", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDT_GameFi", address: "0x0bFE4e0B8A2a096A27e5B18b078d25be57C08634", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDT_DeFi", address: "0x80CC30811e362aC9aB857C3d7875CbcCc0b65750", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vankrBNB_DeFi", address: "0xe507B30C41E9e375BCe05197c1e09fc9ee40c0f6", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vUSDD_DeFi", address: "0xa109DE0abaeefC521Ec29D89eA42E64F37A6882E", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vANKR_DeFi", address: "0xb677e080148368EeeE70fA3865d07E92c6500174", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vBSW_DeFi", address: "0x5e68913fbbfb91af30366ab1B21324410b49a308", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, }, { name: "vALPACA_DeFi", address: "0xb7caC5Ef82cb7f9197ee184779bdc52c5490C02a", - reduceReservesBlockDelta: 8640000, + reduceReservesBlockDelta: 100, + }, + { + name: "vTWT_DeFi", + address: "0xb677e080148368EeeE70fA3865d07E92c6500174", + reduceReservesBlockDelta: 100, }, ]; diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-171/vip-171-testnet.ts index d9a37a62c..42f23063b 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-171/vip-171-testnet.ts @@ -3,7 +3,7 @@ import { ethers } from "hardhat"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; -const NEW_VBEP20_DELEGATE_IMPL = "0xAC5CFaC96871f35f7ce4eD2b46484Db34B548b40"; +const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; @@ -23,83 +23,129 @@ export const CORE_MARKETS: AssetConfig[] = [ { name: "vETH", address: "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: false, }, - { name: "vLTC", address: "0xAfc13BC065ABeE838540823431055D2ea52eBA52", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: false, }, - { name: "VBTC", address: "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: false, }, - { name: "vXRP", address: "0x488aB2826a154da01CC4CC16A8C83d4720D3cA2C", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: false, }, { name: "vSXP", address: "0x74469281310195A04840Daf6EdF576F559a3dE80", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: true, }, { name: "vTRX", address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: false, isMock: true, }, { name: "vTUSD", address: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: false, isMock: true, }, { name: "vUSDC", address: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: true, }, { name: "vUSDT", address: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: false, isMock: true, }, { name: "vWBETH", address: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: false, isMock: true, }, { name: "vXVS", address: "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", - reduceReservesBlockDelta: 840000, + reduceReservesBlockDelta: 100, acceptAdmin: true, isMock: false, }, + { + name: "vBUSD", + address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vTRXOLD", + address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vDOGE", + address: "0xF912d3001CAf6DC4ADD366A62Cc9115B4303c9A9", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vMATIC", + address: "0x3619bdDc61189F33365CC572DF3a68FB3b316516", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vCAKE", + address: "0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vADA", + address: "0x37C28DE42bA3d22217995D146FC684B2326Ede64", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vAAVE", + address: "0x714db6c38A17883964B68a07d56cE331501d9eb6", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, ]; function filterAssets(assets: AssetConfig[]) { From 80e71b84fee1b8b688316354e14c560eb11d0f4f Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Mon, 23 Oct 2023 20:01:49 +0530 Subject: [PATCH 17/32] chore: update vip number --- .../vip-191-testnet}/abi/BEACON_ABI.json | 0 .../vip-191-testnet}/abi/COMPTROLLER.json | 0 .../vip-191-testnet}/abi/MOCK_TOKEN_ABI.json | 0 .../vip-191-testnet}/abi/VTOKEN_ABI.json | 0 .../vip-191-testnet}/simulations.ts | 6 +++--- .../vip-192-testnet}/abi/COMPTROLLER.json | 0 .../vip-192-testnet}/abi/MOCK_TOKEN_ABI.json | 0 .../vip-192-testnet}/abi/VTOKEN_ABI.json | 0 .../vip-192-testnet}/simulations.ts | 6 +++--- .../vip-170-testnet.ts => vip-191/vip-191-testnet.ts} | 4 ++-- .../vip-171-testnet.ts => vip-192/vip-192-testnet.ts} | 4 ++-- 11 files changed, 10 insertions(+), 10 deletions(-) rename simulations/{vip-170/vip-170-testnet => vip-191/vip-191-testnet}/abi/BEACON_ABI.json (100%) rename simulations/{vip-170/vip-170-testnet => vip-191/vip-191-testnet}/abi/COMPTROLLER.json (100%) rename simulations/{vip-170/vip-170-testnet => vip-191/vip-191-testnet}/abi/MOCK_TOKEN_ABI.json (100%) rename simulations/{vip-170/vip-170-testnet => vip-191/vip-191-testnet}/abi/VTOKEN_ABI.json (100%) rename simulations/{vip-170/vip-170-testnet => vip-191/vip-191-testnet}/simulations.ts (96%) rename simulations/{vip-171/vip-171-testnet => vip-192/vip-192-testnet}/abi/COMPTROLLER.json (100%) rename simulations/{vip-171/vip-171-testnet => vip-192/vip-192-testnet}/abi/MOCK_TOKEN_ABI.json (100%) rename simulations/{vip-171/vip-171-testnet => vip-192/vip-192-testnet}/abi/VTOKEN_ABI.json (100%) rename simulations/{vip-171/vip-171-testnet => vip-192/vip-192-testnet}/simulations.ts (96%) rename vips/{vip-170/vip-170-testnet.ts => vip-191/vip-191-testnet.ts} (98%) rename vips/{vip-171/vip-171-testnet.ts => vip-192/vip-192-testnet.ts} (99%) diff --git a/simulations/vip-170/vip-170-testnet/abi/BEACON_ABI.json b/simulations/vip-191/vip-191-testnet/abi/BEACON_ABI.json similarity index 100% rename from simulations/vip-170/vip-170-testnet/abi/BEACON_ABI.json rename to simulations/vip-191/vip-191-testnet/abi/BEACON_ABI.json diff --git a/simulations/vip-170/vip-170-testnet/abi/COMPTROLLER.json b/simulations/vip-191/vip-191-testnet/abi/COMPTROLLER.json similarity index 100% rename from simulations/vip-170/vip-170-testnet/abi/COMPTROLLER.json rename to simulations/vip-191/vip-191-testnet/abi/COMPTROLLER.json diff --git a/simulations/vip-170/vip-170-testnet/abi/MOCK_TOKEN_ABI.json b/simulations/vip-191/vip-191-testnet/abi/MOCK_TOKEN_ABI.json similarity index 100% rename from simulations/vip-170/vip-170-testnet/abi/MOCK_TOKEN_ABI.json rename to simulations/vip-191/vip-191-testnet/abi/MOCK_TOKEN_ABI.json diff --git a/simulations/vip-170/vip-170-testnet/abi/VTOKEN_ABI.json b/simulations/vip-191/vip-191-testnet/abi/VTOKEN_ABI.json similarity index 100% rename from simulations/vip-170/vip-170-testnet/abi/VTOKEN_ABI.json rename to simulations/vip-191/vip-191-testnet/abi/VTOKEN_ABI.json diff --git a/simulations/vip-170/vip-170-testnet/simulations.ts b/simulations/vip-191/vip-191-testnet/simulations.ts similarity index 96% rename from simulations/vip-170/vip-170-testnet/simulations.ts rename to simulations/vip-191/vip-191-testnet/simulations.ts index de222ca8f..2012e02b8 100644 --- a/simulations/vip-170/vip-170-testnet/simulations.ts +++ b/simulations/vip-191/vip-191-testnet/simulations.ts @@ -7,7 +7,7 @@ import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; import { fetchVTokenStorageIL, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; -import { IL_MARKETS, vip170Testnet } from "../../../vips/vip-170/vip-170-testnet"; +import { IL_MARKETS, vip191Testnet } from "../../../vips/vip-191/vip-191-testnet"; import BEACON_ABI from "./abi/BEACON_ABI.json"; import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; @@ -72,7 +72,7 @@ forking(34455768, () => { }); forking(34455768, () => { - testVip("VIP-170 IL VToken Upgrade of AIA", vip170Testnet(), { + testVip("VIP-170 IL VToken Upgrade of AIA", vip191Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 22]); }, @@ -82,7 +82,7 @@ forking(34455768, () => { forking(34455768, () => { describe("Post VIP simulations", async () => { before(async () => { - await pretendExecutingVip(vip170Testnet()); + await pretendExecutingVip(vip191Testnet()); [user] = await ethers.getSigners(); }); diff --git a/simulations/vip-171/vip-171-testnet/abi/COMPTROLLER.json b/simulations/vip-192/vip-192-testnet/abi/COMPTROLLER.json similarity index 100% rename from simulations/vip-171/vip-171-testnet/abi/COMPTROLLER.json rename to simulations/vip-192/vip-192-testnet/abi/COMPTROLLER.json diff --git a/simulations/vip-171/vip-171-testnet/abi/MOCK_TOKEN_ABI.json b/simulations/vip-192/vip-192-testnet/abi/MOCK_TOKEN_ABI.json similarity index 100% rename from simulations/vip-171/vip-171-testnet/abi/MOCK_TOKEN_ABI.json rename to simulations/vip-192/vip-192-testnet/abi/MOCK_TOKEN_ABI.json diff --git a/simulations/vip-171/vip-171-testnet/abi/VTOKEN_ABI.json b/simulations/vip-192/vip-192-testnet/abi/VTOKEN_ABI.json similarity index 100% rename from simulations/vip-171/vip-171-testnet/abi/VTOKEN_ABI.json rename to simulations/vip-192/vip-192-testnet/abi/VTOKEN_ABI.json diff --git a/simulations/vip-171/vip-171-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts similarity index 96% rename from simulations/vip-171/vip-171-testnet/simulations.ts rename to simulations/vip-192/vip-192-testnet/simulations.ts index 617776333..97fe3b6ed 100644 --- a/simulations/vip-171/vip-171-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -7,7 +7,7 @@ import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; import { fetchVTokenStorageCore, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; -import { CORE_MARKETS, vip171Testnet } from "../../../vips/vip-171/vip-171-testnet"; +import { CORE_MARKETS, vip192Testnet } from "../../../vips/vip-192/vip-192-testnet"; import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; @@ -101,7 +101,7 @@ forking(34452659, () => { type: "event", }, ]; - testVip("VIP-171 Core VToken Upgrade of AIA", vip171Testnet(), { + testVip("VIP-171 Core VToken Upgrade of AIA", vip192Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, @@ -116,7 +116,7 @@ forking(34452659, () => { forking(34452659, () => { describe("Post VIP simulations", async () => { before(async () => { - await pretendExecutingVip(vip171Testnet()); + await pretendExecutingVip(vip192Testnet()); [user] = await ethers.getSigners(); }); diff --git a/vips/vip-170/vip-170-testnet.ts b/vips/vip-191/vip-191-testnet.ts similarity index 98% rename from vips/vip-170/vip-170-testnet.ts rename to vips/vip-191/vip-191-testnet.ts index 4d28e786c..a15d1e564 100644 --- a/vips/vip-170/vip-170-testnet.ts +++ b/vips/vip-191/vip-191-testnet.ts @@ -155,10 +155,10 @@ export const IL_MARKETS: AssetConfig[] = [ }, ]; -export const vip170Testnet = () => { +export const vip191Testnet = () => { const meta = { version: "v2", - title: "VIP-170 VToken Upgrade of AIA", + title: "VIP-191 VToken Upgrade of AIA", description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", diff --git a/vips/vip-171/vip-171-testnet.ts b/vips/vip-192/vip-192-testnet.ts similarity index 99% rename from vips/vip-171/vip-171-testnet.ts rename to vips/vip-192/vip-192-testnet.ts index 42f23063b..037b2063d 100644 --- a/vips/vip-171/vip-171-testnet.ts +++ b/vips/vip-192/vip-192-testnet.ts @@ -154,10 +154,10 @@ function filterAssets(assets: AssetConfig[]) { const MARKETS_WITH_ACCEPT_ADMIN = filterAssets(CORE_MARKETS); -export const vip171Testnet = () => { +export const vip192Testnet = () => { const meta = { version: "v2", - title: "VIP-171 VToken Upgrade of AIA", + title: "VIP-192 VToken Upgrade of AIA", description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", From 1e7f84abbfd1c2201a35f4acab06e514f501d148 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Mon, 23 Oct 2023 21:14:35 +0530 Subject: [PATCH 18/32] fix: simulations --- simulations/vip-191/vip-191-testnet/simulations.ts | 4 ++-- simulations/vip-192/vip-192-testnet/simulations.ts | 4 ++-- vips/vip-191/vip-191-testnet.ts | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/simulations/vip-191/vip-191-testnet/simulations.ts b/simulations/vip-191/vip-191-testnet/simulations.ts index 2012e02b8..7db870e20 100644 --- a/simulations/vip-191/vip-191-testnet/simulations.ts +++ b/simulations/vip-191/vip-191-testnet/simulations.ts @@ -34,7 +34,7 @@ forking(34455768, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(IL_MARKETS.length * 2 + 4); // Number of Vip steps + await mine(IL_MARKETS.length * 2 + 5); // Number of Vip steps }); for (const market of IL_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -74,7 +74,7 @@ forking(34455768, () => { forking(34455768, () => { testVip("VIP-170 IL VToken Upgrade of AIA", vip191Testnet(), { callbackAfterExecution: async txResponse => { - await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 22]); + await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [2, 27]); }, }); }); diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index 97fe3b6ed..538b9928f 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(34452659, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 29); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 32); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -134,7 +134,7 @@ forking(34452659, () => { await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.9", 18)); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); if (market.name != "vBUSD") { // Several actions are paused in vBUSD diff --git a/vips/vip-191/vip-191-testnet.ts b/vips/vip-191/vip-191-testnet.ts index a15d1e564..5d91fa71d 100644 --- a/vips/vip-191/vip-191-testnet.ts +++ b/vips/vip-191/vip-191-testnet.ts @@ -10,6 +10,7 @@ const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; +const SN_BNB_BEACON = "0x1103Bec24Eb194d69ae116d62DD9559412E7C23A"; interface AssetConfig { name: string; @@ -150,7 +151,7 @@ export const IL_MARKETS: AssetConfig[] = [ }, { name: "vTWT_DeFi", - address: "0xb677e080148368EeeE70fA3865d07E92c6500174", + address: "0x4C94e67d239aD585275Fdd3246Ab82c8a2668564", reduceReservesBlockDelta: 100, }, ]; @@ -189,6 +190,11 @@ export const vip191Testnet = () => { signature: "upgradeTo(address)", params: [NEW_IMPL_VTOKEN], }, + { + target: SN_BNB_BEACON, + signature: "upgradeTo(address)", + params: [NEW_IMPL_VTOKEN], + }, ...IL_MARKETS.map(asset => { return { target: asset.address, From d1cc42ac78fdf8206df770f784a6710c20861780 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Wed, 25 Oct 2023 12:00:12 +0530 Subject: [PATCH 19/32] refactor: split core vip in two parts --- .../vip-192/vip-192-testnet/simulations.ts | 6 +- .../vip-193-testnet/abi/COMPTROLLER.json | 2782 +++++++++++++++++ .../vip-193-testnet/abi/MOCK_TOKEN_ABI.json | 155 + .../vip-193-testnet/abi/VTOKEN_ABI.json | 820 +++++ .../vip-193/vip-193-testnet/simulations.ts | 174 ++ vips/vip-192/vip-192-testnet.ts | 128 - vips/vip-193/vip-193-testnet.ts | 196 ++ 7 files changed, 4130 insertions(+), 131 deletions(-) create mode 100644 simulations/vip-193/vip-193-testnet/abi/COMPTROLLER.json create mode 100644 simulations/vip-193/vip-193-testnet/abi/MOCK_TOKEN_ABI.json create mode 100644 simulations/vip-193/vip-193-testnet/abi/VTOKEN_ABI.json create mode 100644 simulations/vip-193/vip-193-testnet/simulations.ts create mode 100644 vips/vip-193/vip-193-testnet.ts diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index 538b9928f..1f2146447 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(34452659, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 32); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 14); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -101,13 +101,13 @@ forking(34452659, () => { type: "event", }, ]; - testVip("VIP-171 Core VToken Upgrade of AIA", vip192Testnet(), { + testVip("VIP-192 Core VToken Upgrade of AIA", vip192Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [11, 11, 11, 11], + [16, 16, 16, 16], ); }, }); diff --git a/simulations/vip-193/vip-193-testnet/abi/COMPTROLLER.json b/simulations/vip-193/vip-193-testnet/abi/COMPTROLLER.json new file mode 100644 index 000000000..fb2b4582e --- /dev/null +++ b/simulations/vip-193/vip-193-testnet/abi/COMPTROLLER.json @@ -0,0 +1,2782 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum ComptrollerV9Storage.Action", + "name": "action", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "ActionProtocolPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowDelegatedBorrows", + "type": "bool" + } + ], + "name": "DelegateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusBorrowIndex", + "type": "uint256" + } + ], + "name": "DistributedBorrowerVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "supplier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusSupplyIndex", + "type": "uint256" + } + ], + "name": "DistributedSupplierVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DistributedVAIVaultVenus", + "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": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "NewAccessControl", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldComptrollerLens", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newComptrollerLens", + "type": "address" + } + ], + "name": "NewComptrollerLens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldLiquidatorContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newLiquidatorContract", + "type": "address" + } + ], + "name": "NewLiquidatorContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPauseGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "NewPauseGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSupplyCap", + "type": "uint256" + } + ], + "name": "NewSupplyCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryAddress", + "type": "address" + } + ], + "name": "NewTreasuryAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryGuardian", + "type": "address" + } + ], + "name": "NewTreasuryGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldTreasuryPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTreasuryPercent", + "type": "uint256" + } + ], + "name": "NewTreasuryPercent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VAIControllerInterface", + "name": "oldVAIController", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract VAIControllerInterface", + "name": "newVAIController", + "type": "address" + } + ], + "name": "NewVAIController", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVAIMintRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVAIMintRate", + "type": "uint256" + } + ], + "name": "NewVAIMintRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releaseStartBlock_", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releaseInterval_", + "type": "uint256" + } + ], + "name": "NewVAIVaultInfo", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVenusVAIVaultRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVenusVAIVaultRate", + "type": "uint256" + } + ], + "name": "NewVenusVAIVaultRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "VenusBorrowSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "VenusGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "VenusSupplySpeedUpdated", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract Unitroller", + "name": "unitroller", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "_grantXVS", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "_setAccessControl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "markets", + "type": "address[]" + }, + { + "internalType": "enum ComptrollerV9Storage.Action[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "_setActionsPaused", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCloseFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCollateralFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "comptrollerLens_", + "type": "address" + } + ], + "name": "_setComptrollerLens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "_setLiquidationIncentive", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newLiquidatorContract_", + "type": "address" + } + ], + "name": "_setLiquidatorContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newSupplyCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketSupplyCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "_setPauseGuardian", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "newOracle", + "type": "address" + } + ], + "name": "_setPriceOracle", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setProtocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newTreasuryGuardian", + "type": "address" + }, + { + "internalType": "address", + "name": "newTreasuryAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newTreasuryPercent", + "type": "uint256" + } + ], + "name": "_setTreasuryData", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "vaiController_", + "type": "address" + } + ], + "name": "_setVAIController", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newVAIMintRate", + "type": "uint256" + } + ], + "name": "_setVAIMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "releaseStartBlock_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minReleaseAmount_", + "type": "uint256" + } + ], + "name": "_setVAIVaultInfo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "supplySpeeds", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "borrowSpeeds", + "type": "uint256[]" + } + ], + "name": "_setVenusSpeeds", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "venusVAIVaultRate_", + "type": "uint256" + } + ], + "name": "_setVenusVAIVaultRate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "_supportMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum ComptrollerV9Storage.Action", + "name": "action", + "type": "uint8" + } + ], + "name": "actionPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedDelegates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "checkMembership", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "collateral", + "type": "bool" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimVenusAsCollateral", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerLens", + "outputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "enterMarkets", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenAddress", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "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": "getAllMarkets", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAssetsIn", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenModify", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { + "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": "getXVSAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getXVSVTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "liquidateBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "liquidateBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateVAICalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidatorContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "bool", + "name": "isListed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "collateralFactorMantissa", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isVenus", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minReleaseAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "mintVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualMintAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "mintVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mintedVAIs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract PriceOracle", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "releaseStartBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "releaseToVault", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowerIndex", + "type": "uint256" + } + ], + "name": "repayBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "repayVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "setMintedVAIOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryPercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowBorrows", + "type": "bool" + } + ], + "name": "updateDelegate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiController", + "outputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiVaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusInitialIndex", + "outputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplySpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusVAIVaultRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-193/vip-193-testnet/abi/MOCK_TOKEN_ABI.json b/simulations/vip-193/vip-193-testnet/abi/MOCK_TOKEN_ABI.json new file mode 100644 index 000000000..1d69e8f66 --- /dev/null +++ b/simulations/vip-193/vip-193-testnet/abi/MOCK_TOKEN_ABI.json @@ -0,0 +1,155 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "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": 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": [ + { "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": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "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": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "allocateTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-193/vip-193-testnet/abi/VTOKEN_ABI.json b/simulations/vip-193/vip-193-testnet/abi/VTOKEN_ABI.json new file mode 100644 index 000000000..a7ae900ba --- /dev/null +++ b/simulations/vip-193/vip-193-testnet/abi/VTOKEN_ABI.json @@ -0,0 +1,820 @@ +[ + { "inputs": [], "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAccessControlAddress", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAccessControlAddress", "type": "address" } + ], + "name": "NewAccessControlManager", + "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": true, "internalType": "address", "name": "oldProtocolShareReserve", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newProtocolShareReserve", "type": "address" } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReduceReservesBlockDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReduceReservesBlockDelta", "type": "uint256" } + ], + "name": "NewReduceReservesBlockDelta", + "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "feeAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "RedeemFee", + "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": "protocolShareReserve", "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" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "_becomeImplementation", + "outputs": [], + "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": [], + "name": "_resignImplementation", + "outputs": [], + "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": "accessControlManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "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": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "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": 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": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "protocolShareReserve", + "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": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": false, + "inputs": [{ "internalType": "address", "name": "newAccessControlManagerAddress", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "protcolShareReserve_", "type": "address" }], + "name": "setProtocolShareReserve", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReduceReservesBlockDelta_", "type": "uint256" }], + "name": "setReduceReservesBlockDelta", + "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" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-193/vip-193-testnet/simulations.ts b/simulations/vip-193/vip-193-testnet/simulations.ts new file mode 100644 index 000000000..9c10ac0e0 --- /dev/null +++ b/simulations/vip-193/vip-193-testnet/simulations.ts @@ -0,0 +1,174 @@ +import { mine, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { fetchVTokenStorageCore, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { CORE_MARKETS, vip193Testnet } from "../../../vips/vip-193/vip-193-testnet"; +import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; +import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; +import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; + +const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; +const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const TOKEN_HOLDER = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; + +let vToken: ethers.Contract; +let underlying: ethers.Contract; +let user: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; +const postVipStorage: storageLayout[] = []; +const preVipStorage: storageLayout[] = []; +const provider = ethers.provider; +const mintAmount = parseUnits("200", 18); +const borrowAmount = parseUnits("50", 18); +const repayAmount = parseUnits("50", 18); +const redeemAmount = parseUnits("50", 18); + +forking(34452659, () => { + describe("Pre VIP simulations", async () => { + before(async () => { + [user] = await ethers.getSigners(); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps + }); + for (const market of CORE_MARKETS) { + it(`Save pre VIP storage snapshot of ${market.name}`, async () => { + if (!market.isMock) { + user = await initMainnetUser(TOKEN_HOLDER, ethers.utils.parseEther("5")); + } else { + await setBalance(user.address, ethers.utils.parseEther("5")); + } + + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + if (market.name != "vBUSD") { + // Several actions are paused in vBUSD + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + } + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + preVipStorage.push(state); + }); + } + }); +}); + +forking(34452659, () => { + const ProxyAdminInterface = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "oldImplementation", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "newImplementation", + type: "address", + }, + ], + name: "NewImplementation", + type: "event", + }, + ]; + testVip("VIP-193 Core VToken Upgrade of AIA", vip193Testnet(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [VTOKEN_ABI, ProxyAdminInterface], + ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], + [2, 2, 2, 2], + ); + }, + }); +}); + +forking(34452659, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip193Testnet()); + [user] = await ethers.getSigners(); + }); + + for (const market of CORE_MARKETS) { + it(`Save post VIP storage snapshot of ${market.name}`, async () => { + if (!market.isMock) { + user = await initMainnetUser(TOKEN_HOLDER, ethers.utils.parseEther("5")); + } else { + await setBalance(user.address, ethers.utils.parseEther("5")); + } + + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + if (market.name != "vBUSD") { + // Several actions are paused in vBUSD + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + } + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + expect(await vToken.implementation()).equals(NEW_VBEP20_DELEGATE_IMPL); + expect(await vToken.protocolShareReserve()).equals(PROTOCOL_SHARE_RESERVE); + expect(await vToken.accessControlManager()).equals(ACCESS_CONTROL_MANAGER); + expect(await vToken.admin()).equals(NORMAL_TIMELOCK); + + postVipStorage.push(state); + }); + } + + it("Should match pre and post storage", async () => { + for (let i = 0; i < preVipStorage.length; i++) { + expect(preVipStorage[i]).to.deep.equal(postVipStorage[i]); + } + }); + }); +}); diff --git a/vips/vip-192/vip-192-testnet.ts b/vips/vip-192/vip-192-testnet.ts index 037b2063d..55a26e57f 100644 --- a/vips/vip-192/vip-192-testnet.ts +++ b/vips/vip-192/vip-192-testnet.ts @@ -6,10 +6,7 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; -const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; -const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; interface AssetConfig { name: string; @@ -97,20 +94,6 @@ export const CORE_MARKETS: AssetConfig[] = [ acceptAdmin: true, isMock: false, }, - { - name: "vBUSD", - address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", - reduceReservesBlockDelta: 100, - acceptAdmin: false, - isMock: true, - }, - { - name: "vTRXOLD", - address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", - reduceReservesBlockDelta: 100, - acceptAdmin: false, - isMock: true, - }, { name: "vDOGE", address: "0xF912d3001CAf6DC4ADD366A62Cc9115B4303c9A9", @@ -171,133 +154,22 @@ export const vip192Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], - }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], - }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], - }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], - }, - ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { return { target: asset.address, diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts new file mode 100644 index 000000000..a476738ff --- /dev/null +++ b/vips/vip-193/vip-193-testnet.ts @@ -0,0 +1,196 @@ +import { ethers } from "hardhat"; + +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; +const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; +const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +interface AssetConfig { + name: string; + address: string; + reduceReservesBlockDelta: number; + isMock: boolean; // Defines underlying is MockToken +} + +export const CORE_MARKETS: AssetConfig[] = [ + { + name: "vBUSD", + address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + reduceReservesBlockDelta: 100, + isMock: true, + }, + { + name: "vTRXOLD", + address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", + reduceReservesBlockDelta: 100, + isMock: true, + }, +]; + +export const vip193Testnet = () => { + const meta = { + version: "v2", + title: "VIP-193 VToken Upgrade of AIA Part - 2", + description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, + forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", + againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + }; + + return makeProposal( + [ + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], + }, + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "_setImplementation(address,bool,bytes)", + params: [NEW_VBEP20_DELEGATE_IMPL, false, "0x"], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setAccessControlManager(address)", + params: [ACCESS_CONTROL_MANAGER], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setReduceReservesBlockDelta(uint256)", + params: [asset.reduceReservesBlockDelta], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setProtocolShareReserve(address)", + params: [PROTOCOL_SHARE_RESERVE], + }; + }), + ], + meta, + ProposalType.REGULAR, + ); +}; From 46fef5dbf378dad1eacb8b0b0d7c83e06e47704a Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:52:08 +0530 Subject: [PATCH 20/32] feat: add core vToken AIA upgrade mainnet simulations --- .../vip-192/vip-192-testnet/simulations.ts | 52 +- .../vip-192/vip-192/abi/COMPTROLLER.json | 2782 +++++++++++++++++ .../vip-192/vip-192/abi/MOCK_TOKEN_ABI.json | 155 + .../vip-192/vip-192/abi/VTOKEN_ABI.json | 820 +++++ simulations/vip-192/vip-192/simulations.ts | 191 ++ .../vip-193/vip-193/abi/MOCK_TOKEN_ABI.json | 155 + .../vip-193/vip-193/abi/VTOKEN_ABI.json | 820 +++++ simulations/vip-193/vip-193/simulations.ts | 75 + src/vtokenUpgradesHelper.ts | 7 + vips/vip-192/vip-192.ts | 221 ++ vips/vip-193/vip-193.ts | 202 ++ 11 files changed, 5452 insertions(+), 28 deletions(-) create mode 100644 simulations/vip-192/vip-192/abi/COMPTROLLER.json create mode 100644 simulations/vip-192/vip-192/abi/MOCK_TOKEN_ABI.json create mode 100644 simulations/vip-192/vip-192/abi/VTOKEN_ABI.json create mode 100644 simulations/vip-192/vip-192/simulations.ts create mode 100644 simulations/vip-193/vip-193/abi/MOCK_TOKEN_ABI.json create mode 100644 simulations/vip-193/vip-193/abi/VTOKEN_ABI.json create mode 100644 simulations/vip-193/vip-193/simulations.ts create mode 100644 vips/vip-192/vip-192.ts create mode 100644 vips/vip-193/vip-193.ts diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index 1f2146447..48c4a4ee8 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -53,20 +53,18 @@ forking(34452659, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - if (market.name != "vBUSD") { - // Several actions are paused in vBUSD - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); - } + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -136,20 +134,18 @@ forking(34452659, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - if (market.name != "vBUSD") { - // Several actions are paused in vBUSD - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); - } + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; diff --git a/simulations/vip-192/vip-192/abi/COMPTROLLER.json b/simulations/vip-192/vip-192/abi/COMPTROLLER.json new file mode 100644 index 000000000..fb2b4582e --- /dev/null +++ b/simulations/vip-192/vip-192/abi/COMPTROLLER.json @@ -0,0 +1,2782 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum ComptrollerV9Storage.Action", + "name": "action", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "ActionProtocolPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowDelegatedBorrows", + "type": "bool" + } + ], + "name": "DelegateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusBorrowIndex", + "type": "uint256" + } + ], + "name": "DistributedBorrowerVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "supplier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "venusSupplyIndex", + "type": "uint256" + } + ], + "name": "DistributedSupplierVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DistributedVAIVaultVenus", + "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": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "NewAccessControl", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldComptrollerLens", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newComptrollerLens", + "type": "address" + } + ], + "name": "NewComptrollerLens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldLiquidatorContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newLiquidatorContract", + "type": "address" + } + ], + "name": "NewLiquidatorContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPauseGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "NewPauseGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSupplyCap", + "type": "uint256" + } + ], + "name": "NewSupplyCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryAddress", + "type": "address" + } + ], + "name": "NewTreasuryAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldTreasuryGuardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newTreasuryGuardian", + "type": "address" + } + ], + "name": "NewTreasuryGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldTreasuryPercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTreasuryPercent", + "type": "uint256" + } + ], + "name": "NewTreasuryPercent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VAIControllerInterface", + "name": "oldVAIController", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract VAIControllerInterface", + "name": "newVAIController", + "type": "address" + } + ], + "name": "NewVAIController", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVAIMintRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVAIMintRate", + "type": "uint256" + } + ], + "name": "NewVAIMintRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releaseStartBlock_", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releaseInterval_", + "type": "uint256" + } + ], + "name": "NewVAIVaultInfo", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVenusVAIVaultRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVenusVAIVaultRate", + "type": "uint256" + } + ], + "name": "NewVenusVAIVaultRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "VenusBorrowSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "VenusGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "VenusSupplySpeedUpdated", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract Unitroller", + "name": "unitroller", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "_grantXVS", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newAccessControlAddress", + "type": "address" + } + ], + "name": "_setAccessControl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "markets", + "type": "address[]" + }, + { + "internalType": "enum ComptrollerV9Storage.Action[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "_setActionsPaused", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCloseFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCollateralFactor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "comptrollerLens_", + "type": "address" + } + ], + "name": "_setComptrollerLens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "_setLiquidationIncentive", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newLiquidatorContract_", + "type": "address" + } + ], + "name": "_setLiquidatorContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newSupplyCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketSupplyCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newPauseGuardian", + "type": "address" + } + ], + "name": "_setPauseGuardian", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "newOracle", + "type": "address" + } + ], + "name": "_setPriceOracle", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bool", + "name": "state", + "type": "bool" + } + ], + "name": "_setProtocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newTreasuryGuardian", + "type": "address" + }, + { + "internalType": "address", + "name": "newTreasuryAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newTreasuryPercent", + "type": "uint256" + } + ], + "name": "_setTreasuryData", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "vaiController_", + "type": "address" + } + ], + "name": "_setVAIController", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "newVAIMintRate", + "type": "uint256" + } + ], + "name": "_setVAIMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "releaseStartBlock_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minReleaseAmount_", + "type": "uint256" + } + ], + "name": "_setVAIVaultInfo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "supplySpeeds", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "borrowSpeeds", + "type": "uint256[]" + } + ], + "name": "_setVenusSpeeds", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "venusVAIVaultRate_", + "type": "uint256" + } + ], + "name": "_setVenusVAIVaultRate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "_supportMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum ComptrollerV9Storage.Action", + "name": "action", + "type": "uint8" + } + ], + "name": "actionPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedDelegates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "checkMembership", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "collateral", + "type": "bool" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "holders", + "type": "address[]" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "borrowers", + "type": "bool" + }, + { + "internalType": "bool", + "name": "suppliers", + "type": "bool" + } + ], + "name": "claimVenus", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimVenusAsCollateral", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptrollerLens", + "outputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "enterMarkets", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenAddress", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "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": "getAllMarkets", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAssetsIn", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenModify", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { + "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": "getXVSAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getXVSVTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "liquidateBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "liquidateBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateVAICalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidatorContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "bool", + "name": "isListed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "collateralFactorMantissa", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isVenus", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minReleaseAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "mintVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualMintAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "mintVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mintedVAIs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract PriceOracle", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "protocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "releaseStartBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "releaseToVault", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowerIndex", + "type": "uint256" + } + ], + "name": "repayBorrowVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "repayVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seizeVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "setMintedVAIOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferAllowed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "treasuryPercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowBorrows", + "type": "bool" + } + ], + "name": "updateDelegate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiController", + "outputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiVaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusInitialIndex", + "outputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplySpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "venusVAIVaultRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-192/vip-192/abi/MOCK_TOKEN_ABI.json b/simulations/vip-192/vip-192/abi/MOCK_TOKEN_ABI.json new file mode 100644 index 000000000..1d69e8f66 --- /dev/null +++ b/simulations/vip-192/vip-192/abi/MOCK_TOKEN_ABI.json @@ -0,0 +1,155 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "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": 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": [ + { "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": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "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": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "allocateTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-192/vip-192/abi/VTOKEN_ABI.json b/simulations/vip-192/vip-192/abi/VTOKEN_ABI.json new file mode 100644 index 000000000..a7ae900ba --- /dev/null +++ b/simulations/vip-192/vip-192/abi/VTOKEN_ABI.json @@ -0,0 +1,820 @@ +[ + { "inputs": [], "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAccessControlAddress", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAccessControlAddress", "type": "address" } + ], + "name": "NewAccessControlManager", + "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": true, "internalType": "address", "name": "oldProtocolShareReserve", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newProtocolShareReserve", "type": "address" } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReduceReservesBlockDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReduceReservesBlockDelta", "type": "uint256" } + ], + "name": "NewReduceReservesBlockDelta", + "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "feeAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "RedeemFee", + "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": "protocolShareReserve", "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" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "_becomeImplementation", + "outputs": [], + "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": [], + "name": "_resignImplementation", + "outputs": [], + "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": "accessControlManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "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": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "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": 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": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "protocolShareReserve", + "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": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": false, + "inputs": [{ "internalType": "address", "name": "newAccessControlManagerAddress", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "protcolShareReserve_", "type": "address" }], + "name": "setProtocolShareReserve", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReduceReservesBlockDelta_", "type": "uint256" }], + "name": "setReduceReservesBlockDelta", + "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" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-192/vip-192/simulations.ts b/simulations/vip-192/vip-192/simulations.ts new file mode 100644 index 000000000..3e40f3a68 --- /dev/null +++ b/simulations/vip-192/vip-192/simulations.ts @@ -0,0 +1,191 @@ +import { mine } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { fetchVTokenStorageCore, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { CORE_MARKETS, vip192 } from "../../../vips/vip-192/vip-192"; +import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; +import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; +import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; + +const NEW_VBEP20_DELEGATE_IMPL = "0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775"; +const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; + +let vToken: ethers.Contract; +let underlying: ethers.Contract; +let user: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; +const postVipStorage: storageLayout[] = []; +const preVipStorage: storageLayout[] = []; +const provider = ethers.provider; +const mintAmount = parseUnits("200", 18); +const borrowAmount = parseUnits("50", 18); +const repayAmount = parseUnits("50", 18); +const redeemAmount = parseUnits("50", 18); + +forking(32906245, () => { + describe("Pre VIP simulations", async () => { + before(async () => { + [user] = await ethers.getSigners(); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await mine(CORE_MARKETS.length * 4 + 4); // Number of Vip steps + }); + for (const market of CORE_MARKETS) { + it(`Save pre VIP storage snapshot of ${market.name}`, async () => { + user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); + + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + // Some actions are paused + if (market.name != "vBETH" && market.name != "vSXP") { + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + false, + ); + } + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + preVipStorage.push(state); + }); + } + }); +}); + +forking(32906245, () => { + const ProxyAdminInterface = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "oldImplementation", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "newImplementation", + type: "address", + }, + ], + name: "NewImplementation", + type: "event", + }, + ]; + testVip("VIP-192 Core VToken Upgrade of AIA", vip192(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [VTOKEN_ABI, ProxyAdminInterface], + ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], + [22, 22, 22, 22], + ); + }, + }); +}); + +forking(32906245, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip192()); + [user] = await ethers.getSigners(); + }); + + for (const market of CORE_MARKETS) { + it(`Save post VIP storage snapshot of ${market.name}`, async () => { + user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); + + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + // Some actions are paused + if (market.name != "vBETH" && market.name != "vSXP") { + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + false, + ); + } + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + expect(await vToken.implementation()).equals(NEW_VBEP20_DELEGATE_IMPL); + expect(await vToken.protocolShareReserve()).equals(PROTOCOL_SHARE_RESERVE); + expect(await vToken.accessControlManager()).equals(ACCESS_CONTROL_MANAGER); + expect(await vToken.admin()).equals(NORMAL_TIMELOCK); + + postVipStorage.push(state); + }); + } + + it("Should match pre and post storage", async () => { + for (let i = 0; i < preVipStorage.length; i++) { + expect(preVipStorage[i]).to.deep.equal(postVipStorage[i]); + } + }); + }); +}); + +// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). +forking(32906245, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip192()); + [user] = await ethers.getSigners(); + }); + + for (const market of CORE_MARKETS) { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + expect(await vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); + expect(reservesAfter).equals(0); + }); + } + }); +}); diff --git a/simulations/vip-193/vip-193/abi/MOCK_TOKEN_ABI.json b/simulations/vip-193/vip-193/abi/MOCK_TOKEN_ABI.json new file mode 100644 index 000000000..1d69e8f66 --- /dev/null +++ b/simulations/vip-193/vip-193/abi/MOCK_TOKEN_ABI.json @@ -0,0 +1,155 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "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": 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": [ + { "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": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "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": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "allocateTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-193/vip-193/abi/VTOKEN_ABI.json b/simulations/vip-193/vip-193/abi/VTOKEN_ABI.json new file mode 100644 index 000000000..a7ae900ba --- /dev/null +++ b/simulations/vip-193/vip-193/abi/VTOKEN_ABI.json @@ -0,0 +1,820 @@ +[ + { "inputs": [], "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAccessControlAddress", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAccessControlAddress", "type": "address" } + ], + "name": "NewAccessControlManager", + "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": true, "internalType": "address", "name": "oldProtocolShareReserve", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newProtocolShareReserve", "type": "address" } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReduceReservesBlockDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReduceReservesBlockDelta", "type": "uint256" } + ], + "name": "NewReduceReservesBlockDelta", + "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" }, + { "indexed": false, "internalType": "uint256", "name": "totalSupply", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "feeAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "RedeemFee", + "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": "protocolShareReserve", "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" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "_becomeImplementation", + "outputs": [], + "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": [], + "name": "_resignImplementation", + "outputs": [], + "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": "accessControlManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "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": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "borrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "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": 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": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": true, + "inputs": [], + "name": "protocolShareReserve", + "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": true, + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "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": false, + "inputs": [{ "internalType": "address", "name": "newAccessControlManagerAddress", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "protcolShareReserve_", "type": "address" }], + "name": "setProtocolShareReserve", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReduceReservesBlockDelta_", "type": "uint256" }], + "name": "setReduceReservesBlockDelta", + "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" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-193/vip-193/simulations.ts b/simulations/vip-193/vip-193/simulations.ts new file mode 100644 index 000000000..ead32b210 --- /dev/null +++ b/simulations/vip-193/vip-193/simulations.ts @@ -0,0 +1,75 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, testVip } from "../../../src/vip-framework"; +import { CORE_MARKETS, vip193 } from "../../../vips/vip-193/vip-193"; +import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; +import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; + +const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; + +let vToken: ethers.Contract; +let underlying: ethers.Contract; +let impersonatedTimelock: SignerWithAddress; +const provider = ethers.provider; + +forking(32906245, () => { + const ProxyAdminInterface = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "oldImplementation", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "newImplementation", + type: "address", + }, + ], + name: "NewImplementation", + type: "event", + }, + ]; + testVip("VIP-193 Core VToken Upgrade of AIA Part - 2", vip193(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [VTOKEN_ABI, ProxyAdminInterface], + ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], + [3, 3, 3, 3], + ); + }, + }); + + describe("Post VIP simulations", async () => { + before(async () => { + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + [user] = await ethers.getSigners(); + }); + for (const market of CORE_MARKETS) { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). + expect(await vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); + expect(reservesAfter).equals(0); + }); + } + }); +}); diff --git a/src/vtokenUpgradesHelper.ts b/src/vtokenUpgradesHelper.ts index 28ee03259..7f735538a 100644 --- a/src/vtokenUpgradesHelper.ts +++ b/src/vtokenUpgradesHelper.ts @@ -141,6 +141,13 @@ export const performVTokenBasicActions = async ( repayAmount = parseUnits("25", 6); redeemAmount = parseUnits("50", 6); } + + if (underlyingDecimals == 8) { + mintAmount = parseUnits("200", 8); + borrowAmount = parseUnits("50", 8); + repayAmount = parseUnits("25", 8); + redeemAmount = parseUnits("50", 8); + } if (process.env.FORK_TESTNET === "true" && isUnderlyingMock) { try { await underlying.connect(user).faucet(mintAmount.add(repayAmount)); diff --git a/vips/vip-192/vip-192.ts b/vips/vip-192/vip-192.ts new file mode 100644 index 000000000..eebd05ef8 --- /dev/null +++ b/vips/vip-192/vip-192.ts @@ -0,0 +1,221 @@ +import { ethers } from "hardhat"; + +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const NEW_VBEP20_DELEGATE_IMPL = "0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775"; +const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; + +interface AssetConfig { + name: string; + address: string; + reduceReservesBlockDelta: number; + holder: string; // Defines underlying is MockToken +} + +export const CORE_MARKETS: AssetConfig[] = [ + { + name: "vAAVE", + address: "0x26DA28954763B92139ED49283625ceCAf52C6f94", + reduceReservesBlockDelta: 28800, + holder: "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb", + }, + { + name: "vADA", + address: "0x9A0AF7FDb2065Ce470D72664DE73cAE409dA28Ec", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vBCH", + address: "0x5F0388EBc2B94FA8E123F404b79cCF5f40b29176", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vBETH", + address: "0x972207A639CC1B374B893cc33Fa251b55CEB7c07", + reduceReservesBlockDelta: 28800, + holder: "0xF68a4b64162906efF0fF6aE34E2bB1Cd42FEf62d", + }, + { + name: "vBTC", + address: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vCAKE", + address: "0x86aC3974e2BD0d60825230fa6F355fF11409df5c", + reduceReservesBlockDelta: 28800, + holder: "0x000000000000000000000000000000000000dEaD", + }, + { + name: "vDAI", + address: "0x334b3eCB4DCa3593BCCC3c7EBD1A1C1d1780FBF1", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vDOGE", + address: "0xec3422Ef92B2fb59e84c8B02Ba73F1fE84Ed8D71", + reduceReservesBlockDelta: 28800, + holder: "0x0000000000000000000000000000000000001004", + }, + { + name: "vDOT", + address: "0x1610bc33319e9398de5f57B33a5b184c806aD217", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vETH", + address: "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vFIL", + address: "0xf91d58b5aE142DAcC749f58A49FCBac340Cb0343", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vLINK", + address: "0x650b940a1033B8A1b1873f78730FcFC73ec11f1f", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vLTC", + address: "0x57A5297F2cB2c0AaC9D554660acd6D385Ab50c6B", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vMATIC", + address: "0x5c9476FcD6a4F9a3654139721c949c2233bBbBc8", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vSXP", + address: "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vTRX", + address: "0xC5D3466aA484B040eE977073fcF337f2c00071c1", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vTUSD", + address: "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDC", + address: "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDT", + address: "0xfD5840Cd36d94D7229439859C0112a4185BC0255", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vWBETH", + address: "0x6CFdEc747f37DAf3b87a35a1D9c8AD3063A1A8A0", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vXRP", + address: "0xB248a295732e0225acd3337607cc01068e3b9c10", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vXVS", + address: "0x151B1e2635A717bcDc836ECd6FbB62B674FE3E1D", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, +]; + +export const vip192 = () => { + const meta = { + version: "v2", + title: "VIP-192 VToken Upgrade of AIA", + description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, + forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", + againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + }; + + return makeProposal( + [ + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], + }, + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "_setImplementation(address,bool,bytes)", + params: [NEW_VBEP20_DELEGATE_IMPL, false, "0x"], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setAccessControlManager(address)", + params: [ACCESS_CONTROL_MANAGER], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setReduceReservesBlockDelta(uint256)", + params: [asset.reduceReservesBlockDelta], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setProtocolShareReserve(address)", + params: [PROTOCOL_SHARE_RESERVE], + }; + }), + ], + meta, + ProposalType.REGULAR, + ); +}; diff --git a/vips/vip-193/vip-193.ts b/vips/vip-193/vip-193.ts new file mode 100644 index 000000000..00d626960 --- /dev/null +++ b/vips/vip-193/vip-193.ts @@ -0,0 +1,202 @@ +import { ethers } from "hardhat"; + +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const NEW_VBEP20_DELEGATE_IMPL = "0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775"; +const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; +const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; +const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const COMPTROLLER = "0xfd36e2c2a6789db23113685031d7f16329158384"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; + +interface AssetConfig { + name: string; + address: string; + reduceReservesBlockDelta: number; + holder: string; +} + +export const CORE_MARKETS: AssetConfig[] = [ + { + name: "vBUSD", + address: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + reduceReservesBlockDelta: 105120000, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vTRXOLD", + address: "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", + reduceReservesBlockDelta: 28800, + holder: "0xe2fc31F816A9b94326492132018C3aEcC4a93aE1", + }, + { + name: "vTUSDOLD", + address: "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", + reduceReservesBlockDelta: 28800, + holder: "0x8894E0a0c962CB723c1976a4421c95949bE2D4E3", + }, +]; + +export const vip193 = () => { + const meta = { + version: "v2", + title: "VIP-193 VToken Upgrade of AIA Part - 2", + description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, + forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", + againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + }; + + return makeProposal( + [ + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], + }, + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "_setImplementation(address,bool,bytes)", + params: [NEW_VBEP20_DELEGATE_IMPL, false, "0x"], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setAccessControlManager(address)", + params: [ACCESS_CONTROL_MANAGER], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setReduceReservesBlockDelta(uint256)", + params: [asset.reduceReservesBlockDelta], + }; + }), + + ...CORE_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setProtocolShareReserve(address)", + params: [PROTOCOL_SHARE_RESERVE], + }; + }), + ], + meta, + ProposalType.REGULAR, + ); +}; From be3a6eff7bb23c4e55c747c2f3974499d22b728e Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:16:42 +0530 Subject: [PATCH 21/32] fix: resolve comments --- .../vip-192/vip-192-testnet/simulations.ts | 8 ++++---- simulations/vip-192/vip-192/simulations.ts | 12 ++++++------ .../vip-193/vip-193-testnet/simulations.ts | 19 ++++++++++--------- simulations/vip-193/vip-193/simulations.ts | 7 ++++--- vips/vip-192/vip-192-testnet.ts | 2 +- vips/vip-193/vip-193-testnet.ts | 8 +++++++- 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index 48c4a4ee8..f68b55165 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -12,7 +12,7 @@ import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; -const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; +const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; @@ -30,7 +30,7 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34452659, () => { +forking(34517682, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -77,7 +77,7 @@ forking(34452659, () => { }); }); -forking(34452659, () => { +forking(34517682, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -111,7 +111,7 @@ forking(34452659, () => { }); }); -forking(34452659, () => { +forking(34517682, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip192Testnet()); diff --git a/simulations/vip-192/vip-192/simulations.ts b/simulations/vip-192/vip-192/simulations.ts index 3e40f3a68..8d1bcc475 100644 --- a/simulations/vip-192/vip-192/simulations.ts +++ b/simulations/vip-192/vip-192/simulations.ts @@ -29,7 +29,7 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(32906245, () => { +forking(32915411, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -74,7 +74,7 @@ forking(32906245, () => { }); }); -forking(32906245, () => { +forking(32915411, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -108,7 +108,7 @@ forking(32906245, () => { }); }); -forking(32906245, () => { +forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip192()); @@ -165,11 +165,10 @@ forking(32906245, () => { }); // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). -forking(32906245, () => { +forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip192()); - [user] = await ethers.getSigners(); }); for (const market of CORE_MARKETS) { @@ -179,12 +178,13 @@ forking(32906245, () => { const reservesPrior = await vToken.totalReserves(); const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - expect(await vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); const reservesAfter = await vToken.totalReserves(); const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); }); } }); diff --git a/simulations/vip-193/vip-193-testnet/simulations.ts b/simulations/vip-193/vip-193-testnet/simulations.ts index 9c10ac0e0..6954d7319 100644 --- a/simulations/vip-193/vip-193-testnet/simulations.ts +++ b/simulations/vip-193/vip-193-testnet/simulations.ts @@ -12,7 +12,7 @@ import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; -const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; +const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; @@ -30,7 +30,7 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34452659, () => { +forking(34517682, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -53,8 +53,8 @@ forking(34452659, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - if (market.name != "vBUSD") { - // Several actions are paused in vBUSD + if (market.name == "vTRXOLD") { + // Several actions are paused in vBUSD and vTUSDOLD await performVTokenBasicActions( market.address, user, @@ -79,7 +79,7 @@ forking(34452659, () => { }); }); -forking(34452659, () => { +forking(34517682, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -107,16 +107,17 @@ forking(34452659, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [2, 2, 2, 2], + [3, 3, 3, 3], ); }, }); }); -forking(34452659, () => { +forking(34517682, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip193Testnet()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); [user] = await ethers.getSigners(); }); @@ -136,8 +137,8 @@ forking(34452659, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - if (market.name != "vBUSD") { - // Several actions are paused in vBUSD + if (market.name == "vTRXOLD") { + // Several actions are paused in vBUSD and vTUSDOLD await performVTokenBasicActions( market.address, user, diff --git a/simulations/vip-193/vip-193/simulations.ts b/simulations/vip-193/vip-193/simulations.ts index ead32b210..3bcde990a 100644 --- a/simulations/vip-193/vip-193/simulations.ts +++ b/simulations/vip-193/vip-193/simulations.ts @@ -16,7 +16,7 @@ let underlying: ethers.Contract; let impersonatedTimelock: SignerWithAddress; const provider = ethers.provider; -forking(32906245, () => { +forking(32915411, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -52,9 +52,9 @@ forking(32906245, () => { describe("Post VIP simulations", async () => { before(async () => { impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - [user] = await ethers.getSigners(); }); for (const market of CORE_MARKETS) { + if (market.name != "vTRXOLD") continue; it(`Reduce reserves in ${market.name}`, async () => { vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); @@ -63,12 +63,13 @@ forking(32906245, () => { const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). - expect(await vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); const reservesAfter = await vToken.totalReserves(); const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); }); } }); diff --git a/vips/vip-192/vip-192-testnet.ts b/vips/vip-192/vip-192-testnet.ts index 55a26e57f..4ebbb73ea 100644 --- a/vips/vip-192/vip-192-testnet.ts +++ b/vips/vip-192/vip-192-testnet.ts @@ -3,7 +3,7 @@ import { ethers } from "hardhat"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; -const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; +const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts index a476738ff..8a5433bf6 100644 --- a/vips/vip-193/vip-193-testnet.ts +++ b/vips/vip-193/vip-193-testnet.ts @@ -3,7 +3,7 @@ import { ethers } from "hardhat"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; -const NEW_VBEP20_DELEGATE_IMPL = "0x55b1b22C3E3814644B1C777896b20aBfb618ad6a"; +const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; @@ -31,6 +31,12 @@ export const CORE_MARKETS: AssetConfig[] = [ reduceReservesBlockDelta: 100, isMock: true, }, + { + name: "vTUSDOLD", + address: "0x3A00d9B02781f47d033BAd62edc55fBF8D083Fb0", + reduceReservesBlockDelta: 100, + isMock: true, + }, ]; export const vip193Testnet = () => { From 4ca360d2ed8cb0319d0dee743b7eb7f76447a5cc Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:23:01 +0530 Subject: [PATCH 22/32] test: add test for unavailable liquidiity markets --- simulations/vip-193/vip-193/simulations.ts | 45 +++++++++++++++------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/simulations/vip-193/vip-193/simulations.ts b/simulations/vip-193/vip-193/simulations.ts index 3bcde990a..47f0dfeec 100644 --- a/simulations/vip-193/vip-193/simulations.ts +++ b/simulations/vip-193/vip-193/simulations.ts @@ -54,23 +54,40 @@ forking(32915411, () => { impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); }); for (const market of CORE_MARKETS) { - if (market.name != "vTRXOLD") continue; - it(`Reduce reserves in ${market.name}`, async () => { - vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); - underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + if (market.name == "vTRXOLD") { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - const reservesPrior = await vToken.totalReserves(); - const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). - await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); - const reservesAfter = await vToken.totalReserves(); - const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); - expect(reservesAfter).equals(0); - await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); - }); + expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); + expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + }); + } else { + it(`Reserves should not reduce in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + // Not enough liquidity to reduce reserves + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).equals(psrBalPrior); + expect(reservesAfter).greaterThan(reservesPrior); + }); + } } }); }); From 9f9258b67c28fdc843c8dd683d4be0151a6465bb Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:54:30 +0530 Subject: [PATCH 23/32] fix: resolve comments --- simulations/vip-192/vip-192/simulations.ts | 36 +++++----- simulations/vip-193/vip-193/simulations.ts | 78 +++++++++++++++++++++- vips/vip-192/vip-192.ts | 8 ++- vips/vip-193/vip-193.ts | 8 +-- 4 files changed, 103 insertions(+), 27 deletions(-) diff --git a/simulations/vip-192/vip-192/simulations.ts b/simulations/vip-192/vip-192/simulations.ts index 8d1bcc475..d8e9e9b15 100644 --- a/simulations/vip-192/vip-192/simulations.ts +++ b/simulations/vip-192/vip-192/simulations.ts @@ -49,7 +49,7 @@ forking(32915411, () => { await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); // Some actions are paused - if (market.name != "vBETH" && market.name != "vSXP") { + if (market.name != "vBETH" && market.name != "vSXP" && market.name != "vBUSD") { await performVTokenBasicActions( market.address, user, @@ -102,7 +102,7 @@ forking(32915411, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [22, 22, 22, 22], + [23, 23, 23, 23], ); }, }); @@ -128,7 +128,7 @@ forking(32915411, () => { await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); // Some actions are paused - if (market.name != "vBETH" && market.name != "vSXP") { + if (market.name != "vBETH" && market.name != "vSXP" && market.name != "vBUSD") { await performVTokenBasicActions( market.address, user, @@ -172,20 +172,22 @@ forking(32915411, () => { }); for (const market of CORE_MARKETS) { - it(`Reduce reserves in ${market.name}`, async () => { - vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); - underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - - const reservesPrior = await vToken.totalReserves(); - const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); - const reservesAfter = await vToken.totalReserves(); - const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - - expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); - expect(reservesAfter).equals(0); - await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); - }); + if (market.name != "vBUSD") { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); + expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + }); + } } }); }); diff --git a/simulations/vip-193/vip-193/simulations.ts b/simulations/vip-193/vip-193/simulations.ts index 47f0dfeec..3b3715df1 100644 --- a/simulations/vip-193/vip-193/simulations.ts +++ b/simulations/vip-193/vip-193/simulations.ts @@ -1,21 +1,54 @@ +import { mine } from "@nomicfoundation/hardhat-network-helpers"; import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { expect } from "chai"; import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; -import { forking, testVip } from "../../../src/vip-framework"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { fetchVTokenStorageCore, storageLayout } from "../../../src/vtokenUpgradesHelper"; import { CORE_MARKETS, vip193 } from "../../../vips/vip-193/vip-193"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; +const NEW_VBEP20_DELEGATE_IMPL = "0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775"; +const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; let vToken: ethers.Contract; let underlying: ethers.Contract; let impersonatedTimelock: SignerWithAddress; +let user: SignerWithAddress; +const postVipStorage: storageLayout[] = []; +const preVipStorage: storageLayout[] = []; const provider = ethers.provider; +forking(32915411, () => { + describe("Pre VIP simulations", async () => { + before(async () => { + [user] = await ethers.getSigners(); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps + }); + for (const market of CORE_MARKETS) { + it(`Save pre VIP storage snapshot of ${market.name}`, async () => { + user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); + + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + preVipStorage.push(state); + }); + } + }); +}); + forking(32915411, () => { const ProxyAdminInterface = [ { @@ -44,14 +77,55 @@ forking(32915411, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [3, 3, 3, 3], + [2, 2, 2, 2], ); }, }); +}); + +forking(32915411, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip193()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + [user] = await ethers.getSigners(); + }); + + for (const market of CORE_MARKETS) { + it(`Save post VIP storage snapshot of ${market.name}`, async () => { + user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); + + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const state = await fetchVTokenStorageCore(vToken, user.address); + + delete state.totalReserves; + delete state.pendingOwner; + delete state.owner; + + expect(await vToken.implementation()).equals(NEW_VBEP20_DELEGATE_IMPL); + expect(await vToken.protocolShareReserve()).equals(PROTOCOL_SHARE_RESERVE); + expect(await vToken.accessControlManager()).equals(ACCESS_CONTROL_MANAGER); + expect(await vToken.admin()).equals(NORMAL_TIMELOCK); + + postVipStorage.push(state); + }); + } + + it("Should match pre and post storage", async () => { + for (let i = 0; i < preVipStorage.length; i++) { + expect(preVipStorage[i]).to.deep.equal(postVipStorage[i]); + } + }); + }); +}); +forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await pretendExecutingVip(vip193()); }); for (const market of CORE_MARKETS) { if (market.name == "vTRXOLD") { diff --git a/vips/vip-192/vip-192.ts b/vips/vip-192/vip-192.ts index eebd05ef8..d1ec359af 100644 --- a/vips/vip-192/vip-192.ts +++ b/vips/vip-192/vip-192.ts @@ -12,7 +12,7 @@ interface AssetConfig { name: string; address: string; reduceReservesBlockDelta: number; - holder: string; // Defines underlying is MockToken + holder: string; // Used by the simulation } export const CORE_MARKETS: AssetConfig[] = [ @@ -148,6 +148,12 @@ export const CORE_MARKETS: AssetConfig[] = [ reduceReservesBlockDelta: 28800, holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", }, + { + name: "vBUSD", + address: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + reduceReservesBlockDelta: 105120000, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, ]; export const vip192 = () => { diff --git a/vips/vip-193/vip-193.ts b/vips/vip-193/vip-193.ts index 00d626960..880b12ce4 100644 --- a/vips/vip-193/vip-193.ts +++ b/vips/vip-193/vip-193.ts @@ -15,16 +15,10 @@ interface AssetConfig { name: string; address: string; reduceReservesBlockDelta: number; - holder: string; + holder: string; // Used by the simulation } export const CORE_MARKETS: AssetConfig[] = [ - { - name: "vBUSD", - address: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", - reduceReservesBlockDelta: 105120000, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, { name: "vTRXOLD", address: "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", From 27b52703b707a1fc505325ea56a4d6ff1b74dcfe Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:04:10 +0530 Subject: [PATCH 24/32] chore: update vip numbering --- .../vip-192/vip-192-testnet/simulations.ts | 59 +++-- simulations/vip-192/vip-192/simulations.ts | 78 ++---- .../vip-193/vip-193-testnet/simulations.ts | 59 ++--- .../vip-193}/abi/COMPTROLLER.json | 0 simulations/vip-193/vip-193/simulations.ts | 78 ++++-- .../vip-194-testnet}/abi/BEACON_ABI.json | 0 .../vip-194-testnet}/abi/COMPTROLLER.json | 0 .../vip-194-testnet}/abi/MOCK_TOKEN_ABI.json | 0 .../vip-194-testnet}/abi/VTOKEN_ABI.json | 0 .../vip-194-testnet}/simulations.ts | 6 +- vips/vip-192/vip-192-testnet.ts | 225 ++++++++-------- vips/vip-192/vip-192.ts | 243 ++++++++---------- vips/vip-193/vip-193-testnet.ts | 223 ++++++++-------- vips/vip-193/vip-193.ts | 241 +++++++++-------- .../vip-194-testnet.ts} | 4 +- 15 files changed, 608 insertions(+), 608 deletions(-) rename simulations/{vip-192/vip-192 => vip-193/vip-193}/abi/COMPTROLLER.json (100%) rename simulations/{vip-191/vip-191-testnet => vip-194/vip-194-testnet}/abi/BEACON_ABI.json (100%) rename simulations/{vip-191/vip-191-testnet => vip-194/vip-194-testnet}/abi/COMPTROLLER.json (100%) rename simulations/{vip-191/vip-191-testnet => vip-194/vip-194-testnet}/abi/MOCK_TOKEN_ABI.json (100%) rename simulations/{vip-191/vip-191-testnet => vip-194/vip-194-testnet}/abi/VTOKEN_ABI.json (100%) rename simulations/{vip-191/vip-191-testnet => vip-194/vip-194-testnet}/simulations.ts (96%) rename vips/{vip-191/vip-191-testnet.ts => vip-194/vip-194-testnet.ts} (98%) diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index f68b55165..3321f70bc 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(34517682, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 14); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -53,18 +53,20 @@ forking(34517682, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); - + if (market.name == "vTRXOLD") { + // Several actions are paused in vBUSD and vTUSDOLD + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -99,13 +101,13 @@ forking(34517682, () => { type: "event", }, ]; - testVip("VIP-192 Core VToken Upgrade of AIA", vip192Testnet(), { + testVip("VIP-192 Core VToken Upgrade of AIA Part - 1", vip192Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [16, 16, 16, 16], + [3, 3, 3, 3], ); }, }); @@ -115,6 +117,7 @@ forking(34517682, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip192Testnet()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); [user] = await ethers.getSigners(); }); @@ -134,18 +137,20 @@ forking(34517682, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); - + if (market.name == "vTRXOLD") { + // Several actions are paused in vBUSD and vTUSDOLD + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; diff --git a/simulations/vip-192/vip-192/simulations.ts b/simulations/vip-192/vip-192/simulations.ts index d8e9e9b15..5c098d129 100644 --- a/simulations/vip-192/vip-192/simulations.ts +++ b/simulations/vip-192/vip-192/simulations.ts @@ -1,14 +1,12 @@ import { mine } from "@nomicfoundation/hardhat-network-helpers"; import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { expect } from "chai"; -import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { fetchVTokenStorageCore, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { fetchVTokenStorageCore, storageLayout } from "../../../src/vtokenUpgradesHelper"; import { CORE_MARKETS, vip192 } from "../../../vips/vip-192/vip-192"; -import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; @@ -19,49 +17,26 @@ const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; let vToken: ethers.Contract; let underlying: ethers.Contract; -let user: SignerWithAddress; let impersonatedTimelock: SignerWithAddress; +let user: SignerWithAddress; const postVipStorage: storageLayout[] = []; const preVipStorage: storageLayout[] = []; const provider = ethers.provider; -const mintAmount = parseUnits("200", 18); -const borrowAmount = parseUnits("50", 18); -const repayAmount = parseUnits("50", 18); -const redeemAmount = parseUnits("50", 18); forking(32915411, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 4); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); - const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - - // Some actions are paused - if (market.name != "vBETH" && market.name != "vSXP" && market.name != "vBUSD") { - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - false, - ); - } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -96,13 +71,13 @@ forking(32915411, () => { type: "event", }, ]; - testVip("VIP-192 Core VToken Upgrade of AIA", vip192(), { + testVip("VIP-192 Core VToken Upgrade of AIA Part - 1", vip192(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [23, 23, 23, 23], + [2, 2, 2, 2], ); }, }); @@ -112,6 +87,7 @@ forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip192()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); [user] = await ethers.getSigners(); }); @@ -120,27 +96,8 @@ forking(32915411, () => { user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); - const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); - await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - - // Some actions are paused - if (market.name != "vBETH" && market.name != "vSXP" && market.name != "vBUSD") { - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - false, - ); - } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -164,21 +121,22 @@ forking(32915411, () => { }); }); -// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); await pretendExecutingVip(vip192()); }); - for (const market of CORE_MARKETS) { - if (market.name != "vBUSD") { + if (market.name == "vTRXOLD") { it(`Reduce reserves in ${market.name}`, async () => { vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); const reservesPrior = await vToken.totalReserves(); const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); const reservesAfter = await vToken.totalReserves(); const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); @@ -187,6 +145,22 @@ forking(32915411, () => { expect(reservesAfter).equals(0); await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); }); + } else { + it(`Reserves should not reduce in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + // Not enough liquidity to reduce reserves + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).equals(psrBalPrior); + expect(reservesAfter).greaterThan(reservesPrior); + }); } } }); diff --git a/simulations/vip-193/vip-193-testnet/simulations.ts b/simulations/vip-193/vip-193-testnet/simulations.ts index 6954d7319..6b07f432d 100644 --- a/simulations/vip-193/vip-193-testnet/simulations.ts +++ b/simulations/vip-193/vip-193-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(34517682, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 14); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -53,20 +53,18 @@ forking(34517682, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - if (market.name == "vTRXOLD") { - // Several actions are paused in vBUSD and vTUSDOLD - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); - } + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -101,13 +99,13 @@ forking(34517682, () => { type: "event", }, ]; - testVip("VIP-193 Core VToken Upgrade of AIA", vip193Testnet(), { + testVip("VIP-193 Core VToken Upgrade of AIA Part - 2", vip193Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [3, 3, 3, 3], + [16, 16, 16, 16], ); }, }); @@ -117,7 +115,6 @@ forking(34517682, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip193Testnet()); - impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); [user] = await ethers.getSigners(); }); @@ -137,20 +134,18 @@ forking(34517682, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - if (market.name == "vTRXOLD") { - // Several actions are paused in vBUSD and vTUSDOLD - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); - } + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); + const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; diff --git a/simulations/vip-192/vip-192/abi/COMPTROLLER.json b/simulations/vip-193/vip-193/abi/COMPTROLLER.json similarity index 100% rename from simulations/vip-192/vip-192/abi/COMPTROLLER.json rename to simulations/vip-193/vip-193/abi/COMPTROLLER.json diff --git a/simulations/vip-193/vip-193/simulations.ts b/simulations/vip-193/vip-193/simulations.ts index 3b3715df1..14769ab6e 100644 --- a/simulations/vip-193/vip-193/simulations.ts +++ b/simulations/vip-193/vip-193/simulations.ts @@ -1,12 +1,14 @@ import { mine } from "@nomicfoundation/hardhat-network-helpers"; import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { fetchVTokenStorageCore, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { fetchVTokenStorageCore, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; import { CORE_MARKETS, vip193 } from "../../../vips/vip-193/vip-193"; +import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; @@ -17,26 +19,49 @@ const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; let vToken: ethers.Contract; let underlying: ethers.Contract; -let impersonatedTimelock: SignerWithAddress; let user: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; const postVipStorage: storageLayout[] = []; const preVipStorage: storageLayout[] = []; const provider = ethers.provider; +const mintAmount = parseUnits("200", 18); +const borrowAmount = parseUnits("50", 18); +const repayAmount = parseUnits("50", 18); +const redeemAmount = parseUnits("50", 18); forking(32915411, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 4); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + // Some actions are paused + if (market.name != "vBETH" && market.name != "vSXP" && market.name != "vBUSD") { + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + false, + ); + } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -71,13 +96,13 @@ forking(32915411, () => { type: "event", }, ]; - testVip("VIP-193 Core VToken Upgrade of AIA Part - 2", vip193(), { + testVip("VIP-193 Core VToken Upgrade of AIA Part - 2", vip193(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [2, 2, 2, 2], + [23, 23, 23, 23], ); }, }); @@ -87,7 +112,6 @@ forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip193()); - impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); [user] = await ethers.getSigners(); }); @@ -96,8 +120,27 @@ forking(32915411, () => { user = await initMainnetUser(market.holder, ethers.utils.parseEther("5")); vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); + await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); + + // Some actions are paused + if (market.name != "vBETH" && market.name != "vSXP" && market.name != "vBUSD") { + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + false, + ); + } const state = await fetchVTokenStorageCore(vToken, user.address); delete state.totalReserves; @@ -121,22 +164,21 @@ forking(32915411, () => { }); }); +// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). forking(32915411, () => { describe("Post VIP simulations", async () => { before(async () => { - impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); await pretendExecutingVip(vip193()); }); + for (const market of CORE_MARKETS) { - if (market.name == "vTRXOLD") { + if (market.name != "vBUSD") { it(`Reduce reserves in ${market.name}`, async () => { vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); const reservesPrior = await vToken.totalReserves(); const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - - // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); const reservesAfter = await vToken.totalReserves(); const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); @@ -145,22 +187,6 @@ forking(32915411, () => { expect(reservesAfter).equals(0); await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); }); - } else { - it(`Reserves should not reduce in ${market.name}`, async () => { - vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); - underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); - - const reservesPrior = await vToken.totalReserves(); - const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - - // Not enough liquidity to reduce reserves - await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); - const reservesAfter = await vToken.totalReserves(); - const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); - - expect(psrBalAfter).equals(psrBalPrior); - expect(reservesAfter).greaterThan(reservesPrior); - }); } } }); diff --git a/simulations/vip-191/vip-191-testnet/abi/BEACON_ABI.json b/simulations/vip-194/vip-194-testnet/abi/BEACON_ABI.json similarity index 100% rename from simulations/vip-191/vip-191-testnet/abi/BEACON_ABI.json rename to simulations/vip-194/vip-194-testnet/abi/BEACON_ABI.json diff --git a/simulations/vip-191/vip-191-testnet/abi/COMPTROLLER.json b/simulations/vip-194/vip-194-testnet/abi/COMPTROLLER.json similarity index 100% rename from simulations/vip-191/vip-191-testnet/abi/COMPTROLLER.json rename to simulations/vip-194/vip-194-testnet/abi/COMPTROLLER.json diff --git a/simulations/vip-191/vip-191-testnet/abi/MOCK_TOKEN_ABI.json b/simulations/vip-194/vip-194-testnet/abi/MOCK_TOKEN_ABI.json similarity index 100% rename from simulations/vip-191/vip-191-testnet/abi/MOCK_TOKEN_ABI.json rename to simulations/vip-194/vip-194-testnet/abi/MOCK_TOKEN_ABI.json diff --git a/simulations/vip-191/vip-191-testnet/abi/VTOKEN_ABI.json b/simulations/vip-194/vip-194-testnet/abi/VTOKEN_ABI.json similarity index 100% rename from simulations/vip-191/vip-191-testnet/abi/VTOKEN_ABI.json rename to simulations/vip-194/vip-194-testnet/abi/VTOKEN_ABI.json diff --git a/simulations/vip-191/vip-191-testnet/simulations.ts b/simulations/vip-194/vip-194-testnet/simulations.ts similarity index 96% rename from simulations/vip-191/vip-191-testnet/simulations.ts rename to simulations/vip-194/vip-194-testnet/simulations.ts index 7db870e20..19461fc6e 100644 --- a/simulations/vip-191/vip-191-testnet/simulations.ts +++ b/simulations/vip-194/vip-194-testnet/simulations.ts @@ -7,7 +7,7 @@ import { ethers } from "hardhat"; import { expectEvents, initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; import { fetchVTokenStorageIL, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; -import { IL_MARKETS, vip191Testnet } from "../../../vips/vip-191/vip-191-testnet"; +import { IL_MARKETS, vip194Testnet } from "../../../vips/vip-194/vip-194-testnet"; import BEACON_ABI from "./abi/BEACON_ABI.json"; import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; @@ -72,7 +72,7 @@ forking(34455768, () => { }); forking(34455768, () => { - testVip("VIP-170 IL VToken Upgrade of AIA", vip191Testnet(), { + testVip("VIP-194 IL VToken Upgrade of AIA", vip194Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [2, 27]); }, @@ -82,7 +82,7 @@ forking(34455768, () => { forking(34455768, () => { describe("Post VIP simulations", async () => { before(async () => { - await pretendExecutingVip(vip191Testnet()); + await pretendExecutingVip(vip194Testnet()); [user] = await ethers.getSigners(); }); diff --git a/vips/vip-192/vip-192-testnet.ts b/vips/vip-192/vip-192-testnet.ts index 4ebbb73ea..f7ac1aa10 100644 --- a/vips/vip-192/vip-192-testnet.ts +++ b/vips/vip-192/vip-192-testnet.ts @@ -5,142 +5,44 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; +const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; interface AssetConfig { name: string; address: string; reduceReservesBlockDelta: number; - acceptAdmin: boolean; isMock: boolean; // Defines underlying is MockToken } export const CORE_MARKETS: AssetConfig[] = [ { - name: "vETH", - address: "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: false, - }, - { - name: "vLTC", - address: "0xAfc13BC065ABeE838540823431055D2ea52eBA52", + name: "vBUSD", + address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: false, - }, - { - name: "VBTC", - address: "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: false, - }, - { - name: "vXRP", - address: "0x488aB2826a154da01CC4CC16A8C83d4720D3cA2C", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: false, - }, - { - name: "vSXP", - address: "0x74469281310195A04840Daf6EdF576F559a3dE80", - reduceReservesBlockDelta: 100, - acceptAdmin: true, isMock: true, }, { - name: "vTRX", + name: "vTRXOLD", address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", reduceReservesBlockDelta: 100, - acceptAdmin: false, - isMock: true, - }, - { - name: "vTUSD", - address: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", - reduceReservesBlockDelta: 100, - acceptAdmin: false, - isMock: true, - }, - { - name: "vUSDC", - address: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: true, - }, - { - name: "vUSDT", - address: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", - reduceReservesBlockDelta: 100, - acceptAdmin: false, isMock: true, }, { - name: "vWBETH", - address: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", + name: "vTUSDOLD", + address: "0x3A00d9B02781f47d033BAd62edc55fBF8D083Fb0", reduceReservesBlockDelta: 100, - acceptAdmin: false, - isMock: true, - }, - { - name: "vXVS", - address: "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: false, - }, - { - name: "vDOGE", - address: "0xF912d3001CAf6DC4ADD366A62Cc9115B4303c9A9", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: true, - }, - { - name: "vMATIC", - address: "0x3619bdDc61189F33365CC572DF3a68FB3b316516", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: true, - }, - { - name: "vCAKE", - address: "0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6", - reduceReservesBlockDelta: 100, - acceptAdmin: true, - isMock: true, - }, - { - name: "vADA", - address: "0x37C28DE42bA3d22217995D146FC684B2326Ede64", - reduceReservesBlockDelta: 100, - acceptAdmin: false, - isMock: true, - }, - { - name: "vAAVE", - address: "0x714db6c38A17883964B68a07d56cE331501d9eb6", - reduceReservesBlockDelta: 100, - acceptAdmin: false, isMock: true, }, ]; -function filterAssets(assets: AssetConfig[]) { - return assets.filter(asset => asset.acceptAdmin); -} - -const MARKETS_WITH_ACCEPT_ADMIN = filterAssets(CORE_MARKETS); - export const vip192Testnet = () => { const meta = { version: "v2", - title: "VIP-192 VToken Upgrade of AIA", + title: "VIP-192 VToken Upgrade of AIA Part - 1", description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", @@ -152,31 +54,116 @@ export const vip192Testnet = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) }, { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], }, + { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], }, + { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], }, - ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { - return { - target: asset.address, - signature: "_acceptAdmin()", - params: [], - }; - }), ...CORE_MARKETS.map(asset => { return { target: asset.address, diff --git a/vips/vip-192/vip-192.ts b/vips/vip-192/vip-192.ts index d1ec359af..817d983b3 100644 --- a/vips/vip-192/vip-192.ts +++ b/vips/vip-192/vip-192.ts @@ -5,7 +5,10 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775"; const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; +const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const COMPTROLLER = "0xfd36e2c2a6789db23113685031d7f16329158384"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; interface AssetConfig { @@ -17,149 +20,23 @@ interface AssetConfig { export const CORE_MARKETS: AssetConfig[] = [ { - name: "vAAVE", - address: "0x26DA28954763B92139ED49283625ceCAf52C6f94", + name: "vTRXOLD", + address: "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", reduceReservesBlockDelta: 28800, - holder: "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb", + holder: "0xe2fc31F816A9b94326492132018C3aEcC4a93aE1", }, { - name: "vADA", - address: "0x9A0AF7FDb2065Ce470D72664DE73cAE409dA28Ec", + name: "vTUSDOLD", + address: "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vBCH", - address: "0x5F0388EBc2B94FA8E123F404b79cCF5f40b29176", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vBETH", - address: "0x972207A639CC1B374B893cc33Fa251b55CEB7c07", - reduceReservesBlockDelta: 28800, - holder: "0xF68a4b64162906efF0fF6aE34E2bB1Cd42FEf62d", - }, - { - name: "vBTC", - address: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vCAKE", - address: "0x86aC3974e2BD0d60825230fa6F355fF11409df5c", - reduceReservesBlockDelta: 28800, - holder: "0x000000000000000000000000000000000000dEaD", - }, - { - name: "vDAI", - address: "0x334b3eCB4DCa3593BCCC3c7EBD1A1C1d1780FBF1", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vDOGE", - address: "0xec3422Ef92B2fb59e84c8B02Ba73F1fE84Ed8D71", - reduceReservesBlockDelta: 28800, - holder: "0x0000000000000000000000000000000000001004", - }, - { - name: "vDOT", - address: "0x1610bc33319e9398de5f57B33a5b184c806aD217", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vETH", - address: "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vFIL", - address: "0xf91d58b5aE142DAcC749f58A49FCBac340Cb0343", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vLINK", - address: "0x650b940a1033B8A1b1873f78730FcFC73ec11f1f", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vLTC", - address: "0x57A5297F2cB2c0AaC9D554660acd6D385Ab50c6B", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vMATIC", - address: "0x5c9476FcD6a4F9a3654139721c949c2233bBbBc8", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vSXP", - address: "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vTRX", - address: "0xC5D3466aA484B040eE977073fcF337f2c00071c1", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vTUSD", - address: "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vUSDC", - address: "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vUSDT", - address: "0xfD5840Cd36d94D7229439859C0112a4185BC0255", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vWBETH", - address: "0x6CFdEc747f37DAf3b87a35a1D9c8AD3063A1A8A0", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vXRP", - address: "0xB248a295732e0225acd3337607cc01068e3b9c10", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vXVS", - address: "0x151B1e2635A717bcDc836ECd6FbB62B674FE3E1D", - reduceReservesBlockDelta: 28800, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", - }, - { - name: "vBUSD", - address: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", - reduceReservesBlockDelta: 105120000, - holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + holder: "0x8894E0a0c962CB723c1976a4421c95949bE2D4E3", }, ]; export const vip192 = () => { const meta = { version: "v2", - title: "VIP-192 VToken Upgrade of AIA", + title: "VIP-192 VToken Upgrade of AIA Part - 1", description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", @@ -171,22 +48,114 @@ export const vip192 = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) }, { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], + }, + { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], + }, + { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], + params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], }, ...CORE_MARKETS.map(asset => { diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts index 8a5433bf6..e05c22655 100644 --- a/vips/vip-193/vip-193-testnet.ts +++ b/vips/vip-193/vip-193-testnet.ts @@ -5,40 +5,138 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; -const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; -const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; -const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; -const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; interface AssetConfig { name: string; address: string; reduceReservesBlockDelta: number; + acceptAdmin: boolean; isMock: boolean; // Defines underlying is MockToken } export const CORE_MARKETS: AssetConfig[] = [ { - name: "vBUSD", - address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + name: "vETH", + address: "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: false, + }, + { + name: "vLTC", + address: "0xAfc13BC065ABeE838540823431055D2ea52eBA52", reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: false, + }, + { + name: "VBTC", + address: "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: false, + }, + { + name: "vXRP", + address: "0x488aB2826a154da01CC4CC16A8C83d4720D3cA2C", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: false, + }, + { + name: "vSXP", + address: "0x74469281310195A04840Daf6EdF576F559a3dE80", + reduceReservesBlockDelta: 100, + acceptAdmin: true, isMock: true, }, { - name: "vTRXOLD", + name: "vTRX", address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vTUSD", + address: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vUSDC", + address: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vUSDT", + address: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", + reduceReservesBlockDelta: 100, + acceptAdmin: false, isMock: true, }, { - name: "vTUSDOLD", - address: "0x3A00d9B02781f47d033BAd62edc55fBF8D083Fb0", + name: "vWBETH", + address: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vXVS", + address: "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: false, + }, + { + name: "vDOGE", + address: "0xF912d3001CAf6DC4ADD366A62Cc9115B4303c9A9", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vMATIC", + address: "0x3619bdDc61189F33365CC572DF3a68FB3b316516", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vCAKE", + address: "0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6", + reduceReservesBlockDelta: 100, + acceptAdmin: true, + isMock: true, + }, + { + name: "vADA", + address: "0x37C28DE42bA3d22217995D146FC684B2326Ede64", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, + { + name: "vAAVE", + address: "0x714db6c38A17883964B68a07d56cE331501d9eb6", + reduceReservesBlockDelta: 100, + acceptAdmin: false, isMock: true, }, ]; +function filterAssets(assets: AssetConfig[]) { + return assets.filter(asset => asset.acceptAdmin); +} + +const MARKETS_WITH_ACCEPT_ADMIN = filterAssets(CORE_MARKETS); + export const vip193Testnet = () => { const meta = { version: "v2", @@ -54,116 +152,31 @@ export const vip193Testnet = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) - }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], }, + ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { + return { + target: asset.address, + signature: "_acceptAdmin()", + params: [], + }; + }), ...CORE_MARKETS.map(asset => { return { target: asset.address, diff --git a/vips/vip-193/vip-193.ts b/vips/vip-193/vip-193.ts index 880b12ce4..ecdcc68a0 100644 --- a/vips/vip-193/vip-193.ts +++ b/vips/vip-193/vip-193.ts @@ -5,10 +5,7 @@ import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775"; const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; -const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; -const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; -const COMPTROLLER = "0xfd36e2c2a6789db23113685031d7f16329158384"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; interface AssetConfig { @@ -20,16 +17,142 @@ interface AssetConfig { export const CORE_MARKETS: AssetConfig[] = [ { - name: "vTRXOLD", - address: "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", + name: "vAAVE", + address: "0x26DA28954763B92139ED49283625ceCAf52C6f94", reduceReservesBlockDelta: 28800, - holder: "0xe2fc31F816A9b94326492132018C3aEcC4a93aE1", + holder: "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb", }, { - name: "vTUSDOLD", - address: "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", + name: "vADA", + address: "0x9A0AF7FDb2065Ce470D72664DE73cAE409dA28Ec", reduceReservesBlockDelta: 28800, - holder: "0x8894E0a0c962CB723c1976a4421c95949bE2D4E3", + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vBCH", + address: "0x5F0388EBc2B94FA8E123F404b79cCF5f40b29176", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vBETH", + address: "0x972207A639CC1B374B893cc33Fa251b55CEB7c07", + reduceReservesBlockDelta: 28800, + holder: "0xF68a4b64162906efF0fF6aE34E2bB1Cd42FEf62d", + }, + { + name: "vBTC", + address: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vCAKE", + address: "0x86aC3974e2BD0d60825230fa6F355fF11409df5c", + reduceReservesBlockDelta: 28800, + holder: "0x000000000000000000000000000000000000dEaD", + }, + { + name: "vDAI", + address: "0x334b3eCB4DCa3593BCCC3c7EBD1A1C1d1780FBF1", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vDOGE", + address: "0xec3422Ef92B2fb59e84c8B02Ba73F1fE84Ed8D71", + reduceReservesBlockDelta: 28800, + holder: "0x0000000000000000000000000000000000001004", + }, + { + name: "vDOT", + address: "0x1610bc33319e9398de5f57B33a5b184c806aD217", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vETH", + address: "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vFIL", + address: "0xf91d58b5aE142DAcC749f58A49FCBac340Cb0343", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vLINK", + address: "0x650b940a1033B8A1b1873f78730FcFC73ec11f1f", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vLTC", + address: "0x57A5297F2cB2c0AaC9D554660acd6D385Ab50c6B", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vMATIC", + address: "0x5c9476FcD6a4F9a3654139721c949c2233bBbBc8", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vSXP", + address: "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vTRX", + address: "0xC5D3466aA484B040eE977073fcF337f2c00071c1", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vTUSD", + address: "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDC", + address: "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDT", + address: "0xfD5840Cd36d94D7229439859C0112a4185BC0255", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vWBETH", + address: "0x6CFdEc747f37DAf3b87a35a1D9c8AD3063A1A8A0", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vXRP", + address: "0xB248a295732e0225acd3337607cc01068e3b9c10", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vXVS", + address: "0x151B1e2635A717bcDc836ECd6FbB62B674FE3E1D", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vBUSD", + address: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + reduceReservesBlockDelta: 105120000, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", }, ]; @@ -48,114 +171,22 @@ export const vip193 = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], - }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", FAST_TRACK_TIMELOCK], + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setCollateralFactor(address,uint256)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setProtocolPaused(bool)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setProtocolPaused(bool)", CRITICAL_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", FAST_TRACK_TIMELOCK], - }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setActionsPaused(address[],uint8[],bool)", CRITICAL_TIMELOCK], + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], }, ...CORE_MARKETS.map(asset => { diff --git a/vips/vip-191/vip-191-testnet.ts b/vips/vip-194/vip-194-testnet.ts similarity index 98% rename from vips/vip-191/vip-191-testnet.ts rename to vips/vip-194/vip-194-testnet.ts index 5d91fa71d..c7f2786ec 100644 --- a/vips/vip-191/vip-191-testnet.ts +++ b/vips/vip-194/vip-194-testnet.ts @@ -156,10 +156,10 @@ export const IL_MARKETS: AssetConfig[] = [ }, ]; -export const vip191Testnet = () => { +export const vip194Testnet = () => { const meta = { version: "v2", - title: "VIP-191 VToken Upgrade of AIA", + title: "VIP-194 VToken Upgrade of AIA", description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", From f8cc468986d574e8698505e4eadc99f72064c254 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:49:46 +0530 Subject: [PATCH 25/32] test: add reduce reserve test in testnet --- .../vip-192/vip-192-testnet/simulations.ts | 37 +++++++- .../vip-193/vip-193-testnet/simulations.ts | 91 +++++++++++++------ vips/vip-192/vip-192-testnet.ts | 6 -- vips/vip-193/vip-193-testnet.ts | 7 ++ 4 files changed, 107 insertions(+), 34 deletions(-) diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index 3321f70bc..ebd43d292 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -107,7 +107,7 @@ forking(34517682, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [3, 3, 3, 3], + [2, 2, 2, 2], ); }, }); @@ -173,3 +173,38 @@ forking(34517682, () => { }); }); }); + +// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). +forking(34517682, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip192Testnet()); + }); + + for (const market of CORE_MARKETS) { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const cashPrior = await vToken.getCash(); + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + if (Number(cashPrior) > Number(reservesPrior)) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); + expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + } else { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + expect(psrBalAfter).equals(psrBalPrior); + expect(reservesAfter).greaterThan(reservesPrior); + } + }); + } + }); +}); diff --git a/simulations/vip-193/vip-193-testnet/simulations.ts b/simulations/vip-193/vip-193-testnet/simulations.ts index 6b07f432d..521f4939a 100644 --- a/simulations/vip-193/vip-193-testnet/simulations.ts +++ b/simulations/vip-193/vip-193-testnet/simulations.ts @@ -30,7 +30,7 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34517682, () => { +forking(34534467, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); @@ -53,17 +53,18 @@ forking(34517682, () => { await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); + if (market.name != "vBUSD") + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); const state = await fetchVTokenStorageCore(vToken, user.address); @@ -77,7 +78,7 @@ forking(34517682, () => { }); }); -forking(34517682, () => { +forking(34534467, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -105,13 +106,13 @@ forking(34517682, () => { txResponse, [VTOKEN_ABI, ProxyAdminInterface], ["NewImplementation", "NewProtocolShareReserve", "NewReduceReservesBlockDelta", "NewAccessControlManager"], - [16, 16, 16, 16], + [17, 17, 17, 17], ); }, }); }); -forking(34517682, () => { +forking(34534467, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip193Testnet()); @@ -133,18 +134,18 @@ forking(34517682, () => { await comptroller.connect(impersonatedTimelock)._setMarketBorrowCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setMarketSupplyCaps([market.address], [parseUnits("2", 48)]); await comptroller.connect(impersonatedTimelock)._setCollateralFactor(market.address, parseUnits("0.95", 18)); - - await performVTokenBasicActions( - market.address, - user, - mintAmount, - borrowAmount, - repayAmount, - redeemAmount, - vToken, - underlying, - market.isMock, - ); + if (market.name != "vBUSD") + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + market.isMock, + ); const state = await fetchVTokenStorageCore(vToken, user.address); @@ -168,3 +169,39 @@ forking(34517682, () => { }); }); }); + +// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). +forking(34534467, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip193Testnet()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + }); + + for (const market of CORE_MARKETS) { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const cashPrior = await vToken.getCash(); + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + if (Number(cashPrior) > Number(reservesPrior) && reservesPrior != 0) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + expect(psrBalAfter).greaterThan(psrBalPrior + reservesPrior); + expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + } else if (reservesPrior != 0) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit(vToken, "ReservesReduced"); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + expect(psrBalAfter).equals(psrBalPrior); + expect(reservesAfter).greaterThan(reservesPrior); + } + }); + } + }); +}); diff --git a/vips/vip-192/vip-192-testnet.ts b/vips/vip-192/vip-192-testnet.ts index f7ac1aa10..a2f0aa9c0 100644 --- a/vips/vip-192/vip-192-testnet.ts +++ b/vips/vip-192/vip-192-testnet.ts @@ -19,12 +19,6 @@ interface AssetConfig { } export const CORE_MARKETS: AssetConfig[] = [ - { - name: "vBUSD", - address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", - reduceReservesBlockDelta: 100, - isMock: true, - }, { name: "vTRXOLD", address: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts index e05c22655..5e8a77a9d 100644 --- a/vips/vip-193/vip-193-testnet.ts +++ b/vips/vip-193/vip-193-testnet.ts @@ -129,6 +129,13 @@ export const CORE_MARKETS: AssetConfig[] = [ acceptAdmin: false, isMock: true, }, + { + name: "vBUSD", + address: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + reduceReservesBlockDelta: 100, + acceptAdmin: false, + isMock: true, + }, ]; function filterAssets(assets: AssetConfig[]) { From 58677106732eb0e4d4b5b890cb8610e9aa7be2ea Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:24:13 +0530 Subject: [PATCH 26/32] refactor: move normal timelock permissions --- .../vip-192/vip-192-testnet/simulations.ts | 2 +- simulations/vip-192/vip-192/simulations.ts | 2 +- .../vip-193/vip-193-testnet/simulations.ts | 2 +- simulations/vip-193/vip-193/simulations.ts | 2 +- vips/vip-192/vip-192-testnet.ts | 17 ++++++++++++++- vips/vip-192/vip-192.ts | 21 ++++++++++++++++++- vips/vip-193/vip-193-testnet.ts | 15 ------------- vips/vip-193/vip-193.ts | 15 ------------- 8 files changed, 40 insertions(+), 36 deletions(-) diff --git a/simulations/vip-192/vip-192-testnet/simulations.ts b/simulations/vip-192/vip-192-testnet/simulations.ts index ebd43d292..a990264ca 100644 --- a/simulations/vip-192/vip-192-testnet/simulations.ts +++ b/simulations/vip-192/vip-192-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(34517682, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 22); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/simulations/vip-192/vip-192/simulations.ts b/simulations/vip-192/vip-192/simulations.ts index 5c098d129..a1db05c2c 100644 --- a/simulations/vip-192/vip-192/simulations.ts +++ b/simulations/vip-192/vip-192/simulations.ts @@ -28,7 +28,7 @@ forking(32915411, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 19); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 23); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/simulations/vip-193/vip-193-testnet/simulations.ts b/simulations/vip-193/vip-193-testnet/simulations.ts index 521f4939a..81a105386 100644 --- a/simulations/vip-193/vip-193-testnet/simulations.ts +++ b/simulations/vip-193/vip-193-testnet/simulations.ts @@ -35,7 +35,7 @@ forking(34534467, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 14); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 11); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/simulations/vip-193/vip-193/simulations.ts b/simulations/vip-193/vip-193/simulations.ts index 14769ab6e..d55551a3a 100644 --- a/simulations/vip-193/vip-193/simulations.ts +++ b/simulations/vip-193/vip-193/simulations.ts @@ -34,7 +34,7 @@ forking(32915411, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 4); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 1); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/vips/vip-192/vip-192-testnet.ts b/vips/vip-192/vip-192-testnet.ts index a2f0aa9c0..b5d04351c 100644 --- a/vips/vip-192/vip-192-testnet.ts +++ b/vips/vip-192/vip-192-testnet.ts @@ -48,7 +48,22 @@ export const vip192Testnet = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], }, { target: ACCESS_CONTROL_MANAGER, diff --git a/vips/vip-192/vip-192.ts b/vips/vip-192/vip-192.ts index 817d983b3..1451be610 100644 --- a/vips/vip-192/vip-192.ts +++ b/vips/vip-192/vip-192.ts @@ -48,8 +48,27 @@ export const vip192 = () => { { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], // Permission to success vip simulations (remove later) + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], + }, + + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], + }, + { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts index 5e8a77a9d..8aaeed1aa 100644 --- a/vips/vip-193/vip-193-testnet.ts +++ b/vips/vip-193/vip-193-testnet.ts @@ -161,21 +161,6 @@ export const vip193Testnet = () => { signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], - }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], - }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], - }, ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { return { diff --git a/vips/vip-193/vip-193.ts b/vips/vip-193/vip-193.ts index ecdcc68a0..50345c802 100644 --- a/vips/vip-193/vip-193.ts +++ b/vips/vip-193/vip-193.ts @@ -173,21 +173,6 @@ export const vip193 = () => { signature: "giveCallPermission(address,string,address)", params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setReserveFactor(uint256)", NORMAL_TIMELOCK], - }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_setInterestRateModel(address)", NORMAL_TIMELOCK], - }, - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "_reduceReserves(uint256)", NORMAL_TIMELOCK], - }, ...CORE_MARKETS.map(asset => { return { From 30464631a335355ee07aac4d8fd0f0ec5ac6b85c Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:31:41 +0530 Subject: [PATCH 27/32] feat: remove normal timelock permissions after part1 execution --- simulations/vip-193/vip-193-testnet/simulations.ts | 10 +++++----- vips/vip-193/vip-193-testnet.ts | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/simulations/vip-193/vip-193-testnet/simulations.ts b/simulations/vip-193/vip-193-testnet/simulations.ts index 81a105386..fed597842 100644 --- a/simulations/vip-193/vip-193-testnet/simulations.ts +++ b/simulations/vip-193/vip-193-testnet/simulations.ts @@ -30,12 +30,12 @@ const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34534467, () => { +forking(34541821, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(CORE_MARKETS.length * 4 + 11); // Number of Vip steps + await mine(CORE_MARKETS.length * 4 + 10); // Number of Vip steps }); for (const market of CORE_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -78,7 +78,7 @@ forking(34534467, () => { }); }); -forking(34534467, () => { +forking(34541821, () => { const ProxyAdminInterface = [ { anonymous: false, @@ -112,7 +112,7 @@ forking(34534467, () => { }); }); -forking(34534467, () => { +forking(34541821, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip193Testnet()); @@ -171,7 +171,7 @@ forking(34534467, () => { }); // In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). -forking(34534467, () => { +forking(34541821, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip193Testnet()); diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts index 8aaeed1aa..960aa0698 100644 --- a/vips/vip-193/vip-193-testnet.ts +++ b/vips/vip-193/vip-193-testnet.ts @@ -156,12 +156,6 @@ export const vip193Testnet = () => { return makeProposal( [ - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], - }, - ...MARKETS_WITH_ACCEPT_ADMIN.map(asset => { return { target: asset.address, From 1d0fee46446d18f16b616b41aafb08bbcf242f63 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:34:58 +0530 Subject: [PATCH 28/32] ci: fix lint --- vips/vip-193/vip-193-testnet.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/vips/vip-193/vip-193-testnet.ts b/vips/vip-193/vip-193-testnet.ts index 960aa0698..61e633bb7 100644 --- a/vips/vip-193/vip-193-testnet.ts +++ b/vips/vip-193/vip-193-testnet.ts @@ -1,11 +1,8 @@ -import { ethers } from "hardhat"; - import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; const NEW_VBEP20_DELEGATE_IMPL = "0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850"; const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; interface AssetConfig { From 05e16288d3590b6eae77d53f2b616e21f3b45e92 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:59:24 +0530 Subject: [PATCH 29/32] feat: update IL testnet vip block number and fix add more tests --- .../vip-194/vip-194-testnet/simulations.ts | 54 +++++++++++++++++-- vips/vip-194/vip-194-testnet.ts | 6 --- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/simulations/vip-194/vip-194-testnet/simulations.ts b/simulations/vip-194/vip-194-testnet/simulations.ts index 19461fc6e..6276662b0 100644 --- a/simulations/vip-194/vip-194-testnet/simulations.ts +++ b/simulations/vip-194/vip-194-testnet/simulations.ts @@ -29,12 +29,12 @@ const mintAmount = parseUnits("200", 18); const borrowAmount = parseUnits("50", 18); const repayAmount = parseUnits("50", 18); const redeemAmount = parseUnits("50", 18); -forking(34455768, () => { +forking(34543167, () => { describe("Pre VIP simulations", async () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(IL_MARKETS.length * 2 + 5); // Number of Vip steps + await mine(IL_MARKETS.length * 2 + 4); // Number of Vip steps }); for (const market of IL_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { @@ -71,7 +71,7 @@ forking(34455768, () => { }); }); -forking(34455768, () => { +forking(34543167, () => { testVip("VIP-194 IL VToken Upgrade of AIA", vip194Testnet(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [2, 27]); @@ -79,7 +79,7 @@ forking(34455768, () => { }); }); -forking(34455768, () => { +forking(34543167, () => { describe("Post VIP simulations", async () => { before(async () => { await pretendExecutingVip(vip194Testnet()); @@ -132,3 +132,49 @@ forking(34455768, () => { }); }); }); + +// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). +forking(34543167, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip194Testnet()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + }); + + for (const market of IL_MARKETS) { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const cashPrior = await vToken.getCash(); + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + if (Number(cashPrior) > Number(reservesPrior) && reservesPrior != 0) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit( + vToken, + "SpreadReservesReduced", + ); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).greaterThanOrEqual(psrBalPrior.add(reservesPrior)); + expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit( + vToken, + "SpreadReservesReduced", + ); + } else if (reservesPrior != 0) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit( + vToken, + "SpreadReservesReduced", + ); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + expect(psrBalAfter).equals(psrBalPrior); + expect(reservesAfter).greaterThan(reservesPrior); + } + }); + } + }); +}); diff --git a/vips/vip-194/vip-194-testnet.ts b/vips/vip-194/vip-194-testnet.ts index c7f2786ec..e4cd5d86d 100644 --- a/vips/vip-194/vip-194-testnet.ts +++ b/vips/vip-194/vip-194-testnet.ts @@ -168,12 +168,6 @@ export const vip194Testnet = () => { return makeProposal( [ - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], - }, - { target: ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", From d269d848de1224cb4e714713697b54947136fb3a Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Fri, 27 Oct 2023 09:48:57 +0530 Subject: [PATCH 30/32] fix: remove unused permissions --- .../vip-194/vip-194-testnet/simulations.ts | 2 +- vips/vip-194/vip-194-testnet.ts | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/simulations/vip-194/vip-194-testnet/simulations.ts b/simulations/vip-194/vip-194-testnet/simulations.ts index 6276662b0..6f3d2dcd9 100644 --- a/simulations/vip-194/vip-194-testnet/simulations.ts +++ b/simulations/vip-194/vip-194-testnet/simulations.ts @@ -34,7 +34,7 @@ forking(34543167, () => { before(async () => { [user] = await ethers.getSigners(); impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); - await mine(IL_MARKETS.length * 2 + 4); // Number of Vip steps + await mine(IL_MARKETS.length * 2 + 2); // Number of Vip steps }); for (const market of IL_MARKETS) { it(`Save pre VIP storage snapshot of ${market.name}`, async () => { diff --git a/vips/vip-194/vip-194-testnet.ts b/vips/vip-194/vip-194-testnet.ts index e4cd5d86d..964b0ce96 100644 --- a/vips/vip-194/vip-194-testnet.ts +++ b/vips/vip-194/vip-194-testnet.ts @@ -1,14 +1,8 @@ -import { ethers } from "hardhat"; - import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; const VTOKEN_BEACON = "0xBF85A90673E61956f8c79b9150BAB7893b791bDd"; const NEW_IMPL_VTOKEN = "0xca408d716011169645aa94ddc5665043c33df814"; -const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; -const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; -const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; const PROTOCOL_SHARE_RESERVE = "0x25c7c7D6Bf710949fD7f03364E9BA19a1b3c10E3"; const SN_BNB_BEACON = "0x1103Bec24Eb194d69ae116d62DD9559412E7C23A"; @@ -168,17 +162,6 @@ export const vip194Testnet = () => { return makeProposal( [ - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", FAST_TRACK_TIMELOCK], - }, - - { - target: ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", CRITICAL_TIMELOCK], - }, { target: VTOKEN_BEACON, signature: "upgradeTo(address)", From b3ab7a663cebb85b6a126e2cad7fe9dea9b14329 Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Fri, 27 Oct 2023 14:19:16 +0530 Subject: [PATCH 31/32] feat: add IL Vtoken upgrade simulatios --- .../vip-194/vip-194/abi/BEACON_ABI.json | 51 ++ .../vip-194/vip-194/abi/COMPTROLLER.json | 769 ++++++++++++++++ .../vip-194/vip-194/abi/MOCK_TOKEN_ABI.json | 155 ++++ .../vip-194/vip-194/abi/VTOKEN_ABI.json | 830 ++++++++++++++++++ simulations/vip-194/vip-194/simulations.ts | 179 ++++ vips/vip-194/vip-194.ts | 214 +++++ 6 files changed, 2198 insertions(+) create mode 100644 simulations/vip-194/vip-194/abi/BEACON_ABI.json create mode 100644 simulations/vip-194/vip-194/abi/COMPTROLLER.json create mode 100644 simulations/vip-194/vip-194/abi/MOCK_TOKEN_ABI.json create mode 100644 simulations/vip-194/vip-194/abi/VTOKEN_ABI.json create mode 100644 simulations/vip-194/vip-194/simulations.ts create mode 100644 vips/vip-194/vip-194.ts diff --git a/simulations/vip-194/vip-194/abi/BEACON_ABI.json b/simulations/vip-194/vip-194/abi/BEACON_ABI.json new file mode 100644 index 000000000..fe7f3e52f --- /dev/null +++ b/simulations/vip-194/vip-194/abi/BEACON_ABI.json @@ -0,0 +1,51 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "implementation_", "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" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "implementation", + "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": "address", "name": "newImplementation", "type": "address" }], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-194/vip-194/abi/COMPTROLLER.json b/simulations/vip-194/vip-194/abi/COMPTROLLER.json new file mode 100644 index 000000000..f8d85ef31 --- /dev/null +++ b/simulations/vip-194/vip-194/abi/COMPTROLLER.json @@ -0,0 +1,769 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "poolRegistry_", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "enum ComptrollerStorage.Action", "name": "action", "type": "uint8" } + ], + "name": "ActionPaused", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "BorrowCapExceeded", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "expectedLessThanOrEqualTo", "type": "uint256" }, + { "internalType": "uint256", "name": "actual", "type": "uint256" } + ], + "name": "CollateralExceedsThreshold", + "type": "error" + }, + { "inputs": [], "name": "ComptrollerMismatch", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "collateralToSeize", "type": "uint256" }, + { "internalType": "uint256", "name": "availableCollateral", "type": "uint256" } + ], + "name": "InsufficientCollateral", + "type": "error" + }, + { "inputs": [], "name": "InsufficientLiquidity", "type": "error" }, + { "inputs": [], "name": "InsufficientShortfall", "type": "error" }, + { "inputs": [], "name": "InvalidCollateralFactor", "type": "error" }, + { "inputs": [], "name": "InvalidLiquidationThreshold", "type": "error" }, + { + "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], + "name": "MarketAlreadyListed", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "MarketNotCollateral", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "loopsLimit", "type": "uint256" }, + { "internalType": "uint256", "name": "requiredLoops", "type": "uint256" } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "expectedGreaterThan", "type": "uint256" }, + { "internalType": "uint256", "name": "actual", "type": "uint256" } + ], + "name": "MinimalCollateralViolated", + "type": "error" + }, + { "inputs": [], "name": "NonzeroBorrowBalance", "type": "error" }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "PriceError", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "SnapshotError", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "SupplyCapExceeded", + "type": "error" + }, + { "inputs": [], "name": "TooMuchRepay", "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": [ + { "internalType": "address", "name": "expectedSender", "type": "address" }, + { "internalType": "address", "name": "actualSender", "type": "address" } + ], + "name": "UnexpectedSender", + "type": "error" + }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "enum ComptrollerStorage.Action", "name": "action", "type": "uint8" }, + { "indexed": false, "internalType": "bool", "name": "pauseState", "type": "bool" } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "MarketSupported", + "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": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newBorrowCap", "type": "uint256" } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldCloseFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldCollateralFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldLiquidationIncentiveMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newLiquidationIncentiveMantissa", "type": "uint256" } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldLiquidationThresholdMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newLiquidationThresholdMantissa", "type": "uint256" } + ], + "name": "NewLiquidationThreshold", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMinLiquidatableCollateral", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMinLiquidatableCollateral", "type": "uint256" } + ], + "name": "NewMinLiquidatableCollateral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "rewardsDistributor", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "rewardToken", "type": "address" } + ], + "name": "NewRewardsDistributor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newSupplyCap", "type": "uint256" } + ], + "name": "NewSupplyCap", + "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" + }, + { "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" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "accountAssets", + "outputs": [{ "internalType": "contract VToken", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "enum ComptrollerStorage.Action", "name": "action", "type": "uint8" } + ], + "name": "actionPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract RewardsDistributor", "name": "_rewardsDistributor", "type": "address" }], + "name": "addRewardsDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allMarkets", + "outputs": [{ "internalType": "contract VToken", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "borrowCaps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "contract VToken", "name": "vToken", "type": "address" } + ], + "name": "checkMembership", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address[]", "name": "vTokens", "type": "address[]" }], + "name": "enterMarkets", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vTokenAddress", "type": "address" }], + "name": "exitMarket", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "shortfall", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllMarkets", + "outputs": [{ "internalType": "contract VToken[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAssetsIn", + "outputs": [{ "internalType": "contract VToken[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getBorrowingPower", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "shortfall", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "vTokenModify", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "shortfall", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardDistributors", + "outputs": [{ "internalType": "contract RewardsDistributor[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "getRewardsByMarket", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "rewardToken", "type": "address" }, + { "internalType": "uint256", "name": "supplySpeed", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowSpeed", "type": "uint256" } + ], + "internalType": "struct ComptrollerStorage.RewardSpeeds[]", + "name": "rewardSpeeds", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "healAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "loopLimit", "type": "uint256" }, + { "internalType": "address", "name": "accessControlManager", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isComptroller", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "isDeprecated", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "isMarketListed", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { + "components": [ + { "internalType": "contract VToken", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "contract VToken", "name": "vTokenBorrowed", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "internalType": "struct ComptrollerStorage.LiquidationOrder[]", + "name": "orders", + "type": "tuple[]" + } + ], + "name": "liquidateAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "uint256", "name": "actualRepayAmount", "type": "uint256" } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "tokensToSeize", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "markets", + "outputs": [ + { "internalType": "bool", "name": "isListed", "type": "bool" }, + { "internalType": "uint256", "name": "collateralFactorMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidationThresholdMantissa", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLiquidatableCollateral", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [{ "internalType": "contract ResilientOracleInterface", "name": "", "type": "address" }], + "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": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" } + ], + "name": "preBorrowHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vTokenBorrowed", "type": "address" }, + { "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "bool", "name": "skipLiquidityCheck", "type": "bool" } + ], + "name": "preLiquidateHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "preMintHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "redeemer", "type": "address" }, + { "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "preRedeemHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" } + ], + "name": "preRepayHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "address", "name": "seizerContract", "type": "address" }, + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" } + ], + "name": "preSeizeHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "transferTokens", "type": "uint256" } + ], + "name": "preTransferHook", + "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 VToken[]", "name": "marketsList", "type": "address[]" }, + { "internalType": "enum ComptrollerStorage.Action[]", "name": "actionsList", "type": "uint8[]" }, + { "internalType": "bool", "name": "paused", "type": "bool" } + ], + "name": "setActionsPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newCloseFactorMantissa", "type": "uint256" }], + "name": "setCloseFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "internalType": "uint256", "name": "newCollateralFactorMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "newLiquidationThresholdMantissa", "type": "uint256" } + ], + "name": "setCollateralFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newLiquidationIncentiveMantissa", "type": "uint256" }], + "name": "setLiquidationIncentive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract VToken[]", "name": "vTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "newBorrowCaps", "type": "uint256[]" } + ], + "name": "setMarketBorrowCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract VToken[]", "name": "vTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "newSupplyCaps", "type": "uint256[]" } + ], + "name": "setMarketSupplyCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "limit", "type": "uint256" }], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newMinLiquidatableCollateral", "type": "uint256" }], + "name": "setMinLiquidatableCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract ResilientOracleInterface", "name": "newOracle", "type": "address" }], + "name": "setPriceOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "supplyCaps", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "supportMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "updatePrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-194/vip-194/abi/MOCK_TOKEN_ABI.json b/simulations/vip-194/vip-194/abi/MOCK_TOKEN_ABI.json new file mode 100644 index 000000000..1d69e8f66 --- /dev/null +++ b/simulations/vip-194/vip-194/abi/MOCK_TOKEN_ABI.json @@ -0,0 +1,155 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "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": 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": [ + { "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": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "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": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "allocateTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-194/vip-194/abi/VTOKEN_ABI.json b/simulations/vip-194/vip-194/abi/VTOKEN_ABI.json new file mode 100644 index 000000000..e1dd2dd92 --- /dev/null +++ b/simulations/vip-194/vip-194/abi/VTOKEN_ABI.json @@ -0,0 +1,830 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [{ "internalType": "uint256", "name": "actualAddAmount", "type": "uint256" }], + "name": "AddReservesFactorFreshCheck", + "type": "error" + }, + { "inputs": [], "name": "BorrowCashNotAvailable", "type": "error" }, + { "inputs": [], "name": "BorrowFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "ForceLiquidateBorrowUnauthorized", "type": "error" }, + { "inputs": [], "name": "HealBorrowUnauthorized", "type": "error" }, + { + "inputs": [{ "internalType": "uint256", "name": "errorCode", "type": "uint256" }], + "name": "LiquidateAccrueCollateralInterestFailed", + "type": "error" + }, + { "inputs": [], "name": "LiquidateCloseAmountIsUintMax", "type": "error" }, + { "inputs": [], "name": "LiquidateCloseAmountIsZero", "type": "error" }, + { "inputs": [], "name": "LiquidateCollateralFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "LiquidateFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "LiquidateLiquidatorIsBorrower", "type": "error" }, + { "inputs": [], "name": "LiquidateSeizeLiquidatorIsBorrower", "type": "error" }, + { "inputs": [], "name": "MintFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "ProtocolSeizeShareTooBig", "type": "error" }, + { "inputs": [], "name": "RedeemFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "RedeemTransferOutNotPossible", "type": "error" }, + { "inputs": [], "name": "ReduceReservesCashNotAvailable", "type": "error" }, + { "inputs": [], "name": "ReduceReservesCashValidation", "type": "error" }, + { "inputs": [], "name": "ReduceReservesFreshCheck", "type": "error" }, + { "inputs": [], "name": "RepayBorrowFreshnessCheck", "type": "error" }, + { "inputs": [], "name": "SetInterestRateModelFreshCheck", "type": "error" }, + { "inputs": [], "name": "SetReserveFactorBoundsCheck", "type": "error" }, + { "inputs": [], "name": "SetReserveFactorFreshCheck", "type": "error" }, + { "inputs": [], "name": "TransferNotAllowed", "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": 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": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtOld", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtNew", "type": "uint256" } + ], + "name": "BadDebtIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "badDebtOld", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtNew", "type": "uint256" } + ], + "name": "BadDebtRecovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "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": true, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "HealBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "liquidator", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBalance", "type": "uint256" } + ], + "name": "Mint", + "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": "contract ComptrollerInterface", "name": "oldComptroller", "type": "address" }, + { "indexed": true, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldProtocolSeizeShareMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newProtocolSeizeShareMantissa", "type": "uint256" } + ], + "name": "NewProtocolSeizeShare", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldProtocolShareReserve", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newProtocolShareReserve", "type": "address" } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReduceReservesBlockDelta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReduceReservesBlockDelta", "type": "uint256" } + ], + "name": "NewReduceReservesBlockDelta", + "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": true, "internalType": "address", "name": "oldShortfall", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newShortfall", "type": "address" } + ], + "name": "NewShortfallContract", + "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": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "ProtocolSeize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBalance", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": true, "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": true, "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": true, "internalType": "address", "name": "protocolShareReserve", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "SpreadReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "token", "type": "address" }], + "name": "SweepToken", + "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" + }, + { + "inputs": [], + "name": "NO_ERROR", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "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": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "addReserves", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "badDebt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "recoveredAmount_", "type": "uint256" }], + "name": "badDebtRecovered", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "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": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" }, + { "internalType": "bool", "name": "skipLiquidityCheck", "type": "bool" } + ], + "name": "forceLiquidateBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "error", "type": "uint256" }, + { "internalType": "uint256", "name": "vTokenBalance", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowBalance", "type": "uint256" }, + { "internalType": "uint256", "name": "exchangeRate", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "payer", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "healBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "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": "underlying_", "type": "address" }, + { "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", "name": "admin_", "type": "address" }, + { "internalType": "address", "name": "accessControlManager_", "type": "address" }, + { + "components": [ + { "internalType": "address", "name": "shortfall", "type": "address" }, + { "internalType": "address payable", "name": "protocolShareReserve", "type": "address" } + ], + "internalType": "struct VTokenInterface.RiskManagementInit", + "name": "riskManagement", + "type": "tuple" + }, + { "internalType": "uint256", "name": "reserveFactorMantissa_", "type": "uint256" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "minter", "type": "address" }, + { "internalType": "uint256", "name": "mintAmount", "type": "uint256" } + ], + "name": "mintBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "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": "protocolSeizeShareMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolShareReserve", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "reduceReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "setInterestRateModel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newProtocolSeizeShareMantissa_", "type": "uint256" }], + "name": "setProtocolSeizeShare", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address payable", "name": "protocolShareReserve_", "type": "address" }], + "name": "setProtocolShareReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_newReduceReservesBlockDelta", "type": "uint256" }], + "name": "setReduceReservesBlockDelta", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "setReserveFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "shortfall_", "type": "address" }], + "name": "setShortfallContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shortfall", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract IERC20Upgradeable", "name": "token", "type": "address" }], + "name": "sweepToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "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" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-194/vip-194/simulations.ts b/simulations/vip-194/vip-194/simulations.ts new file mode 100644 index 000000000..891c621af --- /dev/null +++ b/simulations/vip-194/vip-194/simulations.ts @@ -0,0 +1,179 @@ +import { mine, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { fetchVTokenStorageIL, performVTokenBasicActions, storageLayout } from "../../../src/vtokenUpgradesHelper"; +import { IL_MARKETS, vip194 } from "../../../vips/vip-194/vip-194"; +import BEACON_ABI from "./abi/BEACON_ABI.json"; +import COMPTROLLER_ABI from "./abi/COMPTROLLER.json"; +import MOCK_TOKEN_ABI from "./abi/MOCK_TOKEN_ABI.json"; +import VTOKEN_ABI from "./abi/VTOKEN_ABI.json"; + +const VTOKEN_BEACON = "0x2b8A1C539ABaC89CbF7E2Bc6987A0A38A5e660D4"; +const NEW_IMPL_VTOKEN = "0x1Db646E1Ab05571AF99e47e8F909801e5C99d37B"; +const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; + +let vToken: ethers.Contract; +let underlying: ethers.Contract; +let user: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; +const postVipStorage: storageLayout[] = []; +const preVipStorage: storageLayout[] = []; +const provider = ethers.provider; +const mintAmount = parseUnits("200", 18); +const borrowAmount = parseUnits("50", 18); +const repayAmount = parseUnits("50", 18); +const redeemAmount = parseUnits("50", 18); +forking(32940330, () => { + describe("Pre VIP simulations", async () => { + before(async () => { + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + await mine(IL_MARKETS.length * 2 + 2); // Number of Vip steps + }); + for (const market of IL_MARKETS) { + it(`Save pre VIP storage snapshot of ${market.name}`, async () => { + user = await initMainnetUser(market.holder, ethers.utils.parseEther("2")); + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock).setMarketBorrowCaps([market.address], [parseUnits("2", 38)]); + await comptroller.connect(impersonatedTimelock).setMarketSupplyCaps([market.address], [parseUnits("2", 38)]); + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(market.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); + + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + false, + ); + const state = await fetchVTokenStorageIL(vToken, user.address); + + delete state.protocolShareReserve; + delete state.totalReserves; + + preVipStorage.push(state); + }); + } + }); +}); + +forking(32940330, () => { + testVip("VIP-194 IL VToken Upgrade of AIA", vip194(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [VTOKEN_ABI, BEACON_ABI], ["Upgraded", "NewReduceReservesBlockDelta"], [1, 25]); + }, + }); +}); + +forking(32940330, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip194()); + }); + + for (const market of IL_MARKETS) { + it(`Save post VIP storage snapshot of ${market.name}`, async () => { + user = await initMainnetUser(market.holder, ethers.utils.parseEther("2")); + await setBalance(user.address, ethers.utils.parseEther("5")); + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + const comptroller = new ethers.Contract(await vToken.comptroller(), COMPTROLLER_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + await comptroller.connect(impersonatedTimelock).setMarketBorrowCaps([market.address], [parseUnits("2", 38)]); + await comptroller.connect(impersonatedTimelock).setMarketSupplyCaps([market.address], [parseUnits("2", 38)]); + await comptroller + .connect(impersonatedTimelock) + .setCollateralFactor(market.address, parseUnits("0.8", 18), parseUnits("0.9", 18)); + + await performVTokenBasicActions( + market.address, + user, + mintAmount, + borrowAmount, + repayAmount, + redeemAmount, + vToken, + underlying, + false, + ); + const state = await fetchVTokenStorageIL(vToken, user.address); + + delete state.protocolShareReserve; + delete state.totalReserves; + + expect(await vToken.protocolShareReserve()).equals(PROTOCOL_SHARE_RESERVE); + postVipStorage.push(state); + }); + } + + it("Should match pre and post storage", async () => { + for (let i = 0; i < preVipStorage.length; i++) { + expect(preVipStorage[i]).to.deep.equal(postVipStorage[i]); + } + }); + + it("Should change implementation", async () => { + const beacon = new ethers.Contract(VTOKEN_BEACON, BEACON_ABI, provider); + expect(await beacon.implementation()).equals(NEW_IMPL_VTOKEN); + }); + }); +}); + +// In very first operation after upgrade the reserves will be reduced (delta > lastReduceReservesBlockNumber(0)). +forking(32940330, () => { + describe("Post VIP simulations", async () => { + before(async () => { + await pretendExecutingVip(vip194()); + impersonatedTimelock = await initMainnetUser(NORMAL_TIMELOCK, ethers.utils.parseEther("3")); + }); + + for (const market of IL_MARKETS) { + it(`Reduce reserves in ${market.name}`, async () => { + vToken = new ethers.Contract(market.address, VTOKEN_ABI, provider); + underlying = new ethers.Contract(await vToken.underlying(), MOCK_TOKEN_ABI, provider); + + const cashPrior = await vToken.getCash(); + const reservesPrior = await vToken.totalReserves(); + const psrBalPrior = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + if (Number(cashPrior) > Number(reservesPrior) && reservesPrior != 0) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.be.emit( + vToken, + "SpreadReservesReduced", + ); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + + expect(psrBalAfter).greaterThanOrEqual(psrBalPrior.add(reservesPrior)); + expect(reservesAfter).equals(0); + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit( + vToken, + "SpreadReservesReduced", + ); + } else if (reservesPrior != 0) { + await expect(vToken.connect(impersonatedTimelock).accrueInterest()).to.not.be.emit( + vToken, + "SpreadReservesReduced", + ); + const reservesAfter = await vToken.totalReserves(); + const psrBalAfter = await underlying.balanceOf(PROTOCOL_SHARE_RESERVE); + expect(psrBalAfter).equals(psrBalPrior); + expect(reservesAfter).greaterThan(reservesPrior); + } + }); + } + }); +}); diff --git a/vips/vip-194/vip-194.ts b/vips/vip-194/vip-194.ts new file mode 100644 index 000000000..c4234dd35 --- /dev/null +++ b/vips/vip-194/vip-194.ts @@ -0,0 +1,214 @@ +import { ethers } from "hardhat"; + +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const VTOKEN_BEACON = "0x2b8A1C539ABaC89CbF7E2Bc6987A0A38A5e660D4"; +const NEW_IMPL_VTOKEN = "0x1Db646E1Ab05571AF99e47e8F909801e5C99d37B"; +const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; +const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; +const ACCESS_CONTROL_MANAGER = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const PROTOCOL_SHARE_RESERVE = "0xCa01D5A9A248a830E9D93231e791B1afFed7c446"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; + +interface AssetConfig { + name: string; + address: string; + reduceReservesBlockDelta: number; + holder: string; // Used by the simulation +} + +export const IL_MARKETS: AssetConfig[] = [ + { + name: "vHAY_Stablecoins", + address: "0xCa2D81AA7C09A1a025De797600A7081146dceEd9", + reduceReservesBlockDelta: 28800, + holder: "0x192D4e2E19A01e49b30Fb3894A01B6e08947d9CA", + }, + { + name: "vUSDD_Stablecoins", + address: "0xc3a45ad8812189cAb659aD99E64B1376f6aCD035", + reduceReservesBlockDelta: 28800, + holder: "0xCa266910d92a313E5F9eb1AfFC462bcbb7d9c4A9", + }, + { + name: "vUSDT_Stablecoins", + address: "0x5e3072305F9caE1c7A82F6Fe9E38811c74922c3B", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vagEUR_Stablecoins", + address: "0x795DE779Be00Ea46eA97a28BDD38d9ED570BCF0F", + reduceReservesBlockDelta: 28800, + holder: "0x7B1db35fbd95548777B9079527e8fa2a70fb2CE0", + }, + { + name: "vBSW_DeFi", + address: "0x8f657dFD3a1354DEB4545765fE6840cc54AFd379", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vALPACA_DeFi", + address: "0x02c5Fb0F26761093D297165e902e96D08576D344", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDT_DeFi", + address: "0x1D8bBDE12B6b34140604E18e9f9c6e14deC16854", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDD_DeFi", + address: "0xA615467caE6B9E0bb98BC04B4411d9296fd1dFa0", + reduceReservesBlockDelta: 28800, + holder: "0xCa266910d92a313E5F9eb1AfFC462bcbb7d9c4A9", + }, + { + name: "vANKR_DeFi", + address: "0x19CE11C8817a1828D1d357DFBF62dCf5b0B2A362", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vankrBNB_DeFi", + address: "0x53728FD51060a85ac41974C6C3Eb1DaE42776723", + reduceReservesBlockDelta: 28800, + holder: "0x25b21472c073095bebC681001Cbf165f849eEe5E", + }, + { + name: "vTWT_DeFi", + address: "0x736bf1D21A28b5DC19A1aC8cA71Fc2856C23c03F", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vRACA_GameFi", + address: "0xE5FE5527A5b76C75eedE77FdFA6B80D52444A465", + reduceReservesBlockDelta: 28800, + holder: "0xC882b111A75C0c657fC507C04FbFcD2cC984F071", + }, + { + name: "vFLOKI_GameFi", + address: "0xc353B7a1E13dDba393B5E120D4169Da7185aA2cb", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDD_GameFi", + address: "0x9f2FD23bd0A5E08C5f2b9DD6CF9C96Bfb5fA515C", + reduceReservesBlockDelta: 28800, + holder: "0xCa266910d92a313E5F9eb1AfFC462bcbb7d9c4A9", + }, + { + name: "vUSDT_GameFi", + address: "0x4978591f17670A846137d9d613e333C38dc68A37", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vankrBNB_LiquidStakedBNB", + address: "0xBfe25459BA784e70E2D7a718Be99a1f3521cA17f", + reduceReservesBlockDelta: 28800, + holder: "0x25b21472c073095bebC681001Cbf165f849eEe5E", + }, + { + name: "vBNBx_LiquidStakedBNB", + address: "0x5E21bF67a6af41c74C1773E4b473ca5ce8fd3791", + reduceReservesBlockDelta: 28800, + holder: "0xFF4606bd3884554CDbDabd9B6e25E2faD4f6fc54", + }, + { + name: "vstkBNB_LiquidStakedBNB", + address: "0xcc5D9e502574cda17215E70bC0B4546663785227", + reduceReservesBlockDelta: 28800, + holder: "0x98CB81d921B8F5020983A46e96595471Ad4E60Be", + }, + { + name: "vSnBNB_LiquidStakedBNB", + address: "0xd3CC9d8f3689B83c91b7B59cAB4946B063EB894A", + reduceReservesBlockDelta: 28800, + holder: "0x6F28FeC449dbd2056b76ac666350Af8773E03873", + }, + { + name: "vWBNB_LiquidStakedBNB", + address: "0xe10E80B7FD3a29fE46E16C30CC8F4dd938B742e2", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vBTT_Tron", + address: "0x49c26e12959345472E2Fd95E5f79F8381058d3Ee", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vTRX_Tron", + address: "0x836beb2cB723C498136e1119248436A645845F4E", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vWIN_Tron", + address: "0xb114cfA615c828D88021a41bFc524B800E64a9D5", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, + { + name: "vUSDD_Tron", + address: "0xf1da185CCe5BeD1BeBbb3007Ef738Ea4224025F7", + reduceReservesBlockDelta: 28800, + holder: "0xCa266910d92a313E5F9eb1AfFC462bcbb7d9c4A9", + }, + { + name: "vUSDT_Tron", + address: "0x281E5378f99A4bc55b295ABc0A3E7eD32Deba059", + reduceReservesBlockDelta: 28800, + holder: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + }, +]; + +export const vip194 = () => { + const meta = { + version: "v2", + title: "VIP-194 VToken Upgrade of AIA in IL", + description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, + forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", + againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + }; + + return makeProposal( + [ + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ethers.constants.AddressZero, "setReduceReservesBlockDelta(uint256)", NORMAL_TIMELOCK], + }, + { + target: VTOKEN_BEACON, + signature: "upgradeTo(address)", + params: [NEW_IMPL_VTOKEN], + }, + ...IL_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setReduceReservesBlockDelta(uint256)", + params: [asset.reduceReservesBlockDelta], + }; + }), + ...IL_MARKETS.map(asset => { + return { + target: asset.address, + signature: "setProtocolShareReserve(address)", + params: [PROTOCOL_SHARE_RESERVE], + }; + }), + ], + meta, + ProposalType.REGULAR, + ); +}; From eda220dc793a6dc603653dc79bf546a2c9059ca1 Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Fri, 27 Oct 2023 16:03:29 +0200 Subject: [PATCH 32/32] feat: add description for VIPs to enable Automatic income allocation --- vips/vip-192/vip-192.ts | 58 +++++++++++++++++++++++++++++++++++++---- vips/vip-193/vip-193.ts | 53 +++++++++++++++++++++++++++++++++---- vips/vip-194/vip-194.ts | 51 ++++++++++++++++++++++++++++++++---- 3 files changed, 147 insertions(+), 15 deletions(-) diff --git a/vips/vip-192/vip-192.ts b/vips/vip-192/vip-192.ts index 1451be610..ffca61573 100644 --- a/vips/vip-192/vip-192.ts +++ b/vips/vip-192/vip-192.ts @@ -36,11 +36,59 @@ export const CORE_MARKETS: AssetConfig[] = [ export const vip192 = () => { const meta = { version: "v2", - title: "VIP-192 VToken Upgrade of AIA Part - 1", - description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, - forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", - againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + title: "VIP-192 Automatic income allocation: deployment stage 2 - vTRXOLD and vTUSDOLD", + description: `#### Summary + +If passed, this VIP will upgrade the implementation of the [vTRXOLD](https://bscscan.com/address/0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93) and [vTUSDOLD](https://bscscan.com/address/0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3) markets in the Core pool, enabling the [Automatic Income Allocation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation) in those markets. Moreover, it will allow Fast track and Critical VIP’s to be proposed in the future to adjust several risk parameters. + +#### 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. It’s part of the deployment plan started with the [VIP-189](https://app.venus.io/#/governance/proposal/189). + +- The new implementation pushes market reserves of the two affected markets automatically to the [ProtocolShareReserve](https://bscscan.com/address/0xCa01D5A9A248a830E9D93231e791B1afFed7c446) contract after 28,800 blocks (24 hours on BNB chain). These reserves are distributed 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. +- From now on, Fast-track and Critical VIP’s will be able to perform the following actions on the vTRXOLD and vTUSDOLD markets: + - Update reserve factor + - Update the interest rate model + - Update collateral factor + - Update borrow and supply caps + - Pause/resume the full protocol or a specific action in one market + +There will be two more VIP’s for this second stage of the Automatic Income Allocation deployment, proposed in the following days. In those VIP’s, the remaining markets of the Core pool and the markets of the Isolated pools will be upgraded to enable the Automatic Income Allocation. + +**Security and additional considerations** + +We applied the following security procedures for this upgrade: + +- **Markets behavior post upgrade**: in a simulation environment, validating in the upgraded contracts the main operations (supply, borrow, repay and redeem) and the storage layout after the VIP +- **Automatic reduction of the reserves**: in a simulation environment, validating the TUSDOLD and TRXOLD reserves are sent as expected to the ProtocolShareReserve +- **Deployment on testnet**: the same VIP was proposed and executed on testnet, and the upgraded contracts are 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** + +- Mainnet: ****[new vTRXOLD and vTUSDOLD implementations](https://bscscan.com/address/0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775) +- Testnet: ****[new vTRXOLD and vTUSDOLD implementations](https://testnet.bscscan.com/address/0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850) + +**References** + +- [Pull request with the new VToken contracts](https://github.com/VenusProtocol/venus-protocol/pull/262) +- [Simulation post upgrade](https://github.com/VenusProtocol/vips/pull/67) +- [Testnet deployment](https://testnet.bscscan.com/tx/0x710421181c38b08072dff6ff49806f4bd0492bf920adfb64785b83f72e86c57c) +- [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation)`, + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with this proposal or not", }; return makeProposal( diff --git a/vips/vip-193/vip-193.ts b/vips/vip-193/vip-193.ts index 50345c802..2ccd99889 100644 --- a/vips/vip-193/vip-193.ts +++ b/vips/vip-193/vip-193.ts @@ -159,11 +159,54 @@ export const CORE_MARKETS: AssetConfig[] = [ export const vip193 = () => { const meta = { version: "v2", - title: "VIP-193 VToken Upgrade of AIA Part - 2", - description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, - forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", - againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + title: "VIP-193 Automatic income allocation: deployment stage 2 - Core pool", + description: `#### Summary + +If passed, this VIP will upgrade the implementation of every market in the Core pool - except vTRXOLD and vTUSDOLD (already upgraded at [VIP-192](https://app.venus.io/#/governance/proposal/192)), vBNB (non upgradable), vLUNA and vUST (deprecated) - enabling the [Automatic Income Allocation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation) in those markets. + +#### 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. It’s part of the deployment plan started with the [VIP-189](https://app.venus.io/#/governance/proposal/189) and continued with [VIP-191](https://app.venus.io/#/governance/proposal/191). + +The new implementation pushes market reserves of the affected markets automatically to the [ProtocolShareReserve](https://bscscan.com/address/0xCa01D5A9A248a830E9D93231e791B1afFed7c446) contract after 28,800 blocks (24 hours on BNB chain). These reserves are distributed 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. + +There will be one more VIP for this second stage of the Automatic Income Allocation deployment, proposed in the following days. In that VIP, the markets of the Isolated pools will be upgraded to enable the Automatic Income Allocation. + +**Security and additional considerations** + +We applied the following security procedures for this upgrade: + +- **Markets behavior post upgrade**: in a simulation environment, validating in the upgraded contracts the main operations (supply, borrow, repay and redeem) and the storage layout after the VIP +- **Automatic reduction of the reserves**: in a simulation environment, validating the market reserves are sent as expected to the ProtocolShareReserve +- **Deployment on testnet**: the same VIP was proposed and executed on testnet, and the upgraded contracts are 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** + +- Mainnet: ****[new VToken implementations](https://bscscan.com/address/0xc3279442a5aCaCF0A2EcB015d1cDDBb3E0f3F775) +- Testnet: ****[new VToken implementations](https://testnet.bscscan.com/address/0x8d79C8f4400fE68Fd17040539FE5e1706c1f2850) + +**References** + +- [Pull request with the new VToken contracts](https://github.com/VenusProtocol/venus-protocol/pull/262) +- [Simulation post upgrade](https://github.com/VenusProtocol/vips/pull/67) +- [Testnet deployment](https://testnet.bscscan.com/tx/0x01fd5a980e9b2c3d627aaba81c5f08d9c8539355201f48597cdb9cf796cef4e1) +- [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation)`, + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with this proposal or not", }; return makeProposal( diff --git a/vips/vip-194/vip-194.ts b/vips/vip-194/vip-194.ts index c4234dd35..bcfb7f926 100644 --- a/vips/vip-194/vip-194.ts +++ b/vips/vip-194/vip-194.ts @@ -174,11 +174,52 @@ export const IL_MARKETS: AssetConfig[] = [ export const vip194 = () => { const meta = { version: "v2", - title: "VIP-194 VToken Upgrade of AIA in IL", - description: `upgrade the implementation of the Vtoken core supportimg Automatic income allocation feature.`, - forDescription: "I agree that Venus Protocol should proceed with VToken Upgrade of AIA", - againstDescription: "I do not think that Venus Protocol should proceed with VToken Upgrade of AIA", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with VToken Upgrade of AIA or not", + title: "VIP-194 Automatic income allocation: deployment stage 2 - Isolated pools", + description: `#### Summary + +If passed, this VIP will upgrade the implementation of every market in the Isolated pools, enabling the [Automatic Income Allocation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation) in those markets. + +#### 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. It’s part of the deployment plan started with the [VIP-189](https://app.venus.io/#/governance/proposal/189) and continued with [VIP-191](https://app.venus.io/#/governance/proposal/191) and [VIP-192](https://app.venus.io/#/governance/proposal/192). + +The new implementation pushes market reserves of the affected markets automatically to the [ProtocolShareReserve](https://bscscan.com/address/0xCa01D5A9A248a830E9D93231e791B1afFed7c446) contract after 28,800 blocks (24 hours on BNB chain). These reserves are distributed 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. + +**Security and additional considerations** + +We applied the following security procedures for this upgrade: + +- **Markets behavior post upgrade**: in a simulation environment, validating in the upgraded contracts the main operations (supply, borrow, repay and redeem) and the storage layout after the VIP +- **Automatic reduction of the reserves**: in a simulation environment, validating the market reserves are sent as expected to the ProtocolShareReserve +- **Deployment on testnet**: the same VIP was proposed and executed on testnet, and the upgraded contracts are 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** + +- Mainnet: ****[new VToken implementations](https://bscscan.com/address/0x1Db646E1Ab05571AF99e47e8F909801e5C99d37B) +- Testnet: ****[new VToken implementations](https://testnet.bscscan.com/address/0xca408d716011169645aa94ddc5665043c33df814) + +**References** + +- [Pull request with the new VToken contracts](https://github.com/VenusProtocol/venus-protocol/pull/262) +- [Simulation post upgrade](https://github.com/VenusProtocol/vips/pull/67) +- [Testnet deployment](https://testnet.bscscan.com/tx/0x698909ff4cdec8927a49b77f860007aacf0130887ba447fc8faddf9b04942078) +- [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/automatic-income-allocation)`, + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with this proposal or not", }; return makeProposal(