From 1fa8eece7a0d9d46c46bafb4fa6429b6ce1c278b Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 20 Sep 2023 21:36:32 +0530 Subject: [PATCH] feat: add vip and simulations for comptroller beacon upgrade --- .../abi/AccessControlManager.json | 360 ++++ .../abi/comptroller-beacon.json | 104 ++ .../abi/comptroller.json | 1664 +++++++++++++++++ .../simulations.ts | 204 ++ .../vip-comptroller-upgrade-testnet.ts | 130 ++ 5 files changed, 2462 insertions(+) create mode 100644 simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/AccessControlManager.json create mode 100644 simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller-beacon.json create mode 100644 simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller.json create mode 100644 simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/simulations.ts create mode 100644 vips/vip-isolated-pools-comptroller-upgrade/vip-comptroller-upgrade-testnet.ts diff --git a/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/AccessControlManager.json b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/AccessControlManager.json new file mode 100644 index 000000000..4a118fcc4 --- /dev/null +++ b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/AccessControlManager.json @@ -0,0 +1,360 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "functionSig", + "type": "string" + } + ], + "name": "PermissionGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "functionSig", + "type": "string" + } + ], + "name": "PermissionRevoked", + "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" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "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": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + }, + { + "internalType": "address", + "name": "accountToPermit", + "type": "address" + } + ], + "name": "giveCallPermission", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + } + ], + "name": "hasPermission", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "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": "account", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + } + ], + "name": "isAllowedToCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + }, + { + "internalType": "address", + "name": "accountToRevoke", + "type": "address" + } + ], + "name": "revokeCallPermission", + "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": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller-beacon.json b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller-beacon.json new file mode 100644 index 000000000..17ef75bb9 --- /dev/null +++ b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller-beacon.json @@ -0,0 +1,104 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller.json b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller.json new file mode 100644 index 000000000..4608e85a9 --- /dev/null +++ b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/abi/comptroller.json @@ -0,0 +1,1664 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "poolRegistry_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum ComptrollerStorage.Action", + "name": "action", + "type": "uint8" + } + ], + "name": "ActionPaused", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "name": "BorrowCapExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expectedLessThanOrEqualTo", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "CollateralExceedsThreshold", + "type": "error" + }, + { + "inputs": [], + "name": "ComptrollerMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "collateralToSeize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "availableCollateral", + "type": "uint256" + } + ], + "name": "InsufficientCollateral", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientLiquidity", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientShortfall", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCollateralFactor", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLiquidationThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketAlreadyListed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "MarketNotCollateral", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expectedGreaterThan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "MinimalCollateralViolated", + "type": "error" + }, + { + "inputs": [], + "name": "NonzeroBorrowBalance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "PriceError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "SnapshotError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "name": "SupplyCapExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "TooMuchRepay", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "expectedSender", + "type": "address" + }, + { + "internalType": "address", + "name": "actualSender", + "type": "address" + } + ], + "name": "UnexpectedSender", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum ComptrollerStorage.Action", + "name": "action", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketSupported", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationThresholdMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationThresholdMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationThreshold", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMinLiquidatableCollateral", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinLiquidatableCollateral", + "type": "uint256" + } + ], + "name": "NewMinLiquidatableCollateral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardsDistributor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + } + ], + "name": "NewRewardsDistributor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSupplyCap", + "type": "uint256" + } + ], + "name": "NewSupplyCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum ComptrollerStorage.Action", + "name": "action", + "type": "uint8" + } + ], + "name": "actionPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract RewardsDistributor", + "name": "_rewardsDistributor", + "type": "address" + } + ], + "name": "addRewardsDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "checkMembership", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "enterMarkets", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenAddress", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllMarkets", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAssetsIn", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getBorrowingPower", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenModify", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardDistributors", + "outputs": [ + { + "internalType": "contract RewardsDistributor[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "getRewardsByMarket", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "supplySpeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowSpeed", + "type": "uint256" + } + ], + "internalType": "struct ComptrollerStorage.RewardSpeeds[]", + "name": "rewardSpeeds", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "healAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "accessControlManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "isDeprecated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "isMarketListed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "components": [ + { + "internalType": "contract VToken", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "contract VToken", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "internalType": "struct ComptrollerStorage.LiquidationOrder[]", + "name": "orders", + "type": "tuple[]" + } + ], + "name": "liquidateAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensToSeize", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "bool", + "name": "isListed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "collateralFactorMantissa", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationThresholdMantissa", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLiquidatableCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract ResilientOracleInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "preBorrowHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "skipLiquidityCheck", + "type": "bool" + } + ], + "name": "preLiquidateHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "preMintHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "preRedeemHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "preRepayHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "seizerContract", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "preSeizeHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "preTransferHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "marketsList", + "type": "address[]" + }, + { + "internalType": "enum ComptrollerStorage.Action[]", + "name": "actionsList", + "type": "uint8[]" + }, + { + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "setActionsPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "setCloseFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newLiquidationThresholdMantissa", + "type": "uint256" + } + ], + "name": "setCollateralFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "setLiquidationIncentive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "setMarketBorrowCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newSupplyCaps", + "type": "uint256[]" + } + ], + "name": "setMarketSupplyCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinLiquidatableCollateral", + "type": "uint256" + } + ], + "name": "setMinLiquidatableCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ResilientOracleInterface", + "name": "newOracle", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "supportMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "updatePrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/simulations.ts b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/simulations.ts new file mode 100644 index 000000000..9692235fa --- /dev/null +++ b/simulations/vip-isolated-pools-comptroller-upgrade/vip-isolated-pools-comptroller-upgrade-testnet/simulations.ts @@ -0,0 +1,204 @@ +import { expect } from "chai"; +import { BigNumber } from "ethers"; +import { ethers } from "hardhat"; + +import { expectEvents, initMainnetUser } from "../../../src/utils"; +import { forking, testVip } from "../../../src/vip-framework"; +import { vipComptrollerBeaconUpgradeTestnet } from "../../../vips/vip-isolated-pools-comptroller-upgrade/vip-comptroller-upgrade-testnet"; +import ACM_ABI from "./abi/AccessControlManager.json"; +import COMPTROLLER_BEACON_ABI from "./abi/comptroller-beacon.json"; +import COMPTROLLER_ABI from "./abi/comptroller.json"; + +const OLD_COMPTROLLER_IMPLEMENTATION = "0x069705246364d60c5503bF19b4A714ab412521a0"; +const NEW_COMPTROLLER_IMPLEMENTATION = "0xa764a2eAc5C59DFb23E43850cBA89117f1c9f5AB"; +const COMPTROLLER_BEACON = "0xdDDD7725C073105fB2AbfCbdeC16708fC4c24B74"; +const POOL_STABLECOIN = "0x10b57706AD2345e590c2eA4DC02faef0d9f5b08B"; +const POOL_DEFI = "0x23a73971A6B9f6580c048B9CB188869B2A2aA2aD"; +const POOL_GAMEFI = "0x1F4f0989C51f12DAcacD4025018176711f3Bf289"; +const POOL_LIQUID_STAKED_BNB = "0x596B11acAACF03217287939f88d63b51d3771704"; +const POOL_TRON = "0x11537D023f489E4EF0C7157cc729C7B69CbE0c97"; +const ACM = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +function matchValues(array1: string[], array2: string[]) { + for (let i = 0; i < array1.length; i++) { + expect(array1[i]).to.equal(array2[i]); + } +} + +forking(33504900, () => { + const provider = ethers.provider; + let comptrollerBeacon: ethers.Contract; + let comptrollerStableCoin: ethers.Contract; + let closeFactorMantissa: BigNumber; + let markets: string[]; + let isComptroller: boolean; + let maxLoopsLimit: number; + let minLiquidatableCollateral: BigNumber; + let oracle: string; + let owner: string; + let poolRegistry: string; + let rewardDistributors: string[]; + + beforeEach(async () => { + comptrollerBeacon = new ethers.Contract(COMPTROLLER_BEACON, COMPTROLLER_BEACON_ABI, provider); + comptrollerStableCoin = new ethers.Contract(POOL_STABLECOIN, COMPTROLLER_ABI, provider); + + closeFactorMantissa = await comptrollerStableCoin.closeFactorMantissa(); + markets = await comptrollerStableCoin.getAllMarkets(); + isComptroller = await comptrollerStableCoin.isComptroller(); + maxLoopsLimit = await comptrollerStableCoin.maxLoopsLimit(); + minLiquidatableCollateral = await comptrollerStableCoin.minLiquidatableCollateral(); + oracle = await comptrollerStableCoin.oracle(); + owner = await comptrollerStableCoin.owner(); + poolRegistry = await comptrollerStableCoin.poolRegistry(); + rewardDistributors = await comptrollerStableCoin.getRewardDistributors(); + }); + + describe("Pre-VIP behavior", async () => { + it("Comptroller beacon proxy should have old implementation", async () => { + expect(await comptrollerBeacon.implementation()).to.equal(OLD_COMPTROLLER_IMPLEMENTATION); + }); + }); + + testVip("VIPComptrollerBeaconUpgradeTestnet", vipComptrollerBeaconUpgradeTestnet(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [COMPTROLLER_BEACON_ABI], ["Upgraded"], [1]); + await expectEvents(txResponse, [ACM_ABI], ["PermissionGranted"], [15]); + }, + }); + + describe("Post-VIP behavior", () => { + let accessControlManager: ethers.Contract; + let comptrollerStableCoinSigner: ethers.Signer; + let comptrollerDefiSigner: ethers.Signer; + let comptrollerGameFiSigner: ethers.Signer; + let comptrollerLiquidStakedBnbSigner: ethers.Signer; + let comptrollerTronSigner: ethers.Signer; + + before(async () => { + accessControlManager = new ethers.Contract(ACM, ACM_ABI, provider); + comptrollerStableCoinSigner = await initMainnetUser(POOL_STABLECOIN, ethers.utils.parseEther("1")); + comptrollerDefiSigner = await initMainnetUser(POOL_DEFI, ethers.utils.parseEther("1")); + comptrollerGameFiSigner = await initMainnetUser(POOL_GAMEFI, ethers.utils.parseEther("1")); + comptrollerLiquidStakedBnbSigner = await initMainnetUser(POOL_LIQUID_STAKED_BNB, ethers.utils.parseEther("1")); + comptrollerTronSigner = await initMainnetUser(POOL_TRON, ethers.utils.parseEther("1")); + }); + + it("Comptroller beacon implementation should be upgraded", async () => { + expect(await comptrollerBeacon.implementation()).to.equal(NEW_COMPTROLLER_IMPLEMENTATION); + }); + + it("Storage layout should be same after upgarde", async () => { + expect(await comptrollerStableCoin.accessControlManager()).to.equal(ACM); + expect(await comptrollerStableCoin.closeFactorMantissa()).to.equal(closeFactorMantissa); + expect(await comptrollerStableCoin.isComptroller()).to.equal(isComptroller); + expect(await comptrollerStableCoin.maxLoopsLimit()).to.equal(maxLoopsLimit); + expect(await comptrollerStableCoin.minLiquidatableCollateral()).to.equal(minLiquidatableCollateral); + expect(await comptrollerStableCoin.oracle()).to.equal(oracle); + expect(await comptrollerStableCoin.owner()).to.equal(owner); + expect(await comptrollerStableCoin.poolRegistry()).to.equal(poolRegistry); + + const marketsAfterComptrollerUpgrade = await comptrollerStableCoin.getAllMarkets(); + const rewardDistributorsAfterComptrollerUpgrade = await comptrollerStableCoin.getRewardDistributors(); + + expect(marketsAfterComptrollerUpgrade.length).to.equal(markets.length); + expect(rewardDistributorsAfterComptrollerUpgrade.length).to.equal(rewardDistributors.length); + + matchValues(marketsAfterComptrollerUpgrade, markets); + matchValues(rewardDistributorsAfterComptrollerUpgrade, rewardDistributors); + }); + + it("Pool StableCoin permissions", async () => { + expect( + await accessControlManager + .connect(comptrollerStableCoinSigner) + .isAllowedToCall(CRITICAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerStableCoinSigner) + .isAllowedToCall(FAST_TRACK_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerStableCoinSigner) + .isAllowedToCall(NORMAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + }); + + it("Pool Defi permissions", async () => { + expect( + await accessControlManager + .connect(comptrollerDefiSigner) + .isAllowedToCall(CRITICAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerDefiSigner) + .isAllowedToCall(FAST_TRACK_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerDefiSigner) + .isAllowedToCall(NORMAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + }); + + it("Pool GameFi permissions", async () => { + expect( + await accessControlManager + .connect(comptrollerGameFiSigner) + .isAllowedToCall(CRITICAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerGameFiSigner) + .isAllowedToCall(FAST_TRACK_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerGameFiSigner) + .isAllowedToCall(NORMAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + }); + + it("Pool Liquied Staked Bnb permissions", async () => { + expect( + await accessControlManager + .connect(comptrollerLiquidStakedBnbSigner) + .isAllowedToCall(CRITICAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerLiquidStakedBnbSigner) + .isAllowedToCall(FAST_TRACK_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerLiquidStakedBnbSigner) + .isAllowedToCall(NORMAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + }); + + it("Pool Tron permissions", async () => { + expect( + await accessControlManager + .connect(comptrollerTronSigner) + .isAllowedToCall(CRITICAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerTronSigner) + .isAllowedToCall(FAST_TRACK_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + expect( + await accessControlManager + .connect(comptrollerTronSigner) + .isAllowedToCall(NORMAL_TIMELOCK, "_setForcedLiquidation(address,bool)"), + ).equals(true); + }); + }); +}); diff --git a/vips/vip-isolated-pools-comptroller-upgrade/vip-comptroller-upgrade-testnet.ts b/vips/vip-isolated-pools-comptroller-upgrade/vip-comptroller-upgrade-testnet.ts new file mode 100644 index 000000000..1dc491221 --- /dev/null +++ b/vips/vip-isolated-pools-comptroller-upgrade/vip-comptroller-upgrade-testnet.ts @@ -0,0 +1,130 @@ +import { ProposalType } from "../../src/types"; +import { makeProposal } from "../../src/utils"; + +const COMPTROLLER_BEACON = "0xdddd7725c073105fb2abfcbdec16708fc4c24b74"; +const NEW_COMPTROLLER_IMPLEMENTATION = "0xa764a2eAc5C59DFb23E43850cBA89117f1c9f5AB"; +const ACM = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +const POOL_STABLECOIN = "0x10b57706AD2345e590c2eA4DC02faef0d9f5b08B"; +const POOL_DEFI = "0x23a73971A6B9f6580c048B9CB188869B2A2aA2aD"; +const POOL_GAMEFI = "0x1F4f0989C51f12DAcacD4025018176711f3Bf289"; +const POOL_LIQUID_STAKED_BNB = "0x596B11acAACF03217287939f88d63b51d3771704"; +const POOL_TRON = "0x11537D023f489E4EF0C7157cc729C7B69CbE0c97"; +const FAST_TRACK_TIMELOCK = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; +const CRITICAL_TIMELOCK = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; + +export const vipComptrollerBeaconUpgradeTestnet = () => { + const meta = { + version: "v2", + title: "VIP comptroller beacon upgrade", + description: ` + Upgardes the implementation contract for comptroller beacon for isolated pools + Gives call permissions to all three timelocks for setting forced liquidation`, + + forDescription: "I agree that Venus Protocol should proceed with upgrading comptroller beacon", + againstDescription: "I do not think that Venus Protocol should proceed with upgrading comptroller beacon", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds with upgrading comptroller beacon", + }; + + return makeProposal( + [ + { + target: COMPTROLLER_BEACON, + signature: "upgradeTo(address)", + params: [NEW_COMPTROLLER_IMPLEMENTATION], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_STABLECOIN, "_setForcedLiquidation(address,bool)", NORMAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_STABLECOIN, "_setForcedLiquidation(address,bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_STABLECOIN, "_setForcedLiquidation(address,bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_DEFI, "_setForcedLiquidation(address,bool)", NORMAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_DEFI, "_setForcedLiquidation(address,bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_DEFI, "_setForcedLiquidation(address,bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_GAMEFI, "_setForcedLiquidation(address,bool)", NORMAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_GAMEFI, "_setForcedLiquidation(address,bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_GAMEFI, "_setForcedLiquidation(address,bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_LIQUID_STAKED_BNB, "_setForcedLiquidation(address,bool)", NORMAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_LIQUID_STAKED_BNB, "_setForcedLiquidation(address,bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_LIQUID_STAKED_BNB, "_setForcedLiquidation(address,bool)", CRITICAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_TRON, "_setForcedLiquidation(address,bool)", NORMAL_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_TRON, "_setForcedLiquidation(address,bool)", FAST_TRACK_TIMELOCK], + }, + + { + target: ACM, + signature: "giveCallPermission(address,string,address)", + params: [POOL_TRON, "_setForcedLiquidation(address,bool)", CRITICAL_TIMELOCK], + }, + ], + meta, + ProposalType.REGULAR, + ); +};