From ff161d2c61fd7a749067ad23b33e47d410c2a3dd Mon Sep 17 00:00:00 2001 From: defcon022 Date: Thu, 20 Apr 2023 19:00:28 +0530 Subject: [PATCH 01/24] Added vip for comptroller diamond proxy --- .../abi/Comptroller.json | 2782 +++++++++++++++++ .../abi/IERC20UpgradableAbi.json | 295 ++ .../abi/VBep20DelegateAbi.json | 1539 +++++++++ .../abi/priceOracleAbi.json | 154 + .../simulations.ts | 470 +++ .../utils/cut-params-testnet.json | 115 + src/utils.ts | 10 +- src/vip-framework/index.ts | 8 +- vips/vip-Diamond-comptroller-testnet.ts | 50 + 9 files changed, 5409 insertions(+), 14 deletions(-) create mode 100644 simulations/vip-diamond-comptroller-testnet/abi/Comptroller.json create mode 100644 simulations/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json create mode 100644 simulations/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json create mode 100644 simulations/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json create mode 100644 simulations/vip-diamond-comptroller-testnet/simulations.ts create mode 100644 simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json create mode 100644 vips/vip-Diamond-comptroller-testnet.ts diff --git a/simulations/vip-diamond-comptroller-testnet/abi/Comptroller.json b/simulations/vip-diamond-comptroller-testnet/abi/Comptroller.json new file mode 100644 index 000000000..fb2b4582e --- /dev/null +++ b/simulations/vip-diamond-comptroller-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-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json b/simulations/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json new file mode 100644 index 000000000..374b04c75 --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json @@ -0,0 +1,295 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, + { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, + { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } + ], + "name": "MetaTransactionExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERC712_VERSION", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PREDICATE_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "userAddress", "type": "address" }, + { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, + { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, + { "internalType": "uint8", "name": "sigV", "type": "uint8" } + ], + "name": "executeMetaTransaction", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getChainId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeperator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getNonce", + "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "getRoleMember", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleMemberCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json b/simulations/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json new file mode 100644 index 000000000..0f6421ac5 --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json @@ -0,0 +1,1539 @@ +[ + { + "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" + } + ], + "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" + } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "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": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "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": "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": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "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": 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-diamond-comptroller-testnet/abi/priceOracleAbi.json b/simulations/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json new file mode 100644 index 000000000..2eb50681a --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json @@ -0,0 +1,154 @@ +[ + { + "inputs": [{ "internalType": "uint256", "name": "maxStalePeriod_", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "feed", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "symbol", "type": "string" } + ], + "name": "FeedSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMaxStalePeriod", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMaxStalePeriod", "type": "uint256" } + ], + "name": "MaxStalePeriodUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "previousPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "requestedPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newPriceMantissa", "type": "uint256" } + ], + "name": "PricePosted", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], + "name": "assetPrices", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "string", "name": "symbol", "type": "string" }], + "name": "getFeed", + "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "getUnderlyingPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isPriceOracle", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxStalePeriod", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newAdmin", "type": "address" }], + "name": "setAdmin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setDirectPrice", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "address", "name": "feed", "type": "address" } + ], + "name": "setFeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newMaxStalePeriod", "type": "uint256" }], + "name": "setMaxStalePeriod", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "internalType": "uint256", "name": "underlyingPriceMantissa", "type": "uint256" } + ], + "name": "setUnderlyingPrice", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts new file mode 100644 index 000000000..b22bbc0e8 --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -0,0 +1,470 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { forking, pretendExecutingVip, testVip } from "../../src/vip-framework"; +import { vipDiamondTestnet } from "../../vips/vip-Diamond-comptroller-testnet"; +import Comptroller from "./abi/Comptroller.json"; +import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; +import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; + +const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const DIAMOND = "0xF6A9DBc8453EB8b1528B6Cd3f08eC632134f831F"; + +const Owner = "0xce10739590001705F7FF231611ba4A48B2820327"; +const zeroAddr = "0x0000000000000000000000000000000000000000"; +const VBUSD = "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4"; +const VUSDT = "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A"; + +const initMainnetUser = async (user: string) => { + await impersonateAccount(user); + return ethers.getSigner(user); +}; + +forking(29101377, async () => { + let owner: any, + unitroller: Contract, + // layout variables + oracle: any, + maxAssets: any, + closeFactorMantissa: any, + liquidationIncentiveMantissa: any, + allMarkets: any, + venusRate: any, + venusSpeeds: any, + venusSupplyState: any, + venusBorrowState: any, + venusAccrued: any, + vaiMintRate: any, + vaiController: any, + mintedVAIs: any, + mintVAIGuardianPaused: any, + repayVAIGuardianPaused: any, + protocolPaused: any, + venusVAIVaultRate: any, + vaiVaultAddress: any, + releaseStartBlock: any, + minReleaseAmount: any, + treasuryGuardian: any, + treasuryAddress: any, + treasuryPercent: any, + liquidatorContract: any, + comptrollerLens: any, + market: any, + venusSupplierIndex: any, + venusBorrowerIndex: any, + venusBorrowSpeeds: any, + venusSupplySpeeds: any; + + let USDT: ethers.contract; + let BUSD: ethers.contract; + let usdtHolder: ethers.Signer; + let busdHolder: ethers.Signer; + let vBUSD: ethers.contract; + let vUSDT: ethers.contract; + let diamondUnitroller: Contract; + + before(async () => { + console.log("1+++++"); + unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); + console.log("2+++++"); + + diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); + console.log("3+++"); + + await impersonateAccount(Owner); + owner = await ethers.getSigner(Owner); + const [signer] = await ethers.getSigners(); + await signer.sendTransaction({ + to: owner.address, + value: ethers.BigNumber.from("10000000000000000000"), + data: undefined, + }); + + busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); + + usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); + + [vBUSD, vUSDT] = await Promise.all( + [VBUSD, VUSDT].map((address: string) => { + return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); + }), + ); + + [BUSD, USDT] = await Promise.all( + [vBUSD, vUSDT].map(async (vToken: any) => { + const underlying = await vToken.underlying(); + return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); + }), + ); + }); + + describe("Verify Storage slots before vip execution", async () => { + // These tests checks the storage collision of comptroller while updating it via diamond. + describe("Diamond deployed successfully before vip execution", async () => { + it("Owner of Diamond unitroller contract should match", async () => { + const UnitrollerAdmin = await unitroller.admin(); + const pendingAdmin = await unitroller.pendingAdmin(); + expect(UnitrollerAdmin.toLowerCase()).to.equal(Owner.toLowerCase()); + expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); + }); + + it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + const comptrollerImplementation = await unitroller.comptrollerImplementation(); + console.log("implementation address", comptrollerImplementation); + const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); + expect(comptrollerImplementation.toLowerCase()).to.equal( + "0xc934A1b15b30E9b515D8A87b5054432B9b965131".toLowerCase(), + ); + expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); + }); + }); + + describe("Verify storage layout before vip execution", async () => { + it("verify all the state before and after upgrade", async () => { + oracle = await unitroller.oracle(); + + maxAssets = await unitroller.maxAssets(); + + closeFactorMantissa = await unitroller.closeFactorMantissa(); + + liquidationIncentiveMantissa = await unitroller.liquidationIncentiveMantissa(); + + allMarkets = await unitroller.allMarkets(0); + + venusRate = await unitroller.venusRate(); + + venusSpeeds = await unitroller.venusSpeeds(BUSD.address); + + venusSupplyState = await unitroller.venusSupplyState(BUSD.address); + + venusBorrowState = await unitroller.venusBorrowState(BUSD.address); + + venusAccrued = await unitroller.venusAccrued(BUSD.address); + + vaiMintRate = await unitroller.vaiMintRate(); + + vaiController = await unitroller.vaiController(); + + mintedVAIs = await unitroller.mintedVAIs(busdHolder.address); + unitroller.minte; + + mintVAIGuardianPaused = await unitroller.mintVAIGuardianPaused(); + + repayVAIGuardianPaused = await unitroller.repayVAIGuardianPaused(); + + protocolPaused = await unitroller.protocolPaused(); + + venusVAIVaultRate = await unitroller.venusVAIVaultRate(); + + vaiVaultAddress = await unitroller.vaiVaultAddress(); + + releaseStartBlock = await unitroller.releaseStartBlock(); + + minReleaseAmount = await unitroller.minReleaseAmount(); + + treasuryGuardian = await unitroller.treasuryGuardian(); + + treasuryAddress = await unitroller.treasuryAddress(); + + treasuryPercent = await unitroller.treasuryPercent(); + + liquidatorContract = await unitroller.liquidatorContract(); + + comptrollerLens = await unitroller.comptrollerLens(); + + // cheking all public mappings + market = await unitroller.markets(vBUSD.address); + + venusBorrowerIndex = await unitroller.venusBorrowerIndex(vBUSD.address, busdHolder.address); + + venusSupplierIndex = await unitroller.venusSupplierIndex(vBUSD.address, busdHolder.address); + + venusBorrowSpeeds = await unitroller.venusBorrowSpeeds(vUSDT.address); + venusSupplySpeeds = await unitroller.venusSupplySpeeds(vUSDT.address); + }); + }); + }); + + testVip("VIP-Diamond TRON Contract Migration", vipDiamondTestnet()); + + describe("Verify Storage slots after VIP execution", async () => { + // These tests checks the storage collision of comptroller while updating it via diamond. + describe("Diamond deployed successfully after VIP execution", async () => { + it("Owner of Diamond unitroller contract should match", async () => { + const diamondUnitrollerAdmin = await diamondUnitroller.admin(); + const pendingAdmin = await diamondUnitroller.pendingAdmin(); + expect(diamondUnitrollerAdmin.toLowerCase()).to.equal(Owner.toLowerCase()); + expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); + }); + + it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); + const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); + expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); + expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); + }); + }); + + describe("Verify storage layout after VIP execution", async () => { + it("verify all the state before and after upgrade", async () => { + const oracelUpgrade = await diamondUnitroller.oracle(); + expect(oracle).to.equal(oracelUpgrade); + + const maxAssetsAfterUpgrade = await diamondUnitroller.maxAssets(); + expect(maxAssets).to.equal(maxAssetsAfterUpgrade); + + const closeFactorMantissaAfterUpgrade = await diamondUnitroller.closeFactorMantissa(); + expect(closeFactorMantissa).to.equal(closeFactorMantissaAfterUpgrade); + + const liquidationIncentiveMantissaAfterUpgrade = await diamondUnitroller.liquidationIncentiveMantissa(); + expect(liquidationIncentiveMantissa).to.equal(liquidationIncentiveMantissaAfterUpgrade); + + const allMarketsAfterUpgrade = await diamondUnitroller.allMarkets(0); + expect(allMarkets).to.equal(allMarketsAfterUpgrade); + + const venusRateAfterUpgrade = await diamondUnitroller.venusRate(); + expect(venusRate).to.equal(venusRateAfterUpgrade); + + const venusSpeedsAfterUpgrade = await diamondUnitroller.venusSpeeds(BUSD.address); + expect(venusSpeeds).to.equal(venusSpeedsAfterUpgrade); + + const venusSupplyStateAfterUpgrade = await diamondUnitroller.venusSupplyState(BUSD.address); + expect(venusSupplyState.index.toString()).to.equal(venusSupplyStateAfterUpgrade.index.toString()); + + const venusBorrowStateAfterUpgrade = await diamondUnitroller.venusBorrowState(BUSD.address); + expect(venusBorrowState.index.toString()).to.equal(venusBorrowStateAfterUpgrade.index.toString()); + + const venusAccruedAfterUpgrade = await diamondUnitroller.venusAccrued(BUSD.address); + expect(venusAccrued).to.equal(venusAccruedAfterUpgrade); + + const vaiMintRateAfterUpgrade = await diamondUnitroller.vaiMintRate(); + expect(vaiMintRate).to.equal(vaiMintRateAfterUpgrade); + + const vaiControllerUpgrade = await diamondUnitroller.vaiController(); + expect(vaiControllerUpgrade).to.equal(vaiController); + + const mintedVAIsUpgrade = await diamondUnitroller.mintedVAIs(busdHolder.address); + expect(mintedVAIsUpgrade).to.equal(mintedVAIs); + + const mintVAIGuardianPausedUpgrade = await diamondUnitroller.mintVAIGuardianPaused(); + expect(mintVAIGuardianPausedUpgrade).to.equal(mintVAIGuardianPaused); + + const repayVAIGuardianPausedUpgrade = await diamondUnitroller.repayVAIGuardianPaused(); + expect(repayVAIGuardianPausedUpgrade).to.equal(repayVAIGuardianPaused); + + const protocolPausedUpgrade = await diamondUnitroller.protocolPaused(); + expect(protocolPausedUpgrade).to.equal(protocolPaused); + + const venusVAIVaultRateUpgrade = await diamondUnitroller.venusVAIVaultRate(); + expect(venusVAIVaultRateUpgrade).to.equal(venusVAIVaultRate); + + const vaiVaultAddressUpgrade = await diamondUnitroller.vaiVaultAddress(); + expect(vaiVaultAddressUpgrade).to.equal(vaiVaultAddress); + + const releaseStartBlockUpgrade = await diamondUnitroller.releaseStartBlock(); + expect(releaseStartBlockUpgrade).to.equal(releaseStartBlock); + + const minReleaseAmountUpgrade = await diamondUnitroller.minReleaseAmount(); + expect(minReleaseAmountUpgrade).to.equal(minReleaseAmount); + + const treasuryGuardianUpgrade = await diamondUnitroller.treasuryGuardian(); + expect(treasuryGuardian).to.equal(treasuryGuardianUpgrade); + + const treasuryAddressUpgrade = await diamondUnitroller.treasuryAddress(); + expect(treasuryAddress).to.equal(treasuryAddressUpgrade); + + const treasuryPercentUpgrade = await diamondUnitroller.treasuryPercent(); + expect(treasuryPercent).to.equal(treasuryPercentUpgrade); + + const liquidatorContractUpgrade = await diamondUnitroller.liquidatorContract(); + expect(liquidatorContract).to.equal(liquidatorContractUpgrade); + + const comptrollerLensUpgrade = await diamondUnitroller.comptrollerLens(); + expect(comptrollerLens).to.equal(comptrollerLensUpgrade); + + // cheking all public mappings + const marketUpgrade = await diamondUnitroller.markets(vBUSD.address); + expect(market.collateralFactorMantissa).to.equal(marketUpgrade.collateralFactorMantissa); + expect(market.isListed).to.equal(marketUpgrade.isListed); + expect(market.isVenus).to.equal(marketUpgrade.isVenus); + + const venusBorrowerIndexUpgrade = await diamondUnitroller.venusBorrowerIndex(vBUSD.address, busdHolder.address); + expect(venusBorrowerIndex).to.equal(venusBorrowerIndexUpgrade); + + const venusSupplierIndexUpgrade = await diamondUnitroller.venusSupplierIndex(vBUSD.address, busdHolder.address); + expect(venusSupplierIndex).to.equal(venusSupplierIndexUpgrade); + + const venusBorrowSpeedsUpgrade = await diamondUnitroller.venusBorrowSpeeds(vUSDT.address); + const venusSupplySpeedsUpgrade = await diamondUnitroller.venusSupplySpeeds(vUSDT.address); + + expect(venusBorrowSpeeds).to.equal(venusBorrowSpeedsUpgrade); + expect(venusSupplySpeeds).to.equal(venusSupplySpeedsUpgrade); + }); + }); + }); + + describe("Verify states of diamond Contract", () => { + describe("Diamond setters", () => { + it("setting market supply cap", async () => { + const currentSupplyCap = (await diamondUnitroller.supplyCaps(vBUSD.address)).toString(); + await diamondUnitroller.connect(owner)._setMarketSupplyCaps([vBUSD.address], [parseUnits("100000", 18)]); + expect(await diamondUnitroller.supplyCaps(vBUSD.address)).to.equals(parseUnits("100000", 18)); + await diamondUnitroller.connect(owner)._setMarketSupplyCaps([vBUSD.address], [parseUnits(currentSupplyCap, 0)]); + expect(await diamondUnitroller.supplyCaps(vBUSD.address)).to.equals(parseUnits(currentSupplyCap, 0)); + }); + + it("setting close factor", async () => { + const currentCloseFactor = (await diamondUnitroller.closeFactorMantissa()).toString(); + await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits("10000", 18)); + expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits("10000", 18)); + await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits(currentCloseFactor, 0)); + expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits(currentCloseFactor, 0)); + }); + + it("setting setting Liquidation Incentive", async () => { + await diamondUnitroller.connect(owner)._setLiquidationIncentive(parseUnits("13", 17)); + expect(await diamondUnitroller.liquidationIncentiveMantissa()).to.equal(parseUnits("13", 17)); + + await diamondUnitroller.connect(owner)._setLiquidationIncentive(parseUnits("11", 17)); + expect(await diamondUnitroller.liquidationIncentiveMantissa()).to.equal(parseUnits("11", 17)); + }); + + it("setting Pause Guardian", async () => { + const currentPauseGuardia = (await diamondUnitroller.pauseGuardian()).toString(); + + await diamondUnitroller.connect(owner)._setPauseGuardian(owner.address); + expect(await diamondUnitroller.pauseGuardian()).to.equal(owner.address); + + await diamondUnitroller.connect(owner)._setPauseGuardian(currentPauseGuardia); + expect(await diamondUnitroller.pauseGuardian()).to.equal(currentPauseGuardia); + }); + + it("setting market borrow cap", async () => { + const currentBorrowCap = (await diamondUnitroller.borrowCaps(vUSDT.address)).toString(); + await diamondUnitroller.connect(owner)._setMarketBorrowCaps([vUSDT.address], [parseUnits("10000", 18)]); + expect(await diamondUnitroller.borrowCaps(vUSDT.address)).to.equal(parseUnits("10000", 18)); + + await diamondUnitroller.connect(owner)._setMarketBorrowCaps([vUSDT.address], [currentBorrowCap]); + expect(await diamondUnitroller.borrowCaps(vUSDT.address)).to.equal(currentBorrowCap); + }); + + it("pausing mint action in vUSDT", async () => { + expect(await diamondUnitroller.connect(owner)._setActionsPaused([vBUSD.address], [0], true)).to.emit( + vBUSD, + "ActionPausedMarket", + ); + await BUSD.connect(busdHolder).approve(vBUSD.address, 1200); + await expect(vBUSD.connect(usdtHolder).mint(1000)).to.be.revertedWith("action is paused"); + + expect(await diamondUnitroller.connect(owner)._setActionsPaused([vBUSD.address], [0], false)).to.emit( + vBUSD, + "ActionPausedMarket", + ); + expect(await vBUSD.connect(busdHolder).mint(10)).to.be.emit(vBUSD, "Mint"); + }); + }); + }); +}); + +forking(29101377, async () => { + let owner, unitroller; + let USDT: ethers.contract; + let BUSD: ethers.contract; + let usdtHolder: ethers.Signer; + let busdHolder: ethers.Signer; + let vBUSD: ethers.contract; + let vUSDT: ethers.contract; + let diamondUnitroller: Contract; + + before(async () => { + await pretendExecutingVip(vipDiamondTestnet()); + unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); + + diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); + + await impersonateAccount(Owner); + owner = await ethers.getSigner(Owner); + const [signer] = await ethers.getSigners(); + await signer.sendTransaction({ + to: owner.address, + value: ethers.BigNumber.from("10000000000000000000"), + data: undefined, + }); + + busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); + + usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); + + [vBUSD, vUSDT] = await Promise.all( + [VBUSD, VUSDT].map((address: string) => { + return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); + }), + ); + [BUSD, USDT] = await Promise.all( + [vBUSD, vUSDT].map(async (vToken: any) => { + const underlying = await vToken.underlying(); + return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); + }), + ); + console.log("last"); + }); + + describe("Diamond Hooks", () => { + it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); + const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); + expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); + expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); + }); + it("mint vToken vBUSD", async () => { + const vBUSDBalance = await BUSD.balanceOf(vBUSD.address); + const busdHolerBalance = await BUSD.balanceOf(busdHolder.address); + + await BUSD.connect(busdHolder).approve(vBUSD.address, parseUnits("1100", 18)); + expect(await vBUSD.connect(busdHolder).mint(parseUnits("1000", 18))).to.emit(vBUSD, "Mint"); + + const newvBUSDBalance = await BUSD.balanceOf(vBUSD.address); + const newBusdHolerBalance = await BUSD.balanceOf(busdHolder.address); + + expect(newvBUSDBalance).greaterThan(vBUSDBalance); + expect(newBusdHolerBalance).lessThan(busdHolerBalance); + }); + + it("redeem vToken", async () => { + const vBUSDUserBal = await vBUSD.connect(busdHolder).balanceOf(busdHolder.address); + const BUSDBal = await BUSD.connect(busdHolder).balanceOf(busdHolder.address); + + expect(await vBUSD.connect(busdHolder).redeem(1000)).to.emit(vBUSD, "Redeem"); + + const newBUSDBal = await BUSD.connect(busdHolder).balanceOf(busdHolder.address); + const newBUSDUserBal = await vBUSD.connect(busdHolder).balanceOf(busdHolder.address); + + expect(newBUSDUserBal).to.equal(vBUSDUserBal.sub(1000)); + expect(newBUSDBal).greaterThan(BUSDBal); + }); + + it("borrow vToken", async () => { + const busdUserBal = await BUSD.balanceOf(busdHolder.address); + + expect(await vBUSD.connect(busdHolder).borrow(1000)).to.emit(vBUSD, "Borrow"); + + expect((await BUSD.balanceOf(busdHolder.address)).toString()).to.equal(busdUserBal.add(1000)); + }); + + it("Repay vToken", async () => { + const busdUserBal = await BUSD.balanceOf(busdHolder.address); + + expect(await vBUSD.connect(busdHolder).borrow(1000)).to.emit(vBUSD, "Borrow"); + + expect((await BUSD.balanceOf(busdHolder.address)).toString()).to.equal(busdUserBal.add(1000)); + + expect(await vBUSD.connect(busdHolder).repayBorrow(1000)).to.emit(vBUSD, "RepayBorrow"); + + const balanceAfterRepay = await BUSD.balanceOf(busdHolder.address); + expect(balanceAfterRepay).to.equal(busdUserBal); + }); + }); +}); diff --git a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json new file mode 100644 index 000000000..ea0aa2ff7 --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json @@ -0,0 +1,115 @@ +{ + "cutParams": [ + ["0xaEf95dd426ea05CD96A7F3af4f290842f883d0A2", 0, ["0xcdffacc6", "0x52ef6b2c", "0xadfca15e", "0x7a0ed627"]], + [ + "0x38e9cb9215c9d6E4F8761914C1213C12394Cbd9f", + 0, + [ + "0xa76b3fda", + "0x52d84d1e", + "0x21af4569", + "0x4a584432", + "0x929fe9a1", + "0xe8755446", + "0xd3270f99", + "0xc2998238", + "0xede4edd0", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0x4ada90af", + "0x9bb27d62", + "0x8e8f294b", + "0x94b2294b", + "0x0db4b4e5", + "0x4088c73e", + "0x2bc7e29e", + "0x7dc0d1d0", + "0x24a3d622", + "0x425fad58", + "0x719f701b", + "0x76551383", + "0x02c3bcbb", + "0xc5f956af", + "0xb2eafc39", + "0x04ef9d58", + "0x9254f5e5", + "0xbec04f72", + "0x7d172bd5", + "0x8a7dc165", + "0xbbb8864a", + "0xe37d4b79", + "0x08e0225c", + "0x879c2e1d", + "0x1abcaa77", + "0x41a18d2c", + "0x5dd3fc9d", + "0xb8324c7c", + "0xfa6331d8" + ] + ], + [ + "0x9008De0F2172710c3c80BfAAB7A9A7e69C8e8353", + 0, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0xA2Da6C4891474822EF28F1a7B7D10Ff629D9f322", + 0, + [ + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0x42cbb15c", + "0xbf32442d", + "0xededbae6", + "0xddfd287e" + ] + ], + [ + "0xd1ce1369964c33080826A3d9F98C3549E6Aa425e", + 0, + [ + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0xfd51a3ad" + ] + ] + ] +} diff --git a/src/utils.ts b/src/utils.ts index 74496746d..b24469463 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -26,15 +26,7 @@ export async function setForkBlock(blockNumber: number) { export function getCalldatas({ signatures, params }: { signatures: string[]; params: any[][] }) { return params.map((args: any[], i: number) => { - let types = getArgs(signatures[i]); - // Fix for the oracle VIP as there is struct in types and defaultAbiCoder - // is unable to process struct. - - if (signatures[i] == "setTokenConfig((address,address,uint256))") { - types = ["tuple(address, address, uint256)"]; - } else if (signatures[i] == "setTokenConfig((address,address[3],bool[3]))") { - types = ["tuple(address, address[3], bool[3])"]; - } + const types = getArgs(signatures[i]); return defaultAbiCoder.encode(types, args); }); diff --git a/src/vip-framework/index.ts b/src/vip-framework/index.ts index 3eb0d84e5..21aa8c643 100644 --- a/src/vip-framework/index.ts +++ b/src/vip-framework/index.ts @@ -8,19 +8,17 @@ import { Proposal } from "../types"; import { getCalldatas, initMainnetUser, setForkBlock } from "../utils"; import GOVERNOR_BRAVO_DELEGATE_ABI from "./abi/governorBravoDelegateAbi.json"; -const DEFAULT_SUPPORTER_ADDRESS = "0xc444949e0054a23c44fc45789738bdf64aed2391"; -let NORMAL_TIMELOCK_DELAY_BLOCKS = 57600; -const VOTING_PERIOD = 28800; - let DEFAULT_PROPOSER_ADDRESS = "0x55A9f5374Af30E3045FB491f1da3C2E8a74d168D"; +const DEFAULT_SUPPORTER_ADDRESS = "0xc444949e0054a23c44fc45789738bdf64aed2391"; let GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; let NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; +const NORMAL_TIMELOCK_DELAY = 172800; +const VOTING_PERIOD = 28800; if (process.env.FORK_TESTNET === "true") { DEFAULT_PROPOSER_ADDRESS = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; GOVERNOR_PROXY = "0x5573422a1a59385c247ec3a66b93b7c08ec2f8f2"; NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; - NORMAL_TIMELOCK_DELAY_BLOCKS = 200; } export const forking = (blockNumber: number, fn: () => void) => { diff --git a/vips/vip-Diamond-comptroller-testnet.ts b/vips/vip-Diamond-comptroller-testnet.ts new file mode 100644 index 000000000..a282e6f3d --- /dev/null +++ b/vips/vip-Diamond-comptroller-testnet.ts @@ -0,0 +1,50 @@ +import { cutParams as params } from "../simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json"; +import { ProposalType } from "../src/types"; +import { makeProposal } from "../src/utils"; + +const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +const DIAMOND_CUT_FACET = "0x69Ca940186C29b6a9D64e1Be1C59fb7A466354E2"; +const DIAMOND = "0xF6A9DBc8453EB8b1528B6Cd3f08eC632134f831F"; +const DIAMOND_INIT = "0x6D7f7Ed4EbD3A1807d5fe8EE70c155bcAc8174Af"; +const cutParams = params; + +export const vipDiamondTestnet = () => { + const meta = { + version: "v1", + title: "VIP Comptroller Diamond proxy", + description: `This vip implement diamond proxy for the comptroller to divide the comptroller logic into facets. The current implementation of the comptroller is exceeding the max limit of the contract size. To resolve this diamond proxy is implemented.`, + forDescription: + "I agree that Venus Protocol should proceed with the upgrading the Comptroller contract with diamond proxy", + againstDescription: "I do not think that Venus Protocol should proceed with the Comptroller contract upgradation", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not", + }; + + const initFunctionEncode = "0xe1c7392a"; + + return makeProposal( + [ + { + target: UNITROLLER, + signature: "_setPendingImplementation(address)", + params: [DIAMOND], + }, + { + target: DIAMOND, + signature: "_become()", + params: [], + }, + { + target: UNITROLLER, + signature: "facetCutInitilizer(address)", + params: [DIAMOND_CUT_FACET], + }, + { + target: UNITROLLER, + signature: "diamondCut((address,uint8,bytes4[])[],address,bytes)", + params: [cutParams, DIAMOND_INIT, initFunctionEncode], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; From e3dfba9036f1444a362f687a30884aff44a42ea1 Mon Sep 17 00:00:00 2001 From: defcon022 Date: Thu, 20 Apr 2023 19:15:26 +0530 Subject: [PATCH 02/24] Fix: lint fixes --- .../simulations.ts | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index b22bbc0e8..4b0d96e46 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -58,7 +58,6 @@ forking(29101377, async () => { venusBorrowSpeeds: any, venusSupplySpeeds: any; - let USDT: ethers.contract; let BUSD: ethers.contract; let usdtHolder: ethers.Signer; let busdHolder: ethers.Signer; @@ -67,12 +66,9 @@ forking(29101377, async () => { let diamondUnitroller: Contract; before(async () => { - console.log("1+++++"); unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); - console.log("2+++++"); diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); - console.log("3+++"); await impersonateAccount(Owner); owner = await ethers.getSigner(Owner); @@ -93,8 +89,8 @@ forking(29101377, async () => { }), ); - [BUSD, USDT] = await Promise.all( - [vBUSD, vUSDT].map(async (vToken: any) => { + [BUSD] = await Promise.all( + [vBUSD].map(async (vToken: any) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); }), @@ -351,7 +347,7 @@ forking(29101377, async () => { expect(await diamondUnitroller.borrowCaps(vUSDT.address)).to.equal(currentBorrowCap); }); - it("pausing mint action in vUSDT", async () => { + it("pausing mint action in vBUSD", async () => { expect(await diamondUnitroller.connect(owner)._setActionsPaused([vBUSD.address], [0], true)).to.emit( vBUSD, "ActionPausedMarket", @@ -371,12 +367,9 @@ forking(29101377, async () => { forking(29101377, async () => { let owner, unitroller; - let USDT: ethers.contract; let BUSD: ethers.contract; - let usdtHolder: ethers.Signer; let busdHolder: ethers.Signer; let vBUSD: ethers.contract; - let vUSDT: ethers.contract; let diamondUnitroller: Contract; before(async () => { @@ -396,15 +389,13 @@ forking(29101377, async () => { busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); - usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); - - [vBUSD, vUSDT] = await Promise.all( - [VBUSD, VUSDT].map((address: string) => { + [vBUSD] = await Promise.all( + [VBUSD].map((address: string) => { return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); }), ); - [BUSD, USDT] = await Promise.all( - [vBUSD, vUSDT].map(async (vToken: any) => { + [BUSD] = await Promise.all( + [vBUSD].map(async (vToken: any) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); }), From 568a0f831cebe539271e783378fedfa3377b6db1 Mon Sep 17 00:00:00 2001 From: defcon022 Date: Thu, 18 May 2023 13:23:06 +0530 Subject: [PATCH 03/24] refactor: changes in the diamond proxy vip. --- .../simulations.ts | 6 +- .../utils/cut-params-testnet.json | 179 +++++++----------- vips/vip-Diamond-comptroller-testnet.ts | 19 +- 3 files changed, 80 insertions(+), 124 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index 4b0d96e46..cc83651ee 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -11,7 +11,7 @@ import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const DIAMOND = "0xF6A9DBc8453EB8b1528B6Cd3f08eC632134f831F"; +const DIAMOND = "0x52B88fc3F47f607DdcE4048c243050B7576e9cbD"; const Owner = "0xce10739590001705F7FF231611ba4A48B2820327"; const zeroAddr = "0x0000000000000000000000000000000000000000"; @@ -23,7 +23,7 @@ const initMainnetUser = async (user: string) => { return ethers.getSigner(user); }; -forking(29101377, async () => { +forking(29886033, async () => { let owner: any, unitroller: Contract, // layout variables @@ -365,7 +365,7 @@ forking(29101377, async () => { }); }); -forking(29101377, async () => { +forking(29886033, async () => { let owner, unitroller; let BUSD: ethers.contract; let busdHolder: ethers.Signer; diff --git a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json index ea0aa2ff7..cc060a14f 100644 --- a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json +++ b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json @@ -1,115 +1,80 @@ { "cutParams": [ - ["0xaEf95dd426ea05CD96A7F3af4f290842f883d0A2", 0, ["0xcdffacc6", "0x52ef6b2c", "0xadfca15e", "0x7a0ed627"]], - [ - "0x38e9cb9215c9d6E4F8761914C1213C12394Cbd9f", - 0, [ - "0xa76b3fda", - "0x52d84d1e", - "0x21af4569", - "0x4a584432", - "0x929fe9a1", - "0xe8755446", - "0xd3270f99", - "0xc2998238", - "0xede4edd0", - "0xabfceffc", - "0x007e3dd2", - "0xc488847b", - "0x4ada90af", - "0x9bb27d62", - "0x8e8f294b", - "0x94b2294b", - "0x0db4b4e5", - "0x4088c73e", - "0x2bc7e29e", - "0x7dc0d1d0", - "0x24a3d622", - "0x425fad58", - "0x719f701b", - "0x76551383", - "0x02c3bcbb", - "0xc5f956af", - "0xb2eafc39", - "0x04ef9d58", - "0x9254f5e5", - "0xbec04f72", - "0x7d172bd5", - "0x8a7dc165", - "0xbbb8864a", - "0xe37d4b79", - "0x08e0225c", - "0x879c2e1d", - "0x1abcaa77", - "0x41a18d2c", - "0x5dd3fc9d", - "0xb8324c7c", - "0xfa6331d8" - ] - ], - [ - "0x9008De0F2172710c3c80BfAAB7A9A7e69C8e8353", - 0, + "0x981e47f3Fd5A497280Fb9adD5791F155Eb9D7c6F", + 0, + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b" + ] + ], [ - "0xead1a8a0", - "0xda3d454c", - "0x5c778605", - "0x5ec88c79", - "0x5fc7e71e", - "0x47ef3b3b", - "0x4ef4c3e1", - "0x41c728b9", - "0xeabe7d91", - "0x51dff989", - "0x24008a62", - "0x1ededc91", - "0xd02f7351", - "0x6d35bf91", - "0xbdcdc258", - "0x6a56947e" - ] - ], - [ - "0xA2Da6C4891474822EF28F1a7B7D10Ff629D9f322", - 0, + "0xD97212b66b158C3CF8E869E3cCc4d21A0193a7D6", + 0, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], [ - "0xa7604b41", - "0xe85a2960", - "0x70bf66f0", - "0x86df31ee", - "0xadcd5fb9", - "0xd09c54ba", - "0x7858524d", - "0x42cbb15c", - "0xbf32442d", - "0xededbae6", - "0xddfd287e" - ] - ], - [ - "0xd1ce1369964c33080826A3d9F98C3549E6Aa425e", - 0, + "0x01C9caD8F9fe08397b1737F71865067dC08237d8", + 0, + [ + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0x42cbb15c", + "0xbf32442d", + "0xededbae6", + "0xddfd287e" + ] + ], [ - "0xf519fc30", - "0x2b5d790c", - "0x317b0b77", - "0xe4028eee", - "0x9bf34cbb", - "0x4fd42e17", - "0xbb857450", - "0x607ef6c1", - "0x51a485e4", - "0x5f5af1aa", - "0x55ee1fe1", - "0x2a6a6065", - "0xd24febad", - "0x9cfdd9e6", - "0x2ec04124", - "0x4e0853db", - "0x6662c7c9", - "0xfd51a3ad" + "0x06c98127900274eeB636B1957287D2C76C0cb476", + 0, + [ + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0xfd51a3ad" + ] ] - ] ] -} +} \ No newline at end of file diff --git a/vips/vip-Diamond-comptroller-testnet.ts b/vips/vip-Diamond-comptroller-testnet.ts index a282e6f3d..2ba00a120 100644 --- a/vips/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-Diamond-comptroller-testnet.ts @@ -3,9 +3,7 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const DIAMOND_CUT_FACET = "0x69Ca940186C29b6a9D64e1Be1C59fb7A466354E2"; -const DIAMOND = "0xF6A9DBc8453EB8b1528B6Cd3f08eC632134f831F"; -const DIAMOND_INIT = "0x6D7f7Ed4EbD3A1807d5fe8EE70c155bcAc8174Af"; +const DIAMOND = "0x52B88fc3F47f607DdcE4048c243050B7576e9cbD"; const cutParams = params; export const vipDiamondTestnet = () => { @@ -19,8 +17,6 @@ export const vipDiamondTestnet = () => { abstainDescription: "I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not", }; - const initFunctionEncode = "0xe1c7392a"; - return makeProposal( [ { @@ -30,18 +26,13 @@ export const vipDiamondTestnet = () => { }, { target: DIAMOND, - signature: "_become()", - params: [], - }, - { - target: UNITROLLER, - signature: "facetCutInitilizer(address)", - params: [DIAMOND_CUT_FACET], + signature: "_become(address)", + params: [UNITROLLER], }, { target: UNITROLLER, - signature: "diamondCut((address,uint8,bytes4[])[],address,bytes)", - params: [cutParams, DIAMOND_INIT, initFunctionEncode], + signature: "diamondCut((address,uint8,bytes4[])[])", + params: [cutParams], }, ], meta, From 78d3f8fa99b7f2d552cb46ce738c92e2229b5e7e Mon Sep 17 00:00:00 2001 From: defcon022 Date: Thu, 18 May 2023 13:24:19 +0530 Subject: [PATCH 04/24] refactor: changes in the vip framework utils. --- src/utils.ts | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index b24469463..ad19e5e28 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -4,6 +4,7 @@ import { NumberLike } from "@nomicfoundation/hardhat-network-helpers/dist/src/ty import { expect } from "chai"; import { ContractInterface, TransactionResponse } from "ethers"; import { ethers, network } from "hardhat"; +import { ParamType } from "ethers/lib/utils"; import { Command, Proposal, ProposalMeta, ProposalType } from "./types"; import VENUS_CHAINLINK_ORACLE_ABI from "./vip-framework/abi/VenusChainlinkOracle.json"; @@ -32,22 +33,23 @@ export function getCalldatas({ signatures, params }: { signatures: string[]; par }); } -const getArgs = (func: string) => { - if (func === "") return []; - // First match everything inside the function argument parens. - const match = func.match(/.*?\(([^]*)\)/); - const args = match ? match[1] : ""; - // Split the arguments string into an array comma delimited. - return args - .split(",") - .map(arg => { - // Ensure no inline comments are parsed and trim the whitespace. - return arg.replace(/\/\*.*\*\//, "").trim(); - }) - .filter(arg => { - // Ensure no undefined values are added. - return arg; - }); +const formatParamType = (paramType: ParamType): string => { + if (paramType.type === "tuple") { + return `tuple(${paramType.components.map(formatParamType).join(", ")})`; + } + + if (paramType.type === "tuple[]") { + return `tuple(${paramType.components.map(formatParamType).join(", ")})[]`; + } + + return paramType.type; +}; + +const getArgs = (signature: string) => { + if (signature === "") return []; + const fragment = ethers.utils.FunctionFragment.from(signature); + + return fragment.inputs.map(formatParamType); }; export const initMainnetUser = async (user: string, balance: NumberLike) => { From a899f9f911572a9bf7d84354fecc0a041b0aadd0 Mon Sep 17 00:00:00 2001 From: defcon022 Date: Thu, 18 May 2023 13:35:24 +0530 Subject: [PATCH 05/24] refactor: added script to create a diamond cut- params for facets --- .../scripts/diamond.ts | 82 +++++++++++ .../scripts/facet-cut-params-generator.ts | 109 ++++++++++++++ .../utils/cut-params-testnet.json | 138 +++++++++--------- src/utils.ts | 2 +- 4 files changed, 257 insertions(+), 74 deletions(-) create mode 100644 simulations/vip-diamond-comptroller-testnet/scripts/diamond.ts create mode 100644 simulations/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts diff --git a/simulations/vip-diamond-comptroller-testnet/scripts/diamond.ts b/simulations/vip-diamond-comptroller-testnet/scripts/diamond.ts new file mode 100644 index 000000000..27adab39a --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/scripts/diamond.ts @@ -0,0 +1,82 @@ +import { ethers } from "hardhat"; + +const FacetCutAction = { Add: 0, Replace: 1, Remove: 2 }; + +// get function selectors from ABI +function getSelectors(contract: any) { + const signatures = Object.keys(contract.interface.functions); + const selectors: any = signatures.reduce((acc: any, val) => { + if (val !== "init(bytes)") { + acc.push(contract.interface.getSighash(val)); + } + return acc; + }, []); + selectors.contract = contract; + selectors.remove = remove; + selectors.get = get; + return selectors; +} + +// get function selector from function signature +function getSelector(func: any) { + const abiInterface = new ethers.utils.Interface([func]); + return abiInterface.getSighash(ethers.utils.Fragment.from(func)); +} + +// used with getSelectors to remove selectors from an array of selectors +// functionNames argument is an array of function signatures +function remove(functionNames: any) { + const selectors = this.filter(v => { + for (const functionName of functionNames) { + if (v === this.contract.interface.getSighash(functionName)) { + return false; + } + } + return true; + }); + selectors.contract = this.contract; + selectors.remove = this.remove; + selectors.get = this.get; + return selectors; +} + +// used with getSelectors to get selectors from an array of selectors +// functionNames argument is an array of function signatures +function get(functionNames) { + const selectors = this.filter(v => { + for (const functionName of functionNames) { + if (v === this.contract.interface.getSighash(functionName)) { + return true; + } + } + return false; + }); + selectors.contract = this.contract; + selectors.remove = this.remove; + selectors.get = this.get; + return selectors; +} + +// remove selectors using an array of signatures +function removeSelectors(selectors, signatures) { + const iface = new ethers.utils.Interface(signatures.map(v => "function " + v)); + const removeSelectors = signatures.map(v => iface.getSighash(v)); + selectors = selectors.filter(v => !removeSelectors.includes(v)); + return selectors; +} + +// find a particular address position in the return value of diamondLoupeFacet.facets() +function findAddressPositionInFacets(facetAddress, facets) { + for (let i = 0; i < facets.length; i++) { + if (facets[i].facetAddress === facetAddress) { + return i; + } + } +} + +exports.getSelectors = getSelectors; +exports.getSelector = getSelector; +exports.FacetCutAction = FacetCutAction; +exports.remove = remove; +exports.removeSelectors = removeSelectors; +exports.findAddressPositionInFacets = findAddressPositionInFacets; diff --git a/simulations/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts b/simulations/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts new file mode 100644 index 000000000..0f0c5c41a --- /dev/null +++ b/simulations/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts @@ -0,0 +1,109 @@ +import fs from "fs"; +import { ethers } from "hardhat"; + +import { FacetCutAction, getSelectors } from "./diamond"; + +/** + * This script is used to generate the cut-params which will be used in diamond proxy vip + * to add diamond facets + */ + +// Insert the addresses of the deployed facets to generate thecut params according for the same. +const facetsAddresses: any = { + MarketFacet: "", + PolicyFacet: "", + RewardFacet: "", + SetterFacet: "", +}; + +// Set actions to the cut params to perform +// i.e. Add, Remove, Replace function selectors in the mapping. +const facetsActions: any = { + MarketFacet: FacetCutAction.Add, + PolicyFacet: FacetCutAction.Add, + RewardFacet: FacetCutAction.Add, + SetterFacet: FacetCutAction.Add, +}; + +// Set interfaces for the setters to generate function selectors from +const FacetsInterfaces: any = { + MarketFacet: "IMarketFacet", + PolicyFacet: "IPolicyFacet", + RewardFacet: "IRewardFacet", + SetterFacet: "ISetterFacet", +}; + +// Facets for which cute params need to generate +const FacetNames = ["MarketFacet", "PolicyFacet", "RewardFacet", "SetterFacet"]; + +// Name of the file to write the cut-params +const jsonFileName = "cur-params-test"; + +async function generateCutParams() { + const cut: any = []; + + for (const FacetName of FacetNames) { + const FacetInterface = await ethers.getContractAt(FacetsInterfaces[FacetName], facetsAddresses[FacetName]); + + switch (facetsActions[FacetName]) { + case FacetCutAction.Add: + cut.push({ + facetAddress: facetsAddresses[FacetName], + action: FacetCutAction.Add, + functionSelectors: getSelectors(FacetInterface), + }); + break; + case FacetCutAction.Remove: + cut.push({ + facetAddress: ethers.constants.AddressZero, + action: FacetCutAction.Remove, + functionSelectors: getSelectors(FacetInterface), + }); + break; + case FacetCutAction.Replace: + cut.push({ + facetAddress: facetsAddresses[FacetName], + action: FacetCutAction.Replace, + functionSelectors: getSelectors(FacetInterface), + }); + break; + default: + break; + } + } + + function getFunctionSelector(selectors: any) { + const functionSelector: any = []; + for (let i = 0; i < selectors.length; i++) { + if (selectors[i][0] == "0") { + functionSelector.push(selectors[i]); + } else { + break; + } + } + return functionSelector; + } + + function makeCutParam(cut: any) { + const cutParams = []; + for (let i = 0; i < cut.length; i++) { + const arr: any = new Array(3); + arr[0] = cut[i].facetAddress; + arr[1] = cut[i].action; + arr[2] = getFunctionSelector(cut[i].functionSelectors); + cutParams.push(arr); + } + return cutParams; + } + const cutParams = { cutParams: makeCutParam(cut) }; + + fs.writeFileSync(`./${jsonFileName}.json`, JSON.stringify(cutParams, null, 4)); + return cutParams; +} + +generateCutParams() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); diff --git a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json index cc060a14f..60a07ca57 100644 --- a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json +++ b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json @@ -1,80 +1,72 @@ { "cutParams": [ + [ + "0x981e47f3Fd5A497280Fb9adD5791F155Eb9D7c6F", + 0, + ["0xa76b3fda", "0x929fe9a1", "0xc2998238", "0xede4edd0", "0xabfceffc", "0x007e3dd2", "0xc488847b"] + ], + [ + "0xD97212b66b158C3CF8E869E3cCc4d21A0193a7D6", + 0, [ - "0x981e47f3Fd5A497280Fb9adD5791F155Eb9D7c6F", - 0, - [ - "0xa76b3fda", - "0x929fe9a1", - "0xc2998238", - "0xede4edd0", - "0xabfceffc", - "0x007e3dd2", - "0xc488847b" - ] - ], - [ - "0xD97212b66b158C3CF8E869E3cCc4d21A0193a7D6", - 0, - [ - "0xead1a8a0", - "0xda3d454c", - "0x5c778605", - "0x5ec88c79", - "0x5fc7e71e", - "0x47ef3b3b", - "0x4ef4c3e1", - "0x41c728b9", - "0xeabe7d91", - "0x51dff989", - "0x24008a62", - "0x1ededc91", - "0xd02f7351", - "0x6d35bf91", - "0xbdcdc258", - "0x6a56947e" - ] - ], + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x01C9caD8F9fe08397b1737F71865067dC08237d8", + 0, [ - "0x01C9caD8F9fe08397b1737F71865067dC08237d8", - 0, - [ - "0xa7604b41", - "0xe85a2960", - "0x70bf66f0", - "0x86df31ee", - "0xadcd5fb9", - "0xd09c54ba", - "0x7858524d", - "0x42cbb15c", - "0xbf32442d", - "0xededbae6", - "0xddfd287e" - ] - ], + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0x42cbb15c", + "0xbf32442d", + "0xededbae6", + "0xddfd287e" + ] + ], + [ + "0x06c98127900274eeB636B1957287D2C76C0cb476", + 0, [ - "0x06c98127900274eeB636B1957287D2C76C0cb476", - 0, - [ - "0xf519fc30", - "0x2b5d790c", - "0x317b0b77", - "0xe4028eee", - "0x9bf34cbb", - "0x4fd42e17", - "0xbb857450", - "0x607ef6c1", - "0x51a485e4", - "0x5f5af1aa", - "0x55ee1fe1", - "0x2a6a6065", - "0xd24febad", - "0x9cfdd9e6", - "0x2ec04124", - "0x4e0853db", - "0x6662c7c9", - "0xfd51a3ad" - ] + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0xfd51a3ad" ] + ] ] -} \ No newline at end of file +} diff --git a/src/utils.ts b/src/utils.ts index ad19e5e28..e06c5e3d9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -3,8 +3,8 @@ import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network import { NumberLike } from "@nomicfoundation/hardhat-network-helpers/dist/src/types"; import { expect } from "chai"; import { ContractInterface, TransactionResponse } from "ethers"; -import { ethers, network } from "hardhat"; import { ParamType } from "ethers/lib/utils"; +import { ethers, network } from "hardhat"; import { Command, Proposal, ProposalMeta, ProposalType } from "./types"; import VENUS_CHAINLINK_ORACLE_ABI from "./vip-framework/abi/VenusChainlinkOracle.json"; From b24301f241d4ea416809767d456dbb9af0a30300 Mon Sep 17 00:00:00 2001 From: defcon022 Date: Fri, 16 Jun 2023 17:40:48 +0530 Subject: [PATCH 06/24] fix: pr comments --- .../simulations.ts | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index cc83651ee..c8e15f404 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -52,11 +52,12 @@ forking(29886033, async () => { treasuryPercent: any, liquidatorContract: any, comptrollerLens: any, - market: any, - venusSupplierIndex: any, - venusBorrowerIndex: any, - venusBorrowSpeeds: any, - venusSupplySpeeds: any; + + const borrowSpeeds: any = {}; + const supplySpeeds: any = {} + const userBorrowIndexes: any = {}; + const userSupplyIndexes: any = {}; + const markets: any = {}; let BUSD: ethers.contract; let usdtHolder: ethers.Signer; @@ -128,8 +129,6 @@ forking(29886033, async () => { liquidationIncentiveMantissa = await unitroller.liquidationIncentiveMantissa(); - allMarkets = await unitroller.allMarkets(0); - venusRate = await unitroller.venusRate(); venusSpeeds = await unitroller.venusSpeeds(BUSD.address); @@ -145,7 +144,6 @@ forking(29886033, async () => { vaiController = await unitroller.vaiController(); mintedVAIs = await unitroller.mintedVAIs(busdHolder.address); - unitroller.minte; mintVAIGuardianPaused = await unitroller.mintVAIGuardianPaused(); @@ -171,20 +169,24 @@ forking(29886033, async () => { comptrollerLens = await unitroller.comptrollerLens(); - // cheking all public mappings - market = await unitroller.markets(vBUSD.address); + // checking all public mappings + allMarkets = await unitroller.getAllMarkets(); - venusBorrowerIndex = await unitroller.venusBorrowerIndex(vBUSD.address, busdHolder.address); + for( const marketIndex in allMarkets) { + const marketAddress = allMarkets[marketIndex].toString() - venusSupplierIndex = await unitroller.venusSupplierIndex(vBUSD.address, busdHolder.address); + borrowSpeeds[marketAddress] = await unitroller.venusBorrowSpeeds(marketAddress) + supplySpeeds[marketAddress] = await unitroller.venusSupplySpeeds(marketAddress); + markets[marketAddress] = await unitroller.markets(marketAddress); - venusBorrowSpeeds = await unitroller.venusBorrowSpeeds(vUSDT.address); - venusSupplySpeeds = await unitroller.venusSupplySpeeds(vUSDT.address); + userBorrowIndexes[marketAddress] = await unitroller.venusBorrowerIndex(marketAddress, busdHolder.address); + userSupplyIndexes[marketAddress] = await unitroller.venusSupplierIndex(marketAddress, busdHolder.address); + } }); }); }); - testVip("VIP-Diamond TRON Contract Migration", vipDiamondTestnet()); + testVip("VIP-Diamond Contract Migration", vipDiamondTestnet()); describe("Verify Storage slots after VIP execution", async () => { // These tests checks the storage collision of comptroller while updating it via diamond. @@ -218,9 +220,6 @@ forking(29886033, async () => { const liquidationIncentiveMantissaAfterUpgrade = await diamondUnitroller.liquidationIncentiveMantissa(); expect(liquidationIncentiveMantissa).to.equal(liquidationIncentiveMantissaAfterUpgrade); - const allMarketsAfterUpgrade = await diamondUnitroller.allMarkets(0); - expect(allMarkets).to.equal(allMarketsAfterUpgrade); - const venusRateAfterUpgrade = await diamondUnitroller.venusRate(); expect(venusRate).to.equal(venusRateAfterUpgrade); @@ -281,23 +280,25 @@ forking(29886033, async () => { const comptrollerLensUpgrade = await diamondUnitroller.comptrollerLens(); expect(comptrollerLens).to.equal(comptrollerLensUpgrade); - // cheking all public mappings - const marketUpgrade = await diamondUnitroller.markets(vBUSD.address); - expect(market.collateralFactorMantissa).to.equal(marketUpgrade.collateralFactorMantissa); - expect(market.isListed).to.equal(marketUpgrade.isListed); - expect(market.isVenus).to.equal(marketUpgrade.isVenus); - - const venusBorrowerIndexUpgrade = await diamondUnitroller.venusBorrowerIndex(vBUSD.address, busdHolder.address); - expect(venusBorrowerIndex).to.equal(venusBorrowerIndexUpgrade); - - const venusSupplierIndexUpgrade = await diamondUnitroller.venusSupplierIndex(vBUSD.address, busdHolder.address); - expect(venusSupplierIndex).to.equal(venusSupplierIndexUpgrade); - - const venusBorrowSpeedsUpgrade = await diamondUnitroller.venusBorrowSpeeds(vUSDT.address); - const venusSupplySpeedsUpgrade = await diamondUnitroller.venusSupplySpeeds(vUSDT.address); - - expect(venusBorrowSpeeds).to.equal(venusBorrowSpeedsUpgrade); - expect(venusSupplySpeeds).to.equal(venusSupplySpeedsUpgrade); + // checking all public mappings + for( const marketIndex in allMarkets) { + const marketAddress = allMarkets[marketIndex].toString() + + const marketUpgrade = await diamondUnitroller.markets(marketAddress); + expect(markets[marketAddress].collateralFactorMantissa).to.equal(marketUpgrade.collateralFactorMantissa); + expect(markets[marketAddress].isListed).to.equal(marketUpgrade.isListed); + expect(markets[marketAddress].isVenus).to.equal(marketUpgrade.isVenus); + + const venusBorrowSpeed = await diamondUnitroller.venusBorrowSpeeds(marketAddress); + const venusSupplySpeed = await diamondUnitroller.venusSupplySpeeds(marketAddress); + expect(borrowSpeeds[marketAddress]).to.equal(venusBorrowSpeed); + expect(supplySpeeds[marketAddress]).to.equal(venusSupplySpeed); + + const userBorrowIndex = await diamondUnitroller.venusBorrowerIndex(marketAddress, busdHolder.address); + const userSupplyIndex= await diamondUnitroller.venusSupplierIndex(marketAddress, busdHolder.address); + expect(userBorrowIndexes[marketAddress]).to.equal(userBorrowIndex); + expect(userSupplyIndexes[marketAddress]).to.equal(userSupplyIndex); + } }); }); }); @@ -320,7 +321,7 @@ forking(29886033, async () => { expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits(currentCloseFactor, 0)); }); - it("setting setting Liquidation Incentive", async () => { + it("setting Liquidation Incentive", async () => { await diamondUnitroller.connect(owner)._setLiquidationIncentive(parseUnits("13", 17)); expect(await diamondUnitroller.liquidationIncentiveMantissa()).to.equal(parseUnits("13", 17)); From cfe4633bf5ca7d1e1d013d6b9dcd7206e3050a02 Mon Sep 17 00:00:00 2001 From: defcon022 Date: Fri, 16 Jun 2023 18:04:04 +0530 Subject: [PATCH 07/24] fix: rebased develop branch and resolved conflicts --- hardhat.config.ts | 2 +- src/vip-framework/index.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index f5347fd16..521e8bf90 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -83,7 +83,7 @@ function isFork() { blockNumber: 21068448, }, accounts: { - accountsBalance: "1000000000000000000", + accountsBalance: "100000000000000000000000", }, live: false, } diff --git a/src/vip-framework/index.ts b/src/vip-framework/index.ts index 21aa8c643..3eb0d84e5 100644 --- a/src/vip-framework/index.ts +++ b/src/vip-framework/index.ts @@ -8,17 +8,19 @@ import { Proposal } from "../types"; import { getCalldatas, initMainnetUser, setForkBlock } from "../utils"; import GOVERNOR_BRAVO_DELEGATE_ABI from "./abi/governorBravoDelegateAbi.json"; -let DEFAULT_PROPOSER_ADDRESS = "0x55A9f5374Af30E3045FB491f1da3C2E8a74d168D"; const DEFAULT_SUPPORTER_ADDRESS = "0xc444949e0054a23c44fc45789738bdf64aed2391"; +let NORMAL_TIMELOCK_DELAY_BLOCKS = 57600; +const VOTING_PERIOD = 28800; + +let DEFAULT_PROPOSER_ADDRESS = "0x55A9f5374Af30E3045FB491f1da3C2E8a74d168D"; let GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; let NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; -const NORMAL_TIMELOCK_DELAY = 172800; -const VOTING_PERIOD = 28800; if (process.env.FORK_TESTNET === "true") { DEFAULT_PROPOSER_ADDRESS = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; GOVERNOR_PROXY = "0x5573422a1a59385c247ec3a66b93b7c08ec2f8f2"; NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + NORMAL_TIMELOCK_DELAY_BLOCKS = 200; } export const forking = (blockNumber: number, fn: () => void) => { From bbb5e1d660e36f2b5eb93c839cb4fb666e29f71c Mon Sep 17 00:00:00 2001 From: defcon022 Date: Fri, 16 Jun 2023 18:09:27 +0530 Subject: [PATCH 08/24] fix: lint issues --- .../simulations.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index c8e15f404..512335672 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -51,10 +51,10 @@ forking(29886033, async () => { treasuryAddress: any, treasuryPercent: any, liquidatorContract: any, - comptrollerLens: any, + comptrollerLens: any; const borrowSpeeds: any = {}; - const supplySpeeds: any = {} + const supplySpeeds: any = {}; const userBorrowIndexes: any = {}; const userSupplyIndexes: any = {}; const markets: any = {}; @@ -172,10 +172,10 @@ forking(29886033, async () => { // checking all public mappings allMarkets = await unitroller.getAllMarkets(); - for( const marketIndex in allMarkets) { - const marketAddress = allMarkets[marketIndex].toString() + for (const marketIndex in allMarkets) { + const marketAddress = allMarkets[marketIndex].toString(); - borrowSpeeds[marketAddress] = await unitroller.venusBorrowSpeeds(marketAddress) + borrowSpeeds[marketAddress] = await unitroller.venusBorrowSpeeds(marketAddress); supplySpeeds[marketAddress] = await unitroller.venusSupplySpeeds(marketAddress); markets[marketAddress] = await unitroller.markets(marketAddress); @@ -281,8 +281,8 @@ forking(29886033, async () => { expect(comptrollerLens).to.equal(comptrollerLensUpgrade); // checking all public mappings - for( const marketIndex in allMarkets) { - const marketAddress = allMarkets[marketIndex].toString() + for (const marketIndex in allMarkets) { + const marketAddress = allMarkets[marketIndex].toString(); const marketUpgrade = await diamondUnitroller.markets(marketAddress); expect(markets[marketAddress].collateralFactorMantissa).to.equal(marketUpgrade.collateralFactorMantissa); @@ -295,7 +295,7 @@ forking(29886033, async () => { expect(supplySpeeds[marketAddress]).to.equal(venusSupplySpeed); const userBorrowIndex = await diamondUnitroller.venusBorrowerIndex(marketAddress, busdHolder.address); - const userSupplyIndex= await diamondUnitroller.venusSupplierIndex(marketAddress, busdHolder.address); + const userSupplyIndex = await diamondUnitroller.venusSupplierIndex(marketAddress, busdHolder.address); expect(userBorrowIndexes[marketAddress]).to.equal(userBorrowIndex); expect(userSupplyIndexes[marketAddress]).to.equal(userSupplyIndex); } From 6cdc98b1677e6e0c8abfdc2726515b4e2063abfd Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Fri, 4 Aug 2023 17:47:35 +0530 Subject: [PATCH 09/24] refactor: give access to the setCloseFactor --- vips/vip-Diamond-comptroller-testnet.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vips/vip-Diamond-comptroller-testnet.ts b/vips/vip-Diamond-comptroller-testnet.ts index 2ba00a120..779749568 100644 --- a/vips/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-Diamond-comptroller-testnet.ts @@ -4,6 +4,8 @@ import { makeProposal } from "../src/utils"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const DIAMOND = "0x52B88fc3F47f607DdcE4048c243050B7576e9cbD"; +const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const cutParams = params; export const vipDiamondTestnet = () => { @@ -34,6 +36,16 @@ export const vipDiamondTestnet = () => { signature: "diamondCut((address,uint8,bytes4[])[])", params: [cutParams], }, + { + target: ACM, + signature: "revokeCallPermission(address,string,address)", + params: [UNITROLLER, "_setActionsPaused(address[],uint256[],bool)", NORMAL_TIMELOCK], + }, + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [UNITROLLER, "_setActionsPaused(address[],uint8[],bool)", NORMAL_TIMELOCK], + }, ], meta, ProposalType.REGULAR, From 5281ec1e49bbbc7e6b1709d90bc1420f0d2a79bb Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Tue, 12 Sep 2023 20:18:04 +0530 Subject: [PATCH 10/24] fix: updated latest address and tests for diamond comptroller --- .../simulations.ts | 123 +++++++++--------- .../utils/cut-params-testnet.json | 27 ++-- vips/vip-Diamond-comptroller-testnet.ts | 4 +- 3 files changed, 79 insertions(+), 75 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index 512335672..256f67ad1 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -1,6 +1,6 @@ import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; -import { Contract } from "ethers"; +import { Contract, Signer } from "ethers"; import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; @@ -11,7 +11,7 @@ import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const DIAMOND = "0x52B88fc3F47f607DdcE4048c243050B7576e9cbD"; +const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; const Owner = "0xce10739590001705F7FF231611ba4A48B2820327"; const zeroAddr = "0x0000000000000000000000000000000000000000"; @@ -23,7 +23,7 @@ const initMainnetUser = async (user: string) => { return ethers.getSigner(user); }; -forking(29886033, async () => { +forking(33272635, async () => { let owner: any, unitroller: Contract, // layout variables @@ -32,8 +32,6 @@ forking(29886033, async () => { closeFactorMantissa: any, liquidationIncentiveMantissa: any, allMarkets: any, - venusRate: any, - venusSpeeds: any, venusSupplyState: any, venusBorrowState: any, venusAccrued: any, @@ -59,11 +57,12 @@ forking(29886033, async () => { const userSupplyIndexes: any = {}; const markets: any = {}; - let BUSD: ethers.contract; - let usdtHolder: ethers.Signer; - let busdHolder: ethers.Signer; - let vBUSD: ethers.contract; - let vUSDT: ethers.contract; + let BUSD: Contract; + let USDT: Contract; + let usdtHolder: Signer; + let busdHolder: Signer; + let vBUSD: Contract; + let vUSDT: Contract; let diamondUnitroller: Contract; before(async () => { @@ -90,7 +89,7 @@ forking(29886033, async () => { }), ); - [BUSD] = await Promise.all( + [BUSD, USDT] = await Promise.all( [vBUSD].map(async (vToken: any) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); @@ -110,10 +109,9 @@ forking(29886033, async () => { it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { const comptrollerImplementation = await unitroller.comptrollerImplementation(); - console.log("implementation address", comptrollerImplementation); const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal( - "0xc934A1b15b30E9b515D8A87b5054432B9b965131".toLowerCase(), + "0x9d062a805aec794a165cb1f7cedc6d848e83f3ba".toLowerCase(), ); expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); }); @@ -129,10 +127,6 @@ forking(29886033, async () => { liquidationIncentiveMantissa = await unitroller.liquidationIncentiveMantissa(); - venusRate = await unitroller.venusRate(); - - venusSpeeds = await unitroller.venusSpeeds(BUSD.address); - venusSupplyState = await unitroller.venusSupplyState(BUSD.address); venusBorrowState = await unitroller.venusBorrowState(BUSD.address); @@ -220,12 +214,6 @@ forking(29886033, async () => { const liquidationIncentiveMantissaAfterUpgrade = await diamondUnitroller.liquidationIncentiveMantissa(); expect(liquidationIncentiveMantissa).to.equal(liquidationIncentiveMantissaAfterUpgrade); - const venusRateAfterUpgrade = await diamondUnitroller.venusRate(); - expect(venusRate).to.equal(venusRateAfterUpgrade); - - const venusSpeedsAfterUpgrade = await diamondUnitroller.venusSpeeds(BUSD.address); - expect(venusSpeeds).to.equal(venusSpeedsAfterUpgrade); - const venusSupplyStateAfterUpgrade = await diamondUnitroller.venusSupplyState(BUSD.address); expect(venusSupplyState.index.toString()).to.equal(venusSupplyStateAfterUpgrade.index.toString()); @@ -315,8 +303,8 @@ forking(29886033, async () => { it("setting close factor", async () => { const currentCloseFactor = (await diamondUnitroller.closeFactorMantissa()).toString(); - await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits("10000", 18)); - expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits("10000", 18)); + await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits("1", 17)); + expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits("1", 17)); await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits(currentCloseFactor, 0)); expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits(currentCloseFactor, 0)); }); @@ -349,28 +337,32 @@ forking(29886033, async () => { }); it("pausing mint action in vBUSD", async () => { - expect(await diamondUnitroller.connect(owner)._setActionsPaused([vBUSD.address], [0], true)).to.emit( - vBUSD, - "ActionPausedMarket", - ); - await BUSD.connect(busdHolder).approve(vBUSD.address, 1200); - await expect(vBUSD.connect(usdtHolder).mint(1000)).to.be.revertedWith("action is paused"); + const isActionPaused = await diamondUnitroller.actionPaused(VBUSD, 0); + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); - expect(await diamondUnitroller.connect(owner)._setActionsPaused([vBUSD.address], [0], false)).to.emit( + expect(await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], !isActionPaused)).to.emit( vBUSD, "ActionPausedMarket", ); - expect(await vBUSD.connect(busdHolder).mint(10)).to.be.emit(vBUSD, "Mint"); + + await expect(await diamondUnitroller.actionPaused(VBUSD, 0)).to.be.equal(!isActionPaused); + + if (!isActionPaused) { + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); + } }); }); }); }); -forking(29886033, async () => { +forking(33272635, async () => { let owner, unitroller; - let BUSD: ethers.contract; - let busdHolder: ethers.Signer; - let vBUSD: ethers.contract; + let BUSD: Contract; + let USDT: Contract; + let busdHolder: Signer; + let usdtHolder: Signer; + let vBUSD: Contract; + let vUSDT: Contract; let diamondUnitroller: Contract; before(async () => { @@ -390,18 +382,20 @@ forking(29886033, async () => { busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); - [vBUSD] = await Promise.all( - [VBUSD].map((address: string) => { + usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); + + [vBUSD, vUSDT] = await Promise.all( + [VBUSD, VUSDT].map((address: string) => { return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); }), ); - [BUSD] = await Promise.all( - [vBUSD].map(async (vToken: any) => { + [BUSD, USDT] = await Promise.all( + [vBUSD, vUSDT].map(async (vToken: any) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); }), ); - console.log("last"); + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); }); describe("Diamond Hooks", () => { @@ -411,51 +405,50 @@ forking(29886033, async () => { expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); }); - it("mint vToken vBUSD", async () => { - const vBUSDBalance = await BUSD.balanceOf(vBUSD.address); - const busdHolerBalance = await BUSD.balanceOf(busdHolder.address); + it("mint vToken vUSDT", async () => { + const vBUSDBalance = await USDT.balanceOf(vUSDT.address); + const busdHolerBalance = await USDT.balanceOf(usdtHolder.address); - await BUSD.connect(busdHolder).approve(vBUSD.address, parseUnits("1100", 18)); - expect(await vBUSD.connect(busdHolder).mint(parseUnits("1000", 18))).to.emit(vBUSD, "Mint"); + await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); + await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); - const newvBUSDBalance = await BUSD.balanceOf(vBUSD.address); - const newBusdHolerBalance = await BUSD.balanceOf(busdHolder.address); + const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); + const newBusdHolerBalance = await USDT.balanceOf(usdtHolder.address); expect(newvBUSDBalance).greaterThan(vBUSDBalance); expect(newBusdHolerBalance).lessThan(busdHolerBalance); }); it("redeem vToken", async () => { - const vBUSDUserBal = await vBUSD.connect(busdHolder).balanceOf(busdHolder.address); - const BUSDBal = await BUSD.connect(busdHolder).balanceOf(busdHolder.address); - - expect(await vBUSD.connect(busdHolder).redeem(1000)).to.emit(vBUSD, "Redeem"); + await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); + await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); - const newBUSDBal = await BUSD.connect(busdHolder).balanceOf(busdHolder.address); - const newBUSDUserBal = await vBUSD.connect(busdHolder).balanceOf(busdHolder.address); + const vUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(usdtHolder.address); + await expect(vUSDT.connect(usdtHolder).redeem(2000)).to.emit(vUSDT, "Redeem"); + const newVUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(usdtHolder.address); - expect(newBUSDUserBal).to.equal(vBUSDUserBal.sub(1000)); - expect(newBUSDBal).greaterThan(BUSDBal); + expect(newVUSDTUserBal).to.equal(vUSDTUserBal.sub(2000)); }); it("borrow vToken", async () => { - const busdUserBal = await BUSD.balanceOf(busdHolder.address); + const busdUserBal = await USDT.balanceOf(usdtHolder.address); - expect(await vBUSD.connect(busdHolder).borrow(1000)).to.emit(vBUSD, "Borrow"); + await expect(vUSDT.connect(usdtHolder).borrow(1000)).to.emit(vUSDT, "Borrow"); - expect((await BUSD.balanceOf(busdHolder.address)).toString()).to.equal(busdUserBal.add(1000)); + expect((await USDT.balanceOf(usdtHolder.address)).toString()).to.equal(busdUserBal.add(1000)); }); it("Repay vToken", async () => { - const busdUserBal = await BUSD.balanceOf(busdHolder.address); + await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - expect(await vBUSD.connect(busdHolder).borrow(1000)).to.emit(vBUSD, "Borrow"); + const busdUserBal = await USDT.balanceOf(usdtHolder.address); + await vUSDT.connect(usdtHolder).borrow(1000); - expect((await BUSD.balanceOf(busdHolder.address)).toString()).to.equal(busdUserBal.add(1000)); + expect((await USDT.balanceOf(usdtHolder.address)).toString()).to.greaterThan(busdUserBal); - expect(await vBUSD.connect(busdHolder).repayBorrow(1000)).to.emit(vBUSD, "RepayBorrow"); + await vUSDT.connect(usdtHolder).repayBorrow(1000); - const balanceAfterRepay = await BUSD.balanceOf(busdHolder.address); + const balanceAfterRepay = await USDT.balanceOf(usdtHolder.address); expect(balanceAfterRepay).to.equal(busdUserBal); }); }); diff --git a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json index 60a07ca57..61a6184cf 100644 --- a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json +++ b/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json @@ -1,18 +1,30 @@ { "cutParams": [ [ - "0x981e47f3Fd5A497280Fb9adD5791F155Eb9D7c6F", + "0xfFFd0247675DAF20462D9756046E82c3Dbda6092", 0, - ["0xa76b3fda", "0x929fe9a1", "0xc2998238", "0xede4edd0", "0xabfceffc", "0x007e3dd2", "0xc488847b"] + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0xa78dc775", + "0xddbf54fd" + ] ], [ - "0xD97212b66b158C3CF8E869E3cCc4d21A0193a7D6", + "0x830BaCB758Ace1fecaAdD18FE1b996d9Ee5ad99e", 0, [ "0xead1a8a0", "0xda3d454c", "0x5c778605", "0x5ec88c79", + "0x4e79238f", "0x5fc7e71e", "0x47ef3b3b", "0x4ef4c3e1", @@ -28,7 +40,7 @@ ] ], [ - "0x01C9caD8F9fe08397b1737F71865067dC08237d8", + "0x3C115aA5800A589D1E0c3163f3f562D5544F060f", 0, [ "0xa7604b41", @@ -38,14 +50,12 @@ "0xadcd5fb9", "0xd09c54ba", "0x7858524d", - "0x42cbb15c", "0xbf32442d", - "0xededbae6", - "0xddfd287e" + "0xededbae6" ] ], [ - "0x06c98127900274eeB636B1957287D2C76C0cb476", + "0xf641369CeaA090Bcfb29aa01C585913796998fA7", 0, [ "0xf519fc30", @@ -53,6 +63,7 @@ "0x317b0b77", "0xe4028eee", "0x9bf34cbb", + "0x522c656b", "0x4fd42e17", "0xbb857450", "0x607ef6c1", diff --git a/vips/vip-Diamond-comptroller-testnet.ts b/vips/vip-Diamond-comptroller-testnet.ts index 779749568..fa6283317 100644 --- a/vips/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-Diamond-comptroller-testnet.ts @@ -3,8 +3,8 @@ import { ProposalType } from "../src/types"; import { makeProposal } from "../src/utils"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const DIAMOND = "0x52B88fc3F47f607DdcE4048c243050B7576e9cbD"; -const ACM = "0x45f8a08f534f34a97187626e05d4b6648eeaa9aa"; +const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; +const ACM = "0x69a9e5dee4007fb1311c4d086fed4803e09a30b5"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const cutParams = params; From d3644d2d82df18a019b4a203c24f4e5583c36dd0 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Tue, 12 Sep 2023 23:37:00 +0530 Subject: [PATCH 11/24] fix: lint issues --- .../simulations.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index 256f67ad1..df5220bbc 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -58,8 +58,6 @@ forking(33272635, async () => { const markets: any = {}; let BUSD: Contract; - let USDT: Contract; - let usdtHolder: Signer; let busdHolder: Signer; let vBUSD: Contract; let vUSDT: Contract; @@ -81,15 +79,13 @@ forking(33272635, async () => { busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); - usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); - [vBUSD, vUSDT] = await Promise.all( [VBUSD, VUSDT].map((address: string) => { return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); }), ); - [BUSD, USDT] = await Promise.all( + [BUSD] = await Promise.all( [vBUSD].map(async (vToken: any) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); @@ -357,11 +353,8 @@ forking(33272635, async () => { forking(33272635, async () => { let owner, unitroller; - let BUSD: Contract; let USDT: Contract; - let busdHolder: Signer; let usdtHolder: Signer; - let vBUSD: Contract; let vUSDT: Contract; let diamondUnitroller: Contract; @@ -380,17 +373,15 @@ forking(33272635, async () => { data: undefined, }); - busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); - usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); - [vBUSD, vUSDT] = await Promise.all( - [VBUSD, VUSDT].map((address: string) => { + [vUSDT] = await Promise.all( + [VUSDT].map((address: string) => { return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); }), ); - [BUSD, USDT] = await Promise.all( - [vBUSD, vUSDT].map(async (vToken: any) => { + [USDT] = await Promise.all( + [vUSDT].map(async (vToken: any) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); }), From be0cf490a06d3861443b1bfd6bb6e4ffdd6c1b5f Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Fri, 15 Sep 2023 14:36:17 +0530 Subject: [PATCH 12/24] fix: pr comments --- .../simulations.ts | 116 +++++++++--------- vips/vip-Diamond-comptroller-testnet.ts | 38 ++++-- 2 files changed, 88 insertions(+), 66 deletions(-) diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller-testnet/simulations.ts index df5220bbc..b9a26550b 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller-testnet/simulations.ts @@ -1,9 +1,10 @@ import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; -import { Contract, Signer } from "ethers"; +import { BigNumberish, Contract, Signer } from "ethers"; import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; +import { initMainnetUser } from "../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../src/vip-framework"; import { vipDiamondTestnet } from "../../vips/vip-Diamond-comptroller-testnet"; import Comptroller from "./abi/Comptroller.json"; @@ -14,42 +15,37 @@ const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; const Owner = "0xce10739590001705F7FF231611ba4A48B2820327"; -const zeroAddr = "0x0000000000000000000000000000000000000000"; +const zeroAddr = ethers.constants.AddressZero; const VBUSD = "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4"; const VUSDT = "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A"; -const initMainnetUser = async (user: string) => { - await impersonateAccount(user); - return ethers.getSigner(user); -}; - forking(33272635, async () => { - let owner: any, + let owner: Signer, unitroller: Contract, // layout variables - oracle: any, - maxAssets: any, - closeFactorMantissa: any, - liquidationIncentiveMantissa: any, - allMarkets: any, + oracle: Contract, + maxAssets: BigNumberish, + closeFactorMantissa: BigNumberish, + liquidationIncentiveMantissa: BigNumberish, + allMarkets: Array, venusSupplyState: any, venusBorrowState: any, - venusAccrued: any, - vaiMintRate: any, - vaiController: any, - mintedVAIs: any, - mintVAIGuardianPaused: any, - repayVAIGuardianPaused: any, - protocolPaused: any, - venusVAIVaultRate: any, - vaiVaultAddress: any, - releaseStartBlock: any, - minReleaseAmount: any, - treasuryGuardian: any, - treasuryAddress: any, - treasuryPercent: any, - liquidatorContract: any, - comptrollerLens: any; + venusAccrued: BigNumberish, + vaiMintRate: BigNumberish, + vaiController: Contract, + mintedVAIs: BigNumberish, + mintVAIGuardianPaused: boolean, + repayVAIGuardianPaused: boolean, + protocolPaused: boolean, + venusVAIVaultRate: BigNumberish, + vaiVaultAddress: string, + releaseStartBlock: BigNumberish, + minReleaseAmount: BigNumberish, + treasuryGuardian: boolean, + treasuryAddress: string, + treasuryPercent: BigNumberish, + liquidatorContract: Contract, + comptrollerLens: Contract; const borrowSpeeds: any = {}; const supplySpeeds: any = {}; @@ -72,12 +68,12 @@ forking(33272635, async () => { owner = await ethers.getSigner(Owner); const [signer] = await ethers.getSigners(); await signer.sendTransaction({ - to: owner.address, + to: await owner.getAddress(), value: ethers.BigNumber.from("10000000000000000000"), data: undefined, }); - busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888"); + busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888", parseUnits("1000", 18)); [vBUSD, vUSDT] = await Promise.all( [VBUSD, VUSDT].map((address: string) => { @@ -86,7 +82,7 @@ forking(33272635, async () => { ); [BUSD] = await Promise.all( - [vBUSD].map(async (vToken: any) => { + [vBUSD].map(async (vToken: Contract) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); }), @@ -133,7 +129,7 @@ forking(33272635, async () => { vaiController = await unitroller.vaiController(); - mintedVAIs = await unitroller.mintedVAIs(busdHolder.address); + mintedVAIs = await unitroller.mintedVAIs(await busdHolder.getAddress()); mintVAIGuardianPaused = await unitroller.mintVAIGuardianPaused(); @@ -169,8 +165,14 @@ forking(33272635, async () => { supplySpeeds[marketAddress] = await unitroller.venusSupplySpeeds(marketAddress); markets[marketAddress] = await unitroller.markets(marketAddress); - userBorrowIndexes[marketAddress] = await unitroller.venusBorrowerIndex(marketAddress, busdHolder.address); - userSupplyIndexes[marketAddress] = await unitroller.venusSupplierIndex(marketAddress, busdHolder.address); + userBorrowIndexes[marketAddress] = await unitroller.venusBorrowerIndex( + marketAddress, + await busdHolder.getAddress(), + ); + userSupplyIndexes[marketAddress] = await unitroller.venusSupplierIndex( + marketAddress, + await busdHolder.getAddress(), + ); } }); }); @@ -225,7 +227,7 @@ forking(33272635, async () => { const vaiControllerUpgrade = await diamondUnitroller.vaiController(); expect(vaiControllerUpgrade).to.equal(vaiController); - const mintedVAIsUpgrade = await diamondUnitroller.mintedVAIs(busdHolder.address); + const mintedVAIsUpgrade = await diamondUnitroller.mintedVAIs(await busdHolder.getAddress()); expect(mintedVAIsUpgrade).to.equal(mintedVAIs); const mintVAIGuardianPausedUpgrade = await diamondUnitroller.mintVAIGuardianPaused(); @@ -278,8 +280,14 @@ forking(33272635, async () => { expect(borrowSpeeds[marketAddress]).to.equal(venusBorrowSpeed); expect(supplySpeeds[marketAddress]).to.equal(venusSupplySpeed); - const userBorrowIndex = await diamondUnitroller.venusBorrowerIndex(marketAddress, busdHolder.address); - const userSupplyIndex = await diamondUnitroller.venusSupplierIndex(marketAddress, busdHolder.address); + const userBorrowIndex = await diamondUnitroller.venusBorrowerIndex( + marketAddress, + await busdHolder.getAddress(), + ); + const userSupplyIndex = await diamondUnitroller.venusSupplierIndex( + marketAddress, + await busdHolder.getAddress(), + ); expect(userBorrowIndexes[marketAddress]).to.equal(userBorrowIndex); expect(userSupplyIndexes[marketAddress]).to.equal(userSupplyIndex); } @@ -316,8 +324,8 @@ forking(33272635, async () => { it("setting Pause Guardian", async () => { const currentPauseGuardia = (await diamondUnitroller.pauseGuardian()).toString(); - await diamondUnitroller.connect(owner)._setPauseGuardian(owner.address); - expect(await diamondUnitroller.pauseGuardian()).to.equal(owner.address); + await diamondUnitroller.connect(owner)._setPauseGuardian(await owner.getAddress()); + expect(await diamondUnitroller.pauseGuardian()).to.equal(await owner.getAddress()); await diamondUnitroller.connect(owner)._setPauseGuardian(currentPauseGuardia); expect(await diamondUnitroller.pauseGuardian()).to.equal(currentPauseGuardia); @@ -334,12 +342,8 @@ forking(33272635, async () => { it("pausing mint action in vBUSD", async () => { const isActionPaused = await diamondUnitroller.actionPaused(VBUSD, 0); - await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); - expect(await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], !isActionPaused)).to.emit( - vBUSD, - "ActionPausedMarket", - ); + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], !isActionPaused); await expect(await diamondUnitroller.actionPaused(VBUSD, 0)).to.be.equal(!isActionPaused); @@ -373,7 +377,7 @@ forking(33272635, async () => { data: undefined, }); - usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE"); + usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE", parseUnits("1000", 18)); [vUSDT] = await Promise.all( [VUSDT].map((address: string) => { @@ -381,7 +385,7 @@ forking(33272635, async () => { }), ); [USDT] = await Promise.all( - [vUSDT].map(async (vToken: any) => { + [vUSDT].map(async (vToken: Contract) => { const underlying = await vToken.underlying(); return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); }), @@ -398,13 +402,13 @@ forking(33272635, async () => { }); it("mint vToken vUSDT", async () => { const vBUSDBalance = await USDT.balanceOf(vUSDT.address); - const busdHolerBalance = await USDT.balanceOf(usdtHolder.address); + const busdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); - const newBusdHolerBalance = await USDT.balanceOf(usdtHolder.address); + const newBusdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); expect(newvBUSDBalance).greaterThan(vBUSDBalance); expect(newBusdHolerBalance).lessThan(busdHolerBalance); @@ -414,32 +418,32 @@ forking(33272635, async () => { await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); - const vUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(usdtHolder.address); + const vUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(await usdtHolder.getAddress()); await expect(vUSDT.connect(usdtHolder).redeem(2000)).to.emit(vUSDT, "Redeem"); - const newVUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(usdtHolder.address); + const newVUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(await usdtHolder.getAddress()); expect(newVUSDTUserBal).to.equal(vUSDTUserBal.sub(2000)); }); it("borrow vToken", async () => { - const busdUserBal = await USDT.balanceOf(usdtHolder.address); + const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); await expect(vUSDT.connect(usdtHolder).borrow(1000)).to.emit(vUSDT, "Borrow"); - expect((await USDT.balanceOf(usdtHolder.address)).toString()).to.equal(busdUserBal.add(1000)); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(busdUserBal.add(1000)); }); it("Repay vToken", async () => { await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - const busdUserBal = await USDT.balanceOf(usdtHolder.address); + const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); await vUSDT.connect(usdtHolder).borrow(1000); - expect((await USDT.balanceOf(usdtHolder.address)).toString()).to.greaterThan(busdUserBal); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(busdUserBal); await vUSDT.connect(usdtHolder).repayBorrow(1000); - const balanceAfterRepay = await USDT.balanceOf(usdtHolder.address); + const balanceAfterRepay = await USDT.balanceOf(await usdtHolder.getAddress()); expect(balanceAfterRepay).to.equal(busdUserBal); }); }); diff --git a/vips/vip-Diamond-comptroller-testnet.ts b/vips/vip-Diamond-comptroller-testnet.ts index fa6283317..8aaa3cdcf 100644 --- a/vips/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-Diamond-comptroller-testnet.ts @@ -6,8 +6,35 @@ const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; const ACM = "0x69a9e5dee4007fb1311c4d086fed4803e09a30b5"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const PAUSE_GUARDIAN_MULTISIG = "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706"; const cutParams = params; +interface GrantAccess { + target: string; + signature: string; + params: Array; +} + +const grantAccessControl = () => { + const accessProposals: Array = []; + [NORMAL_TIMELOCK, FAST_TRACK_TIMELOCK, CRITICAL_TIMELOCK, PAUSE_GUARDIAN_MULTISIG].map(target => { + accessProposals.push({ + target: ACM, + signature: "revokeCallPermission(address,string,address)", + params: [UNITROLLER, "_setActionsPaused(address[],uint256[],bool)", target], + }); + accessProposals.push({ + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [UNITROLLER, "_setActionsPaused(address[],uint8[],bool)", target], + }); + }); + + return accessProposals; +}; + export const vipDiamondTestnet = () => { const meta = { version: "v1", @@ -36,16 +63,7 @@ export const vipDiamondTestnet = () => { signature: "diamondCut((address,uint8,bytes4[])[])", params: [cutParams], }, - { - target: ACM, - signature: "revokeCallPermission(address,string,address)", - params: [UNITROLLER, "_setActionsPaused(address[],uint256[],bool)", NORMAL_TIMELOCK], - }, - { - target: ACM, - signature: "giveCallPermission(address,string,address)", - params: [UNITROLLER, "_setActionsPaused(address[],uint8[],bool)", NORMAL_TIMELOCK], - }, + ...grantAccessControl(), ], meta, ProposalType.REGULAR, From 109cfc1089c13624a00885809d178ecfe63b6a27 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 18 Sep 2023 18:11:37 +0530 Subject: [PATCH 13/24] feat: vip for diamond comptroller mainnet --- .../abi/Comptroller.json | 0 .../abi/IERC20UpgradableAbi.json | 0 .../abi/VBep20DelegateAbi.json | 0 .../abi/priceOracleAbi.json | 0 .../scripts/diamond.ts | 0 .../scripts/facet-cut-params-generator.ts | 0 .../simulations.ts | 6 +- .../utils/cut-params-testnet.json | 0 .../abi/Comptroller.json | 2782 +++++++++++++++++ .../abi/IERC20UpgradableAbi.json | 295 ++ .../abi/VBep20DelegateAbi.json | 1539 +++++++++ .../abi/priceOracleAbi.json | 154 + .../scripts/diamond.ts | 82 + .../scripts/facet-cut-params-generator.ts | 109 + .../vip-diamond-comptroller/simulations.ts | 450 +++ .../utils/cut-params.json | 3 + .../vip-Diamond-comptroller-testnet.ts | 6 +- .../vip-Diamond-comptroller.ts | 71 + 18 files changed, 5491 insertions(+), 6 deletions(-) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/abi/Comptroller.json (100%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json (100%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json (100%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json (100%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/scripts/diamond.ts (100%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts (100%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/simulations.ts (98%) rename simulations/{ => vip-diamond-comptroller}/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json (100%) create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts create mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json rename vips/{ => vip-diamond-comptroller}/vip-Diamond-comptroller-testnet.ts (91%) create mode 100644 vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts diff --git a/simulations/vip-diamond-comptroller-testnet/abi/Comptroller.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/Comptroller.json similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/abi/Comptroller.json rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/Comptroller.json diff --git a/simulations/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json diff --git a/simulations/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json diff --git a/simulations/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json diff --git a/simulations/vip-diamond-comptroller-testnet/scripts/diamond.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/diamond.ts similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/scripts/diamond.ts rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/diamond.ts diff --git a/simulations/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts diff --git a/simulations/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts similarity index 98% rename from simulations/vip-diamond-comptroller-testnet/simulations.ts rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts index b9a26550b..493dd9e81 100644 --- a/simulations/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts @@ -4,9 +4,9 @@ import { BigNumberish, Contract, Signer } from "ethers"; import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; -import { initMainnetUser } from "../../src/utils"; -import { forking, pretendExecutingVip, testVip } from "../../src/vip-framework"; -import { vipDiamondTestnet } from "../../vips/vip-Diamond-comptroller-testnet"; +import { initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { vipDiamondTestnet } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet"; import Comptroller from "./abi/Comptroller.json"; import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; diff --git a/simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json similarity index 100% rename from simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json rename to simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json new file mode 100644 index 000000000..fb2b4582e --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/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-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json new file mode 100644 index 000000000..374b04c75 --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json @@ -0,0 +1,295 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, + { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, + { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } + ], + "name": "MetaTransactionExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ERC712_VERSION", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PREDICATE_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "userAddress", "type": "address" }, + { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, + { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, + { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, + { "internalType": "uint8", "name": "sigV", "type": "uint8" } + ], + "name": "executeMetaTransaction", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "getChainId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeperator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getNonce", + "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "getRoleMember", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleMemberCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json new file mode 100644 index 000000000..0f6421ac5 --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json @@ -0,0 +1,1539 @@ +[ + { + "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" + } + ], + "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" + } + ], + "name": "MintBehalf", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "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": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "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": "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": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "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": 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-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json new file mode 100644 index 000000000..2eb50681a --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json @@ -0,0 +1,154 @@ +[ + { + "inputs": [{ "internalType": "uint256", "name": "maxStalePeriod_", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "feed", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "symbol", "type": "string" } + ], + "name": "FeedSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMaxStalePeriod", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMaxStalePeriod", "type": "uint256" } + ], + "name": "MaxStalePeriodUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "previousPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "requestedPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newPriceMantissa", "type": "uint256" } + ], + "name": "PricePosted", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], + "name": "assetPrices", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "string", "name": "symbol", "type": "string" }], + "name": "getFeed", + "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], + "name": "getUnderlyingPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isPriceOracle", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxStalePeriod", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newAdmin", "type": "address" }], + "name": "setAdmin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setDirectPrice", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "address", "name": "feed", "type": "address" } + ], + "name": "setFeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newMaxStalePeriod", "type": "uint256" }], + "name": "setMaxStalePeriod", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "contract VToken", "name": "vToken", "type": "address" }, + { "internalType": "uint256", "name": "underlyingPriceMantissa", "type": "uint256" } + ], + "name": "setUnderlyingPrice", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts new file mode 100644 index 000000000..27adab39a --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts @@ -0,0 +1,82 @@ +import { ethers } from "hardhat"; + +const FacetCutAction = { Add: 0, Replace: 1, Remove: 2 }; + +// get function selectors from ABI +function getSelectors(contract: any) { + const signatures = Object.keys(contract.interface.functions); + const selectors: any = signatures.reduce((acc: any, val) => { + if (val !== "init(bytes)") { + acc.push(contract.interface.getSighash(val)); + } + return acc; + }, []); + selectors.contract = contract; + selectors.remove = remove; + selectors.get = get; + return selectors; +} + +// get function selector from function signature +function getSelector(func: any) { + const abiInterface = new ethers.utils.Interface([func]); + return abiInterface.getSighash(ethers.utils.Fragment.from(func)); +} + +// used with getSelectors to remove selectors from an array of selectors +// functionNames argument is an array of function signatures +function remove(functionNames: any) { + const selectors = this.filter(v => { + for (const functionName of functionNames) { + if (v === this.contract.interface.getSighash(functionName)) { + return false; + } + } + return true; + }); + selectors.contract = this.contract; + selectors.remove = this.remove; + selectors.get = this.get; + return selectors; +} + +// used with getSelectors to get selectors from an array of selectors +// functionNames argument is an array of function signatures +function get(functionNames) { + const selectors = this.filter(v => { + for (const functionName of functionNames) { + if (v === this.contract.interface.getSighash(functionName)) { + return true; + } + } + return false; + }); + selectors.contract = this.contract; + selectors.remove = this.remove; + selectors.get = this.get; + return selectors; +} + +// remove selectors using an array of signatures +function removeSelectors(selectors, signatures) { + const iface = new ethers.utils.Interface(signatures.map(v => "function " + v)); + const removeSelectors = signatures.map(v => iface.getSighash(v)); + selectors = selectors.filter(v => !removeSelectors.includes(v)); + return selectors; +} + +// find a particular address position in the return value of diamondLoupeFacet.facets() +function findAddressPositionInFacets(facetAddress, facets) { + for (let i = 0; i < facets.length; i++) { + if (facets[i].facetAddress === facetAddress) { + return i; + } + } +} + +exports.getSelectors = getSelectors; +exports.getSelector = getSelector; +exports.FacetCutAction = FacetCutAction; +exports.remove = remove; +exports.removeSelectors = removeSelectors; +exports.findAddressPositionInFacets = findAddressPositionInFacets; diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts new file mode 100644 index 000000000..0f0c5c41a --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts @@ -0,0 +1,109 @@ +import fs from "fs"; +import { ethers } from "hardhat"; + +import { FacetCutAction, getSelectors } from "./diamond"; + +/** + * This script is used to generate the cut-params which will be used in diamond proxy vip + * to add diamond facets + */ + +// Insert the addresses of the deployed facets to generate thecut params according for the same. +const facetsAddresses: any = { + MarketFacet: "", + PolicyFacet: "", + RewardFacet: "", + SetterFacet: "", +}; + +// Set actions to the cut params to perform +// i.e. Add, Remove, Replace function selectors in the mapping. +const facetsActions: any = { + MarketFacet: FacetCutAction.Add, + PolicyFacet: FacetCutAction.Add, + RewardFacet: FacetCutAction.Add, + SetterFacet: FacetCutAction.Add, +}; + +// Set interfaces for the setters to generate function selectors from +const FacetsInterfaces: any = { + MarketFacet: "IMarketFacet", + PolicyFacet: "IPolicyFacet", + RewardFacet: "IRewardFacet", + SetterFacet: "ISetterFacet", +}; + +// Facets for which cute params need to generate +const FacetNames = ["MarketFacet", "PolicyFacet", "RewardFacet", "SetterFacet"]; + +// Name of the file to write the cut-params +const jsonFileName = "cur-params-test"; + +async function generateCutParams() { + const cut: any = []; + + for (const FacetName of FacetNames) { + const FacetInterface = await ethers.getContractAt(FacetsInterfaces[FacetName], facetsAddresses[FacetName]); + + switch (facetsActions[FacetName]) { + case FacetCutAction.Add: + cut.push({ + facetAddress: facetsAddresses[FacetName], + action: FacetCutAction.Add, + functionSelectors: getSelectors(FacetInterface), + }); + break; + case FacetCutAction.Remove: + cut.push({ + facetAddress: ethers.constants.AddressZero, + action: FacetCutAction.Remove, + functionSelectors: getSelectors(FacetInterface), + }); + break; + case FacetCutAction.Replace: + cut.push({ + facetAddress: facetsAddresses[FacetName], + action: FacetCutAction.Replace, + functionSelectors: getSelectors(FacetInterface), + }); + break; + default: + break; + } + } + + function getFunctionSelector(selectors: any) { + const functionSelector: any = []; + for (let i = 0; i < selectors.length; i++) { + if (selectors[i][0] == "0") { + functionSelector.push(selectors[i]); + } else { + break; + } + } + return functionSelector; + } + + function makeCutParam(cut: any) { + const cutParams = []; + for (let i = 0; i < cut.length; i++) { + const arr: any = new Array(3); + arr[0] = cut[i].facetAddress; + arr[1] = cut[i].action; + arr[2] = getFunctionSelector(cut[i].functionSelectors); + cutParams.push(arr); + } + return cutParams; + } + const cutParams = { cutParams: makeCutParam(cut) }; + + fs.writeFileSync(`./${jsonFileName}.json`, JSON.stringify(cutParams, null, 4)); + return cutParams; +} + +generateCutParams() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts new file mode 100644 index 000000000..c102369fd --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts @@ -0,0 +1,450 @@ +import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumberish, Contract, Signer } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { initMainnetUser } from "../../../src/utils"; +import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; +import { vipDiamondComptroller } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller"; +import Comptroller from "./abi/Comptroller.json"; +import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; +import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; + +const UNITROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const DIAMOND = ""; + +const Owner = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; +const zeroAddr = ethers.constants.AddressZero; +const VBUSD = "0x95c78222B3D6e262426483D42CfA53685A67Ab9D"; +const VUSDT = "0xfD5840Cd36d94D7229439859C0112a4185BC0255"; + +forking(33272635, async () => { + let owner: Signer, + unitroller: Contract, + // layout variables + oracle: Contract, + maxAssets: BigNumberish, + closeFactorMantissa: BigNumberish, + liquidationIncentiveMantissa: BigNumberish, + allMarkets: Array, + venusSupplyState: any, + venusBorrowState: any, + venusAccrued: BigNumberish, + vaiMintRate: BigNumberish, + vaiController: Contract, + mintedVAIs: BigNumberish, + mintVAIGuardianPaused: boolean, + repayVAIGuardianPaused: boolean, + protocolPaused: boolean, + venusVAIVaultRate: BigNumberish, + vaiVaultAddress: string, + releaseStartBlock: BigNumberish, + minReleaseAmount: BigNumberish, + treasuryGuardian: boolean, + treasuryAddress: string, + treasuryPercent: BigNumberish, + liquidatorContract: Contract, + comptrollerLens: Contract; + + const borrowSpeeds: any = {}; + const supplySpeeds: any = {}; + const userBorrowIndexes: any = {}; + const userSupplyIndexes: any = {}; + const markets: any = {}; + + let BUSD: Contract; + let busdHolder: Signer; + let vBUSD: Contract; + let vUSDT: Contract; + let diamondUnitroller: Contract; + + before(async () => { + unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); + + diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); + + await impersonateAccount(Owner); + owner = await ethers.getSigner(Owner); + const [signer] = await ethers.getSigners(); + await signer.sendTransaction({ + to: await owner.getAddress(), + value: ethers.BigNumber.from("10000000000000000000"), + data: undefined, + }); + + busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888", parseUnits("1000", 18)); + + [vBUSD, vUSDT] = await Promise.all( + [VBUSD, VUSDT].map((address: string) => { + return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); + }), + ); + + [BUSD] = await Promise.all( + [vBUSD].map(async (vToken: Contract) => { + const underlying = await vToken.underlying(); + return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); + }), + ); + }); + + describe("Verify Storage slots before vip execution", async () => { + // These tests checks the storage collision of comptroller while updating it via diamond. + describe("Diamond deployed successfully before vip execution", async () => { + it("Owner of Diamond unitroller contract should match", async () => { + const UnitrollerAdmin = await unitroller.admin(); + const pendingAdmin = await unitroller.pendingAdmin(); + expect(UnitrollerAdmin.toLowerCase()).to.equal(Owner.toLowerCase()); + expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); + }); + + it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + const comptrollerImplementation = await unitroller.comptrollerImplementation(); + const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); + expect(comptrollerImplementation.toLowerCase()).to.equal( + "0x9d062a805aec794a165cb1f7cedc6d848e83f3ba".toLowerCase(), + ); + expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); + }); + }); + + describe("Verify storage layout before vip execution", async () => { + it("verify all the state before and after upgrade", async () => { + oracle = await unitroller.oracle(); + + maxAssets = await unitroller.maxAssets(); + + closeFactorMantissa = await unitroller.closeFactorMantissa(); + + liquidationIncentiveMantissa = await unitroller.liquidationIncentiveMantissa(); + + venusSupplyState = await unitroller.venusSupplyState(BUSD.address); + + venusBorrowState = await unitroller.venusBorrowState(BUSD.address); + + venusAccrued = await unitroller.venusAccrued(BUSD.address); + + vaiMintRate = await unitroller.vaiMintRate(); + + vaiController = await unitroller.vaiController(); + + mintedVAIs = await unitroller.mintedVAIs(await busdHolder.getAddress()); + + mintVAIGuardianPaused = await unitroller.mintVAIGuardianPaused(); + + repayVAIGuardianPaused = await unitroller.repayVAIGuardianPaused(); + + protocolPaused = await unitroller.protocolPaused(); + + venusVAIVaultRate = await unitroller.venusVAIVaultRate(); + + vaiVaultAddress = await unitroller.vaiVaultAddress(); + + releaseStartBlock = await unitroller.releaseStartBlock(); + + minReleaseAmount = await unitroller.minReleaseAmount(); + + treasuryGuardian = await unitroller.treasuryGuardian(); + + treasuryAddress = await unitroller.treasuryAddress(); + + treasuryPercent = await unitroller.treasuryPercent(); + + liquidatorContract = await unitroller.liquidatorContract(); + + comptrollerLens = await unitroller.comptrollerLens(); + + // checking all public mappings + allMarkets = await unitroller.getAllMarkets(); + + for (const marketIndex in allMarkets) { + const marketAddress = allMarkets[marketIndex].toString(); + + borrowSpeeds[marketAddress] = await unitroller.venusBorrowSpeeds(marketAddress); + supplySpeeds[marketAddress] = await unitroller.venusSupplySpeeds(marketAddress); + markets[marketAddress] = await unitroller.markets(marketAddress); + + userBorrowIndexes[marketAddress] = await unitroller.venusBorrowerIndex( + marketAddress, + await busdHolder.getAddress(), + ); + userSupplyIndexes[marketAddress] = await unitroller.venusSupplierIndex( + marketAddress, + await busdHolder.getAddress(), + ); + } + }); + }); + }); + + testVip("VIP-Diamond Contract Migration", vipDiamondComptroller()); + + describe("Verify Storage slots after VIP execution", async () => { + // These tests checks the storage collision of comptroller while updating it via diamond. + describe("Diamond deployed successfully after VIP execution", async () => { + it("Owner of Diamond unitroller contract should match", async () => { + const diamondUnitrollerAdmin = await diamondUnitroller.admin(); + const pendingAdmin = await diamondUnitroller.pendingAdmin(); + expect(diamondUnitrollerAdmin.toLowerCase()).to.equal(Owner.toLowerCase()); + expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); + }); + + it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); + const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); + expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); + expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); + }); + }); + + describe("Verify storage layout after VIP execution", async () => { + it("verify all the state before and after upgrade", async () => { + const oracelUpgrade = await diamondUnitroller.oracle(); + expect(oracle).to.equal(oracelUpgrade); + + const maxAssetsAfterUpgrade = await diamondUnitroller.maxAssets(); + expect(maxAssets).to.equal(maxAssetsAfterUpgrade); + + const closeFactorMantissaAfterUpgrade = await diamondUnitroller.closeFactorMantissa(); + expect(closeFactorMantissa).to.equal(closeFactorMantissaAfterUpgrade); + + const liquidationIncentiveMantissaAfterUpgrade = await diamondUnitroller.liquidationIncentiveMantissa(); + expect(liquidationIncentiveMantissa).to.equal(liquidationIncentiveMantissaAfterUpgrade); + + const venusSupplyStateAfterUpgrade = await diamondUnitroller.venusSupplyState(BUSD.address); + expect(venusSupplyState.index.toString()).to.equal(venusSupplyStateAfterUpgrade.index.toString()); + + const venusBorrowStateAfterUpgrade = await diamondUnitroller.venusBorrowState(BUSD.address); + expect(venusBorrowState.index.toString()).to.equal(venusBorrowStateAfterUpgrade.index.toString()); + + const venusAccruedAfterUpgrade = await diamondUnitroller.venusAccrued(BUSD.address); + expect(venusAccrued).to.equal(venusAccruedAfterUpgrade); + + const vaiMintRateAfterUpgrade = await diamondUnitroller.vaiMintRate(); + expect(vaiMintRate).to.equal(vaiMintRateAfterUpgrade); + + const vaiControllerUpgrade = await diamondUnitroller.vaiController(); + expect(vaiControllerUpgrade).to.equal(vaiController); + + const mintedVAIsUpgrade = await diamondUnitroller.mintedVAIs(await busdHolder.getAddress()); + expect(mintedVAIsUpgrade).to.equal(mintedVAIs); + + const mintVAIGuardianPausedUpgrade = await diamondUnitroller.mintVAIGuardianPaused(); + expect(mintVAIGuardianPausedUpgrade).to.equal(mintVAIGuardianPaused); + + const repayVAIGuardianPausedUpgrade = await diamondUnitroller.repayVAIGuardianPaused(); + expect(repayVAIGuardianPausedUpgrade).to.equal(repayVAIGuardianPaused); + + const protocolPausedUpgrade = await diamondUnitroller.protocolPaused(); + expect(protocolPausedUpgrade).to.equal(protocolPaused); + + const venusVAIVaultRateUpgrade = await diamondUnitroller.venusVAIVaultRate(); + expect(venusVAIVaultRateUpgrade).to.equal(venusVAIVaultRate); + + const vaiVaultAddressUpgrade = await diamondUnitroller.vaiVaultAddress(); + expect(vaiVaultAddressUpgrade).to.equal(vaiVaultAddress); + + const releaseStartBlockUpgrade = await diamondUnitroller.releaseStartBlock(); + expect(releaseStartBlockUpgrade).to.equal(releaseStartBlock); + + const minReleaseAmountUpgrade = await diamondUnitroller.minReleaseAmount(); + expect(minReleaseAmountUpgrade).to.equal(minReleaseAmount); + + const treasuryGuardianUpgrade = await diamondUnitroller.treasuryGuardian(); + expect(treasuryGuardian).to.equal(treasuryGuardianUpgrade); + + const treasuryAddressUpgrade = await diamondUnitroller.treasuryAddress(); + expect(treasuryAddress).to.equal(treasuryAddressUpgrade); + + const treasuryPercentUpgrade = await diamondUnitroller.treasuryPercent(); + expect(treasuryPercent).to.equal(treasuryPercentUpgrade); + + const liquidatorContractUpgrade = await diamondUnitroller.liquidatorContract(); + expect(liquidatorContract).to.equal(liquidatorContractUpgrade); + + const comptrollerLensUpgrade = await diamondUnitroller.comptrollerLens(); + expect(comptrollerLens).to.equal(comptrollerLensUpgrade); + + // checking all public mappings + for (const marketIndex in allMarkets) { + const marketAddress = allMarkets[marketIndex].toString(); + + const marketUpgrade = await diamondUnitroller.markets(marketAddress); + expect(markets[marketAddress].collateralFactorMantissa).to.equal(marketUpgrade.collateralFactorMantissa); + expect(markets[marketAddress].isListed).to.equal(marketUpgrade.isListed); + expect(markets[marketAddress].isVenus).to.equal(marketUpgrade.isVenus); + + const venusBorrowSpeed = await diamondUnitroller.venusBorrowSpeeds(marketAddress); + const venusSupplySpeed = await diamondUnitroller.venusSupplySpeeds(marketAddress); + expect(borrowSpeeds[marketAddress]).to.equal(venusBorrowSpeed); + expect(supplySpeeds[marketAddress]).to.equal(venusSupplySpeed); + + const userBorrowIndex = await diamondUnitroller.venusBorrowerIndex( + marketAddress, + await busdHolder.getAddress(), + ); + const userSupplyIndex = await diamondUnitroller.venusSupplierIndex( + marketAddress, + await busdHolder.getAddress(), + ); + expect(userBorrowIndexes[marketAddress]).to.equal(userBorrowIndex); + expect(userSupplyIndexes[marketAddress]).to.equal(userSupplyIndex); + } + }); + }); + }); + + describe("Verify states of diamond Contract", () => { + describe("Diamond setters", () => { + it("setting market supply cap", async () => { + const currentSupplyCap = (await diamondUnitroller.supplyCaps(vBUSD.address)).toString(); + await diamondUnitroller.connect(owner)._setMarketSupplyCaps([vBUSD.address], [parseUnits("100000", 18)]); + expect(await diamondUnitroller.supplyCaps(vBUSD.address)).to.equals(parseUnits("100000", 18)); + await diamondUnitroller.connect(owner)._setMarketSupplyCaps([vBUSD.address], [parseUnits(currentSupplyCap, 0)]); + expect(await diamondUnitroller.supplyCaps(vBUSD.address)).to.equals(parseUnits(currentSupplyCap, 0)); + }); + + it("setting close factor", async () => { + const currentCloseFactor = (await diamondUnitroller.closeFactorMantissa()).toString(); + await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits("1", 17)); + expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits("1", 17)); + await diamondUnitroller.connect(owner)._setCloseFactor(parseUnits(currentCloseFactor, 0)); + expect(await diamondUnitroller.closeFactorMantissa()).to.equals(parseUnits(currentCloseFactor, 0)); + }); + + it("setting Liquidation Incentive", async () => { + await diamondUnitroller.connect(owner)._setLiquidationIncentive(parseUnits("13", 17)); + expect(await diamondUnitroller.liquidationIncentiveMantissa()).to.equal(parseUnits("13", 17)); + + await diamondUnitroller.connect(owner)._setLiquidationIncentive(parseUnits("11", 17)); + expect(await diamondUnitroller.liquidationIncentiveMantissa()).to.equal(parseUnits("11", 17)); + }); + + it("setting Pause Guardian", async () => { + const currentPauseGuardia = (await diamondUnitroller.pauseGuardian()).toString(); + + await diamondUnitroller.connect(owner)._setPauseGuardian(await owner.getAddress()); + expect(await diamondUnitroller.pauseGuardian()).to.equal(await owner.getAddress()); + + await diamondUnitroller.connect(owner)._setPauseGuardian(currentPauseGuardia); + expect(await diamondUnitroller.pauseGuardian()).to.equal(currentPauseGuardia); + }); + + it("setting market borrow cap", async () => { + const currentBorrowCap = (await diamondUnitroller.borrowCaps(vUSDT.address)).toString(); + await diamondUnitroller.connect(owner)._setMarketBorrowCaps([vUSDT.address], [parseUnits("10000", 18)]); + expect(await diamondUnitroller.borrowCaps(vUSDT.address)).to.equal(parseUnits("10000", 18)); + + await diamondUnitroller.connect(owner)._setMarketBorrowCaps([vUSDT.address], [currentBorrowCap]); + expect(await diamondUnitroller.borrowCaps(vUSDT.address)).to.equal(currentBorrowCap); + }); + + it("pausing mint action in vBUSD", async () => { + const isActionPaused = await diamondUnitroller.actionPaused(VBUSD, 0); + + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], !isActionPaused); + + await expect(await diamondUnitroller.actionPaused(VBUSD, 0)).to.be.equal(!isActionPaused); + + if (!isActionPaused) { + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); + } + }); + }); + }); +}); + +forking(33272635, async () => { + let owner, unitroller; + let USDT: Contract; + let usdtHolder: Signer; + let vUSDT: Contract; + let diamondUnitroller: Contract; + + before(async () => { + await pretendExecutingVip(vipDiamondComptroller()); + unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); + + diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); + + await impersonateAccount(Owner); + owner = await ethers.getSigner(Owner); + const [signer] = await ethers.getSigners(); + await signer.sendTransaction({ + to: owner.address, + value: ethers.BigNumber.from("10000000000000000000"), + data: undefined, + }); + + usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE", parseUnits("1000", 18)); + + [vUSDT] = await Promise.all( + [VUSDT].map((address: string) => { + return new ethers.Contract(address, VBEP20_DELEGATE_ABI, ethers.provider); + }), + ); + [USDT] = await Promise.all( + [vUSDT].map(async (vToken: Contract) => { + const underlying = await vToken.underlying(); + return new ethers.Contract(underlying, IERC20Upgradeable, ethers.provider); + }), + ); + await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); + }); + + describe("Diamond Hooks", () => { + it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); + const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); + expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); + expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); + }); + it("mint vToken vUSDT", async () => { + const vBUSDBalance = await USDT.balanceOf(vUSDT.address); + const busdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + + await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); + await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); + + const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); + const newBusdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + + expect(newvBUSDBalance).greaterThan(vBUSDBalance); + expect(newBusdHolerBalance).lessThan(busdHolerBalance); + }); + + it("redeem vToken", async () => { + await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); + await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); + + const vUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(await usdtHolder.getAddress()); + await expect(vUSDT.connect(usdtHolder).redeem(2000)).to.emit(vUSDT, "Redeem"); + const newVUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(await usdtHolder.getAddress()); + + expect(newVUSDTUserBal).to.equal(vUSDTUserBal.sub(2000)); + }); + + it("borrow vToken", async () => { + const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); + + await expect(vUSDT.connect(usdtHolder).borrow(1000)).to.emit(vUSDT, "Borrow"); + + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(busdUserBal.add(1000)); + }); + + it("Repay vToken", async () => { + await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); + + const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); + await vUSDT.connect(usdtHolder).borrow(1000); + + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(busdUserBal); + + await vUSDT.connect(usdtHolder).repayBorrow(1000); + + const balanceAfterRepay = await USDT.balanceOf(await usdtHolder.getAddress()); + expect(balanceAfterRepay).to.equal(busdUserBal); + }); + }); +}); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json new file mode 100644 index 000000000..1869f7ec4 --- /dev/null +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json @@ -0,0 +1,3 @@ +{ + "cutParams": [] +} diff --git a/vips/vip-Diamond-comptroller-testnet.ts b/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts similarity index 91% rename from vips/vip-Diamond-comptroller-testnet.ts rename to vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts index 8aaa3cdcf..33a586dac 100644 --- a/vips/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts @@ -1,6 +1,6 @@ -import { cutParams as params } from "../simulations/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json"; -import { ProposalType } from "../src/types"; -import { makeProposal } from "../src/utils"; +import { cutParams as params } from "../../simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json"; +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts b/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts new file mode 100644 index 000000000..df647ea4e --- /dev/null +++ b/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts @@ -0,0 +1,71 @@ +import { cutParams as params } from "../../simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json"; +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const UNITROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; +const DIAMOND = ""; +const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; +const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; +const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; +const CRITICAL_TIMELOCK = "0x213c446ec11e45b15a6E29C1C1b402B8897f606d"; +const PAUSE_GUARDIAN_MULTISIG = "0x1C2CAc6ec528c20800B2fe734820D87b581eAA6B"; +const cutParams = params; + +interface GrantAccess { + target: string; + signature: string; + params: Array; +} + +const grantAccessControl = () => { + const accessProposals: Array = []; + [NORMAL_TIMELOCK, FAST_TRACK_TIMELOCK, CRITICAL_TIMELOCK, PAUSE_GUARDIAN_MULTISIG].map(target => { + accessProposals.push({ + target: ACM, + signature: "revokeCallPermission(address,string,address)", + params: [UNITROLLER, "_setActionsPaused(address[],uint256[],bool)", target], + }); + accessProposals.push({ + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [UNITROLLER, "_setActionsPaused(address[],uint8[],bool)", target], + }); + }); + + return accessProposals; +}; + +export const vipDiamondComptroller = () => { + const meta = { + version: "v1", + title: "VIP Comptroller Diamond proxy", + description: `This vip implement diamond proxy for the comptroller to divide the comptroller logic into facets. The current implementation of the comptroller is exceeding the max limit of the contract size. To resolve this diamond proxy is implemented.`, + forDescription: + "I agree that Venus Protocol should proceed with the upgrading the Comptroller contract with diamond proxy", + againstDescription: "I do not think that Venus Protocol should proceed with the Comptroller contract upgradation", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not", + }; + + return makeProposal( + [ + { + target: UNITROLLER, + signature: "_setPendingImplementation(address)", + params: [DIAMOND], + }, + { + target: DIAMOND, + signature: "_become(address)", + params: [UNITROLLER], + }, + { + target: UNITROLLER, + signature: "diamondCut((address,uint8,bytes4[])[])", + params: [cutParams], + }, + ...grantAccessControl(), + ], + meta, + ProposalType.REGULAR, + ); +}; From 192dcf67ac257aa8d2f509bbc0606ed6982ab65a Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 20 Sep 2023 08:12:16 +0530 Subject: [PATCH 14/24] refactor: wip addresses changes for facets and diamond --- .../simulations.ts | 23 +++++++++---------- .../utils/cut-params-testnet.json | 10 ++++---- .../vip-Diamond-comptroller-testnet.ts | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts index 493dd9e81..3a1e1ad8d 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts @@ -12,14 +12,14 @@ import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; +const DIAMOND = "0x7e0298880224B8116F3462c50917249E94b3DC53"; const Owner = "0xce10739590001705F7FF231611ba4A48B2820327"; const zeroAddr = ethers.constants.AddressZero; const VBUSD = "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4"; const VUSDT = "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A"; -forking(33272635, async () => { +forking(33479987, async () => { let owner: Signer, unitroller: Contract, // layout variables @@ -103,7 +103,7 @@ forking(33272635, async () => { const comptrollerImplementation = await unitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal( - "0x9d062a805aec794a165cb1f7cedc6d848e83f3ba".toLowerCase(), + "0xa8a476ad16727ce641f27d7738d2d341ebad81cc".toLowerCase(), ); expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); }); @@ -190,7 +190,7 @@ forking(33272635, async () => { expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); }); - it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + it("Diamond Unitroller Implementation (comptroller) should match the comptroller implementation Address", async () => { const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); @@ -355,7 +355,7 @@ forking(33272635, async () => { }); }); -forking(33272635, async () => { +forking(33480500, async () => { let owner, unitroller; let USDT: Contract; let usdtHolder: Signer; @@ -393,25 +393,24 @@ forking(33272635, async () => { await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); }); - describe("Diamond Hooks", () => { + describe.only("Diamond Hooks", () => { it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); }); + it("mint vToken vUSDT", async () => { const vBUSDBalance = await USDT.balanceOf(vUSDT.address); - const busdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); - + const busdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); - + await vUSDT.connect(usdtHolder).mint(2000); const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); - const newBusdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + const newBusdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); expect(newvBUSDBalance).greaterThan(vBUSDBalance); - expect(newBusdHolerBalance).lessThan(busdHolerBalance); + expect(newBusdHolderBalance).lessThan(busdHolderBalance); }); it("redeem vToken", async () => { diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json index 61a6184cf..72c49cb44 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json @@ -1,7 +1,7 @@ { "cutParams": [ [ - "0xfFFd0247675DAF20462D9756046E82c3Dbda6092", + "0xBa70F1c3Fe2922992843Aa429DdE9d9Bfa163360", 0, [ "0xa76b3fda", @@ -17,7 +17,7 @@ ] ], [ - "0x830BaCB758Ace1fecaAdD18FE1b996d9Ee5ad99e", + "0x12eB32007a640eB71B5Fe412ea774CfB186aB220", 0, [ "0xead1a8a0", @@ -40,7 +40,7 @@ ] ], [ - "0x3C115aA5800A589D1E0c3163f3f562D5544F060f", + "0x34F3e6A812DaaB15803Aa9C38A22699d1Dfdc88A", 0, [ "0xa7604b41", @@ -55,7 +55,7 @@ ] ], [ - "0xf641369CeaA090Bcfb29aa01C585913796998fA7", + "0x144301235b35811C7eb7a838565F842766AE6B49", 0, [ "0xf519fc30", @@ -80,4 +80,4 @@ ] ] ] -} +} \ No newline at end of file diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts b/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts index 33a586dac..91488d3f4 100644 --- a/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts @@ -3,7 +3,7 @@ import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -const DIAMOND = "0xB2243Da976F2cbAAa4dd1a76BF7F6EFbe22c4CFc"; +const DIAMOND = "0x7e0298880224B8116F3462c50917249E94b3DC53"; const ACM = "0x69a9e5dee4007fb1311c4d086fed4803e09a30b5"; const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; From 6a97c31ec26162cbee771a919517c01604186f95 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 20 Sep 2023 11:34:56 +0530 Subject: [PATCH 15/24] refactor: changed facet and diamond addresses --- .../abi/Comptroller.json | 0 .../abi/IERC20UpgradableAbi.json | 0 .../abi/VBep20DelegateAbi.json | 0 .../abi/priceOracleAbi.json | 0 .../scripts/diamond.ts | 0 .../scripts/facet-cut-params-generator.ts | 0 .../simulations.ts | 14 +- .../utils/cut-params-testnet.json | 10 +- .../abi/Comptroller.json | 2782 ----------------- .../abi/IERC20UpgradableAbi.json | 295 -- .../abi/VBep20DelegateAbi.json | 1539 --------- .../abi/priceOracleAbi.json | 154 - .../scripts/diamond.ts | 82 - .../scripts/facet-cut-params-generator.ts | 109 - .../vip-diamond-comptroller/simulations.ts | 14 +- 15 files changed, 19 insertions(+), 4980 deletions(-) rename simulations/vip-diamond-comptroller/{vip-diamond-comptroller-testnet => }/abi/Comptroller.json (100%) rename simulations/vip-diamond-comptroller/{vip-diamond-comptroller-testnet => }/abi/IERC20UpgradableAbi.json (100%) rename simulations/vip-diamond-comptroller/{vip-diamond-comptroller-testnet => }/abi/VBep20DelegateAbi.json (100%) rename simulations/vip-diamond-comptroller/{vip-diamond-comptroller-testnet => }/abi/priceOracleAbi.json (100%) rename simulations/vip-diamond-comptroller/{vip-diamond-comptroller-testnet => }/scripts/diamond.ts (100%) rename simulations/vip-diamond-comptroller/{vip-diamond-comptroller-testnet => }/scripts/facet-cut-params-generator.ts (100%) delete mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json delete mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json delete mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json delete mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json delete mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts delete mode 100644 simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/Comptroller.json b/simulations/vip-diamond-comptroller/abi/Comptroller.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/Comptroller.json rename to simulations/vip-diamond-comptroller/abi/Comptroller.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json b/simulations/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/IERC20UpgradableAbi.json rename to simulations/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json b/simulations/vip-diamond-comptroller/abi/VBep20DelegateAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/VBep20DelegateAbi.json rename to simulations/vip-diamond-comptroller/abi/VBep20DelegateAbi.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json b/simulations/vip-diamond-comptroller/abi/priceOracleAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/abi/priceOracleAbi.json rename to simulations/vip-diamond-comptroller/abi/priceOracleAbi.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/diamond.ts b/simulations/vip-diamond-comptroller/scripts/diamond.ts similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/diamond.ts rename to simulations/vip-diamond-comptroller/scripts/diamond.ts diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts b/simulations/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/scripts/facet-cut-params-generator.ts rename to simulations/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts index 3a1e1ad8d..3be4283f4 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts @@ -7,9 +7,9 @@ import { ethers } from "hardhat"; import { initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; import { vipDiamondTestnet } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet"; -import Comptroller from "./abi/Comptroller.json"; -import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; -import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; +import Comptroller from "../abi/Comptroller.json"; +import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; +import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; const UNITROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; const DIAMOND = "0x7e0298880224B8116F3462c50917249E94b3DC53"; @@ -19,7 +19,7 @@ const zeroAddr = ethers.constants.AddressZero; const VBUSD = "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4"; const VUSDT = "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A"; -forking(33479987, async () => { +forking(33497000, async () => { let owner: Signer, unitroller: Contract, // layout variables @@ -99,7 +99,7 @@ forking(33479987, async () => { expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); }); - it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + it("Diamond Unitroller Implementation (comptroller) should match the old comptroller address", async () => { const comptrollerImplementation = await unitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal( @@ -355,7 +355,7 @@ forking(33479987, async () => { }); }); -forking(33480500, async () => { +forking(33497000, async () => { let owner, unitroller; let USDT: Contract; let usdtHolder: Signer; @@ -393,7 +393,7 @@ forking(33480500, async () => { await diamondUnitroller.connect(owner)._setActionsPaused([VBUSD], [0], false); }); - describe.only("Diamond Hooks", () => { + describe("Diamond Hooks", () => { it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { const comptrollerImplementation = await diamondUnitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await diamondUnitroller.pendingComptrollerImplementation(); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json index 72c49cb44..39f5e03c1 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json @@ -1,7 +1,7 @@ { "cutParams": [ [ - "0xBa70F1c3Fe2922992843Aa429DdE9d9Bfa163360", + "0x1B9806d9d2925e8Cd318E268e562eeb7e02C6E00", 0, [ "0xa76b3fda", @@ -17,7 +17,7 @@ ] ], [ - "0x12eB32007a640eB71B5Fe412ea774CfB186aB220", + "0xe13A002aff3c64A72F0b9eD72d7fd861C5E0F280", 0, [ "0xead1a8a0", @@ -40,7 +40,7 @@ ] ], [ - "0x34F3e6A812DaaB15803Aa9C38A22699d1Dfdc88A", + "0x19fB43e4b46DCB803208253E42F5D1800D2ACEca", 0, [ "0xa7604b41", @@ -55,7 +55,7 @@ ] ], [ - "0x144301235b35811C7eb7a838565F842766AE6B49", + "0x68f0C17bf638AB86024B923c643fD15d3A6FC28B", 0, [ "0xf519fc30", @@ -80,4 +80,4 @@ ] ] ] -} \ No newline at end of file +} diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json deleted file mode 100644 index fb2b4582e..000000000 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/Comptroller.json +++ /dev/null @@ -1,2782 +0,0 @@ -[ - { - "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-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json deleted file mode 100644 index 374b04c75..000000000 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json +++ /dev/null @@ -1,295 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" }, - { "indexed": false, "internalType": "address payable", "name": "relayerAddress", "type": "address" }, - { "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" } - ], - "name": "MetaTransactionExecuted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, - { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ERC712_VERSION", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PREDICATE_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "userAddress", "type": "address" }, - { "internalType": "bytes", "name": "functionSignature", "type": "bytes" }, - { "internalType": "bytes32", "name": "sigR", "type": "bytes32" }, - { "internalType": "bytes32", "name": "sigS", "type": "bytes32" }, - { "internalType": "uint8", "name": "sigV", "type": "uint8" } - ], - "name": "executeMetaTransaction", - "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getChainId", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainSeperator", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], - "name": "getNonce", - "outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], - "name": "getRoleAdmin", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "uint256", "name": "index", "type": "uint256" } - ], - "name": "getRoleMember", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], - "name": "getRoleMemberCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "hasRole", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "user", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json deleted file mode 100644 index 0f6421ac5..000000000 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/VBep20DelegateAbi.json +++ /dev/null @@ -1,1539 +0,0 @@ -[ - { - "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" - } - ], - "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" - } - ], - "name": "MintBehalf", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "oldComptroller", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract ComptrollerInterface", - "name": "newComptroller", - "type": "address" - } - ], - "name": "NewComptroller", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "contract InterestRateModel", - "name": "oldInterestRateModel", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract InterestRateModel", - "name": "newInterestRateModel", - "type": "address" - } - ], - "name": "NewMarketInterestRateModel", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldPendingAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newPendingAdmin", - "type": "address" - } - ], - "name": "NewPendingAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldReserveFactorMantissa", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newReserveFactorMantissa", - "type": "uint256" - } - ], - "name": "NewReserveFactor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "redeemer", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "Redeem", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "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": "admin", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reduceAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newTotalReserves", - "type": "uint256" - } - ], - "name": "ReservesReduced", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "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": "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": false, - "inputs": [ - { - "internalType": "uint256", - "name": "redeemTokens", - "type": "uint256" - } - ], - "name": "redeem", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "redeemAmount", - "type": "uint256" - } - ], - "name": "redeemUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "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": 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-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json deleted file mode 100644 index 2eb50681a..000000000 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/abi/priceOracleAbi.json +++ /dev/null @@ -1,154 +0,0 @@ -[ - { - "inputs": [{ "internalType": "uint256", "name": "maxStalePeriod_", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "feed", "type": "address" }, - { "indexed": false, "internalType": "string", "name": "symbol", "type": "string" } - ], - "name": "FeedSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "oldMaxStalePeriod", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newMaxStalePeriod", "type": "uint256" } - ], - "name": "MaxStalePeriodUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } - ], - "name": "NewAdmin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "asset", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "previousPriceMantissa", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "requestedPriceMantissa", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "newPriceMantissa", "type": "uint256" } - ], - "name": "PricePosted", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "admin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], - "name": "assetPrices", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "string", "name": "symbol", "type": "string" }], - "name": "getFeed", - "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "contract VToken", "name": "vToken", "type": "address" }], - "name": "getUnderlyingPrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isPriceOracle", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "maxStalePeriod", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "newAdmin", "type": "address" }], - "name": "setAdmin", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "asset", "type": "address" }, - { "internalType": "uint256", "name": "price", "type": "uint256" } - ], - "name": "setDirectPrice", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "string", "name": "symbol", "type": "string" }, - { "internalType": "address", "name": "feed", "type": "address" } - ], - "name": "setFeed", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "uint256", "name": "newMaxStalePeriod", "type": "uint256" }], - "name": "setMaxStalePeriod", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "contract VToken", "name": "vToken", "type": "address" }, - { "internalType": "uint256", "name": "underlyingPriceMantissa", "type": "uint256" } - ], - "name": "setUnderlyingPrice", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts deleted file mode 100644 index 27adab39a..000000000 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/diamond.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { ethers } from "hardhat"; - -const FacetCutAction = { Add: 0, Replace: 1, Remove: 2 }; - -// get function selectors from ABI -function getSelectors(contract: any) { - const signatures = Object.keys(contract.interface.functions); - const selectors: any = signatures.reduce((acc: any, val) => { - if (val !== "init(bytes)") { - acc.push(contract.interface.getSighash(val)); - } - return acc; - }, []); - selectors.contract = contract; - selectors.remove = remove; - selectors.get = get; - return selectors; -} - -// get function selector from function signature -function getSelector(func: any) { - const abiInterface = new ethers.utils.Interface([func]); - return abiInterface.getSighash(ethers.utils.Fragment.from(func)); -} - -// used with getSelectors to remove selectors from an array of selectors -// functionNames argument is an array of function signatures -function remove(functionNames: any) { - const selectors = this.filter(v => { - for (const functionName of functionNames) { - if (v === this.contract.interface.getSighash(functionName)) { - return false; - } - } - return true; - }); - selectors.contract = this.contract; - selectors.remove = this.remove; - selectors.get = this.get; - return selectors; -} - -// used with getSelectors to get selectors from an array of selectors -// functionNames argument is an array of function signatures -function get(functionNames) { - const selectors = this.filter(v => { - for (const functionName of functionNames) { - if (v === this.contract.interface.getSighash(functionName)) { - return true; - } - } - return false; - }); - selectors.contract = this.contract; - selectors.remove = this.remove; - selectors.get = this.get; - return selectors; -} - -// remove selectors using an array of signatures -function removeSelectors(selectors, signatures) { - const iface = new ethers.utils.Interface(signatures.map(v => "function " + v)); - const removeSelectors = signatures.map(v => iface.getSighash(v)); - selectors = selectors.filter(v => !removeSelectors.includes(v)); - return selectors; -} - -// find a particular address position in the return value of diamondLoupeFacet.facets() -function findAddressPositionInFacets(facetAddress, facets) { - for (let i = 0; i < facets.length; i++) { - if (facets[i].facetAddress === facetAddress) { - return i; - } - } -} - -exports.getSelectors = getSelectors; -exports.getSelector = getSelector; -exports.FacetCutAction = FacetCutAction; -exports.remove = remove; -exports.removeSelectors = removeSelectors; -exports.findAddressPositionInFacets = findAddressPositionInFacets; diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts deleted file mode 100644 index 0f0c5c41a..000000000 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts +++ /dev/null @@ -1,109 +0,0 @@ -import fs from "fs"; -import { ethers } from "hardhat"; - -import { FacetCutAction, getSelectors } from "./diamond"; - -/** - * This script is used to generate the cut-params which will be used in diamond proxy vip - * to add diamond facets - */ - -// Insert the addresses of the deployed facets to generate thecut params according for the same. -const facetsAddresses: any = { - MarketFacet: "", - PolicyFacet: "", - RewardFacet: "", - SetterFacet: "", -}; - -// Set actions to the cut params to perform -// i.e. Add, Remove, Replace function selectors in the mapping. -const facetsActions: any = { - MarketFacet: FacetCutAction.Add, - PolicyFacet: FacetCutAction.Add, - RewardFacet: FacetCutAction.Add, - SetterFacet: FacetCutAction.Add, -}; - -// Set interfaces for the setters to generate function selectors from -const FacetsInterfaces: any = { - MarketFacet: "IMarketFacet", - PolicyFacet: "IPolicyFacet", - RewardFacet: "IRewardFacet", - SetterFacet: "ISetterFacet", -}; - -// Facets for which cute params need to generate -const FacetNames = ["MarketFacet", "PolicyFacet", "RewardFacet", "SetterFacet"]; - -// Name of the file to write the cut-params -const jsonFileName = "cur-params-test"; - -async function generateCutParams() { - const cut: any = []; - - for (const FacetName of FacetNames) { - const FacetInterface = await ethers.getContractAt(FacetsInterfaces[FacetName], facetsAddresses[FacetName]); - - switch (facetsActions[FacetName]) { - case FacetCutAction.Add: - cut.push({ - facetAddress: facetsAddresses[FacetName], - action: FacetCutAction.Add, - functionSelectors: getSelectors(FacetInterface), - }); - break; - case FacetCutAction.Remove: - cut.push({ - facetAddress: ethers.constants.AddressZero, - action: FacetCutAction.Remove, - functionSelectors: getSelectors(FacetInterface), - }); - break; - case FacetCutAction.Replace: - cut.push({ - facetAddress: facetsAddresses[FacetName], - action: FacetCutAction.Replace, - functionSelectors: getSelectors(FacetInterface), - }); - break; - default: - break; - } - } - - function getFunctionSelector(selectors: any) { - const functionSelector: any = []; - for (let i = 0; i < selectors.length; i++) { - if (selectors[i][0] == "0") { - functionSelector.push(selectors[i]); - } else { - break; - } - } - return functionSelector; - } - - function makeCutParam(cut: any) { - const cutParams = []; - for (let i = 0; i < cut.length; i++) { - const arr: any = new Array(3); - arr[0] = cut[i].facetAddress; - arr[1] = cut[i].action; - arr[2] = getFunctionSelector(cut[i].functionSelectors); - cutParams.push(arr); - } - return cutParams; - } - const cutParams = { cutParams: makeCutParam(cut) }; - - fs.writeFileSync(`./${jsonFileName}.json`, JSON.stringify(cutParams, null, 4)); - return cutParams; -} - -generateCutParams() - .then(() => process.exit(0)) - .catch(error => { - console.error(error); - process.exit(1); - }); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts index c102369fd..b830fd4f4 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts @@ -7,9 +7,9 @@ import { ethers } from "hardhat"; import { initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; import { vipDiamondComptroller } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller"; -import Comptroller from "./abi/Comptroller.json"; -import IERC20Upgradeable from "./abi/IERC20UpgradableAbi.json"; -import VBEP20_DELEGATE_ABI from "./abi/VBep20DelegateAbi.json"; +import Comptroller from "../abi/Comptroller.json"; +import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; +import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; const UNITROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; const DIAMOND = ""; @@ -99,7 +99,7 @@ forking(33272635, async () => { expect(pendingAdmin.toLowerCase()).to.equal(zeroAddr); }); - it("Diamond Unitroller Implementation (comptroller) should match the diamond Proxy Address", async () => { + it("Diamond Unitroller Implementation (comptroller) should match the old comptroller address", async () => { const comptrollerImplementation = await unitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal( @@ -402,16 +402,16 @@ forking(33272635, async () => { }); it("mint vToken vUSDT", async () => { const vBUSDBalance = await USDT.balanceOf(vUSDT.address); - const busdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + const busdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); - const newBusdHolerBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + const newBusdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); expect(newvBUSDBalance).greaterThan(vBUSDBalance); - expect(newBusdHolerBalance).lessThan(busdHolerBalance); + expect(newBusdHolderBalance).lessThan(busdHolderBalance); }); it("redeem vToken", async () => { From b2edd66d184eaf862866d5252accbc5ab62c4a58 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 20 Sep 2023 12:26:19 +0530 Subject: [PATCH 16/24] refactor: changed variables names --- .../simulations.ts | 22 +++++++-------- .../vip-diamond-comptroller/simulations.ts | 27 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts index 3be4283f4..045c62884 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts @@ -402,15 +402,15 @@ forking(33497000, async () => { }); it("mint vToken vUSDT", async () => { - const vBUSDBalance = await USDT.balanceOf(vUSDT.address); - const busdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + const vUSDTBalance = await USDT.balanceOf(vUSDT.address); + const usdtHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); await vUSDT.connect(usdtHolder).mint(2000); - const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); - const newBusdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + const newvUSDTBalance = await USDT.balanceOf(vUSDT.address); + const newUsdtHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); - expect(newvBUSDBalance).greaterThan(vBUSDBalance); - expect(newBusdHolderBalance).lessThan(busdHolderBalance); + expect(newvUSDTBalance).greaterThan(vUSDTBalance); + expect(newUsdtHolderBalance).lessThan(usdtHolderBalance); }); it("redeem vToken", async () => { @@ -425,25 +425,25 @@ forking(33497000, async () => { }); it("borrow vToken", async () => { - const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); + const usdtUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); await expect(vUSDT.connect(usdtHolder).borrow(1000)).to.emit(vUSDT, "Borrow"); - expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(busdUserBal.add(1000)); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(usdtUserBal.add(1000)); }); it("Repay vToken", async () => { await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); + const usdtUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); await vUSDT.connect(usdtHolder).borrow(1000); - expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(busdUserBal); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(usdtUserBal); await vUSDT.connect(usdtHolder).repayBorrow(1000); const balanceAfterRepay = await USDT.balanceOf(await usdtHolder.getAddress()); - expect(balanceAfterRepay).to.equal(busdUserBal); + expect(balanceAfterRepay).to.equal(usdtUserBal); }); }); }); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts index b830fd4f4..b96782492 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts @@ -400,18 +400,17 @@ forking(33272635, async () => { expect(comptrollerImplementation.toLowerCase()).to.equal(DIAMOND.toLowerCase()); expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); }); - it("mint vToken vUSDT", async () => { - const vBUSDBalance = await USDT.balanceOf(vUSDT.address); - const busdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + it("mint vToken vUSDT", async () => { + const vUSDTBalance = await USDT.balanceOf(vUSDT.address); + const usdtHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); - - const newvBUSDBalance = await USDT.balanceOf(vUSDT.address); - const newBusdHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); + await vUSDT.connect(usdtHolder).mint(2000); + const newvUSDTBalance = await USDT.balanceOf(vUSDT.address); + const newUsdtHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); - expect(newvBUSDBalance).greaterThan(vBUSDBalance); - expect(newBusdHolderBalance).lessThan(busdHolderBalance); + expect(newvUSDTBalance).greaterThan(vUSDTBalance); + expect(newUsdtHolderBalance).lessThan(usdtHolderBalance); }); it("redeem vToken", async () => { @@ -426,25 +425,25 @@ forking(33272635, async () => { }); it("borrow vToken", async () => { - const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); + const usdtUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); await expect(vUSDT.connect(usdtHolder).borrow(1000)).to.emit(vUSDT, "Borrow"); - expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(busdUserBal.add(1000)); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(usdtUserBal.add(1000)); }); it("Repay vToken", async () => { await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - const busdUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); + const usdtUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); await vUSDT.connect(usdtHolder).borrow(1000); - expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(busdUserBal); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(usdtUserBal); await vUSDT.connect(usdtHolder).repayBorrow(1000); const balanceAfterRepay = await USDT.balanceOf(await usdtHolder.getAddress()); - expect(balanceAfterRepay).to.equal(busdUserBal); + expect(balanceAfterRepay).to.equal(usdtUserBal); }); }); }); From 68b5bd8ce52e650fa365bde4020d85b082b00002 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 21 Sep 2023 15:49:33 +0530 Subject: [PATCH 17/24] feat: added addresses for the facets for diamond comptroller mainnet --- .../vip-diamond-comptroller/simulations.ts | 4 +- .../utils/cut-params.json | 84 ++++++++++++++++++- .../vip-Diamond-comptroller.ts | 2 +- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts index b96782492..939e04303 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts @@ -12,7 +12,7 @@ import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; const UNITROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -const DIAMOND = ""; +const DIAMOND = "0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c"; const Owner = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const zeroAddr = ethers.constants.AddressZero; @@ -103,7 +103,7 @@ forking(33272635, async () => { const comptrollerImplementation = await unitroller.comptrollerImplementation(); const pendingComptrollerImplementation = await unitroller.pendingComptrollerImplementation(); expect(comptrollerImplementation.toLowerCase()).to.equal( - "0x9d062a805aec794a165cb1f7cedc6d848e83f3ba".toLowerCase(), + "0x909dd16b24CEf96c7be13065a9a0EAF8A126FFa5".toLowerCase(), ); expect(pendingComptrollerImplementation.toLowerCase()).to.equal(zeroAddr); }); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json index 1869f7ec4..880deaad1 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json @@ -1,3 +1,83 @@ { - "cutParams": [] -} + "cutParams": [ + [ + "0x40A30E1B01e0CF3eE3F22f769b0E437160550eEa", + 0, + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0xa78dc775", + "0xddbf54fd" + ] + ], + [ + "0xCE305b594A7714E9ed8eDE23c111aFf6A2d54E0e", + 0, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x71e7AAcb01C5764A56DB92aa31aA473e839d964F", + 0, + [ + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0xbf32442d", + "0xededbae6" + ] + ], + [ + "0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c", + 0, + [ + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x522c656b", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0xfd51a3ad" + ] + ] + ] +} \ No newline at end of file diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts b/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts index df647ea4e..3288eb676 100644 --- a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts +++ b/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts @@ -3,7 +3,7 @@ import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; const UNITROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -const DIAMOND = ""; +const DIAMOND = "0xAd69AA3811fE0EE7dBd4e25C4bae40e6422c76C8"; const ACM = "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555"; const NORMAL_TIMELOCK = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const FAST_TRACK_TIMELOCK = "0x555ba73dB1b006F3f2C7dB7126d6e4343aDBce02"; From d6c914513b29b17a1ea915fed1cb8c8b202b0fe4 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 21 Sep 2023 15:52:27 +0530 Subject: [PATCH 18/24] fix: lint issues --- .../utils/cut-params.json | 150 +++++++++--------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json index 880deaad1..902cc09fa 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json @@ -1,83 +1,83 @@ { "cutParams": [ + [ + "0x40A30E1B01e0CF3eE3F22f769b0E437160550eEa", + 0, [ - "0x40A30E1B01e0CF3eE3F22f769b0E437160550eEa", - 0, - [ - "0xa76b3fda", - "0x929fe9a1", - "0xc2998238", - "0xede4edd0", - "0xb0772d0b", - "0xabfceffc", - "0x007e3dd2", - "0xc488847b", - "0xa78dc775", - "0xddbf54fd" - ] - ], + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0xa78dc775", + "0xddbf54fd" + ] + ], + [ + "0xCE305b594A7714E9ed8eDE23c111aFf6A2d54E0e", + 0, [ - "0xCE305b594A7714E9ed8eDE23c111aFf6A2d54E0e", - 0, - [ - "0xead1a8a0", - "0xda3d454c", - "0x5c778605", - "0x5ec88c79", - "0x4e79238f", - "0x5fc7e71e", - "0x47ef3b3b", - "0x4ef4c3e1", - "0x41c728b9", - "0xeabe7d91", - "0x51dff989", - "0x24008a62", - "0x1ededc91", - "0xd02f7351", - "0x6d35bf91", - "0xbdcdc258", - "0x6a56947e" - ] - ], + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x71e7AAcb01C5764A56DB92aa31aA473e839d964F", + 0, [ - "0x71e7AAcb01C5764A56DB92aa31aA473e839d964F", - 0, - [ - "0xa7604b41", - "0xe85a2960", - "0x70bf66f0", - "0x86df31ee", - "0xadcd5fb9", - "0xd09c54ba", - "0x7858524d", - "0xbf32442d", - "0xededbae6" - ] - ], + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0xbf32442d", + "0xededbae6" + ] + ], + [ + "0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c", + 0, [ - "0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c", - 0, - [ - "0xf519fc30", - "0x2b5d790c", - "0x317b0b77", - "0xe4028eee", - "0x9bf34cbb", - "0x522c656b", - "0x4fd42e17", - "0xbb857450", - "0x607ef6c1", - "0x51a485e4", - "0x5f5af1aa", - "0x55ee1fe1", - "0x2a6a6065", - "0xd24febad", - "0x9cfdd9e6", - "0x2ec04124", - "0x4e0853db", - "0x6662c7c9", - "0xfd51a3ad" - ] + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x522c656b", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0xfd51a3ad" ] + ] ] -} \ No newline at end of file +} From 2c2f24436d66082c80f7a3dec41c368e5ca8cfff Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 21 Sep 2023 19:54:37 +0530 Subject: [PATCH 19/24] fix: mainnet simulations --- .../vip-diamond-comptroller/simulations.ts | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts index 939e04303..5d885d315 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts +++ b/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts @@ -12,14 +12,14 @@ import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; const UNITROLLER = "0xfD36E2c2a6789Db23113685031d7F16329158384"; -const DIAMOND = "0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c"; +const DIAMOND = "0xAd69AA3811fE0EE7dBd4e25C4bae40e6422c76C8"; const Owner = "0x939bD8d64c0A9583A7Dcea9933f7b21697ab6396"; const zeroAddr = ethers.constants.AddressZero; const VBUSD = "0x95c78222B3D6e262426483D42CfA53685A67Ab9D"; const VUSDT = "0xfD5840Cd36d94D7229439859C0112a4185BC0255"; -forking(33272635, async () => { +forking(31933620, async () => { let owner: Signer, unitroller: Contract, // layout variables @@ -73,7 +73,7 @@ forking(33272635, async () => { data: undefined, }); - busdHolder = await initMainnetUser("0xC825AD791A6046991e3706b6342970f6d87e4888", parseUnits("1000", 18)); + busdHolder = await initMainnetUser("0x8894E0a0c962CB723c1976a4421c95949bE2D4E3", parseUnits("1000", 18)); [vBUSD, vUSDT] = await Promise.all( [VBUSD, VUSDT].map((address: string) => { @@ -355,7 +355,7 @@ forking(33272635, async () => { }); }); -forking(33272635, async () => { +forking(31933620, async () => { let owner, unitroller; let USDT: Contract; let usdtHolder: Signer; @@ -377,7 +377,7 @@ forking(33272635, async () => { data: undefined, }); - usdtHolder = await initMainnetUser("0xa0747a72C329377C2CE4F0F3165197B3a5359EfE", parseUnits("1000", 18)); + usdtHolder = await initMainnetUser("0x8894E0a0c962CB723c1976a4421c95949bE2D4E3", parseUnits("1000", 18)); [vUSDT] = await Promise.all( [VUSDT].map((address: string) => { @@ -404,8 +404,8 @@ forking(33272635, async () => { it("mint vToken vUSDT", async () => { const vUSDTBalance = await USDT.balanceOf(vUSDT.address); const usdtHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); - await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - await vUSDT.connect(usdtHolder).mint(2000); + await USDT.connect(usdtHolder).approve(vUSDT.address, parseUnits("1", 18)); + await vUSDT.connect(usdtHolder).mint(parseUnits("1", 18)); const newvUSDTBalance = await USDT.balanceOf(vUSDT.address); const newUsdtHolderBalance = await USDT.balanceOf(await usdtHolder.getAddress()); @@ -414,33 +414,37 @@ forking(33272635, async () => { }); it("redeem vToken", async () => { - await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); - await expect(vUSDT.connect(usdtHolder).mint(2000)).to.emit(vUSDT, "Mint"); + await USDT.connect(usdtHolder).approve(vUSDT.address, parseUnits("1", 18)); + await expect(vUSDT.connect(usdtHolder).mint(parseUnits("1", 18))).to.emit(vUSDT, "Mint"); const vUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(await usdtHolder.getAddress()); - await expect(vUSDT.connect(usdtHolder).redeem(2000)).to.emit(vUSDT, "Redeem"); + await expect(vUSDT.connect(usdtHolder).redeem(parseUnits("1", 8))).to.emit(vUSDT, "Redeem"); const newVUSDTUserBal = await vUSDT.connect(usdtHolder).balanceOf(await usdtHolder.getAddress()); - expect(newVUSDTUserBal).to.equal(vUSDTUserBal.sub(2000)); + expect(newVUSDTUserBal).to.equal(vUSDTUserBal.sub(parseUnits("1", 8))); }); it("borrow vToken", async () => { const usdtUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); - await expect(vUSDT.connect(usdtHolder).borrow(1000)).to.emit(vUSDT, "Borrow"); + await expect(vUSDT.connect(usdtHolder).borrow(parseUnits("1", 18))).to.emit(vUSDT, "Borrow"); - expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal(usdtUserBal.add(1000)); + expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.equal( + usdtUserBal.add(parseUnits("1", 18)), + ); }); it("Repay vToken", async () => { - await USDT.connect(usdtHolder).approve(vUSDT.address, 2000); + await USDT.connect(usdtHolder).approve(vUSDT.address, parseUnits("1", 18)); + await expect(vUSDT.connect(usdtHolder).mint(parseUnits("1", 18))).to.emit(vUSDT, "Mint"); const usdtUserBal = await USDT.balanceOf(await usdtHolder.getAddress()); - await vUSDT.connect(usdtHolder).borrow(1000); + await vUSDT.connect(usdtHolder).borrow(parseUnits("0.5", 18)); expect((await USDT.balanceOf(await usdtHolder.getAddress())).toString()).to.greaterThan(usdtUserBal); - await vUSDT.connect(usdtHolder).repayBorrow(1000); + await USDT.connect(usdtHolder).approve(vUSDT.address, parseUnits("0.5", 18)); + await vUSDT.connect(usdtHolder).repayBorrow(parseUnits("0.5", 18)); const balanceAfterRepay = await USDT.balanceOf(await usdtHolder.getAddress()); expect(balanceAfterRepay).to.equal(usdtUserBal); From 2c719fb0295e123713e231d785616b1e80103fa0 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 25 Sep 2023 15:33:48 +0530 Subject: [PATCH 20/24] fix: renamed diamond comptroller vip files and folders --- .../abi/Comptroller.json | 0 .../abi/IERC20UpgradableAbi.json | 0 .../abi/VBep20DelegateAbi.json | 0 .../abi/priceOracleAbi.json | 0 .../scripts/diamond.ts | 0 .../scripts/facet-cut-params-generator.ts | 0 .../vip-174-testnet}/simulations.ts | 6 ++-- .../vip-174-testnet/utils/cut-params.json} | 0 .../vip-174}/simulations.ts | 6 ++-- .../vip-174}/utils/cut-params.json | 0 src/transactions.ts | 33 ++++++++++--------- .../vip-174-testnet.ts} | 4 +-- .../vip-174.ts} | 4 +-- 13 files changed, 28 insertions(+), 25 deletions(-) rename simulations/{vip-diamond-comptroller => vip-174}/abi/Comptroller.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/abi/IERC20UpgradableAbi.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/abi/VBep20DelegateAbi.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/abi/priceOracleAbi.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/scripts/diamond.ts (100%) rename simulations/{vip-diamond-comptroller => vip-174}/scripts/facet-cut-params-generator.ts (100%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller-testnet => vip-174/vip-174-testnet}/simulations.ts (98%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json => vip-174/vip-174-testnet/utils/cut-params.json} (100%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller => vip-174/vip-174}/simulations.ts (98%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller => vip-174/vip-174}/utils/cut-params.json (100%) rename vips/{vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts => vip-174/vip-174-testnet.ts} (93%) rename vips/{vip-diamond-comptroller/vip-Diamond-comptroller.ts => vip-174/vip-174.ts} (93%) diff --git a/simulations/vip-diamond-comptroller/abi/Comptroller.json b/simulations/vip-174/abi/Comptroller.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/Comptroller.json rename to simulations/vip-174/abi/Comptroller.json diff --git a/simulations/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json b/simulations/vip-174/abi/IERC20UpgradableAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json rename to simulations/vip-174/abi/IERC20UpgradableAbi.json diff --git a/simulations/vip-diamond-comptroller/abi/VBep20DelegateAbi.json b/simulations/vip-174/abi/VBep20DelegateAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/VBep20DelegateAbi.json rename to simulations/vip-174/abi/VBep20DelegateAbi.json diff --git a/simulations/vip-diamond-comptroller/abi/priceOracleAbi.json b/simulations/vip-174/abi/priceOracleAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/priceOracleAbi.json rename to simulations/vip-174/abi/priceOracleAbi.json diff --git a/simulations/vip-diamond-comptroller/scripts/diamond.ts b/simulations/vip-174/scripts/diamond.ts similarity index 100% rename from simulations/vip-diamond-comptroller/scripts/diamond.ts rename to simulations/vip-174/scripts/diamond.ts diff --git a/simulations/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts b/simulations/vip-174/scripts/facet-cut-params-generator.ts similarity index 100% rename from simulations/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts rename to simulations/vip-174/scripts/facet-cut-params-generator.ts diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-174/vip-174-testnet/simulations.ts similarity index 98% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts rename to simulations/vip-174/vip-174-testnet/simulations.ts index 045c62884..936b33c18 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-174/vip-174-testnet/simulations.ts @@ -6,7 +6,7 @@ import { ethers } from "hardhat"; import { initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { vipDiamondTestnet } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet"; +import { vip174Testnet } from "../../../vips/vip-174/vip-174-testnet"; import Comptroller from "../abi/Comptroller.json"; import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; @@ -178,7 +178,7 @@ forking(33497000, async () => { }); }); - testVip("VIP-Diamond Contract Migration", vipDiamondTestnet()); + testVip("VIP-Diamond Contract Migration", vip174Testnet()); describe("Verify Storage slots after VIP execution", async () => { // These tests checks the storage collision of comptroller while updating it via diamond. @@ -363,7 +363,7 @@ forking(33497000, async () => { let diamondUnitroller: Contract; before(async () => { - await pretendExecutingVip(vipDiamondTestnet()); + await pretendExecutingVip(vip174Testnet()); unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-174/vip-174-testnet/utils/cut-params.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json rename to simulations/vip-174/vip-174-testnet/utils/cut-params.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-174/vip-174/simulations.ts similarity index 98% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts rename to simulations/vip-174/vip-174/simulations.ts index 5d885d315..f010c30de 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts +++ b/simulations/vip-174/vip-174/simulations.ts @@ -6,7 +6,7 @@ import { ethers } from "hardhat"; import { initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { vipDiamondComptroller } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller"; +import { vip174 } from "../../../vips/vip-174/vip-174"; import Comptroller from "../abi/Comptroller.json"; import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; @@ -178,7 +178,7 @@ forking(31933620, async () => { }); }); - testVip("VIP-Diamond Contract Migration", vipDiamondComptroller()); + testVip("VIP-Diamond Contract Migration", vip174()); describe("Verify Storage slots after VIP execution", async () => { // These tests checks the storage collision of comptroller while updating it via diamond. @@ -363,7 +363,7 @@ forking(31933620, async () => { let diamondUnitroller: Contract; before(async () => { - await pretendExecutingVip(vipDiamondComptroller()); + await pretendExecutingVip(vip174()); unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json b/simulations/vip-174/vip-174/utils/cut-params.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json rename to simulations/vip-174/vip-174/utils/cut-params.json diff --git a/src/transactions.ts b/src/transactions.ts index e61d45028..5bfea322e 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -1,29 +1,32 @@ import { ethers } from "hardhat"; import { getCalldatas } from "./utils"; +import GOVERNOR_BRAVO_DELEGATE_ABI from "./vip-framework/abi/governorBravoDelegateAbi.json"; -const DEFAULT_GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; +const DEFAULT_GOVERNOR_PROXY = "0x5573422A1a59385C247ec3a66B93B7C08eC2f8f2"; export const loadProposal = async (num: string) => { - const x = await import(`../vips/vip-${num}.ts`); - return x[`vip${num}`](); + const x = await import("../vips/vip-174/vip-174-testnet"); + console.log("----------------------------XXX", x); + return x["vip174Testnet"](); }; -export const proposeVIP = async (vipNumber: string, governorProxyAddress?: string) => { +export const proposeVIP = async (vipNumber: string) => { const proposal = await loadProposal(vipNumber); + console.log("----------------------------proposal", proposal); - const { targets, signatures, values, meta } = proposal; + const [proposer] = await ethers.getSigners(); + const governorProxy = await ethers.getContractAt(GOVERNOR_BRAVO_DELEGATE_ABI, DEFAULT_GOVERNOR_PROXY); - const params = [targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type]; - let functionSignature = "function propose(address[],uint256[],string[],bytes[],string,uint8)"; + const { targets, signatures, values, meta } = proposal; - if (proposal.type === undefined || proposal.type === null) { - functionSignature = "function propose(address[],uint256[],string[],bytes[],string)"; - params.pop(); - } + await governorProxy + .connect(proposer) + .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type); - return { - target: governorProxyAddress ?? DEFAULT_GOVERNOR_PROXY, - calldata: new ethers.utils.Interface([functionSignature]).encodeFunctionData("propose", params), - }; + // await governorProxy + // .connect(proposer) + // .castVote(296, 1); }; + +proposeVIP(130); diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts b/vips/vip-174/vip-174-testnet.ts similarity index 93% rename from vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts rename to vips/vip-174/vip-174-testnet.ts index 91488d3f4..8818d3e7a 100644 --- a/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-174/vip-174-testnet.ts @@ -1,4 +1,4 @@ -import { cutParams as params } from "../../simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json"; +import { cutParams as params } from "../../simulations/vip-174/vip-174-testnet/utils/cut-params.json"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; @@ -35,7 +35,7 @@ const grantAccessControl = () => { return accessProposals; }; -export const vipDiamondTestnet = () => { +export const vip174Testnet = () => { const meta = { version: "v1", title: "VIP Comptroller Diamond proxy", diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts b/vips/vip-174/vip-174.ts similarity index 93% rename from vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts rename to vips/vip-174/vip-174.ts index 3288eb676..41c17d414 100644 --- a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts +++ b/vips/vip-174/vip-174.ts @@ -1,4 +1,4 @@ -import { cutParams as params } from "../../simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json"; +import { cutParams as params } from "../../simulations/vip-174/vip-174/utils/cut-params.json"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; @@ -35,7 +35,7 @@ const grantAccessControl = () => { return accessProposals; }; -export const vipDiamondComptroller = () => { +export const vip174 = () => { const meta = { version: "v1", title: "VIP Comptroller Diamond proxy", From c64f95b4c32083c120ea9025ea2b7399e01414a5 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 25 Sep 2023 15:54:25 +0530 Subject: [PATCH 21/24] refactor: vip-174 description --- vips/vip-174/vip-174.ts | 82 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/vips/vip-174/vip-174.ts b/vips/vip-174/vip-174.ts index 41c17d414..4ef506e23 100644 --- a/vips/vip-174/vip-174.ts +++ b/vips/vip-174/vip-174.ts @@ -37,13 +37,81 @@ const grantAccessControl = () => { export const vip174 = () => { const meta = { - version: "v1", - title: "VIP Comptroller Diamond proxy", - description: `This vip implement diamond proxy for the comptroller to divide the comptroller logic into facets. The current implementation of the comptroller is exceeding the max limit of the contract size. To resolve this diamond proxy is implemented.`, - forDescription: - "I agree that Venus Protocol should proceed with the upgrading the Comptroller contract with diamond proxy", - againstDescription: "I do not think that Venus Protocol should proceed with the Comptroller contract upgradation", - abstainDescription: "I am indifferent to whether Venus Protocol proceeds with the Comptroller upgradation or not", + version: "v2", + title: "VIP-174 Core pool Comptroller upgrade - Diamond Comptroller", + + description: `#### Summary + + If passed this VIP will upgrade the implementation of the Comptroller + contract in the Core pool. It will set a re-architectured Comptroller following the [Diamond + pattern](https://eips.ethereum.org/EIPS/eip-2535), not adding new features now for the regular + users. This upgrade will allow Venus to add new features in the Core pool in the future, unlocking the Ethereum + limitation on the size of the contracts (maximum 24KB) added in the [EIP-170](https://eips.ethereum.org/EIPS/eip-170). + + #### Description + + This VIP upgrades the implementation of the [Comptroller + contract in the Core pool](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384). As features continued to be + introduced to the Core Pool Comptroller contract, it grew to exceed the [maximum allowable size of 24KB](https://eips.ethereum.org/EIPS/eip-170). + In response to this challenge and to preemptively address similar issues in the future, a multifaceted diamond pattern was implemented. + + The original comptroller was refactored using the [EIP-2535](https://eips.ethereum.org/EIPS/eip-2535) + diamond pattern into distinct facets. This restructuring aligns the storage layout with that of the Comptroller proxy, + streamlining the contract's organization and enhancing efficiency. As a consequence user interactions now trigger two delegate calls. + + Users will continue to interact with the [Unitroller](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384) + proxy contract same as before with one significant difference. Now the Diamond proxy serves as the implementation contract for the + Unitroller, and the Comptroller's implementation has been divided into multiple facets. These facets will function as the various + components of the Diamond proxy. + + Facets: + + * PolicyFacet: this facet contains all the external pre-hook functions related to vToken. + * SetterFacet: this facet contains all setter configuration functions. + * MarketFacet: this facet provides information about the asset in the market that you are in at that time. This facet is also responsible for entering and exiting the market. + * RewardFacet: this facet provides the external functions related to all claims and rewards of the protocol, it has the following. + + You + can see more technical details about the Diamond Comptroller in the [documentation + site](https://docs-v4.venus.io/technical-reference/reference-technical-articles/diamond-comptroller). + + #### Security and additional considerations + + We applied the following security procedures for this upgrade: + + * **Comptroller contract behavior post upgrade**: in a simulation environment, validating Comptroller work as expected after the upgrade + * **Comptroller storage layout**: in a simulation environment, validating the storage variables are accessible and correct after the upgrade + * **Deployment on testnet**: the same Diamond Comptroller has been [deployed to testnet](https://testnet.bscscan.com/tx/0x8ef7a72736d49f4babd624c8dc353589a1d659fe9995f358cca8c2305f21b2ba), and used in the Venus Protocol testnet deployment + * **Audit:** OpenZeppelin, Quantstamp, Certik, Peckshield and Fairyproof have audited the deployed code + + #### Audit reports + + * [OpenZeppelin audit report (2023/08/17)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/049_diamondComptroller_openzeppelin_20230817.pdf) + * [Quantstamp audit report (2023/09/19)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/047_diamondComptroller_quantstamp_20230919.pdf) + * [Certik audit audit report (2023/08/03)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/044_diamondComptroller_certik_20230803.pdf) + * [Peckshield audit report (2023/07/28)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/042_diamondComptroller_peckshield_20230718.pdf) + * [Fairyproof audit report (2023/06/25)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/040_diamondComptroller_fairyproof_20230625.pdf) + + #### Deployed contracts + + * [Comptroller proxy (Unitroller)](https://bscscan.com/address/0xfd36e2c2a6789db23113685031d7f16329158384) + * [Current Comptroller implementation](https://bscscan.com/address/0x909dd16b24cef96c7be13065a9a0eaf8a126ffa5) + * [New Comptroller implementation (Diamond)](https://bscscan.com/address/0xAd69AA3811fE0EE7dBd4e25C4bae40e6422c76C8) + * Facets on mainnet: + * [MarketFacet](https://bscscan.com/address/0x40A30E1B01e0CF3eE3F22f769b0E437160550eEa) + * [PolicyFacet](https://bscscan.com/address/0xCE305b594A7714E9ed8eDE23c111aFf6A2d54E0e) + * [RewardFacet](https://bscscan.com/address/0x71e7AAcb01C5764A56DB92aa31aA473e839d964F) + * [SetterFacet](https://bscscan.com/address/0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c) + + #### References + + * [Pull request with the changeset](https://github.com/VenusProtocol/venus-protocol/pull/224) + * [Simulation pre and post upgrade](https://github.com/VenusProtocol/vips/pull/11/) + * [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/diamond-comptroller)`, + + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", }; return makeProposal( From 544c54986bf3c99a7d1a97a95f0b6cee2b38c59b Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 25 Sep 2023 15:58:42 +0530 Subject: [PATCH 22/24] fix: revert changes for transaction.ts --- src/transactions.ts | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/transactions.ts b/src/transactions.ts index 5bfea322e..e61d45028 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -1,32 +1,29 @@ import { ethers } from "hardhat"; import { getCalldatas } from "./utils"; -import GOVERNOR_BRAVO_DELEGATE_ABI from "./vip-framework/abi/governorBravoDelegateAbi.json"; -const DEFAULT_GOVERNOR_PROXY = "0x5573422A1a59385C247ec3a66B93B7C08eC2f8f2"; +const DEFAULT_GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; export const loadProposal = async (num: string) => { - const x = await import("../vips/vip-174/vip-174-testnet"); - console.log("----------------------------XXX", x); - return x["vip174Testnet"](); + const x = await import(`../vips/vip-${num}.ts`); + return x[`vip${num}`](); }; -export const proposeVIP = async (vipNumber: string) => { +export const proposeVIP = async (vipNumber: string, governorProxyAddress?: string) => { const proposal = await loadProposal(vipNumber); - console.log("----------------------------proposal", proposal); - - const [proposer] = await ethers.getSigners(); - const governorProxy = await ethers.getContractAt(GOVERNOR_BRAVO_DELEGATE_ABI, DEFAULT_GOVERNOR_PROXY); const { targets, signatures, values, meta } = proposal; - await governorProxy - .connect(proposer) - .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type); + const params = [targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type]; + let functionSignature = "function propose(address[],uint256[],string[],bytes[],string,uint8)"; - // await governorProxy - // .connect(proposer) - // .castVote(296, 1); -}; + if (proposal.type === undefined || proposal.type === null) { + functionSignature = "function propose(address[],uint256[],string[],bytes[],string)"; + params.pop(); + } -proposeVIP(130); + return { + target: governorProxyAddress ?? DEFAULT_GOVERNOR_PROXY, + calldata: new ethers.utils.Interface([functionSignature]).encodeFunctionData("propose", params), + }; +}; From 2b1917362e28ff69d25b468819fd49145d5e4fc7 Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Mon, 25 Sep 2023 12:48:05 +0200 Subject: [PATCH 23/24] fix: set the right format in the VIP-174 description field --- vips/vip-174/vip-174.ts | 118 ++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 66 deletions(-) diff --git a/vips/vip-174/vip-174.ts b/vips/vip-174/vip-174.ts index 4ef506e23..043005880 100644 --- a/vips/vip-174/vip-174.ts +++ b/vips/vip-174/vip-174.ts @@ -42,72 +42,58 @@ export const vip174 = () => { description: `#### Summary - If passed this VIP will upgrade the implementation of the Comptroller - contract in the Core pool. It will set a re-architectured Comptroller following the [Diamond - pattern](https://eips.ethereum.org/EIPS/eip-2535), not adding new features now for the regular - users. This upgrade will allow Venus to add new features in the Core pool in the future, unlocking the Ethereum - limitation on the size of the contracts (maximum 24KB) added in the [EIP-170](https://eips.ethereum.org/EIPS/eip-170). - - #### Description - - This VIP upgrades the implementation of the [Comptroller - contract in the Core pool](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384). As features continued to be - introduced to the Core Pool Comptroller contract, it grew to exceed the [maximum allowable size of 24KB](https://eips.ethereum.org/EIPS/eip-170). - In response to this challenge and to preemptively address similar issues in the future, a multifaceted diamond pattern was implemented. - - The original comptroller was refactored using the [EIP-2535](https://eips.ethereum.org/EIPS/eip-2535) - diamond pattern into distinct facets. This restructuring aligns the storage layout with that of the Comptroller proxy, - streamlining the contract's organization and enhancing efficiency. As a consequence user interactions now trigger two delegate calls. - - Users will continue to interact with the [Unitroller](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384) - proxy contract same as before with one significant difference. Now the Diamond proxy serves as the implementation contract for the - Unitroller, and the Comptroller's implementation has been divided into multiple facets. These facets will function as the various - components of the Diamond proxy. - - Facets: - - * PolicyFacet: this facet contains all the external pre-hook functions related to vToken. - * SetterFacet: this facet contains all setter configuration functions. - * MarketFacet: this facet provides information about the asset in the market that you are in at that time. This facet is also responsible for entering and exiting the market. - * RewardFacet: this facet provides the external functions related to all claims and rewards of the protocol, it has the following. - - You - can see more technical details about the Diamond Comptroller in the [documentation - site](https://docs-v4.venus.io/technical-reference/reference-technical-articles/diamond-comptroller). - - #### Security and additional considerations - - We applied the following security procedures for this upgrade: - - * **Comptroller contract behavior post upgrade**: in a simulation environment, validating Comptroller work as expected after the upgrade - * **Comptroller storage layout**: in a simulation environment, validating the storage variables are accessible and correct after the upgrade - * **Deployment on testnet**: the same Diamond Comptroller has been [deployed to testnet](https://testnet.bscscan.com/tx/0x8ef7a72736d49f4babd624c8dc353589a1d659fe9995f358cca8c2305f21b2ba), and used in the Venus Protocol testnet deployment - * **Audit:** OpenZeppelin, Quantstamp, Certik, Peckshield and Fairyproof have audited the deployed code - - #### Audit reports - - * [OpenZeppelin audit report (2023/08/17)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/049_diamondComptroller_openzeppelin_20230817.pdf) - * [Quantstamp audit report (2023/09/19)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/047_diamondComptroller_quantstamp_20230919.pdf) - * [Certik audit audit report (2023/08/03)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/044_diamondComptroller_certik_20230803.pdf) - * [Peckshield audit report (2023/07/28)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/042_diamondComptroller_peckshield_20230718.pdf) - * [Fairyproof audit report (2023/06/25)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/040_diamondComptroller_fairyproof_20230625.pdf) - - #### Deployed contracts - - * [Comptroller proxy (Unitroller)](https://bscscan.com/address/0xfd36e2c2a6789db23113685031d7f16329158384) - * [Current Comptroller implementation](https://bscscan.com/address/0x909dd16b24cef96c7be13065a9a0eaf8a126ffa5) - * [New Comptroller implementation (Diamond)](https://bscscan.com/address/0xAd69AA3811fE0EE7dBd4e25C4bae40e6422c76C8) - * Facets on mainnet: - * [MarketFacet](https://bscscan.com/address/0x40A30E1B01e0CF3eE3F22f769b0E437160550eEa) - * [PolicyFacet](https://bscscan.com/address/0xCE305b594A7714E9ed8eDE23c111aFf6A2d54E0e) - * [RewardFacet](https://bscscan.com/address/0x71e7AAcb01C5764A56DB92aa31aA473e839d964F) - * [SetterFacet](https://bscscan.com/address/0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c) - - #### References - - * [Pull request with the changeset](https://github.com/VenusProtocol/venus-protocol/pull/224) - * [Simulation pre and post upgrade](https://github.com/VenusProtocol/vips/pull/11/) - * [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/diamond-comptroller)`, +If passed this VIP will upgrade the implementation of the Comptroller contract in the Core pool. It will set a re-architectured Comptroller following the [Diamond pattern](https://eips.ethereum.org/EIPS/eip-2535), not adding new features now for the regular users. This upgrade will allow Venus to add new features in the Core pool in the future, unlocking the Ethereum limitation on the size of the contracts (maximum 24KB) added in the [EIP-170](https://eips.ethereum.org/EIPS/eip-170). + +#### Description + +This VIP upgrades the implementation of the [Comptroller contract in the Core pool](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384). As features continued to be introduced to the Core Pool Comptroller contract, it grew to exceed the [maximum allowable size of 24KB](https://eips.ethereum.org/EIPS/eip-170). In response to this challenge and to preemptively address similar issues in the future, a multifaceted diamond pattern was implemented. + +The original comptroller was refactored using the [EIP-2535](https://eips.ethereum.org/EIPS/eip-2535) diamond pattern into distinct facets. This restructuring aligns the storage layout with that of the Comptroller proxy, streamlining the contract's organization and enhancing efficiency. As a consequence user interactions now trigger two delegate calls. + +Users will continue to interact with the [Unitroller](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384) proxy contract same as before with one significant difference. Now the Diamond proxy serves as the implementation contract for the Unitroller, and the Comptroller's implementation has been divided into multiple facets. These facets will function as the various components of the Diamond proxy. + +Facets: + +* PolicyFacet: this facet contains all the external pre-hook functions related to vToken. +* SetterFacet: this facet contains all setter configuration functions. +* MarketFacet: this facet provides information about the asset in the market that you are in at that time. This facet is also responsible for entering and exiting the market. +* RewardFacet: this facet provides the external functions related to all claims and rewards of the protocol, it has the following. + +You can see more technical details about the Diamond Comptroller in the [documentation site](https://docs-v4.venus.io/technical-reference/reference-technical-articles/diamond-comptroller). + +**Security and additional considerations** + +We applied the following security procedures for this upgrade: + +* **Comptroller contract behavior post upgrade**: in a simulation environment, validating Comptroller work as expected after the upgrade +* **Comptroller storage layout**: in a simulation environment, validating the storage variables are accessible and correct after the upgrade +* **Deployment on testnet**: the same Diamond Comptroller has been [deployed to testnet](https://testnet.bscscan.com/tx/0x8ef7a72736d49f4babd624c8dc353589a1d659fe9995f358cca8c2305f21b2ba), and used in the Venus Protocol testnet deployment +* **Audit: OpenZeppelin, Quantstamp, Certik, Peckshield and Fairyproof have audited the deployed code** + +**Audit reports** + +* [OpenZeppelin audit report (2023/08/17)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/049_diamondComptroller_openzeppelin_20230817.pdf) +* [Quantstamp audit report (2023/09/19)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/047_diamondComptroller_quantstamp_20230919.pdf) +* [Certik audit audit report (2023/08/03)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/044_diamondComptroller_certik_20230803.pdf) +* [Peckshield audit report (2023/07/28)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/042_diamondComptroller_peckshield_20230718.pdf) +* [Fairyproof audit report (2023/06/25)](https://github.com/VenusProtocol/venus-protocol/blob/8553387f2277be152883b4ee22211b77a8cbe5f6/audits/040_diamondComptroller_fairyproof_20230625.pdf) + +**Deployed contracts on main net** + +* [Comptroller proxy (Unitroller)](https://bscscan.com/address/0xfd36e2c2a6789db23113685031d7f16329158384) +* [Current Comptroller implementation](https://bscscan.com/address/0x909dd16b24cef96c7be13065a9a0eaf8a126ffa5) +* [New Comptroller implementation (Diamond)](https://bscscan.com/address/0xAd69AA3811fE0EE7dBd4e25C4bae40e6422c76C8) +* Facets on mainnet: + * [MarketFacet](https://bscscan.com/address/0x40A30E1B01e0CF3eE3F22f769b0E437160550eEa) + * [PolicyFacet](https://bscscan.com/address/0xCE305b594A7714E9ed8eDE23c111aFf6A2d54E0e) + * [RewardFacet](https://bscscan.com/address/0x71e7AAcb01C5764A56DB92aa31aA473e839d964F) + * [SetterFacet](https://bscscan.com/address/0xc3CE70d9bBE8f63510f3C6dBf1C025113C79B40c) + +**References** + +* [Pull request with the changeset](https://github.com/VenusProtocol/venus-protocol/pull/224) +* [Simulation pre and post upgrade](https://github.com/VenusProtocol/vips/pull/11/) +* [Documentation](https://docs-v4.venus.io/technical-reference/reference-technical-articles/diamond-comptroller)`, forDescription: "Execute this proposal", againstDescription: "Do not execute this proposal", From cba80766955238b2026ca6f280c00cf440b8bf18 Mon Sep 17 00:00:00 2001 From: Kirill Kuvshinov Date: Mon, 25 Sep 2023 16:52:41 +0300 Subject: [PATCH 24/24] fix: use EVM instead of Ethereum, use ndash --- vips/vip-174/vip-174.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vips/vip-174/vip-174.ts b/vips/vip-174/vip-174.ts index 043005880..d41a6b018 100644 --- a/vips/vip-174/vip-174.ts +++ b/vips/vip-174/vip-174.ts @@ -38,11 +38,11 @@ const grantAccessControl = () => { export const vip174 = () => { const meta = { version: "v2", - title: "VIP-174 Core pool Comptroller upgrade - Diamond Comptroller", + title: "VIP-174 Core pool Comptroller upgrade – Diamond Comptroller", description: `#### Summary -If passed this VIP will upgrade the implementation of the Comptroller contract in the Core pool. It will set a re-architectured Comptroller following the [Diamond pattern](https://eips.ethereum.org/EIPS/eip-2535), not adding new features now for the regular users. This upgrade will allow Venus to add new features in the Core pool in the future, unlocking the Ethereum limitation on the size of the contracts (maximum 24KB) added in the [EIP-170](https://eips.ethereum.org/EIPS/eip-170). +If passed this VIP will upgrade the implementation of the Comptroller contract in the Core pool. It will set a re-architectured Comptroller following the [Diamond pattern](https://eips.ethereum.org/EIPS/eip-2535), not adding new features now for the regular users. This upgrade will allow Venus to add new features in the Core pool in the future, unlocking the EVM limitation on the size of the contracts (maximum 24KB) added in the [EIP-170](https://eips.ethereum.org/EIPS/eip-170). #### Description