From d6b0336ad373c2eb6ec8f35984840d5b0e6eeb02 Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Thu, 27 Feb 2025 16:58:06 -0300 Subject: [PATCH 01/31] feat: bsctestnet vips for risk stewards --- .../vip-xxx/abi/AccessControlManager.json | 157 + simulations/vip-xxx/abi/Comproller.json | 3091 +++++++++++++++++ .../vip-xxx/abi/IsolatedPoolComptroller.json | 1496 ++++++++ .../vip-xxx/abi/VenusRiskStewardReceiver.json | 645 ++++ simulations/vip-xxx/bsctestnet.ts | 95 + vips/vip-xxx/bsctestnet.ts | 67 + 6 files changed, 5551 insertions(+) create mode 100644 simulations/vip-xxx/abi/AccessControlManager.json create mode 100644 simulations/vip-xxx/abi/Comproller.json create mode 100644 simulations/vip-xxx/abi/IsolatedPoolComptroller.json create mode 100644 simulations/vip-xxx/abi/VenusRiskStewardReceiver.json create mode 100644 simulations/vip-xxx/bsctestnet.ts create mode 100644 vips/vip-xxx/bsctestnet.ts diff --git a/simulations/vip-xxx/abi/AccessControlManager.json b/simulations/vip-xxx/abi/AccessControlManager.json new file mode 100644 index 000000000..2ef119947 --- /dev/null +++ b/simulations/vip-xxx/abi/AccessControlManager.json @@ -0,0 +1,157 @@ +[ + { "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-xxx/abi/Comproller.json b/simulations/vip-xxx/abi/Comproller.json new file mode 100644 index 000000000..9b9336f70 --- /dev/null +++ b/simulations/vip-xxx/abi/Comproller.json @@ -0,0 +1,3091 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum ComptrollerTypes.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": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowDelegatedBorrows", + "type": "bool" + } + ], + "name": "DelegateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + } + ], + "name": "DiamondCut", + "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": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enable", + "type": "bool" + } + ], + "name": "IsForcedLiquidationEnabledForUserUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enable", + "type": "bool" + } + ], + "name": "IsForcedLiquidationEnabledUpdated", + "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": true, + "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": true, + "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": false, + "internalType": "contract IPrime", + "name": "oldPrimeToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IPrime", + "name": "newPrimeToken", + "type": "address" + } + ], + "name": "NewPrimeToken", + "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": true, + "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": true, + "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" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "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 ComptrollerTypes.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": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "bool", + "name": "enable", + "type": "bool" + } + ], + "name": "_setForcedLiquidation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "bool", + "name": "enable", + "type": "bool" + } + ], + "name": "_setForcedLiquidationForUser", + "outputs": [], + "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": "contract IPrime", + "name": "_prime", + "type": "address" + } + ], + "name": "_setPrimeToken", + "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 ComptrollerTypes.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": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "diamondCut_", + "type": "tuple[]" + } + ], + "name": "diamondCut", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "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": "bytes4", + "name": "functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "uint96", + "name": "functionSelectorPosition", + "type": "uint96" + } + ], + "internalType": "struct ComptrollerV13Storage.FacetAddressAndPosition", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "", + "type": "bytes4[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "name": "facetPosition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.Facet[]", + "name": "", + "type": "tuple[]" + } + ], + "payable": false, + "stateMutability": "view", + "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": [ + { + "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": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getXVSVTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabledForUser", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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": "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": "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": "prime", + "outputs": [ + { + "internalType": "contract IPrime", + "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": [ + { + "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": [ + { + "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-xxx/abi/IsolatedPoolComptroller.json b/simulations/vip-xxx/abi/IsolatedPoolComptroller.json new file mode 100644 index 000000000..fafe7b35e --- /dev/null +++ b/simulations/vip-xxx/abi/IsolatedPoolComptroller.json @@ -0,0 +1,1496 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "poolRegistry_", + "type": "address" + }, + { + "internalType": "address", + "name": "accessControl_", + "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": "market", + "type": "address" + } + ], + "name": "MarketNotListed", + "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" + }, + { + "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": 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": "MarketSupported", + "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 PriceOracle", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract PriceOracle", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "rewardsDistributor", + "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": "accessControl", + "outputs": [ + { + "internalType": "address", + "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" + }, + { + "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": [], + "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": "minLiquidatableCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract PriceOracle", + "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": "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": "newMinLiquidatableCollateral", + "type": "uint256" + } + ], + "name": "setMinLiquidatableCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PriceOracle", + "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" + } +] diff --git a/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json b/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json new file mode 100644 index 000000000..8c3b457b8 --- /dev/null +++ b/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json @@ -0,0 +1,645 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "inputs": [], + "name": "ConfigAlreadyProcessed", + "type": "error" + }, + { + "inputs": [], + "name": "ConfigNotActive", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDebounce", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "UnsupportedUpdateType", + "type": "error" + }, + { + "inputs": [], + "name": "UpdateIsExpired", + "type": "error" + }, + { + "inputs": [], + "name": "UpdateTooFrequent", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "updateType", + "type": "string" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousRiskSteward", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "riskSteward", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousDebounce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "debounce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "previousActive", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "RiskParameterConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "updateId", + "type": "uint256" + } + ], + "name": "RiskParameterUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "updateType", + "type": "string" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ToggleConfigActive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "RISK_ORACLE", + "outputs": [ + { + "internalType": "contract IRiskOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UPDATE_EXPIRATION_TIME", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "marketUpdateType", + "type": "bytes" + } + ], + "name": "lastProcessedTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "updateId", + "type": "uint256" + } + ], + "name": "processUpdateById", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "updateType", + "type": "string" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "processUpdateByParameterAndMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "updateId", + "type": "uint256" + } + ], + "name": "processedUpdates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "updateType", + "type": "string" + } + ], + "name": "riskParameterConfigs", + "outputs": [ + { + "internalType": "bool", + "name": "active", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "debounce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "riskSteward", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "updateType", + "type": "string" + }, + { + "internalType": "address", + "name": "riskSteward", + "type": "address" + }, + { + "internalType": "uint256", + "name": "debounce", + "type": "uint256" + } + ], + "name": "setRiskParameterConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "updateType", + "type": "string" + } + ], + "name": "toggleConfigActive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } +] \ No newline at end of file diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts new file mode 100644 index 000000000..ad2b87ebe --- /dev/null +++ b/simulations/vip-xxx/bsctestnet.ts @@ -0,0 +1,95 @@ + +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; +import { ethers } from "hardhat"; +import { expectEvents } from "src/utils"; +import { forking, testVip } from "src/vip-framework"; +import { parseUnits } from "ethers/lib/utils"; + +import vipxxx, { COMPTROLLER, MARKET_CAP_RISK_STEWARD, ACCESS_CONTROL_MANAGER, ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; +import COMPTROLLER_ABI from "./abi/Comproller.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; + + +forking(48650752, async () => { + const provider = ethers.provider; + const acm = new ethers.Contract( + ACCESS_CONTROL_MANAGER, + ACCESS_CONTROL_MANAGER_ABI, + provider, + ); + const comptroller = new ethers.Contract( + COMPTROLLER, + COMPTROLLER_ABI, + provider, + ); + + const isolatedPoolComptroller = new ethers.Contract( + '0x1F4f0989C51f12DAcacD4025018176711f3Bf289', + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + testVip("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [5, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + + const supplyCapCorePoolRole = ethers.utils.solidityPack( + ["address", "string"], + [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapCorePoolRoleHash = ethers.utils.keccak256(supplyCapCorePoolRole); + expect(await acm.hasRole(supplyCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + + const borrowCapCorePoolRole = ethers.utils.solidityPack( + ["address", "string"], + [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapCorePoolRoleHash = ethers.utils.keccak256(borrowCapCorePoolRole); + expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD); + await setBalance(MARKET_CAP_RISK_STEWARD, parseUnits("1000000", 18)); + await expect(comptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + ._setMarketSupplyCaps(['0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6'], ['150000000000000000000000'])) + .to.emit(comptroller, "NewSupplyCap"); + await expect(comptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + ._setMarketBorrowCaps(['0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6'], ['55000000000000000000000'])) + .to.emit(comptroller, "NewBorrowCap"); + + + await expect(isolatedPoolComptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .setMarketSupplyCaps(['0xef470AbC365F88e4582D8027172a392C473A5B53'], ['150000000000000000000000'])) + .to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect(isolatedPoolComptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .setMarketBorrowCaps(['0xef470AbC365F88e4582D8027172a392C473A5B53'], ['55000000000000000000000'])) + .to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/vips/vip-xxx/bsctestnet.ts b/vips/vip-xxx/bsctestnet.ts new file mode 100644 index 000000000..435d3fb5b --- /dev/null +++ b/vips/vip-xxx/bsctestnet.ts @@ -0,0 +1,67 @@ +import { ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +export const RISK_STEWARD_RECEIVER = "0x31DEb4D1326838522697f7a012992f0824d80f2b"; +export const MARKET_CAP_RISK_STEWARD = "0x9b40390771cAeEa69DE55EEd176aeDC72d70cA3E"; +export const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +export const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; +export const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; + +const vip457 = () => { + const meta = { + version: "v2", + title: "Configure Risk Steward", + description: `#### Summary +Configure Risk Steward +`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "setRiskParameterConfig(string,address,uint256)", NORMAL_TIMELOCK], + }, + { + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD, 86401], + }, + { + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD, 86401], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + }, + { + target: ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + }, + + ], + meta, + ProposalType.REGULAR + ); +}; + +export default vip457; From 3ffa04f25446b3eb69ed338abfe5affad69c8bda Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Fri, 7 Mar 2025 15:54:06 -0300 Subject: [PATCH 02/31] feat: add crosschain risk config configuration for testnet --- .../abi/OmnichainGovernanceExecutor.json | 539 ++++++++++++++++++ .../vip-xxx/abi/VenusRiskStewardReceiver.json | 2 +- simulations/vip-xxx/arbitrumsepolia.ts | 98 ++++ simulations/vip-xxx/basesepolia.ts | 98 ++++ simulations/vip-xxx/bsctestnet.ts | 63 +- simulations/vip-xxx/opbnbtestnet.ts | 98 ++++ simulations/vip-xxx/opsepolia.ts | 98 ++++ simulations/vip-xxx/unichainsepolia.ts | 98 ++++ simulations/vip-xxx/zksyncsepolia.ts | 98 ++++ vips/vip-xxx/bsctestnet-crosschain.ts | 295 ++++++++++ vips/vip-xxx/bsctestnet.ts | 15 +- 11 files changed, 1463 insertions(+), 39 deletions(-) create mode 100644 simulations/vip-xxx/abi/OmnichainGovernanceExecutor.json create mode 100644 simulations/vip-xxx/arbitrumsepolia.ts create mode 100644 simulations/vip-xxx/basesepolia.ts create mode 100644 simulations/vip-xxx/opbnbtestnet.ts create mode 100644 simulations/vip-xxx/opsepolia.ts create mode 100644 simulations/vip-xxx/unichainsepolia.ts create mode 100644 simulations/vip-xxx/zksyncsepolia.ts create mode 100644 vips/vip-xxx/bsctestnet-crosschain.ts diff --git a/simulations/vip-xxx/abi/OmnichainGovernanceExecutor.json b/simulations/vip-xxx/abi/OmnichainGovernanceExecutor.json new file mode 100644 index 000000000..b40c3cf44 --- /dev/null +++ b/simulations/vip-xxx/abi/OmnichainGovernanceExecutor.json @@ -0,0 +1,539 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "endpoint_", "type": "address" }, + { "internalType": "address", "name": "guardian_", "type": "address" }, + { "internalType": "uint16", "name": "srcChainId_", "type": "uint16" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "InvalidProposalId", "type": "error" }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes", "name": "_payload", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "_reason", "type": "bytes" } + ], + "name": "MessageFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldGuardian", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newGuardian", "type": "address" } + ], + "name": "NewGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }], + "name": "ProposalCanceled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }], + "name": "ProposalExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "eta", "type": "uint256" } + ], + "name": "ProposalQueued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "proposalId", "type": "uint256" }, + { "indexed": false, "internalType": "address[]", "name": "targets", "type": "address[]" }, + { "indexed": false, "internalType": "uint256[]", "name": "values", "type": "uint256[]" }, + { "indexed": false, "internalType": "string[]", "name": "signatures", "type": "string[]" }, + { "indexed": false, "internalType": "bytes[]", "name": "calldatas", "type": "bytes[]" }, + { "indexed": false, "internalType": "uint8", "name": "proposalType", "type": "uint8" } + ], + "name": "ProposalReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "srcChainId", "type": "uint16" }, + { "indexed": true, "internalType": "bytes", "name": "srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes", "name": "reason", "type": "bytes" } + ], + "name": "ReceivePayloadFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes32", "name": "_payloadHash", "type": "bytes32" } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMaxLimit", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMaxLimit", "type": "uint256" } + ], + "name": "SetMaxDailyReceiveLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint16", "name": "_type", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "_minDstGas", "type": "uint256" } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "precrime", "type": "address" }], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "oldSrcChainId", "type": "uint16" }, + { "indexed": true, "internalType": "uint16", "name": "newSrcChainId", "type": "uint16" } + ], + "name": "SetSrcChainId", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "", "type": "address" }, + { "indexed": false, "internalType": "uint8", "name": "", "type": "uint8" } + ], + "name": "SetTimelockPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_path", "type": "bytes" } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint8", "name": "routeType", "type": "uint8" }, + { "indexed": true, "internalType": "address", "name": "oldTimelock", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newTimelock", "type": "address" } + ], + "name": "TimelockAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_PAYLOAD_SIZE_LIMIT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract ITimelock[]", "name": "timelocks_", "type": "address[]" }], + "name": "addTimelocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "proposalId_", "type": "uint256" }], + "name": "cancel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "proposalId_", "type": "uint256" }], + "name": "execute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "bytes", "name": "", "type": "bytes" }, + { "internalType": "uint64", "name": "", "type": "uint64" } + ], + "name": "failedMessages", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" } + ], + "name": "getConfig", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }], + "name": "getTrustedRemoteAddress", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "guardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "isTrustedRemote", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "last24HourCommandsReceived", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "last24HourReceiveWindowStart", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastProposalReceived", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [{ "internalType": "contract ILayerZeroEndpoint", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxDailyReceiveLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "uint16", "name": "", "type": "uint16" } + ], + "name": "minDstGasLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "payloadSizeLimitLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "proposalTimelocks", + "outputs": [{ "internalType": "contract ITimelock", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "proposals", + "outputs": [ + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "uint256", "name": "eta", "type": "uint256" }, + { "internalType": "bool", "name": "canceled", "type": "bool" }, + { "internalType": "bool", "name": "executed", "type": "bool" }, + { "internalType": "uint8", "name": "proposalType", "type": "uint8" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "queued", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "uint16", "name": "srcChainId_", "type": "uint16" }, + { "internalType": "bytes", "name": "srcAddress_", "type": "bytes" }, + { "internalType": "uint64", "name": "nonce_", "type": "uint64" }, + { "internalType": "bytes", "name": "payload_", "type": "bytes" } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" }, + { "internalType": "bytes", "name": "_config", "type": "bytes" } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newGuardian", "type": "address" }], + "name": "setGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "limit_", "type": "uint256" }], + "name": "setMaxDailyReceiveLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint16", "name": "_packetType", "type": "uint16" }, + { "internalType": "uint256", "name": "_minGas", "type": "uint256" } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_size", "type": "uint256" } + ], + "name": "setPayloadSizeLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_precrime", "type": "address" }], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "srcChainId_", "type": "uint16" }], + "name": "setSrcChainId", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "pendingAdmin_", "type": "address" }, + { "internalType": "uint8", "name": "proposalType_", "type": "uint8" } + ], + "name": "setTimelockPendingAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_path", "type": "bytes" } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "srcChainId", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "proposalId_", "type": "uint256" }], + "name": "state", + "outputs": [{ "internalType": "enum OmnichainGovernanceExecutor.ProposalState", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "trustedRemoteLookup", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" } +] diff --git a/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json b/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json index 8c3b457b8..ecdc55c4b 100644 --- a/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json +++ b/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json @@ -642,4 +642,4 @@ "stateMutability": "payable", "type": "constructor" } -] \ No newline at end of file +] diff --git a/simulations/vip-xxx/arbitrumsepolia.ts b/simulations/vip-xxx/arbitrumsepolia.ts new file mode 100644 index 000000000..9133ef218 --- /dev/null +++ b/simulations/vip-xxx/arbitrumsepolia.ts @@ -0,0 +1,98 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { arbitrumsepolia } = NETWORK_ADDRESSES; + +forking(130235955, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0x006D44b6f5927b3eD83bD0c1C36Fb1A3BaCaC208", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract( + arbitrumsepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, + OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, + provider, + ); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA); + await setBalance(MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA)) + .setMarketSupplyCaps(["0xdEFbf0F9Ab6CdDd0a1FdDC894b358D0c0a39B052"], ["160000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA)) + .setMarketBorrowCaps(["0xdEFbf0F9Ab6CdDd0a1FdDC894b358D0c0a39B052"], ["150000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/basesepolia.ts b/simulations/vip-xxx/basesepolia.ts new file mode 100644 index 000000000..88a806892 --- /dev/null +++ b/simulations/vip-xxx/basesepolia.ts @@ -0,0 +1,98 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_BASESEPOLIA, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_BASESEPOLIA, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { basesepolia } = NETWORK_ADDRESSES; + +forking(22799683, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_BASESEPOLIA, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0x272795dd6c5355CF25765F36043F34014454Eb5b", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract( + basesepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, + OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, + provider, + ); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_BASESEPOLIA)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BASESEPOLIA)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_BASESEPOLIA); + await setBalance(MARKET_CAP_RISK_STEWARD_BASESEPOLIA, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BASESEPOLIA)) + .setMarketSupplyCaps(["0xA31D67c056Aadc2501535f2776bF1157904f810e"], ["180000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BASESEPOLIA)) + .setMarketBorrowCaps(["0xA31D67c056Aadc2501535f2776bF1157904f810e"], ["150000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts index ad2b87ebe..4f9a3f064 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-xxx/bsctestnet.ts @@ -1,32 +1,28 @@ - -import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import { parseUnits } from "ethers/lib/utils"; -import vipxxx, { COMPTROLLER, MARKET_CAP_RISK_STEWARD, ACCESS_CONTROL_MANAGER, ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet"; +import vipxxx, { + ACCESS_CONTROL_MANAGER, + ANY_TARGET_CONTRACT, + COMPTROLLER, + MARKET_CAP_RISK_STEWARD, +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; -import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; - +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; forking(48650752, async () => { const provider = ethers.provider; - const acm = new ethers.Contract( - ACCESS_CONTROL_MANAGER, - ACCESS_CONTROL_MANAGER_ABI, - provider, - ); - const comptroller = new ethers.Contract( - COMPTROLLER, - COMPTROLLER_ABI, - provider, - ); + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); + const comptroller = new ethers.Contract(COMPTROLLER, COMPTROLLER_ABI, provider); const isolatedPoolComptroller = new ethers.Contract( - '0x1F4f0989C51f12DAcacD4025018176711f3Bf289', + "0x1F4f0989C51f12DAcacD4025018176711f3Bf289", ISOLATED_POOL_COMPTROLLER_ABI, provider, ); @@ -76,20 +72,27 @@ forking(48650752, async () => { it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { await impersonateAccount(MARKET_CAP_RISK_STEWARD); await setBalance(MARKET_CAP_RISK_STEWARD, parseUnits("1000000", 18)); - await expect(comptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) - ._setMarketSupplyCaps(['0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6'], ['150000000000000000000000'])) - .to.emit(comptroller, "NewSupplyCap"); - await expect(comptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) - ._setMarketBorrowCaps(['0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6'], ['55000000000000000000000'])) - .to.emit(comptroller, "NewBorrowCap"); - + await expect( + comptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + ._setMarketSupplyCaps(["0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6"], ["150000000000000000000000"]), + ).to.emit(comptroller, "NewSupplyCap"); + await expect( + comptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + ._setMarketBorrowCaps(["0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6"], ["55000000000000000000000"]), + ).to.emit(comptroller, "NewBorrowCap"); - await expect(isolatedPoolComptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) - .setMarketSupplyCaps(['0xef470AbC365F88e4582D8027172a392C473A5B53'], ['150000000000000000000000'])) - .to.emit(isolatedPoolComptroller, "NewSupplyCap"); - await expect(isolatedPoolComptroller.connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) - .setMarketBorrowCaps(['0xef470AbC365F88e4582D8027172a392C473A5B53'], ['55000000000000000000000'])) - .to.emit(isolatedPoolComptroller, "NewBorrowCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .setMarketSupplyCaps(["0xef470AbC365F88e4582D8027172a392C473A5B53"], ["150000000000000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .setMarketBorrowCaps(["0xef470AbC365F88e4582D8027172a392C473A5B53"], ["55000000000000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); }); }); }); diff --git a/simulations/vip-xxx/opbnbtestnet.ts b/simulations/vip-xxx/opbnbtestnet.ts new file mode 100644 index 000000000..8119afe55 --- /dev/null +++ b/simulations/vip-xxx/opbnbtestnet.ts @@ -0,0 +1,98 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { opbnbtestnet } = NETWORK_ADDRESSES; + +forking(54487051, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_OPBNBTESTNET, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0x2FCABb31E57F010D623D8d68e1E18Aed11d5A388", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract( + opbnbtestnet.OMNICHAIN_GOVERNANCE_EXECUTOR, + OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, + provider, + ); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_OPBNBTESTNET)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_OPBNBTESTNET)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_OPBNBTESTNET); + await setBalance(MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_OPBNBTESTNET)) + .setMarketSupplyCaps(["0xe3923805f6E117E51f5387421240a86EF1570abC"], ["15000000000000000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_OPBNBTESTNET)) + .setMarketBorrowCaps(["0xe3923805f6E117E51f5387421240a86EF1570abC"], ["9500000000000000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/opsepolia.ts b/simulations/vip-xxx/opsepolia.ts new file mode 100644 index 000000000..3c544dfed --- /dev/null +++ b/simulations/vip-xxx/opsepolia.ts @@ -0,0 +1,98 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_OPSEPOLIA, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_OPSEPOLIA, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { opsepolia } = NETWORK_ADDRESSES; + +forking(24782602, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_OPSEPOLIA, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0x59d10988974223B042767aaBFb6D926863069535", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract( + opsepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, + OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, + provider, + ); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_OPSEPOLIA)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_OPSEPOLIA)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_OPSEPOLIA); + await setBalance(MARKET_CAP_RISK_STEWARD_OPSEPOLIA, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_OPSEPOLIA)) + .setMarketSupplyCaps(["0x2419606690B08060ebFd7581e0a6Ae45f1915ee9"], ["180000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_OPSEPOLIA)) + .setMarketBorrowCaps(["0x2419606690B08060ebFd7581e0a6Ae45f1915ee9"], ["150000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/unichainsepolia.ts b/simulations/vip-xxx/unichainsepolia.ts new file mode 100644 index 000000000..ae904cbac --- /dev/null +++ b/simulations/vip-xxx/unichainsepolia.ts @@ -0,0 +1,98 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { unichainsepolia } = NETWORK_ADDRESSES; + +forking(14515634, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0xFeD3eAA668a6179c9E5E1A84e3A7d6883F06f7c1", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract( + unichainsepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, + OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, + provider, + ); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA); + await setBalance(MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA)) + .setMarketSupplyCaps(["0x2d8814e1358D71B6B271295893F7409E3127CBBf"], ["25000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA)) + .setMarketBorrowCaps(["0x2d8814e1358D71B6B271295893F7409E3127CBBf"], ["19000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/zksyncsepolia.ts b/simulations/vip-xxx/zksyncsepolia.ts new file mode 100644 index 000000000..0d6212d3e --- /dev/null +++ b/simulations/vip-xxx/zksyncsepolia.ts @@ -0,0 +1,98 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { zksyncsepolia } = NETWORK_ADDRESSES; + +forking(4898583, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0xC527DE08E43aeFD759F7c0e6aE85433923064669", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract( + zksyncsepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, + OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, + provider, + ); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA); + await setBalance(MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA)) + .setMarketSupplyCaps(["0x7Bfd185eF8380a72027bF65bFEEAb0242b147778"], ["25000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA)) + .setMarketBorrowCaps(["0x7Bfd185eF8380a72027bF65bFEEAb0242b147778"], ["20000000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/vips/vip-xxx/bsctestnet-crosschain.ts b/vips/vip-xxx/bsctestnet-crosschain.ts new file mode 100644 index 000000000..b9c5d919d --- /dev/null +++ b/vips/vip-xxx/bsctestnet-crosschain.ts @@ -0,0 +1,295 @@ +import { LzChainId, ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +// export const RISK_STEWARD_RECEIVER_SEPOLIA = ""; +// export const MARKET_CAP_RISK_STEWARD_SEPOLIA = ""; +// export const ACCESS_CONTROL_MANAGER_SEPOLIA = ""; +// export const NORMAL_TIMELOCK_SEPOLIA = ""; + +export const RISK_STEWARD_RECEIVER_OPBNBTESTNET = "0x3F2b0d789ceB24A3270C3f4B176825882aE0D041"; +export const MARKET_CAP_RISK_STEWARD_OPBNBTESTNET = "0x220646CE7c7136341ED919938e16700a84A5715c"; +export const ACCESS_CONTROL_MANAGER_OPBNBTESTNET = "0x049f77F7046266d27C3bC96376f53C17Ef09c986"; +export const NORMAL_TIMELOCK_OPBNBTESTNET = "0x1c4e015Bd435Efcf4f58D82B0d0fBa8fC4F81120"; + +export const RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA = "0x74E708A7F5486ed73CCCAe54B63e71B1988F1383"; +export const MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA = "0xA03205bC635A772E533E7BE36b5701E331a70ea3"; +export const ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA = "0xa36AD96441cB931D8dFEAAaC97D3FaB4B39E590F"; +export const NORMAL_TIMELOCK_ARBITRUMSEPOLIA = "0x794BCA78E606f3a462C31e5Aba98653Efc1322F8"; + +export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0xc9a4Cc7f05fa9DF9C331992451dB0209D29fC7cc"; +export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0xA0439BFB9C9fe7B8451eE20673b796698ab52e95"; +export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; +export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; + +export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0x06473fB3f7bF11e2E8EfEcC95aC55ABEFCb2e0A0"; +export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; +export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; +export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; + +export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x06473fB3f7bF11e2E8EfEcC95aC55ABEFCb2e0A0"; +export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; +export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; +export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; + +export const RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA = "0x25483111881c431492D010a9071Ce6C84C3b90A6"; +export const MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA = "0xe88C01daAd0b931af68C9fD70bfa9bde8142FF64"; +export const ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA = "0xD07f543d47c3a8997D6079958308e981AC14CD01"; +export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b42971a67E"; + +export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; + +const vip457 = () => { + const meta = { + version: "v2", + title: "Configure Remote Risk Stewards", + description: `#### Summary +Configure Remote Risk Stewards +`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + // opbnbsepolia + { + target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_OPBNBTESTNET, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_OPBNBTESTNET, + ], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], + dstChainId: LzChainId.opbnbtestnet, + }, + // arbitrumsepolia + { + target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_ARBITRUMSEPOLIA, + ], + dstChainId: LzChainId.arbitrumsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], + dstChainId: LzChainId.arbitrumsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], + dstChainId: LzChainId.arbitrumsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, + ], + dstChainId: LzChainId.arbitrumsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, + ], + dstChainId: LzChainId.arbitrumsepolia, + }, + // opsepolia + { + target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_OPSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_OPSEPOLIA, + ], + dstChainId: LzChainId.opsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_OPSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + dstChainId: LzChainId.opsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_OPSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + dstChainId: LzChainId.opsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], + dstChainId: LzChainId.opsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], + dstChainId: LzChainId.opsepolia, + }, + // basesepolia + { + target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_BASESEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_BASESEPOLIA, + ], + dstChainId: LzChainId.basesepolia, + }, + { + target: RISK_STEWARD_RECEIVER_BASESEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + dstChainId: LzChainId.basesepolia, + }, + { + target: RISK_STEWARD_RECEIVER_BASESEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + dstChainId: LzChainId.basesepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], + dstChainId: LzChainId.basesepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], + dstChainId: LzChainId.basesepolia, + }, + // unichainsepolia + { + target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_UNICHAINSEPOLIA, + ], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, + ], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, + ], + dstChainId: LzChainId.unichainsepolia, + }, + // zksyncsepolia + { + target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_ZKSYNCSEPOLIA, + ], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, + ], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, + ], + dstChainId: LzChainId.zksyncsepolia, + }, + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip457; diff --git a/vips/vip-xxx/bsctestnet.ts b/vips/vip-xxx/bsctestnet.ts index 435d3fb5b..d90c5238f 100644 --- a/vips/vip-xxx/bsctestnet.ts +++ b/vips/vip-xxx/bsctestnet.ts @@ -6,7 +6,7 @@ export const MARKET_CAP_RISK_STEWARD = "0x9b40390771cAeEa69DE55EEd176aeDC72d70cA export const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; export const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; export const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; -export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; +export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; const vip457 = () => { const meta = { @@ -29,13 +29,13 @@ Configure Risk Steward }, { target: RISK_STEWARD_RECEIVER, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD, 86401], + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD, 86401], }, { - target: RISK_STEWARD_RECEIVER, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD, 86401], + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD, 86401], }, { target: ACCESS_CONTROL_MANAGER, @@ -57,10 +57,9 @@ Configure Risk Steward signature: "giveCallPermission(address,string,address)", params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], }, - ], meta, - ProposalType.REGULAR + ProposalType.REGULAR, ); }; From 3211cbf64186e351ed1966ea567a2e3ec27bd938 Mon Sep 17 00:00:00 2001 From: web3rover Date: Thu, 3 Apr 2025 22:41:27 +0530 Subject: [PATCH 03/31] fix: updated addresses --- simulations/vip-xxx/arbitrumsepolia.ts | 2 +- simulations/vip-xxx/basesepolia.ts | 2 +- simulations/vip-xxx/opbnbtestnet.ts | 2 +- simulations/vip-xxx/opsepolia.ts | 2 +- simulations/vip-xxx/sepolia.ts | 94 ++++++++++++++++++++++++++ simulations/vip-xxx/unichainsepolia.ts | 2 +- vips/vip-xxx/bsctestnet-crosschain.ts | 63 +++++++++++++---- 7 files changed, 148 insertions(+), 19 deletions(-) create mode 100644 simulations/vip-xxx/sepolia.ts diff --git a/simulations/vip-xxx/arbitrumsepolia.ts b/simulations/vip-xxx/arbitrumsepolia.ts index 9133ef218..c68ef205c 100644 --- a/simulations/vip-xxx/arbitrumsepolia.ts +++ b/simulations/vip-xxx/arbitrumsepolia.ts @@ -19,7 +19,7 @@ import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json const { arbitrumsepolia } = NETWORK_ADDRESSES; -forking(130235955, async () => { +forking(138822251, async () => { const provider = ethers.provider; let executor: Contract; let lastProposalReceived: BigNumber; diff --git a/simulations/vip-xxx/basesepolia.ts b/simulations/vip-xxx/basesepolia.ts index 88a806892..409d6bff4 100644 --- a/simulations/vip-xxx/basesepolia.ts +++ b/simulations/vip-xxx/basesepolia.ts @@ -19,7 +19,7 @@ import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json const { basesepolia } = NETWORK_ADDRESSES; -forking(22799683, async () => { +forking(23964088, async () => { const provider = ethers.provider; let executor: Contract; let lastProposalReceived: BigNumber; diff --git a/simulations/vip-xxx/opbnbtestnet.ts b/simulations/vip-xxx/opbnbtestnet.ts index 8119afe55..ae11d3400 100644 --- a/simulations/vip-xxx/opbnbtestnet.ts +++ b/simulations/vip-xxx/opbnbtestnet.ts @@ -19,7 +19,7 @@ import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json const { opbnbtestnet } = NETWORK_ADDRESSES; -forking(54487051, async () => { +forking(56951686, async () => { const provider = ethers.provider; let executor: Contract; let lastProposalReceived: BigNumber; diff --git a/simulations/vip-xxx/opsepolia.ts b/simulations/vip-xxx/opsepolia.ts index 3c544dfed..07a0b273a 100644 --- a/simulations/vip-xxx/opsepolia.ts +++ b/simulations/vip-xxx/opsepolia.ts @@ -19,7 +19,7 @@ import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json const { opsepolia } = NETWORK_ADDRESSES; -forking(24782602, async () => { +forking(25946983, async () => { const provider = ethers.provider; let executor: Contract; let lastProposalReceived: BigNumber; diff --git a/simulations/vip-xxx/sepolia.ts b/simulations/vip-xxx/sepolia.ts new file mode 100644 index 000000000..fe8c864a8 --- /dev/null +++ b/simulations/vip-xxx/sepolia.ts @@ -0,0 +1,94 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vipxxx, { + ACCESS_CONTROL_MANAGER_SEPOLIA, + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_SEPOLIA, +} from "../../vips/vip-xxx/bsctestnet-crosschain"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { sepolia } = NETWORK_ADDRESSES; + +forking(8043152, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_SEPOLIA, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0x7Aa39ab4BcA897F403425C9C6FDbd0f882Be0D70", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract(sepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, provider); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [3, 2], + ); + }, + }); + + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_SEPOLIA)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_SEPOLIA)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_SEPOLIA); + await setBalance(MARKET_CAP_RISK_STEWARD_SEPOLIA, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_SEPOLIA)) + .setMarketSupplyCaps(["0x19252AFD0B2F539C400aEab7d460CBFbf74c17ff"], ["160000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_SEPOLIA)) + .setMarketBorrowCaps(["0x19252AFD0B2F539C400aEab7d460CBFbf74c17ff"], ["150000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/unichainsepolia.ts b/simulations/vip-xxx/unichainsepolia.ts index ae904cbac..3889d2851 100644 --- a/simulations/vip-xxx/unichainsepolia.ts +++ b/simulations/vip-xxx/unichainsepolia.ts @@ -19,7 +19,7 @@ import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json const { unichainsepolia } = NETWORK_ADDRESSES; -forking(14515634, async () => { +forking(16844634, async () => { const provider = ethers.provider; let executor: Contract; let lastProposalReceived: BigNumber; diff --git a/vips/vip-xxx/bsctestnet-crosschain.ts b/vips/vip-xxx/bsctestnet-crosschain.ts index b9c5d919d..83b17b5ca 100644 --- a/vips/vip-xxx/bsctestnet-crosschain.ts +++ b/vips/vip-xxx/bsctestnet-crosschain.ts @@ -1,33 +1,33 @@ import { LzChainId, ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -// export const RISK_STEWARD_RECEIVER_SEPOLIA = ""; -// export const MARKET_CAP_RISK_STEWARD_SEPOLIA = ""; -// export const ACCESS_CONTROL_MANAGER_SEPOLIA = ""; -// export const NORMAL_TIMELOCK_SEPOLIA = ""; +export const RISK_STEWARD_RECEIVER_SEPOLIA = "0xDF1807d323Dd2E2871e8b394c8F7595E097e1C73"; +export const MARKET_CAP_RISK_STEWARD_SEPOLIA = "0xEa687c54321Db5b20CA544f38f08E429a4bfCBc8"; +export const ACCESS_CONTROL_MANAGER_SEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; +export const NORMAL_TIMELOCK_SEPOLIA = "0xc332F7D8D5eA72cf760ED0E1c0485c8891C6E0cF"; -export const RISK_STEWARD_RECEIVER_OPBNBTESTNET = "0x3F2b0d789ceB24A3270C3f4B176825882aE0D041"; -export const MARKET_CAP_RISK_STEWARD_OPBNBTESTNET = "0x220646CE7c7136341ED919938e16700a84A5715c"; +export const RISK_STEWARD_RECEIVER_OPBNBTESTNET = "0x3f0e45aC20048cE0a803c439913a638A8208602e"; +export const MARKET_CAP_RISK_STEWARD_OPBNBTESTNET = "0x155F16CB2b5f69F66d4359d81C6cA55E8Be5a253"; export const ACCESS_CONTROL_MANAGER_OPBNBTESTNET = "0x049f77F7046266d27C3bC96376f53C17Ef09c986"; export const NORMAL_TIMELOCK_OPBNBTESTNET = "0x1c4e015Bd435Efcf4f58D82B0d0fBa8fC4F81120"; -export const RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA = "0x74E708A7F5486ed73CCCAe54B63e71B1988F1383"; -export const MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA = "0xA03205bC635A772E533E7BE36b5701E331a70ea3"; +export const RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA = "0xE6b7B1846106605fdfaB3a9F407dd64bed6917a6"; +export const MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA = "0xe739ff9CFa2CFA24fb7816133e1CBe7046A37Ecc"; export const ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA = "0xa36AD96441cB931D8dFEAAaC97D3FaB4B39E590F"; export const NORMAL_TIMELOCK_ARBITRUMSEPOLIA = "0x794BCA78E606f3a462C31e5Aba98653Efc1322F8"; -export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0xc9a4Cc7f05fa9DF9C331992451dB0209D29fC7cc"; -export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0xA0439BFB9C9fe7B8451eE20673b796698ab52e95"; +export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; +export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0x7831156A181288ce76B5952624Df6C842F4Cc0c1"; export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; -export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0x06473fB3f7bF11e2E8EfEcC95aC55ABEFCb2e0A0"; -export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; +export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0xf69fd7757c8A59DFA5c35622d9D44B31dB21B0a2"; +export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xE03E243AC1f3239ed6a0793C25E79C951339a915"; export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; -export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x06473fB3f7bF11e2E8EfEcC95aC55ABEFCb2e0A0"; -export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; +export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; +export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0x6edbFE9a95dB5f0CdDcE446A0Fe75D7832Cf8DDB"; export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; @@ -52,6 +52,41 @@ Configure Remote Risk Stewards return makeProposal( [ + // sepolia + { + target: ACCESS_CONTROL_MANAGER_SEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_SEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_SEPOLIA, + ], + dstChainId: LzChainId.sepolia, + }, + { + target: RISK_STEWARD_RECEIVER_SEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], + dstChainId: LzChainId.sepolia, + }, + { + target: RISK_STEWARD_RECEIVER_SEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], + dstChainId: LzChainId.sepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_SEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], + dstChainId: LzChainId.sepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_SEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], + dstChainId: LzChainId.sepolia, + }, // opbnbsepolia { target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, From 1fcfb537fc973b159d5f9ce65b419051b9843b0e Mon Sep 17 00:00:00 2001 From: web3rover Date: Tue, 8 Apr 2025 15:57:55 +0530 Subject: [PATCH 04/31] fix: merged vips --- simulations/vip-xxx/arbitrumsepolia.ts | 2 +- simulations/vip-xxx/basesepolia.ts | 2 +- simulations/vip-xxx/bsctestnet.ts | 36 +-- simulations/vip-xxx/opbnbtestnet.ts | 2 +- simulations/vip-xxx/opsepolia.ts | 2 +- simulations/vip-xxx/sepolia.ts | 2 +- simulations/vip-xxx/unichainsepolia.ts | 2 +- simulations/vip-xxx/zksyncsepolia.ts | 2 +- vips/vip-xxx/bsctestnet-crosschain.ts | 330 ----------------------- vips/vip-xxx/bsctestnet.ts | 355 +++++++++++++++++++++++-- 10 files changed, 358 insertions(+), 377 deletions(-) delete mode 100644 vips/vip-xxx/bsctestnet-crosschain.ts diff --git a/simulations/vip-xxx/arbitrumsepolia.ts b/simulations/vip-xxx/arbitrumsepolia.ts index c68ef205c..6f3cf7286 100644 --- a/simulations/vip-xxx/arbitrumsepolia.ts +++ b/simulations/vip-xxx/arbitrumsepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/basesepolia.ts b/simulations/vip-xxx/basesepolia.ts index 409d6bff4..804d71e76 100644 --- a/simulations/vip-xxx/basesepolia.ts +++ b/simulations/vip-xxx/basesepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_BASESEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_BASESEPOLIA, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts index 4f9a3f064..93f73fddf 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-xxx/bsctestnet.ts @@ -6,10 +6,10 @@ import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; import vipxxx, { - ACCESS_CONTROL_MANAGER, - ANY_TARGET_CONTRACT, - COMPTROLLER, - MARKET_CAP_RISK_STEWARD, + ACCESS_CONTROL_MANAGER_BSC_TESTNET, + MARKET_CAP_RISK_STEWARD_BSC_TESTNET, + BSC_TESTNET_CORE_COMPTROLLER, + ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; @@ -18,8 +18,8 @@ import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json forking(48650752, async () => { const provider = ethers.provider; - const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); - const comptroller = new ethers.Contract(COMPTROLLER, COMPTROLLER_ABI, provider); + const acm = new ethers.Contract(ACCESS_CONTROL_MANAGER_BSC_TESTNET, ACCESS_CONTROL_MANAGER_ABI, provider); + const comptroller = new ethers.Contract(BSC_TESTNET_CORE_COMPTROLLER, COMPTROLLER_ABI, provider); const isolatedPoolComptroller = new ethers.Contract( "0x1F4f0989C51f12DAcacD4025018176711f3Bf289", @@ -45,52 +45,52 @@ forking(48650752, async () => { [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], ); const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); - expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_BSC_TESTNET)).to.be.true; const borrowCapRole = ethers.utils.solidityPack( ["address", "string"], [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], ); const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); - expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BSC_TESTNET)).to.be.true; const supplyCapCorePoolRole = ethers.utils.solidityPack( ["address", "string"], - [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])"], + [BSC_TESTNET_CORE_COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])"], ); const supplyCapCorePoolRoleHash = ethers.utils.keccak256(supplyCapCorePoolRole); - expect(await acm.hasRole(supplyCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + expect(await acm.hasRole(supplyCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSC_TESTNET)).to.be.true; const borrowCapCorePoolRole = ethers.utils.solidityPack( ["address", "string"], - [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])"], + [BSC_TESTNET_CORE_COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])"], ); const borrowCapCorePoolRoleHash = ethers.utils.keccak256(borrowCapCorePoolRole); - expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD)).to.be.true; + expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSC_TESTNET)).to.be.true; }); it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { - await impersonateAccount(MARKET_CAP_RISK_STEWARD); - await setBalance(MARKET_CAP_RISK_STEWARD, parseUnits("1000000", 18)); + await impersonateAccount(MARKET_CAP_RISK_STEWARD_BSC_TESTNET); + await setBalance(MARKET_CAP_RISK_STEWARD_BSC_TESTNET, parseUnits("1000000", 18)); await expect( comptroller - .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSC_TESTNET)) ._setMarketSupplyCaps(["0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6"], ["150000000000000000000000"]), ).to.emit(comptroller, "NewSupplyCap"); await expect( comptroller - .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSC_TESTNET)) ._setMarketBorrowCaps(["0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6"], ["55000000000000000000000"]), ).to.emit(comptroller, "NewBorrowCap"); await expect( isolatedPoolComptroller - .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSC_TESTNET)) .setMarketSupplyCaps(["0xef470AbC365F88e4582D8027172a392C473A5B53"], ["150000000000000000000000"]), ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); await expect( isolatedPoolComptroller - .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD)) + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSC_TESTNET)) .setMarketBorrowCaps(["0xef470AbC365F88e4582D8027172a392C473A5B53"], ["55000000000000000000000"]), ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); }); diff --git a/simulations/vip-xxx/opbnbtestnet.ts b/simulations/vip-xxx/opbnbtestnet.ts index ae11d3400..5435ae260 100644 --- a/simulations/vip-xxx/opbnbtestnet.ts +++ b/simulations/vip-xxx/opbnbtestnet.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_OPBNBTESTNET, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/opsepolia.ts b/simulations/vip-xxx/opsepolia.ts index 07a0b273a..b0d386d41 100644 --- a/simulations/vip-xxx/opsepolia.ts +++ b/simulations/vip-xxx/opsepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_OPSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_OPSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/sepolia.ts b/simulations/vip-xxx/sepolia.ts index fe8c864a8..b1594aeea 100644 --- a/simulations/vip-xxx/sepolia.ts +++ b/simulations/vip-xxx/sepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_SEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_SEPOLIA, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/unichainsepolia.ts b/simulations/vip-xxx/unichainsepolia.ts index 3889d2851..fd98bbec1 100644 --- a/simulations/vip-xxx/unichainsepolia.ts +++ b/simulations/vip-xxx/unichainsepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/zksyncsepolia.ts b/simulations/vip-xxx/zksyncsepolia.ts index 0d6212d3e..923743e3d 100644 --- a/simulations/vip-xxx/zksyncsepolia.ts +++ b/simulations/vip-xxx/zksyncsepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet-crosschain"; +} from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/vips/vip-xxx/bsctestnet-crosschain.ts b/vips/vip-xxx/bsctestnet-crosschain.ts deleted file mode 100644 index 83b17b5ca..000000000 --- a/vips/vip-xxx/bsctestnet-crosschain.ts +++ /dev/null @@ -1,330 +0,0 @@ -import { LzChainId, ProposalType } from "src/types"; -import { makeProposal } from "src/utils"; - -export const RISK_STEWARD_RECEIVER_SEPOLIA = "0xDF1807d323Dd2E2871e8b394c8F7595E097e1C73"; -export const MARKET_CAP_RISK_STEWARD_SEPOLIA = "0xEa687c54321Db5b20CA544f38f08E429a4bfCBc8"; -export const ACCESS_CONTROL_MANAGER_SEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; -export const NORMAL_TIMELOCK_SEPOLIA = "0xc332F7D8D5eA72cf760ED0E1c0485c8891C6E0cF"; - -export const RISK_STEWARD_RECEIVER_OPBNBTESTNET = "0x3f0e45aC20048cE0a803c439913a638A8208602e"; -export const MARKET_CAP_RISK_STEWARD_OPBNBTESTNET = "0x155F16CB2b5f69F66d4359d81C6cA55E8Be5a253"; -export const ACCESS_CONTROL_MANAGER_OPBNBTESTNET = "0x049f77F7046266d27C3bC96376f53C17Ef09c986"; -export const NORMAL_TIMELOCK_OPBNBTESTNET = "0x1c4e015Bd435Efcf4f58D82B0d0fBa8fC4F81120"; - -export const RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA = "0xE6b7B1846106605fdfaB3a9F407dd64bed6917a6"; -export const MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA = "0xe739ff9CFa2CFA24fb7816133e1CBe7046A37Ecc"; -export const ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA = "0xa36AD96441cB931D8dFEAAaC97D3FaB4B39E590F"; -export const NORMAL_TIMELOCK_ARBITRUMSEPOLIA = "0x794BCA78E606f3a462C31e5Aba98653Efc1322F8"; - -export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; -export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0x7831156A181288ce76B5952624Df6C842F4Cc0c1"; -export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; -export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; - -export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0xf69fd7757c8A59DFA5c35622d9D44B31dB21B0a2"; -export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xE03E243AC1f3239ed6a0793C25E79C951339a915"; -export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; -export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; - -export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; -export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0x6edbFE9a95dB5f0CdDcE446A0Fe75D7832Cf8DDB"; -export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; -export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; - -export const RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA = "0x25483111881c431492D010a9071Ce6C84C3b90A6"; -export const MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA = "0xe88C01daAd0b931af68C9fD70bfa9bde8142FF64"; -export const ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA = "0xD07f543d47c3a8997D6079958308e981AC14CD01"; -export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b42971a67E"; - -export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; - -const vip457 = () => { - const meta = { - version: "v2", - title: "Configure Remote Risk Stewards", - description: `#### Summary -Configure Remote Risk Stewards -`, - forDescription: "Execute this proposal", - againstDescription: "Do not execute this proposal", - abstainDescription: "Indifferent to execution", - }; - - return makeProposal( - [ - // sepolia - { - target: ACCESS_CONTROL_MANAGER_SEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_SEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_SEPOLIA, - ], - dstChainId: LzChainId.sepolia, - }, - { - target: RISK_STEWARD_RECEIVER_SEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], - dstChainId: LzChainId.sepolia, - }, - { - target: RISK_STEWARD_RECEIVER_SEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], - dstChainId: LzChainId.sepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_SEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], - dstChainId: LzChainId.sepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_SEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], - dstChainId: LzChainId.sepolia, - }, - // opbnbsepolia - { - target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_OPBNBTESTNET, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_OPBNBTESTNET, - ], - dstChainId: LzChainId.opbnbtestnet, - }, - { - target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], - dstChainId: LzChainId.opbnbtestnet, - }, - { - target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], - dstChainId: LzChainId.opbnbtestnet, - }, - { - target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], - dstChainId: LzChainId.opbnbtestnet, - }, - { - target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], - dstChainId: LzChainId.opbnbtestnet, - }, - // arbitrumsepolia - { - target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_ARBITRUMSEPOLIA, - ], - dstChainId: LzChainId.arbitrumsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], - dstChainId: LzChainId.arbitrumsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], - dstChainId: LzChainId.arbitrumsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, - ], - dstChainId: LzChainId.arbitrumsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, - ], - dstChainId: LzChainId.arbitrumsepolia, - }, - // opsepolia - { - target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_OPSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_OPSEPOLIA, - ], - dstChainId: LzChainId.opsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_OPSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], - dstChainId: LzChainId.opsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_OPSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], - dstChainId: LzChainId.opsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], - dstChainId: LzChainId.opsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], - dstChainId: LzChainId.opsepolia, - }, - // basesepolia - { - target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_BASESEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_BASESEPOLIA, - ], - dstChainId: LzChainId.basesepolia, - }, - { - target: RISK_STEWARD_RECEIVER_BASESEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], - dstChainId: LzChainId.basesepolia, - }, - { - target: RISK_STEWARD_RECEIVER_BASESEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], - dstChainId: LzChainId.basesepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], - dstChainId: LzChainId.basesepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], - dstChainId: LzChainId.basesepolia, - }, - // unichainsepolia - { - target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_UNICHAINSEPOLIA, - ], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, - ], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, - ], - dstChainId: LzChainId.unichainsepolia, - }, - // zksyncsepolia - { - target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_ZKSYNCSEPOLIA, - ], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, - ], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, - ], - dstChainId: LzChainId.zksyncsepolia, - }, - ], - meta, - ProposalType.REGULAR, - ); -}; - -export default vip457; diff --git a/vips/vip-xxx/bsctestnet.ts b/vips/vip-xxx/bsctestnet.ts index d90c5238f..b7542b632 100644 --- a/vips/vip-xxx/bsctestnet.ts +++ b/vips/vip-xxx/bsctestnet.ts @@ -1,19 +1,55 @@ -import { ProposalType } from "src/types"; +import { LzChainId, ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -export const RISK_STEWARD_RECEIVER = "0x31DEb4D1326838522697f7a012992f0824d80f2b"; -export const MARKET_CAP_RISK_STEWARD = "0x9b40390771cAeEa69DE55EEd176aeDC72d70cA3E"; -export const ACCESS_CONTROL_MANAGER = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; -export const NORMAL_TIMELOCK = "0xce10739590001705F7FF231611ba4A48B2820327"; -export const COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +export const RISK_STEWARD_RECEIVER_BSC_TESTNET = "0x31DEb4D1326838522697f7a012992f0824d80f2b"; +export const MARKET_CAP_RISK_STEWARD_BSC_TESTNET = "0x9b40390771cAeEa69DE55EEd176aeDC72d70cA3E"; +export const ACCESS_CONTROL_MANAGER_BSC_TESTNET = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; +export const NORMAL_TIMELOCK_BSC_TESTNET = "0xce10739590001705F7FF231611ba4A48B2820327"; +export const BSC_TESTNET_CORE_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; + +export const RISK_STEWARD_RECEIVER_SEPOLIA = "0xDF1807d323Dd2E2871e8b394c8F7595E097e1C73"; +export const MARKET_CAP_RISK_STEWARD_SEPOLIA = "0xEa687c54321Db5b20CA544f38f08E429a4bfCBc8"; +export const ACCESS_CONTROL_MANAGER_SEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; +export const NORMAL_TIMELOCK_SEPOLIA = "0xc332F7D8D5eA72cf760ED0E1c0485c8891C6E0cF"; + +export const RISK_STEWARD_RECEIVER_OPBNBTESTNET = "0x3f0e45aC20048cE0a803c439913a638A8208602e"; +export const MARKET_CAP_RISK_STEWARD_OPBNBTESTNET = "0x155F16CB2b5f69F66d4359d81C6cA55E8Be5a253"; +export const ACCESS_CONTROL_MANAGER_OPBNBTESTNET = "0x049f77F7046266d27C3bC96376f53C17Ef09c986"; +export const NORMAL_TIMELOCK_OPBNBTESTNET = "0x1c4e015Bd435Efcf4f58D82B0d0fBa8fC4F81120"; + +export const RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA = "0xE6b7B1846106605fdfaB3a9F407dd64bed6917a6"; +export const MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA = "0xe739ff9CFa2CFA24fb7816133e1CBe7046A37Ecc"; +export const ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA = "0xa36AD96441cB931D8dFEAAaC97D3FaB4B39E590F"; +export const NORMAL_TIMELOCK_ARBITRUMSEPOLIA = "0x794BCA78E606f3a462C31e5Aba98653Efc1322F8"; + +export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; +export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0x7831156A181288ce76B5952624Df6C842F4Cc0c1"; +export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; +export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; + +export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0xf69fd7757c8A59DFA5c35622d9D44B31dB21B0a2"; +export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xE03E243AC1f3239ed6a0793C25E79C951339a915"; +export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; +export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; + +export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; +export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0x6edbFE9a95dB5f0CdDcE446A0Fe75D7832Cf8DDB"; +export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; +export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; + +export const RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA = "0x25483111881c431492D010a9071Ce6C84C3b90A6"; +export const MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA = "0xe88C01daAd0b931af68C9fD70bfa9bde8142FF64"; +export const ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA = "0xD07f543d47c3a8997D6079958308e981AC14CD01"; +export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b42971a67E"; + export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; const vip457 = () => { const meta = { version: "v2", - title: "Configure Risk Steward", + title: "Configure Remote Risk Stewards", description: `#### Summary -Configure Risk Steward +Configure Remote Risk Stewards `, forDescription: "Execute this proposal", againstDescription: "Do not execute this proposal", @@ -22,40 +58,315 @@ Configure Risk Steward return makeProposal( [ + // bsc testnet + { + target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_BSC_TESTNET, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_BSC_TESTNET, + ], + }, + { + target: RISK_STEWARD_RECEIVER_BSC_TESTNET, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 86401], + }, + { + target: RISK_STEWARD_RECEIVER_BSC_TESTNET, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 86401], + }, + { + target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], + }, + { + target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], + }, + { + target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, + signature: "giveCallPermission(address,string,address)", + params: [BSC_TESTNET_CORE_COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], + }, + { + target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, + signature: "giveCallPermission(address,string,address)", + params: [BSC_TESTNET_CORE_COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], + }, + + // sepolia + { + target: ACCESS_CONTROL_MANAGER_SEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_SEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_SEPOLIA, + ], + dstChainId: LzChainId.sepolia, + }, + { + target: RISK_STEWARD_RECEIVER_SEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], + dstChainId: LzChainId.sepolia, + }, + { + target: RISK_STEWARD_RECEIVER_SEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], + dstChainId: LzChainId.sepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_SEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], + dstChainId: LzChainId.sepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_SEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], + dstChainId: LzChainId.sepolia, + }, + // opbnbsepolia + { + target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_OPBNBTESTNET, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_OPBNBTESTNET, + ], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], + dstChainId: LzChainId.opbnbtestnet, + }, + { + target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], + dstChainId: LzChainId.opbnbtestnet, + }, { - target: ACCESS_CONTROL_MANAGER, + target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "setRiskParameterConfig(string,address,uint256)", NORMAL_TIMELOCK], + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], + dstChainId: LzChainId.opbnbtestnet, }, + // arbitrumsepolia { - target: RISK_STEWARD_RECEIVER, + target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_ARBITRUMSEPOLIA, + ], + dstChainId: LzChainId.arbitrumsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], + dstChainId: LzChainId.arbitrumsepolia, }, { - target: RISK_STEWARD_RECEIVER, + target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], + dstChainId: LzChainId.arbitrumsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, + ], + dstChainId: LzChainId.arbitrumsepolia, }, { - target: ACCESS_CONTROL_MANAGER, + target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + params: [ + ANY_TARGET_CONTRACT, + "setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, + ], + dstChainId: LzChainId.arbitrumsepolia, + }, + // opsepolia + { + target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_OPSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_OPSEPOLIA, + ], + dstChainId: LzChainId.opsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_OPSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + dstChainId: LzChainId.opsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_OPSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + dstChainId: LzChainId.opsepolia, }, { - target: ACCESS_CONTROL_MANAGER, + target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], + dstChainId: LzChainId.opsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], + dstChainId: LzChainId.opsepolia, + }, + // basesepolia + { + target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_BASESEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_BASESEPOLIA, + ], + dstChainId: LzChainId.basesepolia, + }, + { + target: RISK_STEWARD_RECEIVER_BASESEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + dstChainId: LzChainId.basesepolia, + }, + { + target: RISK_STEWARD_RECEIVER_BASESEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + dstChainId: LzChainId.basesepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], + dstChainId: LzChainId.basesepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], + dstChainId: LzChainId.basesepolia, + }, + // unichainsepolia + { + target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_UNICHAINSEPOLIA, + ], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, + ], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + ANY_TARGET_CONTRACT, + "setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, + ], + dstChainId: LzChainId.unichainsepolia, + }, + // zksyncsepolia + { + target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + signature: "giveCallPermission(address,string,address)", + params: [ + RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + "setRiskParameterConfig(string,address,uint256)", + NORMAL_TIMELOCK_ZKSYNCSEPOLIA, + ], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + dstChainId: LzChainId.zksyncsepolia, }, { - target: ACCESS_CONTROL_MANAGER, + target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + params: [ + ANY_TARGET_CONTRACT, + "setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, + ], + dstChainId: LzChainId.zksyncsepolia, }, { - target: ACCESS_CONTROL_MANAGER, + target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, signature: "giveCallPermission(address,string,address)", - params: [COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + params: [ + ANY_TARGET_CONTRACT, + "setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, + ], + dstChainId: LzChainId.zksyncsepolia, }, ], meta, From 292d61814d47447b014eedf6fe0ac94286ed55f3 Mon Sep 17 00:00:00 2001 From: web3rover Date: Tue, 8 Apr 2025 16:00:39 +0530 Subject: [PATCH 05/31] fix: changed debounce --- vips/vip-xxx/bsctestnet.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/vips/vip-xxx/bsctestnet.ts b/vips/vip-xxx/bsctestnet.ts index b7542b632..ce61af894 100644 --- a/vips/vip-xxx/bsctestnet.ts +++ b/vips/vip-xxx/bsctestnet.ts @@ -71,12 +71,12 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_BSC_TESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 600], }, { target: RISK_STEWARD_RECEIVER_BSC_TESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 600], }, { target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, @@ -113,13 +113,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_SEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 600], dstChainId: LzChainId.sepolia, }, { target: RISK_STEWARD_RECEIVER_SEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 600], dstChainId: LzChainId.sepolia, }, { @@ -148,13 +148,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 600], dstChainId: LzChainId.opbnbtestnet, }, { target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 600], dstChainId: LzChainId.opbnbtestnet, }, { @@ -183,13 +183,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 600], dstChainId: LzChainId.arbitrumsepolia, }, { target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 600], dstChainId: LzChainId.arbitrumsepolia, }, { @@ -226,13 +226,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_OPSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 600], dstChainId: LzChainId.opsepolia, }, { target: RISK_STEWARD_RECEIVER_OPSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 600], dstChainId: LzChainId.opsepolia, }, { @@ -261,13 +261,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_BASESEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 600], dstChainId: LzChainId.basesepolia, }, { target: RISK_STEWARD_RECEIVER_BASESEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 600], dstChainId: LzChainId.basesepolia, }, { @@ -296,13 +296,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 600], dstChainId: LzChainId.unichainsepolia, }, { target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 600], dstChainId: LzChainId.unichainsepolia, }, { @@ -339,13 +339,13 @@ Configure Remote Risk Stewards { target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 600], dstChainId: LzChainId.zksyncsepolia, }, { target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 600], dstChainId: LzChainId.zksyncsepolia, }, { From d3b985da9be1b30e59ad6981364e9736a2467717 Mon Sep 17 00:00:00 2001 From: web3rover Date: Tue, 8 Apr 2025 18:10:29 +0530 Subject: [PATCH 06/31] fix: added missing permissions --- simulations/vip-xxx/bsctestnet.ts | 4 +- vips/vip-xxx/bsctestnet.ts | 451 ++++++++++++++++-------------- 2 files changed, 237 insertions(+), 218 deletions(-) diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts index 93f73fddf..deb2142d8 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-xxx/bsctestnet.ts @@ -7,9 +7,9 @@ import { forking, testVip } from "src/vip-framework"; import vipxxx, { ACCESS_CONTROL_MANAGER_BSC_TESTNET, - MARKET_CAP_RISK_STEWARD_BSC_TESTNET, + ANY_TARGET_CONTRACT, BSC_TESTNET_CORE_COMPTROLLER, - ANY_TARGET_CONTRACT + MARKET_CAP_RISK_STEWARD_BSC_TESTNET, } from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; diff --git a/vips/vip-xxx/bsctestnet.ts b/vips/vip-xxx/bsctestnet.ts index ce61af894..68700b00a 100644 --- a/vips/vip-xxx/bsctestnet.ts +++ b/vips/vip-xxx/bsctestnet.ts @@ -6,44 +6,173 @@ export const MARKET_CAP_RISK_STEWARD_BSC_TESTNET = "0x9b40390771cAeEa69DE55EEd17 export const ACCESS_CONTROL_MANAGER_BSC_TESTNET = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; export const NORMAL_TIMELOCK_BSC_TESTNET = "0xce10739590001705F7FF231611ba4A48B2820327"; export const BSC_TESTNET_CORE_COMPTROLLER = "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D"; +export const CRITIAL_TIMELOCK_BSC_TESTNET = "0x23B893a7C45a5Eb8c8C062b9F32d0D2e43eD286D"; +export const FAST_TRACK_TIMELOCK_BSC_TESTNET = "0x3CFf21b7AF8390fE68799D58727d3b4C25a83cb6"; export const RISK_STEWARD_RECEIVER_SEPOLIA = "0xDF1807d323Dd2E2871e8b394c8F7595E097e1C73"; export const MARKET_CAP_RISK_STEWARD_SEPOLIA = "0xEa687c54321Db5b20CA544f38f08E429a4bfCBc8"; export const ACCESS_CONTROL_MANAGER_SEPOLIA = "0xbf705C00578d43B6147ab4eaE04DBBEd1ccCdc96"; export const NORMAL_TIMELOCK_SEPOLIA = "0xc332F7D8D5eA72cf760ED0E1c0485c8891C6E0cF"; +export const CRITIAL_TIMELOCK_SEPOLIA = "0xA24A7A65b8968a749841988Bd7d05F6a94329fDe"; +export const FAST_TRACK_TIMELOCK_SEPOLIA = "0x7F043F43Adb392072a3Ba0cC9c96e894C6f7e182"; export const RISK_STEWARD_RECEIVER_OPBNBTESTNET = "0x3f0e45aC20048cE0a803c439913a638A8208602e"; export const MARKET_CAP_RISK_STEWARD_OPBNBTESTNET = "0x155F16CB2b5f69F66d4359d81C6cA55E8Be5a253"; export const ACCESS_CONTROL_MANAGER_OPBNBTESTNET = "0x049f77F7046266d27C3bC96376f53C17Ef09c986"; export const NORMAL_TIMELOCK_OPBNBTESTNET = "0x1c4e015Bd435Efcf4f58D82B0d0fBa8fC4F81120"; +export const CRITIAL_TIMELOCK_OPBNBTESTNET = "0xBd06aCDEF38230F4EdA0c6FD392905Ad463e42E3"; +export const FAST_TRACK_TIMELOCK_OPBNBTESTNET = "0xB2E6268085E75817669479b22c73C2AfEaADF7A6"; export const RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA = "0xE6b7B1846106605fdfaB3a9F407dd64bed6917a6"; export const MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA = "0xe739ff9CFa2CFA24fb7816133e1CBe7046A37Ecc"; export const ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA = "0xa36AD96441cB931D8dFEAAaC97D3FaB4B39E590F"; export const NORMAL_TIMELOCK_ARBITRUMSEPOLIA = "0x794BCA78E606f3a462C31e5Aba98653Efc1322F8"; +export const CRITIAL_TIMELOCK_ARBITRUMSEPOLIA = "0x0b32Be083f7041608E023007e7802430396a2123"; +export const FAST_TRACK_TIMELOCK_ARBITRUMSEPOLIA = "0x14642991184F989F45505585Da52ca6A6a7dD4c8"; export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0x7831156A181288ce76B5952624Df6C842F4Cc0c1"; export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; +export const CRITIAL_TIMELOCK_OPSEPOLIA = "0x45d2263c6E0dbF84eBffB1Ee0b80aC740607990B"; +export const FAST_TRACK_TIMELOCK_OPSEPOLIA = "0xe0Fa35b6279dd802C382ae54c50C8B16deaC0885"; export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0xf69fd7757c8A59DFA5c35622d9D44B31dB21B0a2"; export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xE03E243AC1f3239ed6a0793C25E79C951339a915"; export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; +export const CRITIAL_TIMELOCK_BASESEPOLIA = "0xbeDb7F2d0617292364bA4D73cf016c0f6BB5542E"; +export const FAST_TRACK_TIMELOCK_BASESEPOLIA = "0x3dFA652D3aaDcb93F9EA7d160d674C441AaA8EE2"; export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0x6edbFE9a95dB5f0CdDcE446A0Fe75D7832Cf8DDB"; export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; +export const CRITIAL_TIMELOCK_UNICHAINSEPOLIA = "0x86C093266e824FA4345484a7B9109e9567923DA6"; +export const FAST_TRACK_TIMELOCK_UNICHAINSEPOLIA = "0x668cDb1A414006D0a26e9e13881D4Cd30B8b2a4A"; export const RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA = "0x25483111881c431492D010a9071Ce6C84C3b90A6"; export const MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA = "0xe88C01daAd0b931af68C9fD70bfa9bde8142FF64"; export const ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA = "0xD07f543d47c3a8997D6079958308e981AC14CD01"; export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b42971a67E"; +export const CRITIAL_TIMELOCK_ZKSYNCSEPOLIA = "0x0E6138bE0FA1915efC73670a20A10EFd720a6Cc8"; +export const FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA = "0xb055e028b27d53a455a6c040a6952e44E9E615c4"; export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; +const permissions = ( + chain: LzChainId|undefined, + acm: string, + riskStewardReceiver: string, + marketCapRiskSteward: string, + normalTimelock: string, + fastTrackTimelock: string, + criticalTimelock: string, +) => { + return [ + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [ + riskStewardReceiver, + "setRiskParameterConfig(string,address,uint256)", + normalTimelock, + ], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", marketCapRiskSteward], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", marketCapRiskSteward], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "toggleConfigActive(string)", normalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "toggleConfigActive(string)", criticalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "toggleConfigActive(string)", fastTrackTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "pause()", normalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "pause()", criticalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "pause()", fastTrackTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "unpause()", normalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "unpause()", criticalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [riskStewardReceiver, "unpause()", fastTrackTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [marketCapRiskSteward, "processUpdate(RiskParameterUpdate)", riskStewardReceiver], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", normalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", criticalTimelock], + dstChainId: chain, + }, + { + target: acm, + signature: "giveCallPermission(address,string,address)", + params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", fastTrackTimelock], + dstChainId: chain, + }, + ] +} + const vip457 = () => { const meta = { version: "v2", @@ -59,313 +188,203 @@ Configure Remote Risk Stewards return makeProposal( [ // bsc testnet - { - target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_BSC_TESTNET, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_BSC_TESTNET, - ], - }, + ...permissions( + undefined, + ACCESS_CONTROL_MANAGER_BSC_TESTNET, + RISK_STEWARD_RECEIVER_BSC_TESTNET, + MARKET_CAP_RISK_STEWARD_BSC_TESTNET, + NORMAL_TIMELOCK_BSC_TESTNET, + FAST_TRACK_TIMELOCK_BSC_TESTNET, + CRITIAL_TIMELOCK_BSC_TESTNET, + ), { target: RISK_STEWARD_RECEIVER_BSC_TESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 86401], }, { target: RISK_STEWARD_RECEIVER_BSC_TESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 600], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSC_TESTNET, 86401], }, { target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], - }, - { - target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], - }, - { - target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, - signature: "giveCallPermission(address,string,address)", - params: [BSC_TESTNET_CORE_COMPTROLLER, "_setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], + params: [ + BSC_TESTNET_CORE_COMPTROLLER, + "_setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_BSC_TESTNET, + ], }, { target: ACCESS_CONTROL_MANAGER_BSC_TESTNET, signature: "giveCallPermission(address,string,address)", - params: [BSC_TESTNET_CORE_COMPTROLLER, "_setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSC_TESTNET], - }, - - // sepolia - { - target: ACCESS_CONTROL_MANAGER_SEPOLIA, - signature: "giveCallPermission(address,string,address)", params: [ - RISK_STEWARD_RECEIVER_SEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_SEPOLIA, + BSC_TESTNET_CORE_COMPTROLLER, + "_setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_BSC_TESTNET, ], - dstChainId: LzChainId.sepolia, }, + + // sepolia + ...permissions( + LzChainId.sepolia, + ACCESS_CONTROL_MANAGER_SEPOLIA, + RISK_STEWARD_RECEIVER_SEPOLIA, + MARKET_CAP_RISK_STEWARD_SEPOLIA, + NORMAL_TIMELOCK_SEPOLIA, + FAST_TRACK_TIMELOCK_SEPOLIA, + CRITIAL_TIMELOCK_SEPOLIA, + ), { target: RISK_STEWARD_RECEIVER_SEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], dstChainId: LzChainId.sepolia, }, { target: RISK_STEWARD_RECEIVER_SEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 600], - dstChainId: LzChainId.sepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_SEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], - dstChainId: LzChainId.sepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_SEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_SEPOLIA], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_SEPOLIA, 86401], dstChainId: LzChainId.sepolia, }, - // opbnbsepolia - { - target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_OPBNBTESTNET, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_OPBNBTESTNET, - ], - dstChainId: LzChainId.opbnbtestnet, - }, + + // opbnbtestnet + ...permissions( + LzChainId.opbnbtestnet, + ACCESS_CONTROL_MANAGER_OPBNBTESTNET, + RISK_STEWARD_RECEIVER_OPBNBTESTNET, + MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, + NORMAL_TIMELOCK_OPBNBTESTNET, + FAST_TRACK_TIMELOCK_OPBNBTESTNET, + CRITIAL_TIMELOCK_OPBNBTESTNET, + ), { target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], dstChainId: LzChainId.opbnbtestnet, }, { target: RISK_STEWARD_RECEIVER_OPBNBTESTNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 600], - dstChainId: LzChainId.opbnbtestnet, - }, - { - target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], - dstChainId: LzChainId.opbnbtestnet, - }, - { - target: ACCESS_CONTROL_MANAGER_OPBNBTESTNET, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], dstChainId: LzChainId.opbnbtestnet, }, + // arbitrumsepolia - { - target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_ARBITRUMSEPOLIA, - ], - dstChainId: LzChainId.arbitrumsepolia, - }, + ...permissions( + LzChainId.arbitrumsepolia, + ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, + RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, + MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, + NORMAL_TIMELOCK_ARBITRUMSEPOLIA, + FAST_TRACK_TIMELOCK_ARBITRUMSEPOLIA, + CRITIAL_TIMELOCK_ARBITRUMSEPOLIA, + ), { target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], dstChainId: LzChainId.arbitrumsepolia, }, { target: RISK_STEWARD_RECEIVER_ARBITRUMSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 600], - dstChainId: LzChainId.arbitrumsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, - ], - dstChainId: LzChainId.arbitrumsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, - ], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], dstChainId: LzChainId.arbitrumsepolia, }, + + // opsepolia - { - target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_OPSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_OPSEPOLIA, - ], - dstChainId: LzChainId.opsepolia, - }, + ...permissions( + LzChainId.opsepolia, + ACCESS_CONTROL_MANAGER_OPSEPOLIA, + RISK_STEWARD_RECEIVER_OPSEPOLIA, + MARKET_CAP_RISK_STEWARD_OPSEPOLIA, + NORMAL_TIMELOCK_OPSEPOLIA, + FAST_TRACK_TIMELOCK_OPSEPOLIA, + CRITIAL_TIMELOCK_OPSEPOLIA, + ), { target: RISK_STEWARD_RECEIVER_OPSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], dstChainId: LzChainId.opsepolia, }, { target: RISK_STEWARD_RECEIVER_OPSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 600], - dstChainId: LzChainId.opsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], - dstChainId: LzChainId.opsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_OPSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_OPSEPOLIA], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], dstChainId: LzChainId.opsepolia, }, + // basesepolia - { - target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_BASESEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_BASESEPOLIA, - ], - dstChainId: LzChainId.basesepolia, - }, + ...permissions( + LzChainId.basesepolia, + ACCESS_CONTROL_MANAGER_BASESEPOLIA, + RISK_STEWARD_RECEIVER_BASESEPOLIA, + MARKET_CAP_RISK_STEWARD_BASESEPOLIA, + NORMAL_TIMELOCK_BASESEPOLIA, + FAST_TRACK_TIMELOCK_BASESEPOLIA, + CRITIAL_TIMELOCK_BASESEPOLIA, + ), { target: RISK_STEWARD_RECEIVER_BASESEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], dstChainId: LzChainId.basesepolia, }, { target: RISK_STEWARD_RECEIVER_BASESEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 600], - dstChainId: LzChainId.basesepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], - dstChainId: LzChainId.basesepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_BASESEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BASESEPOLIA], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], dstChainId: LzChainId.basesepolia, }, + // unichainsepolia - { - target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_UNICHAINSEPOLIA, - ], - dstChainId: LzChainId.unichainsepolia, - }, + ...permissions( + LzChainId.unichainsepolia, + ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, + NORMAL_TIMELOCK_UNICHAINSEPOLIA, + FAST_TRACK_TIMELOCK_UNICHAINSEPOLIA, + CRITIAL_TIMELOCK_UNICHAINSEPOLIA, + ), { target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], dstChainId: LzChainId.unichainsepolia, }, { target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 600], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, - ], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, - ], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], dstChainId: LzChainId.unichainsepolia, }, + // zksyncsepolia - { - target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - "setRiskParameterConfig(string,address,uint256)", - NORMAL_TIMELOCK_ZKSYNCSEPOLIA, - ], - dstChainId: LzChainId.zksyncsepolia, - }, + ...permissions( + LzChainId.zksyncsepolia, + ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, + NORMAL_TIMELOCK_ZKSYNCSEPOLIA, + FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA, + CRITIAL_TIMELOCK_ZKSYNCSEPOLIA, + ), { target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 600], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], dstChainId: LzChainId.zksyncsepolia, }, { target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 600], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, - ], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - signature: "giveCallPermission(address,string,address)", - params: [ - ANY_TARGET_CONTRACT, - "setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, - ], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], dstChainId: LzChainId.zksyncsepolia, }, ], From 4e1667457e8f7aeffbcbe58f800a7b0cb82d2518 Mon Sep 17 00:00:00 2001 From: web3rover Date: Tue, 15 Apr 2025 20:42:51 +0400 Subject: [PATCH 07/31] fix: fixed bsctestnet simulation --- simulations/vip-xxx/bsctestnet.ts | 8 +++++++- src/utils.ts | 2 +- src/vip-framework/index.ts | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts index deb2142d8..a38369202 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-xxx/bsctestnet.ts @@ -10,6 +10,7 @@ import vipxxx, { ANY_TARGET_CONTRACT, BSC_TESTNET_CORE_COMPTROLLER, MARKET_CAP_RISK_STEWARD_BSC_TESTNET, + NORMAL_TIMELOCK_BSC_TESTNET } from "../../vips/vip-xxx/bsctestnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; @@ -27,13 +28,18 @@ forking(48650752, async () => { provider, ); + before(async () => { + await setBalance(NORMAL_TIMELOCK_BSC_TESTNET, parseUnits("1000000", 18)); + await setBalance("0xCfD34AEB46b1CB4779c945854d405E91D27A1899", parseUnits("1000000", 18)); + }); + testVip("vipxxx Configuring Risk Stewards", await vipxxx(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [5, 2], + [18, 2], ); }, }); diff --git a/src/utils.ts b/src/utils.ts index 82a8ef120..69bfdfd92 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -162,7 +162,7 @@ const getAdapterParam = (noOfCommands: number): string => { }; export const calculateGasForAdapterParam = (noOfCommands: number): number => { - const requiredGas = (500000 + gasUsedPerCommand * noOfCommands) * 1.5; + const requiredGas = (500000000 + gasUsedPerCommand * noOfCommands) * 1.5; return requiredGas; }; diff --git a/src/vip-framework/index.ts b/src/vip-framework/index.ts index 2e28a3029..c475dfcde 100644 --- a/src/vip-framework/index.ts +++ b/src/vip-framework/index.ts @@ -177,7 +177,9 @@ export const testVip = (description: string, proposal: Proposal, options: Testin } else { tx = await governorProxy .connect(proposer) - .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type); + .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type, { + gasLimit: 45_000_000, + }); } await tx.wait(); proposalId = await governorProxy.callStatic.proposalCount(); From 117ff3a63226156ebde5e3b40ff1fdf239644b64 Mon Sep 17 00:00:00 2001 From: web3rover Date: Tue, 15 Apr 2025 20:45:46 +0400 Subject: [PATCH 08/31] fix: revert calculateGasForAdapterParam --- simulations/vip-xxx/arbitrumsepolia.ts | 2 +- simulations/vip-xxx/basesepolia.ts | 2 +- simulations/vip-xxx/opbnbtestnet.ts | 2 +- simulations/vip-xxx/opsepolia.ts | 2 +- simulations/vip-xxx/sepolia.ts | 2 +- simulations/vip-xxx/unichainsepolia.ts | 2 +- simulations/vip-xxx/zksyncsepolia.ts | 2 +- src/utils.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/simulations/vip-xxx/arbitrumsepolia.ts b/simulations/vip-xxx/arbitrumsepolia.ts index 6f3cf7286..b690073a7 100644 --- a/simulations/vip-xxx/arbitrumsepolia.ts +++ b/simulations/vip-xxx/arbitrumsepolia.ts @@ -48,7 +48,7 @@ forking(138822251, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/simulations/vip-xxx/basesepolia.ts b/simulations/vip-xxx/basesepolia.ts index 804d71e76..ae2b3ef5f 100644 --- a/simulations/vip-xxx/basesepolia.ts +++ b/simulations/vip-xxx/basesepolia.ts @@ -48,7 +48,7 @@ forking(23964088, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/simulations/vip-xxx/opbnbtestnet.ts b/simulations/vip-xxx/opbnbtestnet.ts index 5435ae260..302f96305 100644 --- a/simulations/vip-xxx/opbnbtestnet.ts +++ b/simulations/vip-xxx/opbnbtestnet.ts @@ -48,7 +48,7 @@ forking(56951686, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/simulations/vip-xxx/opsepolia.ts b/simulations/vip-xxx/opsepolia.ts index b0d386d41..7adcd3a4f 100644 --- a/simulations/vip-xxx/opsepolia.ts +++ b/simulations/vip-xxx/opsepolia.ts @@ -48,7 +48,7 @@ forking(25946983, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/simulations/vip-xxx/sepolia.ts b/simulations/vip-xxx/sepolia.ts index b1594aeea..5b86b7947 100644 --- a/simulations/vip-xxx/sepolia.ts +++ b/simulations/vip-xxx/sepolia.ts @@ -44,7 +44,7 @@ forking(8043152, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/simulations/vip-xxx/unichainsepolia.ts b/simulations/vip-xxx/unichainsepolia.ts index fd98bbec1..bdf54f529 100644 --- a/simulations/vip-xxx/unichainsepolia.ts +++ b/simulations/vip-xxx/unichainsepolia.ts @@ -48,7 +48,7 @@ forking(16844634, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/simulations/vip-xxx/zksyncsepolia.ts b/simulations/vip-xxx/zksyncsepolia.ts index 923743e3d..77207e0e7 100644 --- a/simulations/vip-xxx/zksyncsepolia.ts +++ b/simulations/vip-xxx/zksyncsepolia.ts @@ -48,7 +48,7 @@ forking(4898583, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [3, 2], + [16, 2], ); }, }); diff --git a/src/utils.ts b/src/utils.ts index 69bfdfd92..82a8ef120 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -162,7 +162,7 @@ const getAdapterParam = (noOfCommands: number): string => { }; export const calculateGasForAdapterParam = (noOfCommands: number): number => { - const requiredGas = (500000000 + gasUsedPerCommand * noOfCommands) * 1.5; + const requiredGas = (500000 + gasUsedPerCommand * noOfCommands) * 1.5; return requiredGas; }; From 39141d33b0ed155808a375927e88ef5de4dc53fc Mon Sep 17 00:00:00 2001 From: web3rover Date: Wed, 16 Apr 2025 11:53:14 +0400 Subject: [PATCH 09/31] fix: split into 2 vips --- simulations/vip-xxx/arbitrumsepolia.ts | 2 +- simulations/vip-xxx/basesepolia.ts | 4 +- simulations/vip-xxx/bsctestnet.ts | 4 +- simulations/vip-xxx/opbnbtestnet.ts | 2 +- simulations/vip-xxx/opsepolia.ts | 4 +- simulations/vip-xxx/sepolia.ts | 2 +- simulations/vip-xxx/unichainsepolia.ts | 4 +- simulations/vip-xxx/zksyncsepolia.ts | 4 +- src/vip-framework/index.ts | 4 +- .../vip-xxx/{bsctestnet.ts => bsctestnet1.ts} | 137 +---------------- vips/vip-xxx/bsctestnet2.ts | 145 ++++++++++++++++++ 11 files changed, 165 insertions(+), 147 deletions(-) rename vips/vip-xxx/{bsctestnet.ts => bsctestnet1.ts} (63%) create mode 100644 vips/vip-xxx/bsctestnet2.ts diff --git a/simulations/vip-xxx/arbitrumsepolia.ts b/simulations/vip-xxx/arbitrumsepolia.ts index b690073a7..cf52b5f3d 100644 --- a/simulations/vip-xxx/arbitrumsepolia.ts +++ b/simulations/vip-xxx/arbitrumsepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/basesepolia.ts b/simulations/vip-xxx/basesepolia.ts index ae2b3ef5f..22fe8fee6 100644 --- a/simulations/vip-xxx/basesepolia.ts +++ b/simulations/vip-xxx/basesepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; +import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; import vipxxx, { ACCESS_CONTROL_MANAGER_BASESEPOLIA, - ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_BASESEPOLIA, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts index a38369202..30db73e87 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-xxx/bsctestnet.ts @@ -10,8 +10,8 @@ import vipxxx, { ANY_TARGET_CONTRACT, BSC_TESTNET_CORE_COMPTROLLER, MARKET_CAP_RISK_STEWARD_BSC_TESTNET, - NORMAL_TIMELOCK_BSC_TESTNET -} from "../../vips/vip-xxx/bsctestnet"; + NORMAL_TIMELOCK_BSC_TESTNET, +} from "../../vips/vip-xxx/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; diff --git a/simulations/vip-xxx/opbnbtestnet.ts b/simulations/vip-xxx/opbnbtestnet.ts index 302f96305..d9811e247 100644 --- a/simulations/vip-xxx/opbnbtestnet.ts +++ b/simulations/vip-xxx/opbnbtestnet.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_OPBNBTESTNET, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/opsepolia.ts b/simulations/vip-xxx/opsepolia.ts index 7adcd3a4f..58757de64 100644 --- a/simulations/vip-xxx/opsepolia.ts +++ b/simulations/vip-xxx/opsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; +import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; import vipxxx, { ACCESS_CONTROL_MANAGER_OPSEPOLIA, - ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_OPSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/sepolia.ts b/simulations/vip-xxx/sepolia.ts index 5b86b7947..2abfd609a 100644 --- a/simulations/vip-xxx/sepolia.ts +++ b/simulations/vip-xxx/sepolia.ts @@ -11,7 +11,7 @@ import vipxxx, { ACCESS_CONTROL_MANAGER_SEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_SEPOLIA, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/unichainsepolia.ts b/simulations/vip-xxx/unichainsepolia.ts index bdf54f529..775e81365 100644 --- a/simulations/vip-xxx/unichainsepolia.ts +++ b/simulations/vip-xxx/unichainsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; +import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; import vipxxx, { ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/simulations/vip-xxx/zksyncsepolia.ts b/simulations/vip-xxx/zksyncsepolia.ts index 77207e0e7..4ca5f3f9e 100644 --- a/simulations/vip-xxx/zksyncsepolia.ts +++ b/simulations/vip-xxx/zksyncsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; +import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; import vipxxx, { ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet"; +} from "../../vips/vip-xxx/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; diff --git a/src/vip-framework/index.ts b/src/vip-framework/index.ts index c475dfcde..2e28a3029 100644 --- a/src/vip-framework/index.ts +++ b/src/vip-framework/index.ts @@ -177,9 +177,7 @@ export const testVip = (description: string, proposal: Proposal, options: Testin } else { tx = await governorProxy .connect(proposer) - .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type, { - gasLimit: 45_000_000, - }); + .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type); } await tx.wait(); proposalId = await governorProxy.callStatic.proposalCount(); diff --git a/vips/vip-xxx/bsctestnet.ts b/vips/vip-xxx/bsctestnet1.ts similarity index 63% rename from vips/vip-xxx/bsctestnet.ts rename to vips/vip-xxx/bsctestnet1.ts index 68700b00a..e027b74c0 100644 --- a/vips/vip-xxx/bsctestnet.ts +++ b/vips/vip-xxx/bsctestnet1.ts @@ -30,38 +30,10 @@ export const NORMAL_TIMELOCK_ARBITRUMSEPOLIA = "0x794BCA78E606f3a462C31e5Aba9865 export const CRITIAL_TIMELOCK_ARBITRUMSEPOLIA = "0x0b32Be083f7041608E023007e7802430396a2123"; export const FAST_TRACK_TIMELOCK_ARBITRUMSEPOLIA = "0x14642991184F989F45505585Da52ca6A6a7dD4c8"; -export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; -export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0x7831156A181288ce76B5952624Df6C842F4Cc0c1"; -export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; -export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; -export const CRITIAL_TIMELOCK_OPSEPOLIA = "0x45d2263c6E0dbF84eBffB1Ee0b80aC740607990B"; -export const FAST_TRACK_TIMELOCK_OPSEPOLIA = "0xe0Fa35b6279dd802C382ae54c50C8B16deaC0885"; - -export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0xf69fd7757c8A59DFA5c35622d9D44B31dB21B0a2"; -export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xE03E243AC1f3239ed6a0793C25E79C951339a915"; -export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; -export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; -export const CRITIAL_TIMELOCK_BASESEPOLIA = "0xbeDb7F2d0617292364bA4D73cf016c0f6BB5542E"; -export const FAST_TRACK_TIMELOCK_BASESEPOLIA = "0x3dFA652D3aaDcb93F9EA7d160d674C441AaA8EE2"; - -export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; -export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0x6edbFE9a95dB5f0CdDcE446A0Fe75D7832Cf8DDB"; -export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; -export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; -export const CRITIAL_TIMELOCK_UNICHAINSEPOLIA = "0x86C093266e824FA4345484a7B9109e9567923DA6"; -export const FAST_TRACK_TIMELOCK_UNICHAINSEPOLIA = "0x668cDb1A414006D0a26e9e13881D4Cd30B8b2a4A"; - -export const RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA = "0x25483111881c431492D010a9071Ce6C84C3b90A6"; -export const MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA = "0xe88C01daAd0b931af68C9fD70bfa9bde8142FF64"; -export const ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA = "0xD07f543d47c3a8997D6079958308e981AC14CD01"; -export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b42971a67E"; -export const CRITIAL_TIMELOCK_ZKSYNCSEPOLIA = "0x0E6138bE0FA1915efC73670a20A10EFd720a6Cc8"; -export const FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA = "0xb055e028b27d53a455a6c040a6952e44E9E615c4"; - export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; -const permissions = ( - chain: LzChainId|undefined, +export const permissions = ( + chain: LzChainId | undefined, acm: string, riskStewardReceiver: string, marketCapRiskSteward: string, @@ -73,11 +45,7 @@ const permissions = ( { target: acm, signature: "giveCallPermission(address,string,address)", - params: [ - riskStewardReceiver, - "setRiskParameterConfig(string,address,uint256)", - normalTimelock, - ], + params: [riskStewardReceiver, "setRiskParameterConfig(string,address,uint256)", normalTimelock], dstChainId: chain, }, { @@ -170,8 +138,8 @@ const permissions = ( params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", fastTrackTimelock], dstChainId: chain, }, - ] -} + ]; +}; const vip457 = () => { const meta = { @@ -271,7 +239,7 @@ Configure Remote Risk Stewards params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, 86401], dstChainId: LzChainId.opbnbtestnet, }, - + // arbitrumsepolia ...permissions( LzChainId.arbitrumsepolia, @@ -294,99 +262,6 @@ Configure Remote Risk Stewards params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, 86401], dstChainId: LzChainId.arbitrumsepolia, }, - - - // opsepolia - ...permissions( - LzChainId.opsepolia, - ACCESS_CONTROL_MANAGER_OPSEPOLIA, - RISK_STEWARD_RECEIVER_OPSEPOLIA, - MARKET_CAP_RISK_STEWARD_OPSEPOLIA, - NORMAL_TIMELOCK_OPSEPOLIA, - FAST_TRACK_TIMELOCK_OPSEPOLIA, - CRITIAL_TIMELOCK_OPSEPOLIA, - ), - { - target: RISK_STEWARD_RECEIVER_OPSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], - dstChainId: LzChainId.opsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_OPSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], - dstChainId: LzChainId.opsepolia, - }, - - // basesepolia - ...permissions( - LzChainId.basesepolia, - ACCESS_CONTROL_MANAGER_BASESEPOLIA, - RISK_STEWARD_RECEIVER_BASESEPOLIA, - MARKET_CAP_RISK_STEWARD_BASESEPOLIA, - NORMAL_TIMELOCK_BASESEPOLIA, - FAST_TRACK_TIMELOCK_BASESEPOLIA, - CRITIAL_TIMELOCK_BASESEPOLIA, - ), - { - target: RISK_STEWARD_RECEIVER_BASESEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], - dstChainId: LzChainId.basesepolia, - }, - { - target: RISK_STEWARD_RECEIVER_BASESEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], - dstChainId: LzChainId.basesepolia, - }, - - // unichainsepolia - ...permissions( - LzChainId.unichainsepolia, - ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, - RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, - NORMAL_TIMELOCK_UNICHAINSEPOLIA, - FAST_TRACK_TIMELOCK_UNICHAINSEPOLIA, - CRITIAL_TIMELOCK_UNICHAINSEPOLIA, - ), - { - target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], - dstChainId: LzChainId.unichainsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], - dstChainId: LzChainId.unichainsepolia, - }, - - // zksyncsepolia - ...permissions( - LzChainId.zksyncsepolia, - ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, - RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, - NORMAL_TIMELOCK_ZKSYNCSEPOLIA, - FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA, - CRITIAL_TIMELOCK_ZKSYNCSEPOLIA, - ), - { - target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], - dstChainId: LzChainId.zksyncsepolia, - }, - { - target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], - dstChainId: LzChainId.zksyncsepolia, - }, ], meta, ProposalType.REGULAR, diff --git a/vips/vip-xxx/bsctestnet2.ts b/vips/vip-xxx/bsctestnet2.ts new file mode 100644 index 000000000..fa19ee311 --- /dev/null +++ b/vips/vip-xxx/bsctestnet2.ts @@ -0,0 +1,145 @@ +import { LzChainId, ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +import { permissions } from "./bsctestnet1"; + +export const RISK_STEWARD_RECEIVER_OPSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; +export const MARKET_CAP_RISK_STEWARD_OPSEPOLIA = "0x7831156A181288ce76B5952624Df6C842F4Cc0c1"; +export const ACCESS_CONTROL_MANAGER_OPSEPOLIA = "0x1652E12C8ABE2f0D84466F0fc1fA4286491B3BC1"; +export const NORMAL_TIMELOCK_OPSEPOLIA = "0xdDe31d7eEEAD7Cf9790F833C4FF4c6e61404402a"; +export const CRITIAL_TIMELOCK_OPSEPOLIA = "0x45d2263c6E0dbF84eBffB1Ee0b80aC740607990B"; +export const FAST_TRACK_TIMELOCK_OPSEPOLIA = "0xe0Fa35b6279dd802C382ae54c50C8B16deaC0885"; + +export const RISK_STEWARD_RECEIVER_BASESEPOLIA = "0xf69fd7757c8A59DFA5c35622d9D44B31dB21B0a2"; +export const MARKET_CAP_RISK_STEWARD_BASESEPOLIA = "0xE03E243AC1f3239ed6a0793C25E79C951339a915"; +export const ACCESS_CONTROL_MANAGER_BASESEPOLIA = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; +export const NORMAL_TIMELOCK_BASESEPOLIA = "0xCc84f6122649eDc48f4a426814e6b6C6fF9bBe0a"; +export const CRITIAL_TIMELOCK_BASESEPOLIA = "0xbeDb7F2d0617292364bA4D73cf016c0f6BB5542E"; +export const FAST_TRACK_TIMELOCK_BASESEPOLIA = "0x3dFA652D3aaDcb93F9EA7d160d674C441AaA8EE2"; + +export const RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA = "0x4fCbfE445396f31005b3Fd2F6DE2A986d6E2dCB5"; +export const MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA = "0x6edbFE9a95dB5f0CdDcE446A0Fe75D7832Cf8DDB"; +export const ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA = "0x854C064EA6b503A97980F481FA3B7279012fdeDd"; +export const NORMAL_TIMELOCK_UNICHAINSEPOLIA = "0x5e20F5A2e23463D39287185DF84607DF7068F314"; +export const CRITIAL_TIMELOCK_UNICHAINSEPOLIA = "0x86C093266e824FA4345484a7B9109e9567923DA6"; +export const FAST_TRACK_TIMELOCK_UNICHAINSEPOLIA = "0x668cDb1A414006D0a26e9e13881D4Cd30B8b2a4A"; + +export const RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA = "0x25483111881c431492D010a9071Ce6C84C3b90A6"; +export const MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA = "0xe88C01daAd0b931af68C9fD70bfa9bde8142FF64"; +export const ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA = "0xD07f543d47c3a8997D6079958308e981AC14CD01"; +export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b42971a67E"; +export const CRITIAL_TIMELOCK_ZKSYNCSEPOLIA = "0x0E6138bE0FA1915efC73670a20A10EFd720a6Cc8"; +export const FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA = "0xb055e028b27d53a455a6c040a6952e44E9E615c4"; + +const vip457 = () => { + const meta = { + version: "v2", + title: "Configure Remote Risk Stewards", + description: `#### Summary +Configure Remote Risk Stewards +`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + // opsepolia + ...permissions( + LzChainId.opsepolia, + ACCESS_CONTROL_MANAGER_OPSEPOLIA, + RISK_STEWARD_RECEIVER_OPSEPOLIA, + MARKET_CAP_RISK_STEWARD_OPSEPOLIA, + NORMAL_TIMELOCK_OPSEPOLIA, + FAST_TRACK_TIMELOCK_OPSEPOLIA, + CRITIAL_TIMELOCK_OPSEPOLIA, + ), + { + target: RISK_STEWARD_RECEIVER_OPSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + dstChainId: LzChainId.opsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_OPSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_OPSEPOLIA, 86401], + dstChainId: LzChainId.opsepolia, + }, + + // basesepolia + ...permissions( + LzChainId.basesepolia, + ACCESS_CONTROL_MANAGER_BASESEPOLIA, + RISK_STEWARD_RECEIVER_BASESEPOLIA, + MARKET_CAP_RISK_STEWARD_BASESEPOLIA, + NORMAL_TIMELOCK_BASESEPOLIA, + FAST_TRACK_TIMELOCK_BASESEPOLIA, + CRITIAL_TIMELOCK_BASESEPOLIA, + ), + { + target: RISK_STEWARD_RECEIVER_BASESEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + dstChainId: LzChainId.basesepolia, + }, + { + target: RISK_STEWARD_RECEIVER_BASESEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BASESEPOLIA, 86401], + dstChainId: LzChainId.basesepolia, + }, + + // unichainsepolia + ...permissions( + LzChainId.unichainsepolia, + ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, + RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, + NORMAL_TIMELOCK_UNICHAINSEPOLIA, + FAST_TRACK_TIMELOCK_UNICHAINSEPOLIA, + CRITIAL_TIMELOCK_UNICHAINSEPOLIA, + ), + { + target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + dstChainId: LzChainId.unichainsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_UNICHAINSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, 86401], + dstChainId: LzChainId.unichainsepolia, + }, + + // zksyncsepolia + ...permissions( + LzChainId.zksyncsepolia, + ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, + RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, + NORMAL_TIMELOCK_ZKSYNCSEPOLIA, + FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA, + CRITIAL_TIMELOCK_ZKSYNCSEPOLIA, + ), + { + target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + dstChainId: LzChainId.zksyncsepolia, + }, + { + target: RISK_STEWARD_RECEIVER_ZKSYNCSEPOLIA, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, 86401], + dstChainId: LzChainId.zksyncsepolia, + }, + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip457; From 43b76c572daf525e786b162e50b2eb4b706d2feb Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Tue, 1 Jul 2025 10:47:13 +0200 Subject: [PATCH 10/31] feat: add RiskStewards to ethereum --- src/networkAddresses.ts | 6 ++ vips/vip-xxx/bsctestnet1.ts | 4 +- vips/vip-xxx/bsctestnet2.ts | 4 +- vips/vip-xxx/ethereum.ts | 135 ++++++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 vips/vip-xxx/ethereum.ts diff --git a/src/networkAddresses.ts b/src/networkAddresses.ts index 8ba5c68cb..5a6d8ed1a 100644 --- a/src/networkAddresses.ts +++ b/src/networkAddresses.ts @@ -19,6 +19,9 @@ import opbnbmainnetDeployedContracts from "@venusprotocol/venus-protocol/deploym import opbnbtestnetDeployedContracts from "@venusprotocol/venus-protocol/deployments/opbnbtestnet_addresses.json"; import sepoliaDeployedContracts from "@venusprotocol/venus-protocol/deployments/sepolia_addresses.json"; import { ethers } from "ethers"; +import { ACCESS_CONTROL_MANAGER } from "vips/vip-384/bscmainnet"; + +import { FAST_TRACK_TIMELOCK } from "./vip-framework"; export const ZERO_ADDRESS = ethers.constants.AddressZero; export const ORACLE_BNB = "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"; @@ -76,7 +79,10 @@ export const NETWORK_ADDRESSES = { }, ethereum: { NORMAL_TIMELOCK: "0xd969E79406c35E80750aAae061D402Aab9325714", + FAST_TRACK_TIMELOCK: "0x8764F50616B62a99A997876C2DEAaa04554C5B2E", + CRITICAL_TIMELOCK: "0xeB9b85342c34F65af734C7bd4a149c86c472bC00", GUARDIAN: "0x285960C5B22fD66A736C7136967A3eB15e93CC67", + ACCESS_CONTROL_MANAGER: "0x230058da2D23eb8836EC5DB7037ef7250c56E25E", VTREASURY: ethereumDeployedContracts.addresses.VTreasuryV8, POOL_REGISTRY: ilEthereumDeployedContracts.addresses.PoolRegistry, RESILIENT_ORACLE: oracleEthereumContracts.addresses.ResilientOracle, diff --git a/vips/vip-xxx/bsctestnet1.ts b/vips/vip-xxx/bsctestnet1.ts index e027b74c0..ee5aba1a6 100644 --- a/vips/vip-xxx/bsctestnet1.ts +++ b/vips/vip-xxx/bsctestnet1.ts @@ -141,7 +141,7 @@ export const permissions = ( ]; }; -const vip457 = () => { +const vip599 = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -268,4 +268,4 @@ Configure Remote Risk Stewards ); }; -export default vip457; +export default vip599; diff --git a/vips/vip-xxx/bsctestnet2.ts b/vips/vip-xxx/bsctestnet2.ts index fa19ee311..215880421 100644 --- a/vips/vip-xxx/bsctestnet2.ts +++ b/vips/vip-xxx/bsctestnet2.ts @@ -31,7 +31,7 @@ export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b4 export const CRITIAL_TIMELOCK_ZKSYNCSEPOLIA = "0x0E6138bE0FA1915efC73670a20A10EFd720a6Cc8"; export const FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA = "0xb055e028b27d53a455a6c040a6952e44E9E615c4"; -const vip457 = () => { +const vip599 = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -142,4 +142,4 @@ Configure Remote Risk Stewards ); }; -export default vip457; +export default vip599; diff --git a/vips/vip-xxx/ethereum.ts b/vips/vip-xxx/ethereum.ts new file mode 100644 index 000000000..a01a418af --- /dev/null +++ b/vips/vip-xxx/ethereum.ts @@ -0,0 +1,135 @@ +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { LzChainId } from "src/types"; +import { makeProposal } from "src/utils"; + +const { ethereum } = NETWORK_ADDRESSES; + +export const RISK_STEWARD_RECEIVER = "0x5086Dc718D1288E4cc4F6a75991E4a0bD0611bF1"; +export const MARKET_CAP_RISK_STEWARD = "0x7191b4602Fe9d36E1A4b2cb84D0c80C543F13f9A"; +export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; + +export const MORE_THAN_1_DAY = 86401; // 24 hours + 1 second + +export const vip599 = () => { + const meta = { + version: "v2", + title: "VIP-599: Configure Remote Risk Stewards", + description: `#### Summary +Configure Remote Risk Stewards +`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal([ + // Permissions + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "setRiskParameterConfig(string,address,uint256)", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.CRITICAL_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.FAST_TRACK_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.CRITICAL_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.FAST_TRACK_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.CRITICAL_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.FAST_TRACK_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "processUpdate(RiskParameterUpdate)", RISK_STEWARD_RECEIVER], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.CRITICAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + + // Set risk parameter configurations + { + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], + dstChainId: LzChainId.ethereum, + }, + + { + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], + dstChainId: LzChainId.ethereum, + }, + ]); +}; + +export default vip599; From bfcd72fb1463864c5817db7cb864006f1a7a0527 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Thu, 3 Jul 2025 09:47:07 +0200 Subject: [PATCH 11/31] feat: add new facet --- simulations/vip-xxx/bsctestnet-addendum.ts | 9 ++ .../vip-xxx/utils/cur-params-test.json | 101 ++++++++++++++++++ vips/vip-xxx/bsctestnet-addendum.ts | 36 +++++++ 3 files changed, 146 insertions(+) create mode 100644 simulations/vip-xxx/bsctestnet-addendum.ts create mode 100644 simulations/vip-xxx/utils/cur-params-test.json create mode 100644 vips/vip-xxx/bsctestnet-addendum.ts diff --git a/simulations/vip-xxx/bsctestnet-addendum.ts b/simulations/vip-xxx/bsctestnet-addendum.ts new file mode 100644 index 000000000..1b8f0cac1 --- /dev/null +++ b/simulations/vip-xxx/bsctestnet-addendum.ts @@ -0,0 +1,9 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; +import { forking, testVip } from "src/vip-framework"; + +import { vip599_Addendum } from "./../../vips/vip-xxx/bsctestnet-addendum"; + +forking(56835644, async () => { + testVip("vip-599-addendum", await vip599_Addendum(), {}); +}); diff --git a/simulations/vip-xxx/utils/cur-params-test.json b/simulations/vip-xxx/utils/cur-params-test.json new file mode 100644 index 000000000..b19f483ac --- /dev/null +++ b/simulations/vip-xxx/utils/cur-params-test.json @@ -0,0 +1,101 @@ +{ + "cutParams": [ + [ + "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", + 0, + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0x3d98a1e5", + "0xc488847b", + "0xa78dc775", + "0xcab4f84c", + "0x0686dab6", + "0xddbf54fd" + ] + ], + [ + "0x671B787AEDB6769972f081C6ee4978146F7D92E6", + 0, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x528a174c", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x905006DCD5DbAa9B67359bcB341a0C49AfC8d0A6", + 0, + [ + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0xbf32442d", + "0xededbae6", + "0x655f0725" + ] + ], + [ + "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A", + 0, + [ + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x522c656b", + "0x17db2163", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x9460c8b5", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0x919a3736", + "0x4ef233fc", + "0x24aaa220", + "0x12348e96", + "0x5cc4fdeb", + "0x8b3113f6", + "0xa8431081", + "0x186db48f", + "0xd136af44", + "0xfd51a3ad", + "0x530e784f", + "0xc32094c7" + ] + ] + ] +} diff --git a/vips/vip-xxx/bsctestnet-addendum.ts b/vips/vip-xxx/bsctestnet-addendum.ts new file mode 100644 index 000000000..cbaa99ce3 --- /dev/null +++ b/vips/vip-xxx/bsctestnet-addendum.ts @@ -0,0 +1,36 @@ +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-test.json"; + +export const cutParams = params; + +const { bsctestnet } = NETWORK_ADDRESSES; + +export const vip599_Addendum = () => { + const meta = { + version: "v2", + title: "Configure Remote Risk Stewards", + description: `#### Summary +Configure Remote Risk Stewards +`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + { + target: bsctestnet.UNITROLLER, + signature: "diamondCut((address,uint8,bytes4[])[])", + params: [cutParams], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip599_Addendum; From de5984967b80fef3260fec1c96829b0f2f6de35a Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Thu, 3 Jul 2025 12:10:19 +0200 Subject: [PATCH 12/31] feat: addendum to deploy facets --- simulations/vip-xxx/bsctestnet-addendum.ts | 2 +- .../vip-xxx/utils/cur-params-test.json | 87 +++---------------- 2 files changed, 11 insertions(+), 78 deletions(-) diff --git a/simulations/vip-xxx/bsctestnet-addendum.ts b/simulations/vip-xxx/bsctestnet-addendum.ts index 1b8f0cac1..2856ae7a4 100644 --- a/simulations/vip-xxx/bsctestnet-addendum.ts +++ b/simulations/vip-xxx/bsctestnet-addendum.ts @@ -4,6 +4,6 @@ import { forking, testVip } from "src/vip-framework"; import { vip599_Addendum } from "./../../vips/vip-xxx/bsctestnet-addendum"; -forking(56835644, async () => { +forking(56931937, async () => { testVip("vip-599-addendum", await vip599_Addendum(), {}); }); diff --git a/simulations/vip-xxx/utils/cur-params-test.json b/simulations/vip-xxx/utils/cur-params-test.json index b19f483ac..53dac8df3 100644 --- a/simulations/vip-xxx/utils/cur-params-test.json +++ b/simulations/vip-xxx/utils/cur-params-test.json @@ -4,98 +4,31 @@ "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", 0, [ - "0xa76b3fda", - "0x929fe9a1", - "0xc2998238", - "0xede4edd0", - "0xb0772d0b", - "0xabfceffc", - "0x007e3dd2", "0x3d98a1e5", - "0xc488847b", - "0xa78dc775", - "0xcab4f84c", - "0x0686dab6", - "0xddbf54fd" + "0xcab4f84c" ] ], [ "0x671B787AEDB6769972f081C6ee4978146F7D92E6", 0, [ - "0xead1a8a0", - "0xda3d454c", - "0x5c778605", - "0x5ec88c79", - "0x528a174c", - "0x4e79238f", - "0x5fc7e71e", - "0x47ef3b3b", - "0x4ef4c3e1", - "0x41c728b9", - "0xeabe7d91", - "0x51dff989", - "0x24008a62", - "0x1ededc91", - "0xd02f7351", - "0x6d35bf91", - "0xbdcdc258", - "0x6a56947e" - ] - ], - [ - "0x905006DCD5DbAa9B67359bcB341a0C49AfC8d0A6", - 0, - [ - "0xa7604b41", - "0xe85a2960", - "0x70bf66f0", - "0x86df31ee", - "0xadcd5fb9", - "0xd09c54ba", - "0x7858524d", - "0xbf32442d", - "0xededbae6", - "0x655f0725" + "0x528a174c" ] ], [ "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A", 0, [ - "0xf519fc30", - "0x2b5d790c", - "0x317b0b77", - "0xe4028eee", - "0x9bf34cbb", - "0x522c656b", - "0x17db2163", - "0x4fd42e17", - "0xbb857450", - "0x607ef6c1", - "0x51a485e4", - "0x5f5af1aa", - "0x55ee1fe1", - "0x9460c8b5", - "0x2a6a6065", - "0xd24febad", - "0x9cfdd9e6", - "0x2ec04124", - "0x4e0853db", - "0x6662c7c9", - "0x919a3736", - "0x4ef233fc", - "0x24aaa220", - "0x12348e96", - "0x5cc4fdeb", "0x8b3113f6", - "0xa8431081", - "0x186db48f", + "0xc32094c7", + "0x24aaa220", "0xd136af44", - "0xfd51a3ad", - "0x530e784f", - "0xc32094c7" + "0x186db48f", + "0xa8431081", + "0x5cc4fdeb", + "0x12348e96", + "0x530e784f" ] ] ] -} +} \ No newline at end of file From eca0f66a248b930c278eb53ab237efe4da7ca505 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Thu, 3 Jul 2025 13:51:39 +0200 Subject: [PATCH 13/31] fix: add proposal type --- vips/vip-xxx/ethereum.ts | 218 ++++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 107 deletions(-) diff --git a/vips/vip-xxx/ethereum.ts b/vips/vip-xxx/ethereum.ts index a01a418af..fd9b5177e 100644 --- a/vips/vip-xxx/ethereum.ts +++ b/vips/vip-xxx/ethereum.ts @@ -1,5 +1,5 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; -import { LzChainId } from "src/types"; +import { LzChainId, ProposalType } from "src/types"; import { makeProposal } from "src/utils"; const { ethereum } = NETWORK_ADDRESSES; @@ -22,114 +22,118 @@ Configure Remote Risk Stewards abstainDescription: "Indifferent to execution", }; - return makeProposal([ - // Permissions - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "setRiskParameterConfig(string,address,uint256)", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.CRITICAL_TIMELOCK], - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.FAST_TRACK_TIMELOCK], - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.CRITICAL_TIMELOCK], - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.FAST_TRACK_TIMELOCK], - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.CRITICAL_TIMELOCK], - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.FAST_TRACK_TIMELOCK], - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "processUpdate(RiskParameterUpdate)", RISK_STEWARD_RECEIVER], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.CRITICAL_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], - dstChainId: LzChainId.ethereum, - }, + return makeProposal( + [ + // Permissions + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "setRiskParameterConfig(string,address,uint256)", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.CRITICAL_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.FAST_TRACK_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.CRITICAL_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.FAST_TRACK_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.CRITICAL_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.FAST_TRACK_TIMELOCK], + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "processUpdate(RiskParameterUpdate)", RISK_STEWARD_RECEIVER], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.NORMAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.CRITICAL_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, + { + target: ethereum.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], + dstChainId: LzChainId.ethereum, + }, - // Set risk parameter configurations - { - target: RISK_STEWARD_RECEIVER, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], - dstChainId: LzChainId.ethereum, - }, + // Set risk parameter configurations + { + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["supplyCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], + dstChainId: LzChainId.ethereum, + }, - { - target: RISK_STEWARD_RECEIVER, - signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], - dstChainId: LzChainId.ethereum, - }, - ]); + { + target: RISK_STEWARD_RECEIVER, + signature: "setRiskParameterConfig(string,address,uint256)", + params: ["borrowCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], + dstChainId: LzChainId.ethereum, + }, + ], + meta, + ProposalType.REGULAR, + ); }; export default vip599; From c5bebafb6ce72c12fa647c6152c4b6ff85452f8c Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Thu, 3 Jul 2025 14:09:19 +0200 Subject: [PATCH 14/31] fixup! fix: add proposal type --- simulations/vip-xxx/bsctestnet-addendum.ts | 2 -- src/networkAddresses.ts | 3 --- 2 files changed, 5 deletions(-) diff --git a/simulations/vip-xxx/bsctestnet-addendum.ts b/simulations/vip-xxx/bsctestnet-addendum.ts index 2856ae7a4..9ab299363 100644 --- a/simulations/vip-xxx/bsctestnet-addendum.ts +++ b/simulations/vip-xxx/bsctestnet-addendum.ts @@ -1,5 +1,3 @@ -import { expect } from "chai"; -import { ethers } from "hardhat"; import { forking, testVip } from "src/vip-framework"; import { vip599_Addendum } from "./../../vips/vip-xxx/bsctestnet-addendum"; diff --git a/src/networkAddresses.ts b/src/networkAddresses.ts index 8d44373d8..89e6c36f6 100644 --- a/src/networkAddresses.ts +++ b/src/networkAddresses.ts @@ -19,9 +19,6 @@ import opbnbmainnetDeployedContracts from "@venusprotocol/venus-protocol/deploym import opbnbtestnetDeployedContracts from "@venusprotocol/venus-protocol/deployments/opbnbtestnet_addresses.json"; import sepoliaDeployedContracts from "@venusprotocol/venus-protocol/deployments/sepolia_addresses.json"; import { ethers } from "ethers"; -import { ACCESS_CONTROL_MANAGER } from "vips/vip-384/bscmainnet"; - -import { FAST_TRACK_TIMELOCK } from "./vip-framework"; export const ZERO_ADDRESS = ethers.constants.AddressZero; export const ORACLE_BNB = "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"; From 7701f6cf89d1e0ae5739ed625f3dace818b87e7c Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Thu, 3 Jul 2025 14:26:29 +0200 Subject: [PATCH 15/31] fixup! fixup! fix: add proposal type --- .../vip-xxx/utils/cur-params-test.json | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/simulations/vip-xxx/utils/cur-params-test.json b/simulations/vip-xxx/utils/cur-params-test.json index 53dac8df3..0fb46afe3 100644 --- a/simulations/vip-xxx/utils/cur-params-test.json +++ b/simulations/vip-xxx/utils/cur-params-test.json @@ -1,20 +1,7 @@ { "cutParams": [ - [ - "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", - 0, - [ - "0x3d98a1e5", - "0xcab4f84c" - ] - ], - [ - "0x671B787AEDB6769972f081C6ee4978146F7D92E6", - 0, - [ - "0x528a174c" - ] - ], + ["0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", 0, ["0x3d98a1e5", "0xcab4f84c"]], + ["0x671B787AEDB6769972f081C6ee4978146F7D92E6", 0, ["0x528a174c"]], [ "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A", 0, @@ -31,4 +18,4 @@ ] ] ] -} \ No newline at end of file +} From c6d5b4225c10c1f494b7c8277b05498bb425445d Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Fri, 4 Jul 2025 10:22:28 +0200 Subject: [PATCH 16/31] feat: add new facets on bscmainnet --- simulations/vip-xxx/bscmainnet.ts | 7 ++ simulations/vip-xxx/ethereum.ts | 91 +++++++++++++++++++ .../vip-xxx/utils/cur-params-bscmainnet.json | 21 +++++ ...s-test.json => cur-params-bsctestnet.json} | 0 vips/vip-xxx/{ethereum.ts => bscmainnet.ts} | 69 +++++++++----- vips/vip-xxx/bsctestnet-addendum.ts | 2 +- 6 files changed, 166 insertions(+), 24 deletions(-) create mode 100644 simulations/vip-xxx/bscmainnet.ts create mode 100644 simulations/vip-xxx/ethereum.ts create mode 100644 simulations/vip-xxx/utils/cur-params-bscmainnet.json rename simulations/vip-xxx/utils/{cur-params-test.json => cur-params-bsctestnet.json} (100%) rename vips/vip-xxx/{ethereum.ts => bscmainnet.ts} (57%) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts new file mode 100644 index 000000000..f559cb385 --- /dev/null +++ b/simulations/vip-xxx/bscmainnet.ts @@ -0,0 +1,7 @@ +import { forking, testVip } from "src/vip-framework"; + +import vip599 from "../../vips/vip-xxx/bscmainnet"; + +forking(52815412, async () => { + testVip("vip-599", await vip599(), {}); +}); diff --git a/simulations/vip-xxx/ethereum.ts b/simulations/vip-xxx/ethereum.ts new file mode 100644 index 000000000..6fc70c557 --- /dev/null +++ b/simulations/vip-xxx/ethereum.ts @@ -0,0 +1,91 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; + +import { ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ETHEREUM } from "../../vips/vip-xxx/bscmainnet"; +import vipxxx from "../../vips/vip-xxx/bscmainnet"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; +import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; + +const { ethereum } = NETWORK_ADDRESSES; + +forking(22829643, async () => { + const provider = ethers.provider; + let executor: Contract; + let lastProposalReceived: BigNumber; + + const acm = new ethers.Contract(ethereum.ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); + + const isolatedPoolComptroller = new ethers.Contract( + "0x687a01ecF6d3907658f7A7c714749fAC32336D1B", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); + + before(async () => { + executor = new ethers.Contract(ethereum.OMNICHAIN_GOVERNANCE_EXECUTOR, OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, provider); + + lastProposalReceived = await executor.lastProposalReceived(); + await pretendExecutingVip(await vipxxx()); + }); + + testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["PermissionGranted", "RiskParameterConfigSet"], + [16, 2], + ); + }, + }); + describe("Post-VIP behavior", () => { + it("Proposal id should be incremented", async () => { + expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); + }); + + it("proposal should be executed", async () => { + const pId = await executor.lastProposalReceived(); + expect(await executor.state(pId)).to.be.equals(2); + }); + + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_ETHEREUM)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_ETHEREUM)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_ETHEREUM); + await setBalance(MARKET_CAP_RISK_STEWARD_ETHEREUM, parseUnits("1000000", 18)); + + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ETHEREUM)) + .setMarketSupplyCaps(["0xA31D67c056Aadc2501535f2776bF1157904f810e"], ["180000000000"]), + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( + isolatedPoolComptroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ETHEREUM)) + .setMarketBorrowCaps(["0xA31D67c056Aadc2501535f2776bF1157904f810e"], ["150000000000"]), + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); + }); + }); +}); diff --git a/simulations/vip-xxx/utils/cur-params-bscmainnet.json b/simulations/vip-xxx/utils/cur-params-bscmainnet.json new file mode 100644 index 000000000..2807b5af3 --- /dev/null +++ b/simulations/vip-xxx/utils/cur-params-bscmainnet.json @@ -0,0 +1,21 @@ +{ + "cutParams": [ + ["0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", 0, ["0x3d98a1e5", "0xcab4f84c"]], + ["0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", 0, ["0x528a174c"]], + [ + "0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64", + 0, + [ + "0x8b3113f6", + "0xc32094c7", + "0x24aaa220", + "0xd136af44", + "0x186db48f", + "0xa8431081", + "0x5cc4fdeb", + "0x12348e96", + "0x530e784f" + ] + ] + ] +} diff --git a/simulations/vip-xxx/utils/cur-params-test.json b/simulations/vip-xxx/utils/cur-params-bsctestnet.json similarity index 100% rename from simulations/vip-xxx/utils/cur-params-test.json rename to simulations/vip-xxx/utils/cur-params-bsctestnet.json diff --git a/vips/vip-xxx/ethereum.ts b/vips/vip-xxx/bscmainnet.ts similarity index 57% rename from vips/vip-xxx/ethereum.ts rename to vips/vip-xxx/bscmainnet.ts index fd9b5177e..ab4808dcc 100644 --- a/vips/vip-xxx/ethereum.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -2,13 +2,16 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { LzChainId, ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -const { ethereum } = NETWORK_ADDRESSES; +import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-bscmainnet.json"; -export const RISK_STEWARD_RECEIVER = "0x5086Dc718D1288E4cc4F6a75991E4a0bD0611bF1"; -export const MARKET_CAP_RISK_STEWARD = "0x7191b4602Fe9d36E1A4b2cb84D0c80C543F13f9A"; +const { ethereum, bscmainnet } = NETWORK_ADDRESSES; + +export const RISK_STEWARD_RECEIVER_ETHEREUM = "0x5086Dc718D1288E4cc4F6a75991E4a0bD0611bF1"; +export const MARKET_CAP_RISK_STEWARD_ETHEREUM = "0x7191b4602Fe9d36E1A4b2cb84D0c80C543F13f9A"; export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; export const MORE_THAN_1_DAY = 86401; // 24 hours + 1 second +export const cutParams = params; export const vip599 = () => { const meta = { @@ -24,110 +27,130 @@ Configure Remote Risk Stewards return makeProposal( [ + // Update dimond cut + { + target: bscmainnet.UNITROLLER, + signature: "diamondCut((address,uint8,bytes4[])[])", + params: [cutParams], + }, // Permissions { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "setRiskParameterConfig(string,address,uint256)", ethereum.NORMAL_TIMELOCK], + params: [ + RISK_STEWARD_RECEIVER_ETHEREUM, + "setRiskParameterConfig(string,address,uint256)", + ethereum.NORMAL_TIMELOCK, + ], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_ETHEREUM], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD], + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_ETHEREUM], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.NORMAL_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "toggleConfigActive(string)", ethereum.NORMAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.CRITICAL_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "toggleConfigActive(string)", ethereum.CRITICAL_TIMELOCK], + dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "toggleConfigActive(string)", ethereum.FAST_TRACK_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "toggleConfigActive(string)", ethereum.FAST_TRACK_TIMELOCK], + dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.NORMAL_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "pause()", ethereum.NORMAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.CRITICAL_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "pause()", ethereum.CRITICAL_TIMELOCK], + dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "pause()", ethereum.FAST_TRACK_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "pause()", ethereum.FAST_TRACK_TIMELOCK], + dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.NORMAL_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "unpause()", ethereum.NORMAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.CRITICAL_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "unpause()", ethereum.CRITICAL_TIMELOCK], + dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER, "unpause()", ethereum.FAST_TRACK_TIMELOCK], + params: [RISK_STEWARD_RECEIVER_ETHEREUM, "unpause()", ethereum.FAST_TRACK_TIMELOCK], + dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "processUpdate(RiskParameterUpdate)", RISK_STEWARD_RECEIVER], + params: [ + MARKET_CAP_RISK_STEWARD_ETHEREUM, + "processUpdate(RiskParameterUpdate)", + RISK_STEWARD_RECEIVER_ETHEREUM, + ], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.NORMAL_TIMELOCK], + params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxIncreaseBps(uint256)", ethereum.NORMAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.CRITICAL_TIMELOCK], + params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxIncreaseBps(uint256)", ethereum.CRITICAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD, "setMaxIncreaseBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], + params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxIncreaseBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], dstChainId: LzChainId.ethereum, }, // Set risk parameter configurations { - target: RISK_STEWARD_RECEIVER, + target: RISK_STEWARD_RECEIVER_ETHEREUM, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ETHEREUM, MORE_THAN_1_DAY], dstChainId: LzChainId.ethereum, }, { - target: RISK_STEWARD_RECEIVER, + target: RISK_STEWARD_RECEIVER_ETHEREUM, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD, MORE_THAN_1_DAY], + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ETHEREUM, MORE_THAN_1_DAY], dstChainId: LzChainId.ethereum, }, ], diff --git a/vips/vip-xxx/bsctestnet-addendum.ts b/vips/vip-xxx/bsctestnet-addendum.ts index cbaa99ce3..1c5ed1380 100644 --- a/vips/vip-xxx/bsctestnet-addendum.ts +++ b/vips/vip-xxx/bsctestnet-addendum.ts @@ -2,7 +2,7 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-test.json"; +import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-bsctestnet.json"; export const cutParams = params; From 657d6e97a500fbcd5336d90869f89b5935ae1ac2 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Tue, 8 Jul 2025 11:04:40 +0200 Subject: [PATCH 17/31] feat: add pre- post- checks --- simulations/vip-xxx/abi/Diamond.json | 957 +++++++++++++++++++++ simulations/vip-xxx/bscmainnet.ts | 121 ++- simulations/vip-xxx/bsctestnet-addendum.ts | 121 ++- simulations/vip-xxx/ethereum.ts | 5 +- vips/vip-xxx/bscmainnet.ts | 16 +- vips/vip-xxx/bsctestnet1.ts | 6 +- 6 files changed, 1205 insertions(+), 21 deletions(-) create mode 100644 simulations/vip-xxx/abi/Diamond.json diff --git a/simulations/vip-xxx/abi/Diamond.json b/simulations/vip-xxx/abi/Diamond.json new file mode 100644 index 000000000..3c6f08008 --- /dev/null +++ b/simulations/vip-xxx/abi/Diamond.json @@ -0,0 +1,957 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract Unitroller", + "name": "unitroller", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "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": [], + "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": 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": 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": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "diamondCut_", + "type": "tuple[]" + } + ], + "name": "diamondCut", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "uint96", + "name": "functionSelectorPosition", + "type": "uint96" + } + ], + "internalType": "struct ComptrollerV13Storage.FacetAddressAndPosition", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "", + "type": "bytes4[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "name": "facetPosition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.Facet[]", + "name": "", + "type": "tuple[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabledForUser", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": true, + "inputs": [], + "name": "mintVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "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": "prime", + "outputs": [ + { + "internalType": "contract IPrime", + "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": true, + "inputs": [], + "name": "releaseStartBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "repayVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "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": 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": 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": [ + { + "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-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index f559cb385..67f18c022 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -1,7 +1,126 @@ +import { TransactionResponse } from "@ethersproject/providers"; +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; import vip599 from "../../vips/vip-xxx/bscmainnet"; +import COMPTROLLER_ABI from "./abi/Comproller.json"; +import DIAMOND_ABI from "./abi/Diamond.json"; + +const { bscmainnet } = NETWORK_ADDRESSES; + +const OLD_SETTER_FACET = "0x9B0D9D7c50d90f23449c4BbCAA671Ce7cd19DbCf"; +const OLD_MARKET_FACET = "0x4b093a3299F39615bA6b34B7897FDedCe7b83D63"; +const OLD_POLICY_FACET = "0x93e7Ff7c87B496aE76fFb22d437c9d46461A9B51"; + +const NEW_SETTER_FACET = "0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64"; +const NEW_MARKET_FACET = "0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db"; +const NEW_POLICY_FACET = "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9"; + +const UNCHANGED_REWARD_FACET = "0xc2F6bDCEa4907E8CB7480d3d315bc01c125fb63C"; forking(52815412, async () => { - testVip("vip-599", await vip599(), {}); + const provider = ethers.provider; + let unitroller: Contract; + let marketFacetFunctionSelectors: string[]; + let policyFacetFunctionSelectors: string[]; + let rewardFacetFuntionSelectors: string[]; + let setterFacetFuntionSelectors: string[]; + + before(async () => { + unitroller = new ethers.Contract(bscmainnet.UNITROLLER, COMPTROLLER_ABI, provider); + rewardFacetFuntionSelectors = await unitroller.facetFunctionSelectors(UNCHANGED_REWARD_FACET); + setterFacetFuntionSelectors = await unitroller.facetFunctionSelectors(OLD_SETTER_FACET); + marketFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_MARKET_FACET); + policyFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_POLICY_FACET); + }); + + describe("Pre-VIP behaviour", async () => { + it("market facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal([]); + }); + + it("policy facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal([]); + }); + + it("setter facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal([]); + }); + + it("reward facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(UNCHANGED_REWARD_FACET)).to.deep.equal( + rewardFacetFuntionSelectors, + ); + }); + + it("unitroller should contain only old facet addresses", async () => { + expect(await unitroller.facetAddresses()).to.include(OLD_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.include(OLD_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.include(OLD_MARKET_FACET); + expect(await unitroller.facetAddresses()).to.include(UNCHANGED_REWARD_FACET); + + expect(await unitroller.facetAddresses()).to.not.include(NEW_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.not.include(NEW_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.not.include(NEW_MARKET_FACET); + }); + }); + + testVip("vip-599", await vip599(), { + callbackAfterExecution: async (txResponse: TransactionResponse) => { + await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); + }, + }); + + describe("Post-VIP behavior", async () => { + it("market facet function selectors should be updated for new facet address", async () => { + const newMarketFacetFunctionSelectors = ["0x3d98a1e5", "0xcab4f84c"]; + + expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal(newMarketFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors); + }); + + it("policy facet function selectors should be updated for new facet address", async () => { + const newPolicyFacetFunctionSelectors = ["0x528a174c"]; + + expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal(newPolicyFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors); + }); + + it("setter facet function selectors should be updated for new facet address", async () => { + const newSetterFacetFunctionSelectors = [ + "0x8b3113f6", + "0xc32094c7", + "0x24aaa220", + "0xd136af44", + "0x186db48f", + "0xa8431081", + "0x5cc4fdeb", + "0x12348e96", + "0x530e784f", + ]; + + expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal(newSetterFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors); + }); + + it("reward facet function selectors should not be changed", async () => { + expect(await unitroller.facetFunctionSelectors(UNCHANGED_REWARD_FACET)).to.deep.equal( + rewardFacetFuntionSelectors, + ); + }); + + it("unitroller should contain the new and old facet addresses", async () => { + expect(await unitroller.facetAddresses()).to.include(NEW_SETTER_FACET, OLD_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_POLICY_FACET, OLD_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_MARKET_FACET, OLD_MARKET_FACET); + expect(await unitroller.facetAddresses()).to.include(UNCHANGED_REWARD_FACET); + }); + }); }); diff --git a/simulations/vip-xxx/bsctestnet-addendum.ts b/simulations/vip-xxx/bsctestnet-addendum.ts index 9ab299363..4ce74beaa 100644 --- a/simulations/vip-xxx/bsctestnet-addendum.ts +++ b/simulations/vip-xxx/bsctestnet-addendum.ts @@ -1,7 +1,126 @@ +import { TransactionResponse } from "@ethersproject/providers"; +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; import { vip599_Addendum } from "./../../vips/vip-xxx/bsctestnet-addendum"; +import COMPTROLLER_ABI from "./abi/Comproller.json"; +import DIAMOND_ABI from "./abi/Diamond.json"; + +const { bsctestnet } = NETWORK_ADDRESSES; + +const OLD_SETTER_FACET = "0x490DFD07f592452307817C4283866035BDb3b275"; +const OLD_MARKET_FACET = "0x00a949FfDa9B216fBA9C4E5b40ef561Af0FDb723"; +const OLD_POLICY_FACET = "0x085C8d0133291348004AabFfbE7CAc2097aF2aa1"; + +const NEW_SETTER_FACET = "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A"; +const NEW_MARKET_FACET = "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd"; +const NEW_POLICY_FACET = "0x671B787AEDB6769972f081C6ee4978146F7D92E6"; + +const UNCHANGED_REWARD_FACET = "0x905006DCD5DbAa9B67359bcB341a0C49AfC8d0A6"; forking(56931937, async () => { - testVip("vip-599-addendum", await vip599_Addendum(), {}); + const provider = ethers.provider; + let unitroller: Contract; + let marketFacetFunctionSelectors: string[]; + let policyFacetFunctionSelectors: string[]; + let rewardFacetFuntionSelectors: string[]; + let setterFacetFuntionSelectors: string[]; + + before(async () => { + unitroller = new ethers.Contract(bsctestnet.UNITROLLER, COMPTROLLER_ABI, provider); + rewardFacetFuntionSelectors = await unitroller.facetFunctionSelectors(UNCHANGED_REWARD_FACET); + setterFacetFuntionSelectors = await unitroller.facetFunctionSelectors(OLD_SETTER_FACET); + marketFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_MARKET_FACET); + policyFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_POLICY_FACET); + }); + + describe("Pre-VIP behaviour", async () => { + it("market facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal([]); + }); + + it("policy facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal([]); + }); + + it("setter facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal([]); + }); + + it("reward facet function selectors should be correct", async () => { + expect(await unitroller.facetFunctionSelectors(UNCHANGED_REWARD_FACET)).to.deep.equal( + rewardFacetFuntionSelectors, + ); + }); + + it("unitroller should contain only old facet addresses", async () => { + expect(await unitroller.facetAddresses()).to.include(OLD_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.include(OLD_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.include(OLD_MARKET_FACET); + expect(await unitroller.facetAddresses()).to.include(UNCHANGED_REWARD_FACET); + + expect(await unitroller.facetAddresses()).to.not.include(NEW_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.not.include(NEW_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.not.include(NEW_MARKET_FACET); + }); + }); + + testVip("vip-599-addendum", await vip599_Addendum(), { + callbackAfterExecution: async (txResponse: TransactionResponse) => { + await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); + }, + }); + + describe("Post-VIP behavior", async () => { + it("market facet function selectors should be updated for new facet address", async () => { + const newMarketFacetFunctionSelectors = ["0x3d98a1e5", "0xcab4f84c"]; + + expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal(newMarketFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors); + }); + + it("policy facet function selectors should be updated for new facet address", async () => { + const newPolicyFacetFunctionSelectors = ["0x528a174c"]; + + expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal(newPolicyFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors); + }); + + it("setter facet function selectors should be updated for new facet address", async () => { + const newSetterFacetFunctionSelectors = [ + "0x8b3113f6", + "0xc32094c7", + "0x24aaa220", + "0xd136af44", + "0x186db48f", + "0xa8431081", + "0x5cc4fdeb", + "0x12348e96", + "0x530e784f", + ]; + + expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal(newSetterFacetFunctionSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors); + }); + + it("reward facet function selectors should not be changed", async () => { + expect(await unitroller.facetFunctionSelectors(UNCHANGED_REWARD_FACET)).to.deep.equal( + rewardFacetFuntionSelectors, + ); + }); + + it("unitroller should contain the new and old facet addresses", async () => { + expect(await unitroller.facetAddresses()).to.include(NEW_SETTER_FACET, OLD_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_POLICY_FACET, OLD_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_MARKET_FACET, OLD_MARKET_FACET); + expect(await unitroller.facetAddresses()).to.include(UNCHANGED_REWARD_FACET); + }); + }); }); diff --git a/simulations/vip-xxx/ethereum.ts b/simulations/vip-xxx/ethereum.ts index 6fc70c557..cce890085 100644 --- a/simulations/vip-xxx/ethereum.ts +++ b/simulations/vip-xxx/ethereum.ts @@ -33,7 +33,6 @@ forking(22829643, async () => { executor = new ethers.Contract(ethereum.OMNICHAIN_GOVERNANCE_EXECUTOR, OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, provider); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); }); testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { @@ -79,12 +78,12 @@ forking(22829643, async () => { await expect( isolatedPoolComptroller .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ETHEREUM)) - .setMarketSupplyCaps(["0xA31D67c056Aadc2501535f2776bF1157904f810e"], ["180000000000"]), + .setMarketSupplyCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["180000000000"]), ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); await expect( isolatedPoolComptroller .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ETHEREUM)) - .setMarketBorrowCaps(["0xA31D67c056Aadc2501535f2776bF1157904f810e"], ["150000000000"]), + .setMarketBorrowCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["150000000000"]), ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); }); }); diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-xxx/bscmainnet.ts index ab4808dcc..d94b2c662 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -113,29 +113,19 @@ Configure Remote Risk Stewards { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ - MARKET_CAP_RISK_STEWARD_ETHEREUM, - "processUpdate(RiskParameterUpdate)", - RISK_STEWARD_RECEIVER_ETHEREUM, - ], - dstChainId: LzChainId.ethereum, - }, - { - target: ethereum.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxIncreaseBps(uint256)", ethereum.NORMAL_TIMELOCK], + params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxDeltaBps(uint256)", ethereum.NORMAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxIncreaseBps(uint256)", ethereum.CRITICAL_TIMELOCK], + params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxDeltaBps(uint256)", ethereum.CRITICAL_TIMELOCK], dstChainId: LzChainId.ethereum, }, { target: ethereum.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxIncreaseBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], + params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxDeltaBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], dstChainId: LzChainId.ethereum, }, diff --git a/vips/vip-xxx/bsctestnet1.ts b/vips/vip-xxx/bsctestnet1.ts index ee5aba1a6..864f9e4fa 100644 --- a/vips/vip-xxx/bsctestnet1.ts +++ b/vips/vip-xxx/bsctestnet1.ts @@ -123,19 +123,19 @@ export const permissions = ( { target: acm, signature: "giveCallPermission(address,string,address)", - params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", normalTimelock], + params: [marketCapRiskSteward, "setMaxDeltaBps(uint256)", normalTimelock], dstChainId: chain, }, { target: acm, signature: "giveCallPermission(address,string,address)", - params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", criticalTimelock], + params: [marketCapRiskSteward, "setMaxDeltaBps(uint256)", criticalTimelock], dstChainId: chain, }, { target: acm, signature: "giveCallPermission(address,string,address)", - params: [marketCapRiskSteward, "setMaxIncreaseBps(uint256)", fastTrackTimelock], + params: [marketCapRiskSteward, "setMaxDeltaBps(uint256)", fastTrackTimelock], dstChainId: chain, }, ]; From 9384c861bf3c7fccdf02ff18cfb2cdb6b9273f01 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Tue, 8 Jul 2025 11:09:02 +0200 Subject: [PATCH 18/31] fixup! feat: add pre- post- checks --- simulations/vip-xxx/ethereum.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-xxx/ethereum.ts b/simulations/vip-xxx/ethereum.ts index cce890085..f3b3f77f6 100644 --- a/simulations/vip-xxx/ethereum.ts +++ b/simulations/vip-xxx/ethereum.ts @@ -5,7 +5,7 @@ import { parseUnits } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; -import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; +import { forking, testForkedNetworkVipCommands } from "src/vip-framework"; import { ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ETHEREUM } from "../../vips/vip-xxx/bscmainnet"; import vipxxx from "../../vips/vip-xxx/bscmainnet"; From 722eec7ba51bb6db9c8ec320dcff0cbcf02f86f4 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Tue, 8 Jul 2025 13:07:37 +0200 Subject: [PATCH 19/31] fix: ethereum simulation --- simulations/vip-xxx/ethereum.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-xxx/ethereum.ts b/simulations/vip-xxx/ethereum.ts index f3b3f77f6..444cd954c 100644 --- a/simulations/vip-xxx/ethereum.ts +++ b/simulations/vip-xxx/ethereum.ts @@ -41,7 +41,7 @@ forking(22829643, async () => { txResponse, [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["PermissionGranted", "RiskParameterConfigSet"], - [16, 2], + [15, 2], ); }, }); From 2172b5fe0bd2d691ad2e762d689b877b930be96b Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Fri, 11 Jul 2025 13:05:55 +0200 Subject: [PATCH 20/31] feat: replace old facets with new ones --- simulations/vip-xxx/bscmainnet.ts | 31 +++++-- simulations/vip-xxx/bsctestnet-addendum.ts | 21 +++-- .../vip-xxx/utils/cur-params-bscmainnet.json | 89 ++++++++++++++++++- .../vip-xxx/utils/cur-params-bsctestnet.json | 89 ++++++++++++++++++- 4 files changed, 209 insertions(+), 21 deletions(-) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index 67f18c022..480946b0a 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -82,15 +82,21 @@ forking(52815412, async () => { it("market facet function selectors should be updated for new facet address", async () => { const newMarketFacetFunctionSelectors = ["0x3d98a1e5", "0xcab4f84c"]; - expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal(newMarketFacetFunctionSelectors); - expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors); + const expectSelectors = [...marketFacetFunctionSelectors, ...newMarketFacetFunctionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal([]); }); it("policy facet function selectors should be updated for new facet address", async () => { const newPolicyFacetFunctionSelectors = ["0x528a174c"]; - expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal(newPolicyFacetFunctionSelectors); - expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors); + const expectSelectors = [...policyFacetFunctionSelectors, ...newPolicyFacetFunctionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal([]); }); it("setter facet function selectors should be updated for new facet address", async () => { @@ -106,8 +112,11 @@ forking(52815412, async () => { "0x530e784f", ]; - expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal(newSetterFacetFunctionSelectors); - expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors); + const expectSelectors = [...setterFacetFuntionSelectors, ...newSetterFacetFunctionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal([]); }); it("reward facet function selectors should not be changed", async () => { @@ -117,10 +126,14 @@ forking(52815412, async () => { }); it("unitroller should contain the new and old facet addresses", async () => { - expect(await unitroller.facetAddresses()).to.include(NEW_SETTER_FACET, OLD_SETTER_FACET); - expect(await unitroller.facetAddresses()).to.include(NEW_POLICY_FACET, OLD_POLICY_FACET); - expect(await unitroller.facetAddresses()).to.include(NEW_MARKET_FACET, OLD_MARKET_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.include(NEW_MARKET_FACET); expect(await unitroller.facetAddresses()).to.include(UNCHANGED_REWARD_FACET); + + expect(await unitroller.facetAddresses()).to.not.include(OLD_SETTER_FACET); + expect(await unitroller.facetAddresses()).to.not.include(OLD_POLICY_FACET); + expect(await unitroller.facetAddresses()).to.not.include(OLD_MARKET_FACET); }); }); }); diff --git a/simulations/vip-xxx/bsctestnet-addendum.ts b/simulations/vip-xxx/bsctestnet-addendum.ts index 4ce74beaa..158acc7a4 100644 --- a/simulations/vip-xxx/bsctestnet-addendum.ts +++ b/simulations/vip-xxx/bsctestnet-addendum.ts @@ -82,15 +82,21 @@ forking(56931937, async () => { it("market facet function selectors should be updated for new facet address", async () => { const newMarketFacetFunctionSelectors = ["0x3d98a1e5", "0xcab4f84c"]; - expect(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET)).to.deep.equal(newMarketFacetFunctionSelectors); - expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal(marketFacetFunctionSelectors); + const expectSelectors = [...marketFacetFunctionSelectors, ...newMarketFacetFunctionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_MARKET_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_MARKET_FACET)).to.deep.equal([]); }); it("policy facet function selectors should be updated for new facet address", async () => { const newPolicyFacetFunctionSelectors = ["0x528a174c"]; - expect(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET)).to.deep.equal(newPolicyFacetFunctionSelectors); - expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal(policyFacetFunctionSelectors); + const expectSelectors = [...policyFacetFunctionSelectors, ...newPolicyFacetFunctionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_POLICY_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_POLICY_FACET)).to.deep.equal([]); }); it("setter facet function selectors should be updated for new facet address", async () => { @@ -106,8 +112,11 @@ forking(56931937, async () => { "0x530e784f", ]; - expect(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET)).to.deep.equal(newSetterFacetFunctionSelectors); - expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal(setterFacetFuntionSelectors); + const expectSelectors = [...setterFacetFuntionSelectors, ...newSetterFacetFunctionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_SETTER_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_SETTER_FACET)).to.deep.equal([]); }); it("reward facet function selectors should not be changed", async () => { diff --git a/simulations/vip-xxx/utils/cur-params-bscmainnet.json b/simulations/vip-xxx/utils/cur-params-bscmainnet.json index 2807b5af3..5172412a6 100644 --- a/simulations/vip-xxx/utils/cur-params-bscmainnet.json +++ b/simulations/vip-xxx/utils/cur-params-bscmainnet.json @@ -1,7 +1,90 @@ { "cutParams": [ - ["0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", 0, ["0x3d98a1e5", "0xcab4f84c"]], - ["0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", 0, ["0x528a174c"]], + [ + "0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", + 1, + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0xa78dc775", + "0x0686dab6", + "0xddbf54fd", + "0xc5b4db55" + ] + ], + [ + "0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", + 0, + [ + "0x3d98a1e5", + "0xcab4f84c" + ] + ], + [ + "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", + 1, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", + 0, + [ + "0x528a174c" + ] + ], + [ + "0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64", + 1, + [ + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x522c656b", + "0x17db2163", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x9460c8b5", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0x919a3736", + "0x4ef233fc", + "0xfd51a3ad" + ] + ], [ "0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64", 0, @@ -18,4 +101,4 @@ ] ] ] -} +} \ No newline at end of file diff --git a/simulations/vip-xxx/utils/cur-params-bsctestnet.json b/simulations/vip-xxx/utils/cur-params-bsctestnet.json index 0fb46afe3..28667ea5f 100644 --- a/simulations/vip-xxx/utils/cur-params-bsctestnet.json +++ b/simulations/vip-xxx/utils/cur-params-bsctestnet.json @@ -1,7 +1,90 @@ { "cutParams": [ - ["0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", 0, ["0x3d98a1e5", "0xcab4f84c"]], - ["0x671B787AEDB6769972f081C6ee4978146F7D92E6", 0, ["0x528a174c"]], + [ + "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", + 1, + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0xa78dc775", + "0x0686dab6", + "0xddbf54fd", + "0xc5b4db55" + ] + ], + [ + "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", + 0, + [ + "0x3d98a1e5", + "0xcab4f84c" + ] + ], + [ + "0x671B787AEDB6769972f081C6ee4978146F7D92E6", + 1, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x671B787AEDB6769972f081C6ee4978146F7D92E6", + 0, + [ + "0x528a174c" + ] + ], + [ + "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A", + 1, + [ + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x522c656b", + "0x17db2163", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x9460c8b5", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0x919a3736", + "0x4ef233fc", + "0xfd51a3ad" + ] + ], [ "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A", 0, @@ -18,4 +101,4 @@ ] ] ] -} +} \ No newline at end of file From 6b355257e33943b88ccdca783c76692a12c0ac46 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Fri, 11 Jul 2025 15:32:14 +0200 Subject: [PATCH 21/31] fixup! feat: replace old facets with new ones --- .../vip-xxx/utils/cur-params-bscmainnet.json | 19 +++---------------- .../vip-xxx/utils/cur-params-bsctestnet.json | 19 +++---------------- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/simulations/vip-xxx/utils/cur-params-bscmainnet.json b/simulations/vip-xxx/utils/cur-params-bscmainnet.json index 5172412a6..1020370a7 100644 --- a/simulations/vip-xxx/utils/cur-params-bscmainnet.json +++ b/simulations/vip-xxx/utils/cur-params-bscmainnet.json @@ -18,14 +18,7 @@ "0xc5b4db55" ] ], - [ - "0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", - 0, - [ - "0x3d98a1e5", - "0xcab4f84c" - ] - ], + ["0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db", 0, ["0x3d98a1e5", "0xcab4f84c"]], [ "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", 1, @@ -49,13 +42,7 @@ "0x6a56947e" ] ], - [ - "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", - 0, - [ - "0x528a174c" - ] - ], + ["0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9", 0, ["0x528a174c"]], [ "0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64", 1, @@ -101,4 +88,4 @@ ] ] ] -} \ No newline at end of file +} diff --git a/simulations/vip-xxx/utils/cur-params-bsctestnet.json b/simulations/vip-xxx/utils/cur-params-bsctestnet.json index 28667ea5f..ab6aac869 100644 --- a/simulations/vip-xxx/utils/cur-params-bsctestnet.json +++ b/simulations/vip-xxx/utils/cur-params-bsctestnet.json @@ -18,14 +18,7 @@ "0xc5b4db55" ] ], - [ - "0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", - 0, - [ - "0x3d98a1e5", - "0xcab4f84c" - ] - ], + ["0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd", 0, ["0x3d98a1e5", "0xcab4f84c"]], [ "0x671B787AEDB6769972f081C6ee4978146F7D92E6", 1, @@ -49,13 +42,7 @@ "0x6a56947e" ] ], - [ - "0x671B787AEDB6769972f081C6ee4978146F7D92E6", - 0, - [ - "0x528a174c" - ] - ], + ["0x671B787AEDB6769972f081C6ee4978146F7D92E6", 0, ["0x528a174c"]], [ "0xb619F7ce96c0a6E3F0b44e993f663522F79f294A", 1, @@ -101,4 +88,4 @@ ] ] ] -} \ No newline at end of file +} From efd29fea15018c084ce583d734081ed5f98a9858 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Mon, 14 Jul 2025 15:44:59 +0200 Subject: [PATCH 22/31] feat: shift deployment from ethereum to bnb --- simulations/vip-xxx/bscmainnet.ts | 51 ++++++++++++- simulations/vip-xxx/ethereum.ts | 90 ----------------------- vips/vip-xxx/bscmainnet.ts | 114 ++++++++++++++---------------- 3 files changed, 102 insertions(+), 153 deletions(-) delete mode 100644 simulations/vip-xxx/ethereum.ts diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index 480946b0a..f16a88835 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -1,4 +1,6 @@ import { TransactionResponse } from "@ethersproject/providers"; +import { parseUnits } from "@ethersproject/units"; +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { Contract } from "ethers"; import { ethers } from "hardhat"; @@ -6,9 +8,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import vip599 from "../../vips/vip-xxx/bscmainnet"; +import vip599, { ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_BSCMAINNET } from "../../vips/vip-xxx/bscmainnet"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; +import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; const { bscmainnet } = NETWORK_ADDRESSES; @@ -22,9 +26,11 @@ const NEW_POLICY_FACET = "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9"; const UNCHANGED_REWARD_FACET = "0xc2F6bDCEa4907E8CB7480d3d315bc01c125fb63C"; -forking(52815412, async () => { +forking(54002305, async () => { const provider = ethers.provider; let unitroller: Contract; + let acm: Contract; + let marketFacetFunctionSelectors: string[]; let policyFacetFunctionSelectors: string[]; let rewardFacetFuntionSelectors: string[]; @@ -36,6 +42,8 @@ forking(52815412, async () => { setterFacetFuntionSelectors = await unitroller.facetFunctionSelectors(OLD_SETTER_FACET); marketFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_MARKET_FACET); policyFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_POLICY_FACET); + + acm = new ethers.Contract(bscmainnet.ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); }); describe("Pre-VIP behaviour", async () => { @@ -74,7 +82,12 @@ forking(52815412, async () => { testVip("vip-599", await vip599(), { callbackAfterExecution: async (txResponse: TransactionResponse) => { - await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); + await expectEvents( + txResponse, + [DIAMOND_ABI, ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], + ["DiamondCut", "RiskParameterConfigSet", "RoleGranted"], + [1, 2, 15], + ); }, }); @@ -135,5 +148,37 @@ forking(52815412, async () => { expect(await unitroller.facetAddresses()).to.not.include(OLD_POLICY_FACET); expect(await unitroller.facetAddresses()).to.not.include(OLD_MARKET_FACET); }); + + it("grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + const supplyCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); + expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + + const borrowCapRole = ethers.utils.solidityPack( + ["address", "string"], + [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); + expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + }); + + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { + await impersonateAccount(MARKET_CAP_RISK_STEWARD_BSCMAINNET); + await setBalance(MARKET_CAP_RISK_STEWARD_BSCMAINNET, parseUnits("1000000", 18)); + + await expect( + unitroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSCMAINNET)) + .setMarketSupplyCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["180000000000"]), + ).to.emit(unitroller, "NewSupplyCap"); + await expect( + unitroller + .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSCMAINNET)) + .setMarketBorrowCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["150000000000"]), + ).to.emit(unitroller, "NewBorrowCap"); + }); }); }); diff --git a/simulations/vip-xxx/ethereum.ts b/simulations/vip-xxx/ethereum.ts deleted file mode 100644 index 444cd954c..000000000 --- a/simulations/vip-xxx/ethereum.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; -import { expect } from "chai"; -import { BigNumber, Contract } from "ethers"; -import { parseUnits } from "ethers/lib/utils"; -import { ethers } from "hardhat"; -import { NETWORK_ADDRESSES } from "src/networkAddresses"; -import { expectEvents } from "src/utils"; -import { forking, testForkedNetworkVipCommands } from "src/vip-framework"; - -import { ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ETHEREUM } from "../../vips/vip-xxx/bscmainnet"; -import vipxxx from "../../vips/vip-xxx/bscmainnet"; -import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; -import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; -import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; -import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; - -const { ethereum } = NETWORK_ADDRESSES; - -forking(22829643, async () => { - const provider = ethers.provider; - let executor: Contract; - let lastProposalReceived: BigNumber; - - const acm = new ethers.Contract(ethereum.ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); - - const isolatedPoolComptroller = new ethers.Contract( - "0x687a01ecF6d3907658f7A7c714749fAC32336D1B", - ISOLATED_POOL_COMPTROLLER_ABI, - provider, - ); - - before(async () => { - executor = new ethers.Contract(ethereum.OMNICHAIN_GOVERNANCE_EXECUTOR, OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, provider); - - lastProposalReceived = await executor.lastProposalReceived(); - }); - - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { - callbackAfterExecution: async txResponse => { - await expectEvents( - txResponse, - [ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], - ["PermissionGranted", "RiskParameterConfigSet"], - [15, 2], - ); - }, - }); - describe("Post-VIP behavior", () => { - it("Proposal id should be incremented", async () => { - expect(await executor.lastProposalReceived()).to.be.equals(lastProposalReceived.add(1)); - }); - - it("proposal should be executed", async () => { - const pId = await executor.lastProposalReceived(); - expect(await executor.state(pId)).to.be.equals(2); - }); - - it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { - const supplyCapRole = ethers.utils.solidityPack( - ["address", "string"], - [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], - ); - const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); - expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_ETHEREUM)).to.be.true; - - const borrowCapRole = ethers.utils.solidityPack( - ["address", "string"], - [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], - ); - const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); - expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_ETHEREUM)).to.be.true; - }); - - it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { - await impersonateAccount(MARKET_CAP_RISK_STEWARD_ETHEREUM); - await setBalance(MARKET_CAP_RISK_STEWARD_ETHEREUM, parseUnits("1000000", 18)); - - await expect( - isolatedPoolComptroller - .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ETHEREUM)) - .setMarketSupplyCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["180000000000"]), - ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); - await expect( - isolatedPoolComptroller - .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_ETHEREUM)) - .setMarketBorrowCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["150000000000"]), - ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); - }); - }); -}); diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-xxx/bscmainnet.ts index d94b2c662..c5d710c9b 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -1,14 +1,15 @@ +import { ethers } from "hardhat"; import { NETWORK_ADDRESSES } from "src/networkAddresses"; -import { LzChainId, ProposalType } from "src/types"; +import { ProposalType } from "src/types"; import { makeProposal } from "src/utils"; import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-bscmainnet.json"; -const { ethereum, bscmainnet } = NETWORK_ADDRESSES; +const { bscmainnet } = NETWORK_ADDRESSES; -export const RISK_STEWARD_RECEIVER_ETHEREUM = "0x5086Dc718D1288E4cc4F6a75991E4a0bD0611bF1"; -export const MARKET_CAP_RISK_STEWARD_ETHEREUM = "0x7191b4602Fe9d36E1A4b2cb84D0c80C543F13f9A"; -export const ANY_TARGET_CONTRACT = "0x0000000000000000000000000000000000000000"; +export const RISK_STEWARD_RECEIVER_BSCMAINNET = "0xBa2a43279a228cf9cD94d072777d8d98e7e0a229"; +export const MARKET_CAP_RISK_STEWARD_BSCMAINNET = "0xE7252dccd79F2A555E314B9cdd440745b697D562"; +export const ANY_TARGET_CONTRACT = ethers.constants.AddressZero; export const MORE_THAN_1_DAY = 86401; // 24 hours + 1 second export const cutParams = params; @@ -27,7 +28,7 @@ Configure Remote Risk Stewards return makeProposal( [ - // Update dimond cut + // Update diamond cut { target: bscmainnet.UNITROLLER, signature: "diamondCut((address,uint8,bytes4[])[])", @@ -35,113 +36,106 @@ Configure Remote Risk Stewards }, // Permissions { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", params: [ - RISK_STEWARD_RECEIVER_ETHEREUM, + RISK_STEWARD_RECEIVER_BSCMAINNET, "setRiskParameterConfig(string,address,uint256)", - ethereum.NORMAL_TIMELOCK, + bscmainnet.NORMAL_TIMELOCK, ], - dstChainId: LzChainId.ethereum, }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_ETHEREUM], - dstChainId: LzChainId.ethereum, + params: [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSCMAINNET], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_ETHEREUM], - dstChainId: LzChainId.ethereum, + params: [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])", MARKET_CAP_RISK_STEWARD_BSCMAINNET], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "toggleConfigActive(string)", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "toggleConfigActive(string)", bscmainnet.NORMAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "toggleConfigActive(string)", ethereum.CRITICAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "toggleConfigActive(string)", bscmainnet.CRITICAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "toggleConfigActive(string)", ethereum.FAST_TRACK_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "toggleConfigActive(string)", bscmainnet.FAST_TRACK_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "pause()", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "pause()", bscmainnet.NORMAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "pause()", ethereum.CRITICAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "pause()", bscmainnet.CRITICAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "pause()", ethereum.FAST_TRACK_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "pause()", bscmainnet.FAST_TRACK_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "unpause()", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "unpause()", bscmainnet.NORMAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "unpause()", ethereum.CRITICAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "unpause()", bscmainnet.CRITICAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [RISK_STEWARD_RECEIVER_ETHEREUM, "unpause()", ethereum.FAST_TRACK_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "unpause()", bscmainnet.FAST_TRACK_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxDeltaBps(uint256)", ethereum.NORMAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [MARKET_CAP_RISK_STEWARD_BSCMAINNET, "setMaxDeltaBps(uint256)", bscmainnet.NORMAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxDeltaBps(uint256)", ethereum.CRITICAL_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [MARKET_CAP_RISK_STEWARD_BSCMAINNET, "setMaxDeltaBps(uint256)", bscmainnet.CRITICAL_TIMELOCK], }, { - target: ethereum.ACCESS_CONTROL_MANAGER, + target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", - params: [MARKET_CAP_RISK_STEWARD_ETHEREUM, "setMaxDeltaBps(uint256)", ethereum.FAST_TRACK_TIMELOCK], - dstChainId: LzChainId.ethereum, + params: [MARKET_CAP_RISK_STEWARD_BSCMAINNET, "setMaxDeltaBps(uint256)", bscmainnet.FAST_TRACK_TIMELOCK], + }, + // Accept ownership of Risk Steward Receiver + { + target: RISK_STEWARD_RECEIVER_BSCMAINNET, + signature: "acceptOwnership()", + params: [], + }, + // Accept ownership of Market Cap Risk Steward + { + target: MARKET_CAP_RISK_STEWARD_BSCMAINNET, + signature: "acceptOwnership()", + params: [], }, - // Set risk parameter configurations { - target: RISK_STEWARD_RECEIVER_ETHEREUM, + target: RISK_STEWARD_RECEIVER_BSCMAINNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["supplyCap", MARKET_CAP_RISK_STEWARD_ETHEREUM, MORE_THAN_1_DAY], - dstChainId: LzChainId.ethereum, + params: ["supplyCap", MARKET_CAP_RISK_STEWARD_BSCMAINNET, MORE_THAN_1_DAY], }, - { - target: RISK_STEWARD_RECEIVER_ETHEREUM, + target: RISK_STEWARD_RECEIVER_BSCMAINNET, signature: "setRiskParameterConfig(string,address,uint256)", - params: ["borrowCap", MARKET_CAP_RISK_STEWARD_ETHEREUM, MORE_THAN_1_DAY], - dstChainId: LzChainId.ethereum, + params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSCMAINNET, MORE_THAN_1_DAY], }, ], meta, From f143a81259ee1f541a01cc67eb2de36c7224c241 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Mon, 14 Jul 2025 16:04:17 +0200 Subject: [PATCH 23/31] fix: simulations check --- simulations/vip-xxx/bscmainnet.ts | 29 +++++++++++++++++++++++------ vips/vip-xxx/bscmainnet.ts | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index f16a88835..cd45ee89c 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -12,6 +12,7 @@ import vip599, { ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_BSCMAINNET } from import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; +import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import VENUS_RISK_STEWARD_RECEIVER_ABI from "./abi/VenusRiskStewardReceiver.json"; const { bscmainnet } = NETWORK_ADDRESSES; @@ -30,6 +31,7 @@ forking(54002305, async () => { const provider = ethers.provider; let unitroller: Contract; let acm: Contract; + let isolatedPoolComptroller: Contract; let marketFacetFunctionSelectors: string[]; let policyFacetFunctionSelectors: string[]; @@ -44,6 +46,7 @@ forking(54002305, async () => { policyFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_POLICY_FACET); acm = new ethers.Contract(bscmainnet.ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); + isolatedPoolComptroller = new ethers.Contract(bscmainnet.UNITROLLER, ISOLATED_POOL_COMPTROLLER_ABI, provider); }); describe("Pre-VIP behaviour", async () => { @@ -86,7 +89,7 @@ forking(54002305, async () => { txResponse, [DIAMOND_ABI, ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["DiamondCut", "RiskParameterConfigSet", "RoleGranted"], - [1, 2, 15], + [1, 2, 17], ); }, }); @@ -149,7 +152,7 @@ forking(54002305, async () => { expect(await unitroller.facetAddresses()).to.not.include(OLD_MARKET_FACET); }); - it("grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { const supplyCapRole = ethers.utils.solidityPack( ["address", "string"], [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], @@ -163,6 +166,20 @@ forking(54002305, async () => { ); const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + + const supplyCapCorePoolRole = ethers.utils.solidityPack( + ["address", "string"], + [bscmainnet.UNITROLLER, "_setMarketSupplyCaps(address[],uint256[])"], + ); + const supplyCapCorePoolRoleHash = ethers.utils.keccak256(supplyCapCorePoolRole); + expect(await acm.hasRole(supplyCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + + const borrowCapCorePoolRole = ethers.utils.solidityPack( + ["address", "string"], + [bscmainnet.UNITROLLER, "_setMarketSupplyCaps(address[],uint256[])"], + ); + const borrowCapCorePoolRoleHash = ethers.utils.keccak256(borrowCapCorePoolRole); + expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; }); it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { @@ -170,15 +187,15 @@ forking(54002305, async () => { await setBalance(MARKET_CAP_RISK_STEWARD_BSCMAINNET, parseUnits("1000000", 18)); await expect( - unitroller + isolatedPoolComptroller .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSCMAINNET)) .setMarketSupplyCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["180000000000"]), - ).to.emit(unitroller, "NewSupplyCap"); + ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); await expect( - unitroller + isolatedPoolComptroller .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSCMAINNET)) .setMarketBorrowCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["150000000000"]), - ).to.emit(unitroller, "NewBorrowCap"); + ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); }); }); }); diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-xxx/bscmainnet.ts index c5d710c9b..50602a47d 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -137,6 +137,24 @@ Configure Remote Risk Stewards signature: "setRiskParameterConfig(string,address,uint256)", params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSCMAINNET, MORE_THAN_1_DAY], }, + { + target: bscmainnet.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ + bscmainnet.UNITROLLER, + "_setMarketSupplyCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_BSCMAINNET, + ], + }, + { + target: bscmainnet.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [ + bscmainnet.UNITROLLER, + "_setMarketBorrowCaps(address[],uint256[])", + MARKET_CAP_RISK_STEWARD_BSCMAINNET, + ], + }, ], meta, ProposalType.REGULAR, From 24021639497d1898911788d7e0d1728d85708d51 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Mon, 14 Jul 2025 17:15:49 +0200 Subject: [PATCH 24/31] feat: shift to use only for Isolated Pools --- simulations/vip-xxx/bscmainnet.ts | 65 ++++++++++++++++++++++++++----- simulations/vip-xxx/bsctestnet.ts | 2 +- vips/vip-xxx/bscmainnet.ts | 34 ++++------------ 3 files changed, 65 insertions(+), 36 deletions(-) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index cd45ee89c..c445f7414 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -8,7 +8,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import vip599, { ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_BSCMAINNET } from "../../vips/vip-xxx/bscmainnet"; +import vip599, { + ANY_TARGET_CONTRACT, + MARKET_CAP_RISK_STEWARD_BSCMAINNET, + RISK_STEWARD_RECEIVER_BSCMAINNET, +} from "../../vips/vip-xxx/bscmainnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; @@ -46,7 +50,11 @@ forking(54002305, async () => { policyFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_POLICY_FACET); acm = new ethers.Contract(bscmainnet.ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); - isolatedPoolComptroller = new ethers.Contract(bscmainnet.UNITROLLER, ISOLATED_POOL_COMPTROLLER_ABI, provider); + isolatedPoolComptroller = new ethers.Contract( + "0xBE609449Eb4D76AD8545f957bBE04b596E8fC529", + ISOLATED_POOL_COMPTROLLER_ABI, + provider, + ); }); describe("Pre-VIP behaviour", async () => { @@ -81,6 +89,24 @@ forking(54002305, async () => { expect(await unitroller.facetAddresses()).to.not.include(NEW_POLICY_FACET); expect(await unitroller.facetAddresses()).to.not.include(NEW_MARKET_FACET); }); + + it("normal timelock is not owner of risk steward receiver", async () => { + const riskStewardReceiver = new ethers.Contract( + RISK_STEWARD_RECEIVER_BSCMAINNET, + VENUS_RISK_STEWARD_RECEIVER_ABI, + provider, + ); + expect(await riskStewardReceiver.owner()).to.not.equal(bscmainnet.NORMAL_TIMELOCK); + }); + + it("normal timelock is not owner of market cap risk steward", async () => { + const marketCapRiskSteward = new ethers.Contract( + MARKET_CAP_RISK_STEWARD_BSCMAINNET, + VENUS_RISK_STEWARD_RECEIVER_ABI, + provider, + ); + expect(await marketCapRiskSteward.owner()).to.not.equal(bscmainnet.NORMAL_TIMELOCK); + }); }); testVip("vip-599", await vip599(), { @@ -89,7 +115,7 @@ forking(54002305, async () => { txResponse, [DIAMOND_ABI, ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["DiamondCut", "RiskParameterConfigSet", "RoleGranted"], - [1, 2, 17], + [1, 2, 15], ); }, }); @@ -152,7 +178,7 @@ forking(54002305, async () => { expect(await unitroller.facetAddresses()).to.not.include(OLD_MARKET_FACET); }); - it("Grants timelock permissions to setRiskParameterConfig on Market Cap Risk Steward", async () => { + it("grants Market Cap Risk Steward permissions to call setMarketSupplyCaps and setMarketBorrowCaps on any target contract (Isolated Pools)", async () => { const supplyCapRole = ethers.utils.solidityPack( ["address", "string"], [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], @@ -162,24 +188,26 @@ forking(54002305, async () => { const borrowCapRole = ethers.utils.solidityPack( ["address", "string"], - [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])"], ); const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + }); + it("does not grant permissions for Market Cap Risk Steward to call CORE pool comptlorer", async () => { const supplyCapCorePoolRole = ethers.utils.solidityPack( ["address", "string"], [bscmainnet.UNITROLLER, "_setMarketSupplyCaps(address[],uint256[])"], ); const supplyCapCorePoolRoleHash = ethers.utils.keccak256(supplyCapCorePoolRole); - expect(await acm.hasRole(supplyCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + expect(await acm.hasRole(supplyCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.false; const borrowCapCorePoolRole = ethers.utils.solidityPack( ["address", "string"], [bscmainnet.UNITROLLER, "_setMarketSupplyCaps(address[],uint256[])"], ); const borrowCapCorePoolRoleHash = ethers.utils.keccak256(borrowCapCorePoolRole); - expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; + expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.false; }); it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { @@ -189,13 +217,32 @@ forking(54002305, async () => { await expect( isolatedPoolComptroller .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSCMAINNET)) - .setMarketSupplyCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["180000000000"]), + .setMarketSupplyCaps(["0xef470AbC365F88e4582D8027172a392C473A5B53"], ["150000000000000000000000"]), ).to.emit(isolatedPoolComptroller, "NewSupplyCap"); + await expect( isolatedPoolComptroller .connect(await ethers.getSigner(MARKET_CAP_RISK_STEWARD_BSCMAINNET)) - .setMarketBorrowCaps(["0xa8e7f9473635a5CB79646f14356a9Fc394CA111A"], ["150000000000"]), + .setMarketBorrowCaps(["0xef470AbC365F88e4582D8027172a392C473A5B53"], ["55000000000000000000000"]), ).to.emit(isolatedPoolComptroller, "NewBorrowCap"); }); + + it("normal timelock is owner of risk steward receiver", async () => { + const riskStewardReceiver = new ethers.Contract( + RISK_STEWARD_RECEIVER_BSCMAINNET, + VENUS_RISK_STEWARD_RECEIVER_ABI, + provider, + ); + expect(await riskStewardReceiver.owner()).to.equal(bscmainnet.NORMAL_TIMELOCK); + }); + + it("normal timelock is owner of market cap risk steward", async () => { + const marketCapRiskSteward = new ethers.Contract( + MARKET_CAP_RISK_STEWARD_BSCMAINNET, + VENUS_RISK_STEWARD_RECEIVER_ABI, + provider, + ); + expect(await marketCapRiskSteward.owner()).to.equal(bscmainnet.NORMAL_TIMELOCK); + }); }); }); diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-xxx/bsctestnet.ts index 30db73e87..2e4da991a 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-xxx/bsctestnet.ts @@ -55,7 +55,7 @@ forking(48650752, async () => { const borrowCapRole = ethers.utils.solidityPack( ["address", "string"], - [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])"], ); const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BSC_TESTNET)).to.be.true; diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-xxx/bscmainnet.ts index 50602a47d..c8b4db76a 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -114,18 +114,6 @@ Configure Remote Risk Stewards signature: "giveCallPermission(address,string,address)", params: [MARKET_CAP_RISK_STEWARD_BSCMAINNET, "setMaxDeltaBps(uint256)", bscmainnet.FAST_TRACK_TIMELOCK], }, - // Accept ownership of Risk Steward Receiver - { - target: RISK_STEWARD_RECEIVER_BSCMAINNET, - signature: "acceptOwnership()", - params: [], - }, - // Accept ownership of Market Cap Risk Steward - { - target: MARKET_CAP_RISK_STEWARD_BSCMAINNET, - signature: "acceptOwnership()", - params: [], - }, // Set risk parameter configurations { target: RISK_STEWARD_RECEIVER_BSCMAINNET, @@ -137,23 +125,17 @@ Configure Remote Risk Stewards signature: "setRiskParameterConfig(string,address,uint256)", params: ["borrowCap", MARKET_CAP_RISK_STEWARD_BSCMAINNET, MORE_THAN_1_DAY], }, + // Accept ownership of Risk Steward Receiver { - target: bscmainnet.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ - bscmainnet.UNITROLLER, - "_setMarketSupplyCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_BSCMAINNET, - ], + target: RISK_STEWARD_RECEIVER_BSCMAINNET, + signature: "acceptOwnership()", + params: [], }, + // Accept ownership of Market Cap Risk Steward { - target: bscmainnet.ACCESS_CONTROL_MANAGER, - signature: "giveCallPermission(address,string,address)", - params: [ - bscmainnet.UNITROLLER, - "_setMarketBorrowCaps(address[],uint256[])", - MARKET_CAP_RISK_STEWARD_BSCMAINNET, - ], + target: MARKET_CAP_RISK_STEWARD_BSCMAINNET, + signature: "acceptOwnership()", + params: [], }, ], meta, From 8c8d90b9593fb4777fa506e8cc609bbaa1e42c05 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Mon, 14 Jul 2025 17:24:45 +0200 Subject: [PATCH 25/31] fixup! feat: shift to use only for Isolated Pools --- simulations/vip-xxx/bscmainnet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index c445f7414..4f7b0cc3e 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -51,7 +51,7 @@ forking(54002305, async () => { acm = new ethers.Contract(bscmainnet.ACCESS_CONTROL_MANAGER, ACCESS_CONTROL_MANAGER_ABI, provider); isolatedPoolComptroller = new ethers.Contract( - "0xBE609449Eb4D76AD8545f957bBE04b596E8fC529", + "0x1b43ea8622e76627B81665B1eCeBB4867566B963", ISOLATED_POOL_COMPTROLLER_ABI, provider, ); From 6d16cd86d76c6d79cc8ece10650699413632e0b6 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Mon, 14 Jul 2025 17:29:49 +0200 Subject: [PATCH 26/31] feat: update description --- vips/vip-xxx/bscmainnet.ts | 64 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-xxx/bscmainnet.ts index c8b4db76a..0a5e76136 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -17,9 +17,69 @@ export const cutParams = params; export const vip599 = () => { const meta = { version: "v2", - title: "VIP-599: Configure Remote Risk Stewards", + title: "VIP-5XX [BNB Chain] Chaos Labs' Risk Oracle integration (1/2)", description: `#### Summary -Configure Remote Risk Stewards + +If passed, following the community proposal “[Integrate Chaos Labs’ Risk Oracle to Venus Protocol](https://community.venus.io/t/integrate-chaos-labs-risk-oracle-to-venus-protocol/4569)” ([snapshot](https://snapshot.box/#/s:venus-xvs.eth/proposal/0x6d84d48a17981a84e3eb320139552306f70fd006d7f3d9df131e20002e98620c)), this VIP will integrate the Chaos Labs’ Risk Oracle into Venus Protocol on BNB Chain, allowing the update of the supply and borrow caps of the Venus markets (on Isolated Pools) on this chain without VIP’s, considering Chaos Labs recommendations. + +Moreover, this VIP would upgrade the implementation of the [Comptroller contract for the Core pool on BNB Chain](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384), aligning its interface with the Comptroller contract used in the Isolated Pools. This change will simplify future interactions with both Comptroller contracts. + +#### Description + +[Chaos Labs’ Risk Oracle](https://github.com/ChaosLabsInc/risk-oracle) is a system composed of off-chain artifacts, where simulations and recommendations are defined, and a smart contract where [Chaos Labs](https://chaoslabs.xyz/) will submit recommendations for the Venus Protocol. These recommendations will be processed by the Venus Risk Steward contracts, performing some checks before applying them in the affected markets. + +Main characteristics of the Risk Stewards enabled in this VIP: + +- Only the supply and borrow caps can be adjusted—either increased or decreased. All other risk parameters cannot be updated +- The new caps cannot be greater or lower than 50% of the current caps. For example, given the current supply cap of the market [WBNB on the Liquid Staked BNB pool](https://app.venus.io/#/isolated-pools/pool/0xd933909A4a2b7A4638903028f44D1d38ce27c352/market/0xe10E80B7FD3a29fE46E16C30CC8F4dd938B742e2?chainId=56) is 15K WBNB, Risk Stewards will be only able to set a new supply cap between 7.5K and 22.5K WBNB in one transaction. This limit can be modified with a VIP. +- Risk Stewards can only update the supply cap for a specific market once every 24 hours. The same rule applies to borrow cap updates. This constraint can be modified with a VIP. +- Risk Stewards will initially only be allowed to update markets in the Isolated Pools. In a separate VIP, they’ll also be granted permission to update markets in the Core Pool. This phased rollout is part of the overall security strategy. + +#### Next steps + +A new VIP will be proposed in the coming days to enable this integration for the markets in the Core pool on BNB Chain. Markets on other supported networks will be integrated at a later stage. + +The second version of the Risk Stewards framework will allow Chaos Labs to propose VIPs and update a broader set of risk parameters, following the established governance process. + +#### Security and additional considerations + +We applied the following security procedures for this upgrade: + +- **Audits:** [Certik](https://www.certik.com/), [Quanstamp](https://quantstamp.com/) and [Fairyproof](https://www.fairyproof.com/) have audited the deployed code +- **VIP execution simulation**: in a simulation environment, validating the expected permissions are configured and the Risk Steward can update the caps as expected +- **Deployment on testnet**: the same commands have been executed on every testnet, and used in the Venus Protocol testnet deployment + +#### Audit reports + +- [Certik audit audit report](https://github.com/VenusProtocol/governance-contracts/blob/210d1e54f0c9136a805977b41077567b0883a4e0/audits/120_risk_stewards_v1_certik_20250219.pdf) (2025/02/19) +- [Quantstamp](https://github.com/VenusProtocol/governance-contracts/blob/210d1e54f0c9136a805977b41077567b0883a4e0/audits/121_risk_stewards_v1_quantstamp_20250213.pdf) (2025/02/13) +- [Fairyproof audit report](https://github.com/VenusProtocol/governance-contracts/blob/210d1e54f0c9136a805977b41077567b0883a4e0/audits/122_risk_stewards_v1_fairyproof_20250226.pdf) (2025/02/26) + +#### Deployed contracts + +- BNB Chain + - [RiskStewardReceiver](https://bscscan.com/address/0xBa2a43279a228cf9cD94d072777d8d98e7e0a229) + - [MarketCapsRiskSteward](https://bscscan.com/address/0xE7252dccd79F2A555E314B9cdd440745b697D562) + - [RiskOracle (managed by Chaos Labs)](https://bscscan.com/address/0x66A8cb6c4230B044378aC3676D47Ed4fE18e3cFB) + - New facets + - [MarketFacet](https://bscscan.com/address/0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db) + - [PolicyFacet](https://bscscan.com/address/0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9) + - [SetterFacet](https://bscscan.com/address/0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64) +- BNB Chain testnet + - [RiskStewardReceiver](https://testnet.bscscan.com/address/0x31DEb4D1326838522697f7a012992f0824d80f2b) + - [MarketCapsRiskSteward](https://testnet.bscscan.com/address/0x9b40390771cAeEa69DE55EEd176aeDC72d70cA3E) + - [RiskOracle (managed by Chaos Labs)](https://testnet.bscscan.com/address/0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F) + - New facets + - [MarketFacet](https://testnet.bscscan.com/address/0x377c2E7CE08B4cc7033EDF678EE1224A290075Fd) + - [PolicyFacet](https://testnet.bscscan.com/address/0x671B787AEDB6769972f081C6ee4978146F7D92E6) + - [SetterFacet](https://testnet.bscscan.com/address/0xb619F7ce96c0a6E3F0b44e993f663522F79f294A) + +#### References + +- [VIP simulation](https://github.com/VenusProtocol/vips/pull/520) +- [Codebase of the new facets for the Core pool Comptroller on BNB Chain](https://github.com/VenusProtocol/venus-protocol/pull/548) +- [Codebase of the Risk Steward contracts](https://github.com/VenusProtocol/governance-contracts/pull/115) +- [Codebase of the RiskOracle contract, by Chaos Labs](https://github.com/ChaosLabsInc/risk-oracle) `, forDescription: "Execute this proposal", againstDescription: "Do not execute this proposal", From 2b540780ced04fd19643938ba3d9e3c2449695d5 Mon Sep 17 00:00:00 2001 From: web3rover Date: Mon, 14 Jul 2025 23:15:31 +0530 Subject: [PATCH 27/31] fix: fixed role check in simulation --- simulations/vip-xxx/bscmainnet.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index 4f7b0cc3e..be8e867ec 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -9,7 +9,6 @@ import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; import vip599, { - ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_BSCMAINNET, RISK_STEWARD_RECEIVER_BSCMAINNET, } from "../../vips/vip-xxx/bscmainnet"; @@ -31,6 +30,8 @@ const NEW_POLICY_FACET = "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9"; const UNCHANGED_REWARD_FACET = "0xc2F6bDCEa4907E8CB7480d3d315bc01c125fb63C"; +const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000"; + forking(54002305, async () => { const provider = ethers.provider; let unitroller: Contract; @@ -181,14 +182,14 @@ forking(54002305, async () => { it("grants Market Cap Risk Steward permissions to call setMarketSupplyCaps and setMarketBorrowCaps on any target contract (Isolated Pools)", async () => { const supplyCapRole = ethers.utils.solidityPack( ["address", "string"], - [ANY_TARGET_CONTRACT, "setMarketSupplyCaps(address[],uint256[])"], + [DEFAULT_ADMIN_ROLE, "setMarketSupplyCaps(address[],uint256[])"], ); const supplyCapRoleHash = ethers.utils.keccak256(supplyCapRole); expect(await acm.hasRole(supplyCapRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; const borrowCapRole = ethers.utils.solidityPack( ["address", "string"], - [ANY_TARGET_CONTRACT, "setMarketBorrowCaps(address[],uint256[])"], + [DEFAULT_ADMIN_ROLE, "setMarketBorrowCaps(address[],uint256[])"], ); const borrowCapRoleHash = ethers.utils.keccak256(borrowCapRole); expect(await acm.hasRole(borrowCapRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.true; From 9a79ff75c0d40ff9ef04c6a184b1a8970fe76085 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Wed, 23 Jul 2025 16:02:35 +0200 Subject: [PATCH 28/31] feat: after review --- simulations/vip-xxx/bscmainnet.ts | 21 ++++++++++++++++++++- vips/vip-xxx/bscmainnet.ts | 10 ++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-xxx/bscmainnet.ts index be8e867ec..16200c524 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-xxx/bscmainnet.ts @@ -116,7 +116,7 @@ forking(54002305, async () => { txResponse, [DIAMOND_ABI, ACCESS_CONTROL_MANAGER_ABI, VENUS_RISK_STEWARD_RECEIVER_ABI], ["DiamondCut", "RiskParameterConfigSet", "RoleGranted"], - [1, 2, 15], + [1, 2, 17], ); }, }); @@ -211,6 +211,25 @@ forking(54002305, async () => { expect(await acm.hasRole(borrowCapCorePoolRoleHash, MARKET_CAP_RISK_STEWARD_BSCMAINNET)).to.be.false; }); + it("grants timelocks and guardian permissions to pause and unpause Risk Steward Receiver", async () => { + const pauseRole = ethers.utils.solidityPack(["address", "string"], [RISK_STEWARD_RECEIVER_BSCMAINNET, "pause()"]); + const pauseRoleHash = ethers.utils.keccak256(pauseRole); + expect(await acm.hasRole(pauseRoleHash, bscmainnet.GUARDIAN)).to.be.true; + expect(await acm.hasRole(pauseRoleHash, bscmainnet.NORMAL_TIMELOCK)).to.be.true; + expect(await acm.hasRole(pauseRoleHash, bscmainnet.CRITICAL_TIMELOCK)).to.be.true; + expect(await acm.hasRole(pauseRoleHash, bscmainnet.FAST_TRACK_TIMELOCK)).to.be.true; + + const unpauseRole = ethers.utils.solidityPack( + ["address", "string"], + [RISK_STEWARD_RECEIVER_BSCMAINNET, "unpause()"], + ); + const unpauseRoleHash = ethers.utils.keccak256(unpauseRole); + expect(await acm.hasRole(unpauseRoleHash, bscmainnet.GUARDIAN)).to.be.true; + expect(await acm.hasRole(unpauseRoleHash, bscmainnet.NORMAL_TIMELOCK)).to.be.true; + expect(await acm.hasRole(unpauseRoleHash, bscmainnet.CRITICAL_TIMELOCK)).to.be.true; + expect(await acm.hasRole(unpauseRoleHash, bscmainnet.FAST_TRACK_TIMELOCK)).to.be.true; + }); + it("Market Cap Risk Steward should be able to set supply and borrow caps on markets", async () => { await impersonateAccount(MARKET_CAP_RISK_STEWARD_BSCMAINNET); await setBalance(MARKET_CAP_RISK_STEWARD_BSCMAINNET, parseUnits("1000000", 18)); diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-xxx/bscmainnet.ts index 0a5e76136..dc74e993a 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-xxx/bscmainnet.ts @@ -144,6 +144,11 @@ We applied the following security procedures for this upgrade: signature: "giveCallPermission(address,string,address)", params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "pause()", bscmainnet.FAST_TRACK_TIMELOCK], }, + { + target: bscmainnet.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "pause()", bscmainnet.GUARDIAN], + }, { target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", @@ -159,6 +164,11 @@ We applied the following security procedures for this upgrade: signature: "giveCallPermission(address,string,address)", params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "unpause()", bscmainnet.FAST_TRACK_TIMELOCK], }, + { + target: bscmainnet.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RISK_STEWARD_RECEIVER_BSCMAINNET, "unpause()", bscmainnet.GUARDIAN], + }, { target: bscmainnet.ACCESS_CONTROL_MANAGER, signature: "giveCallPermission(address,string,address)", From ccc9c2700131aa95e2b921f2f5600fbce2106ad7 Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Wed, 6 Aug 2025 20:56:34 +0200 Subject: [PATCH 29/31] feat: set ID and description for the VIP 538 --- .../abi/AccessControlManager.json | 0 simulations/{vip-xxx => vip-538}/abi/Comproller.json | 0 simulations/{vip-xxx => vip-538}/abi/Diamond.json | 0 .../abi/IsolatedPoolComptroller.json | 0 .../abi/OmnichainGovernanceExecutor.json | 0 .../abi/VenusRiskStewardReceiver.json | 0 simulations/{vip-xxx => vip-538}/arbitrumsepolia.ts | 8 ++++---- simulations/{vip-xxx => vip-538}/basesepolia.ts | 10 +++++----- simulations/{vip-xxx => vip-538}/bscmainnet.ts | 8 ++++---- .../{vip-xxx => vip-538}/bsctestnet-addendum.ts | 4 ++-- simulations/{vip-xxx => vip-538}/bsctestnet.ts | 6 +++--- simulations/{vip-xxx => vip-538}/opbnbtestnet.ts | 8 ++++---- simulations/{vip-xxx => vip-538}/opsepolia.ts | 10 +++++----- simulations/{vip-xxx => vip-538}/sepolia.ts | 8 ++++---- simulations/{vip-xxx => vip-538}/unichainsepolia.ts | 10 +++++----- .../utils/cur-params-bscmainnet.json | 0 .../utils/cur-params-bsctestnet.json | 0 simulations/{vip-xxx => vip-538}/zksyncsepolia.ts | 10 +++++----- vips/{vip-xxx => vip-538}/bscmainnet.ts | 11 +++++------ vips/{vip-xxx => vip-538}/bsctestnet-addendum.ts | 6 +++--- vips/{vip-xxx => vip-538}/bsctestnet1.ts | 4 ++-- vips/{vip-xxx => vip-538}/bsctestnet2.ts | 4 ++-- 22 files changed, 53 insertions(+), 54 deletions(-) rename simulations/{vip-xxx => vip-538}/abi/AccessControlManager.json (100%) rename simulations/{vip-xxx => vip-538}/abi/Comproller.json (100%) rename simulations/{vip-xxx => vip-538}/abi/Diamond.json (100%) rename simulations/{vip-xxx => vip-538}/abi/IsolatedPoolComptroller.json (100%) rename simulations/{vip-xxx => vip-538}/abi/OmnichainGovernanceExecutor.json (100%) rename simulations/{vip-xxx => vip-538}/abi/VenusRiskStewardReceiver.json (100%) rename simulations/{vip-xxx => vip-538}/arbitrumsepolia.ts (95%) rename simulations/{vip-xxx => vip-538}/basesepolia.ts (93%) rename simulations/{vip-xxx => vip-538}/bscmainnet.ts (98%) rename simulations/{vip-xxx => vip-538}/bsctestnet-addendum.ts (98%) rename simulations/{vip-xxx => vip-538}/bsctestnet.ts (97%) rename simulations/{vip-xxx => vip-538}/opbnbtestnet.ts (95%) rename simulations/{vip-xxx => vip-538}/opsepolia.ts (93%) rename simulations/{vip-xxx => vip-538}/sepolia.ts (95%) rename simulations/{vip-xxx => vip-538}/unichainsepolia.ts (93%) rename simulations/{vip-xxx => vip-538}/utils/cur-params-bscmainnet.json (100%) rename simulations/{vip-xxx => vip-538}/utils/cur-params-bsctestnet.json (100%) rename simulations/{vip-xxx => vip-538}/zksyncsepolia.ts (93%) rename vips/{vip-xxx => vip-538}/bscmainnet.ts (98%) rename vips/{vip-xxx => vip-538}/bsctestnet-addendum.ts (85%) rename vips/{vip-xxx => vip-538}/bsctestnet1.ts (99%) rename vips/{vip-xxx => vip-538}/bsctestnet2.ts (99%) diff --git a/simulations/vip-xxx/abi/AccessControlManager.json b/simulations/vip-538/abi/AccessControlManager.json similarity index 100% rename from simulations/vip-xxx/abi/AccessControlManager.json rename to simulations/vip-538/abi/AccessControlManager.json diff --git a/simulations/vip-xxx/abi/Comproller.json b/simulations/vip-538/abi/Comproller.json similarity index 100% rename from simulations/vip-xxx/abi/Comproller.json rename to simulations/vip-538/abi/Comproller.json diff --git a/simulations/vip-xxx/abi/Diamond.json b/simulations/vip-538/abi/Diamond.json similarity index 100% rename from simulations/vip-xxx/abi/Diamond.json rename to simulations/vip-538/abi/Diamond.json diff --git a/simulations/vip-xxx/abi/IsolatedPoolComptroller.json b/simulations/vip-538/abi/IsolatedPoolComptroller.json similarity index 100% rename from simulations/vip-xxx/abi/IsolatedPoolComptroller.json rename to simulations/vip-538/abi/IsolatedPoolComptroller.json diff --git a/simulations/vip-xxx/abi/OmnichainGovernanceExecutor.json b/simulations/vip-538/abi/OmnichainGovernanceExecutor.json similarity index 100% rename from simulations/vip-xxx/abi/OmnichainGovernanceExecutor.json rename to simulations/vip-538/abi/OmnichainGovernanceExecutor.json diff --git a/simulations/vip-xxx/abi/VenusRiskStewardReceiver.json b/simulations/vip-538/abi/VenusRiskStewardReceiver.json similarity index 100% rename from simulations/vip-xxx/abi/VenusRiskStewardReceiver.json rename to simulations/vip-538/abi/VenusRiskStewardReceiver.json diff --git a/simulations/vip-xxx/arbitrumsepolia.ts b/simulations/vip-538/arbitrumsepolia.ts similarity index 95% rename from simulations/vip-xxx/arbitrumsepolia.ts rename to simulations/vip-538/arbitrumsepolia.ts index cf52b5f3d..af9626e1d 100644 --- a/simulations/vip-xxx/arbitrumsepolia.ts +++ b/simulations/vip-538/arbitrumsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vipxxx, { +import vip538, { ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet1"; +} from "../../vips/vip-538/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(138822251, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/basesepolia.ts b/simulations/vip-538/basesepolia.ts similarity index 93% rename from simulations/vip-xxx/basesepolia.ts rename to simulations/vip-538/basesepolia.ts index 22fe8fee6..bf5377ea8 100644 --- a/simulations/vip-xxx/basesepolia.ts +++ b/simulations/vip-538/basesepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; -import vipxxx, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; +import vip538, { ACCESS_CONTROL_MANAGER_BASESEPOLIA, MARKET_CAP_RISK_STEWARD_BASESEPOLIA, -} from "../../vips/vip-xxx/bsctestnet2"; +} from "../../vips/vip-538/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(23964088, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/bscmainnet.ts b/simulations/vip-538/bscmainnet.ts similarity index 98% rename from simulations/vip-xxx/bscmainnet.ts rename to simulations/vip-538/bscmainnet.ts index 16200c524..33ec75860 100644 --- a/simulations/vip-xxx/bscmainnet.ts +++ b/simulations/vip-538/bscmainnet.ts @@ -8,10 +8,10 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import vip599, { +import vip538, { MARKET_CAP_RISK_STEWARD_BSCMAINNET, RISK_STEWARD_RECEIVER_BSCMAINNET, -} from "../../vips/vip-xxx/bscmainnet"; +} from "../../vips/vip-538/bscmainnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; @@ -32,7 +32,7 @@ const UNCHANGED_REWARD_FACET = "0xc2F6bDCEa4907E8CB7480d3d315bc01c125fb63C"; const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000"; -forking(54002305, async () => { +forking(56676950, async () => { const provider = ethers.provider; let unitroller: Contract; let acm: Contract; @@ -110,7 +110,7 @@ forking(54002305, async () => { }); }); - testVip("vip-599", await vip599(), { + testVip("vip-538", await vip538(), { callbackAfterExecution: async (txResponse: TransactionResponse) => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/bsctestnet-addendum.ts b/simulations/vip-538/bsctestnet-addendum.ts similarity index 98% rename from simulations/vip-xxx/bsctestnet-addendum.ts rename to simulations/vip-538/bsctestnet-addendum.ts index 158acc7a4..c123c3aeb 100644 --- a/simulations/vip-xxx/bsctestnet-addendum.ts +++ b/simulations/vip-538/bsctestnet-addendum.ts @@ -6,7 +6,7 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import { vip599_Addendum } from "./../../vips/vip-xxx/bsctestnet-addendum"; +import { vip538_Addendum } from "./../../vips/vip-538/bsctestnet-addendum"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; @@ -72,7 +72,7 @@ forking(56931937, async () => { }); }); - testVip("vip-599-addendum", await vip599_Addendum(), { + testVip("vip-538-addendum", await vip538_Addendum(), { callbackAfterExecution: async (txResponse: TransactionResponse) => { await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); }, diff --git a/simulations/vip-xxx/bsctestnet.ts b/simulations/vip-538/bsctestnet.ts similarity index 97% rename from simulations/vip-xxx/bsctestnet.ts rename to simulations/vip-538/bsctestnet.ts index 2e4da991a..0c83082e3 100644 --- a/simulations/vip-xxx/bsctestnet.ts +++ b/simulations/vip-538/bsctestnet.ts @@ -5,13 +5,13 @@ import { ethers } from "hardhat"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import vipxxx, { +import vip538, { ACCESS_CONTROL_MANAGER_BSC_TESTNET, ANY_TARGET_CONTRACT, BSC_TESTNET_CORE_COMPTROLLER, MARKET_CAP_RISK_STEWARD_BSC_TESTNET, NORMAL_TIMELOCK_BSC_TESTNET, -} from "../../vips/vip-xxx/bsctestnet1"; +} from "../../vips/vip-538/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; @@ -33,7 +33,7 @@ forking(48650752, async () => { await setBalance("0xCfD34AEB46b1CB4779c945854d405E91D27A1899", parseUnits("1000000", 18)); }); - testVip("vipxxx Configuring Risk Stewards", await vipxxx(), { + testVip("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/opbnbtestnet.ts b/simulations/vip-538/opbnbtestnet.ts similarity index 95% rename from simulations/vip-xxx/opbnbtestnet.ts rename to simulations/vip-538/opbnbtestnet.ts index d9811e247..622a5a186 100644 --- a/simulations/vip-xxx/opbnbtestnet.ts +++ b/simulations/vip-538/opbnbtestnet.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vipxxx, { +import vip538, { ACCESS_CONTROL_MANAGER_OPBNBTESTNET, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, -} from "../../vips/vip-xxx/bsctestnet1"; +} from "../../vips/vip-538/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(56951686, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/opsepolia.ts b/simulations/vip-538/opsepolia.ts similarity index 93% rename from simulations/vip-xxx/opsepolia.ts rename to simulations/vip-538/opsepolia.ts index 58757de64..54ef3d0f9 100644 --- a/simulations/vip-xxx/opsepolia.ts +++ b/simulations/vip-538/opsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; -import vipxxx, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; +import vip538, { ACCESS_CONTROL_MANAGER_OPSEPOLIA, MARKET_CAP_RISK_STEWARD_OPSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet2"; +} from "../../vips/vip-538/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(25946983, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/sepolia.ts b/simulations/vip-538/sepolia.ts similarity index 95% rename from simulations/vip-xxx/sepolia.ts rename to simulations/vip-538/sepolia.ts index 2abfd609a..e27122056 100644 --- a/simulations/vip-xxx/sepolia.ts +++ b/simulations/vip-538/sepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vipxxx, { +import vip538, { ACCESS_CONTROL_MANAGER_SEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_SEPOLIA, -} from "../../vips/vip-xxx/bsctestnet1"; +} from "../../vips/vip-538/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -35,10 +35,10 @@ forking(8043152, async () => { executor = new ethers.Contract(sepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, provider); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/unichainsepolia.ts b/simulations/vip-538/unichainsepolia.ts similarity index 93% rename from simulations/vip-xxx/unichainsepolia.ts rename to simulations/vip-538/unichainsepolia.ts index 775e81365..e62812a95 100644 --- a/simulations/vip-xxx/unichainsepolia.ts +++ b/simulations/vip-538/unichainsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; -import vipxxx, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; +import vip538, { ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet2"; +} from "../../vips/vip-538/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(16844634, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-xxx/utils/cur-params-bscmainnet.json b/simulations/vip-538/utils/cur-params-bscmainnet.json similarity index 100% rename from simulations/vip-xxx/utils/cur-params-bscmainnet.json rename to simulations/vip-538/utils/cur-params-bscmainnet.json diff --git a/simulations/vip-xxx/utils/cur-params-bsctestnet.json b/simulations/vip-538/utils/cur-params-bsctestnet.json similarity index 100% rename from simulations/vip-xxx/utils/cur-params-bsctestnet.json rename to simulations/vip-538/utils/cur-params-bsctestnet.json diff --git a/simulations/vip-xxx/zksyncsepolia.ts b/simulations/vip-538/zksyncsepolia.ts similarity index 93% rename from simulations/vip-xxx/zksyncsepolia.ts rename to simulations/vip-538/zksyncsepolia.ts index 4ca5f3f9e..fe7724fbc 100644 --- a/simulations/vip-xxx/zksyncsepolia.ts +++ b/simulations/vip-538/zksyncsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-xxx/bsctestnet1"; -import vipxxx, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; +import vip538, { ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, -} from "../../vips/vip-xxx/bsctestnet2"; +} from "../../vips/vip-538/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(4898583, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vipxxx()); + await pretendExecutingVip(await vip538()); }); - testForkedNetworkVipCommands("vipxxx Configuring Risk Stewards", await vipxxx(), { + testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/vips/vip-xxx/bscmainnet.ts b/vips/vip-538/bscmainnet.ts similarity index 98% rename from vips/vip-xxx/bscmainnet.ts rename to vips/vip-538/bscmainnet.ts index dc74e993a..73f2de7cc 100644 --- a/vips/vip-xxx/bscmainnet.ts +++ b/vips/vip-538/bscmainnet.ts @@ -3,7 +3,7 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-bscmainnet.json"; +import { cutParams as params } from "../../simulations/vip-538/utils/cur-params-bscmainnet.json"; const { bscmainnet } = NETWORK_ADDRESSES; @@ -14,10 +14,10 @@ export const ANY_TARGET_CONTRACT = ethers.constants.AddressZero; export const MORE_THAN_1_DAY = 86401; // 24 hours + 1 second export const cutParams = params; -export const vip599 = () => { +export const vip538 = () => { const meta = { version: "v2", - title: "VIP-5XX [BNB Chain] Chaos Labs' Risk Oracle integration (1/2)", + title: "VIP-538 [BNB Chain] Chaos Labs' Risk Oracle integration (1/2)", description: `#### Summary If passed, following the community proposal “[Integrate Chaos Labs’ Risk Oracle to Venus Protocol](https://community.venus.io/t/integrate-chaos-labs-risk-oracle-to-venus-protocol/4569)” ([snapshot](https://snapshot.box/#/s:venus-xvs.eth/proposal/0x6d84d48a17981a84e3eb320139552306f70fd006d7f3d9df131e20002e98620c)), this VIP will integrate the Chaos Labs’ Risk Oracle into Venus Protocol on BNB Chain, allowing the update of the supply and borrow caps of the Venus markets (on Isolated Pools) on this chain without VIP’s, considering Chaos Labs recommendations. @@ -79,8 +79,7 @@ We applied the following security procedures for this upgrade: - [VIP simulation](https://github.com/VenusProtocol/vips/pull/520) - [Codebase of the new facets for the Core pool Comptroller on BNB Chain](https://github.com/VenusProtocol/venus-protocol/pull/548) - [Codebase of the Risk Steward contracts](https://github.com/VenusProtocol/governance-contracts/pull/115) -- [Codebase of the RiskOracle contract, by Chaos Labs](https://github.com/ChaosLabsInc/risk-oracle) -`, +- [Codebase of the RiskOracle contract, by Chaos Labs](https://github.com/ChaosLabsInc/risk-oracle)`, forDescription: "Execute this proposal", againstDescription: "Do not execute this proposal", abstainDescription: "Indifferent to execution", @@ -213,4 +212,4 @@ We applied the following security procedures for this upgrade: ); }; -export default vip599; +export default vip538; diff --git a/vips/vip-xxx/bsctestnet-addendum.ts b/vips/vip-538/bsctestnet-addendum.ts similarity index 85% rename from vips/vip-xxx/bsctestnet-addendum.ts rename to vips/vip-538/bsctestnet-addendum.ts index 1c5ed1380..65dd1b6cc 100644 --- a/vips/vip-xxx/bsctestnet-addendum.ts +++ b/vips/vip-538/bsctestnet-addendum.ts @@ -2,13 +2,13 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -import { cutParams as params } from "../../simulations/vip-xxx/utils/cur-params-bsctestnet.json"; +import { cutParams as params } from "../../simulations/vip-538/utils/cur-params-bsctestnet.json"; export const cutParams = params; const { bsctestnet } = NETWORK_ADDRESSES; -export const vip599_Addendum = () => { +export const vip538_Addendum = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -33,4 +33,4 @@ Configure Remote Risk Stewards ); }; -export default vip599_Addendum; +export default vip538_Addendum; diff --git a/vips/vip-xxx/bsctestnet1.ts b/vips/vip-538/bsctestnet1.ts similarity index 99% rename from vips/vip-xxx/bsctestnet1.ts rename to vips/vip-538/bsctestnet1.ts index 864f9e4fa..a19b47bdf 100644 --- a/vips/vip-xxx/bsctestnet1.ts +++ b/vips/vip-538/bsctestnet1.ts @@ -141,7 +141,7 @@ export const permissions = ( ]; }; -const vip599 = () => { +const vip538 = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -268,4 +268,4 @@ Configure Remote Risk Stewards ); }; -export default vip599; +export default vip538; diff --git a/vips/vip-xxx/bsctestnet2.ts b/vips/vip-538/bsctestnet2.ts similarity index 99% rename from vips/vip-xxx/bsctestnet2.ts rename to vips/vip-538/bsctestnet2.ts index 215880421..fcb4f80cd 100644 --- a/vips/vip-xxx/bsctestnet2.ts +++ b/vips/vip-538/bsctestnet2.ts @@ -31,7 +31,7 @@ export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b4 export const CRITIAL_TIMELOCK_ZKSYNCSEPOLIA = "0x0E6138bE0FA1915efC73670a20A10EFd720a6Cc8"; export const FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA = "0xb055e028b27d53a455a6c040a6952e44E9E615c4"; -const vip599 = () => { +const vip538 = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -142,4 +142,4 @@ Configure Remote Risk Stewards ); }; -export default vip599; +export default vip538; From 08d11fa91b21d2bb16e464967195c7f99cf7ce55 Mon Sep 17 00:00:00 2001 From: Filip Malachowicz Date: Fri, 12 Sep 2025 09:09:19 +0200 Subject: [PATCH 30/31] feat: Pause RiskStewardReceiver --- simulations/vip-538/bscmainnet.ts | 9 +++++++++ vips/vip-538/bscmainnet.ts | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/simulations/vip-538/bscmainnet.ts b/simulations/vip-538/bscmainnet.ts index 33ec75860..b43baee08 100644 --- a/simulations/vip-538/bscmainnet.ts +++ b/simulations/vip-538/bscmainnet.ts @@ -264,5 +264,14 @@ forking(56676950, async () => { ); expect(await marketCapRiskSteward.owner()).to.equal(bscmainnet.NORMAL_TIMELOCK); }); + + it("Risk Steward Receiver should be paused", async () => { + const riskStewardReceiver = new ethers.Contract( + RISK_STEWARD_RECEIVER_BSCMAINNET, + VENUS_RISK_STEWARD_RECEIVER_ABI, + provider, + ); + expect(await riskStewardReceiver.paused()).to.be.true; + }); }); }); diff --git a/vips/vip-538/bscmainnet.ts b/vips/vip-538/bscmainnet.ts index 73f2de7cc..3f058aa0d 100644 --- a/vips/vip-538/bscmainnet.ts +++ b/vips/vip-538/bscmainnet.ts @@ -206,6 +206,12 @@ We applied the following security procedures for this upgrade: signature: "acceptOwnership()", params: [], }, + // Pause Risk Steward Receiver + { + target: RISK_STEWARD_RECEIVER_BSCMAINNET, + signature: "pause()", + params: [], + }, ], meta, ProposalType.REGULAR, From 55a844c745bae0f48f93b746ebdd7895f8dc1381 Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Mon, 15 Sep 2025 13:34:47 +0200 Subject: [PATCH 31/31] feat: set ID and description for the VIP 544 --- .../abi/AccessControlManager.json | 0 simulations/{vip-538 => vip-544}/abi/Comproller.json | 0 simulations/{vip-538 => vip-544}/abi/Diamond.json | 0 .../abi/IsolatedPoolComptroller.json | 0 .../abi/OmnichainGovernanceExecutor.json | 0 .../abi/VenusRiskStewardReceiver.json | 0 simulations/{vip-538 => vip-544}/arbitrumsepolia.ts | 8 ++++---- simulations/{vip-538 => vip-544}/basesepolia.ts | 10 +++++----- simulations/{vip-538 => vip-544}/bscmainnet.ts | 8 ++++---- .../{vip-538 => vip-544}/bsctestnet-addendum.ts | 4 ++-- simulations/{vip-538 => vip-544}/bsctestnet.ts | 6 +++--- simulations/{vip-538 => vip-544}/opbnbtestnet.ts | 8 ++++---- simulations/{vip-538 => vip-544}/opsepolia.ts | 10 +++++----- simulations/{vip-538 => vip-544}/sepolia.ts | 8 ++++---- simulations/{vip-538 => vip-544}/unichainsepolia.ts | 10 +++++----- .../utils/cur-params-bscmainnet.json | 0 .../utils/cur-params-bsctestnet.json | 0 simulations/{vip-538 => vip-544}/zksyncsepolia.ts | 10 +++++----- vips/{vip-538 => vip-544}/bscmainnet.ts | 12 +++++------- vips/{vip-538 => vip-544}/bsctestnet-addendum.ts | 6 +++--- vips/{vip-538 => vip-544}/bsctestnet1.ts | 4 ++-- vips/{vip-538 => vip-544}/bsctestnet2.ts | 4 ++-- 22 files changed, 53 insertions(+), 55 deletions(-) rename simulations/{vip-538 => vip-544}/abi/AccessControlManager.json (100%) rename simulations/{vip-538 => vip-544}/abi/Comproller.json (100%) rename simulations/{vip-538 => vip-544}/abi/Diamond.json (100%) rename simulations/{vip-538 => vip-544}/abi/IsolatedPoolComptroller.json (100%) rename simulations/{vip-538 => vip-544}/abi/OmnichainGovernanceExecutor.json (100%) rename simulations/{vip-538 => vip-544}/abi/VenusRiskStewardReceiver.json (100%) rename simulations/{vip-538 => vip-544}/arbitrumsepolia.ts (95%) rename simulations/{vip-538 => vip-544}/basesepolia.ts (93%) rename simulations/{vip-538 => vip-544}/bscmainnet.ts (99%) rename simulations/{vip-538 => vip-544}/bsctestnet-addendum.ts (98%) rename simulations/{vip-538 => vip-544}/bsctestnet.ts (97%) rename simulations/{vip-538 => vip-544}/opbnbtestnet.ts (95%) rename simulations/{vip-538 => vip-544}/opsepolia.ts (93%) rename simulations/{vip-538 => vip-544}/sepolia.ts (95%) rename simulations/{vip-538 => vip-544}/unichainsepolia.ts (93%) rename simulations/{vip-538 => vip-544}/utils/cur-params-bscmainnet.json (100%) rename simulations/{vip-538 => vip-544}/utils/cur-params-bsctestnet.json (100%) rename simulations/{vip-538 => vip-544}/zksyncsepolia.ts (93%) rename vips/{vip-538 => vip-544}/bscmainnet.ts (94%) rename vips/{vip-538 => vip-544}/bsctestnet-addendum.ts (85%) rename vips/{vip-538 => vip-544}/bsctestnet1.ts (99%) rename vips/{vip-538 => vip-544}/bsctestnet2.ts (99%) diff --git a/simulations/vip-538/abi/AccessControlManager.json b/simulations/vip-544/abi/AccessControlManager.json similarity index 100% rename from simulations/vip-538/abi/AccessControlManager.json rename to simulations/vip-544/abi/AccessControlManager.json diff --git a/simulations/vip-538/abi/Comproller.json b/simulations/vip-544/abi/Comproller.json similarity index 100% rename from simulations/vip-538/abi/Comproller.json rename to simulations/vip-544/abi/Comproller.json diff --git a/simulations/vip-538/abi/Diamond.json b/simulations/vip-544/abi/Diamond.json similarity index 100% rename from simulations/vip-538/abi/Diamond.json rename to simulations/vip-544/abi/Diamond.json diff --git a/simulations/vip-538/abi/IsolatedPoolComptroller.json b/simulations/vip-544/abi/IsolatedPoolComptroller.json similarity index 100% rename from simulations/vip-538/abi/IsolatedPoolComptroller.json rename to simulations/vip-544/abi/IsolatedPoolComptroller.json diff --git a/simulations/vip-538/abi/OmnichainGovernanceExecutor.json b/simulations/vip-544/abi/OmnichainGovernanceExecutor.json similarity index 100% rename from simulations/vip-538/abi/OmnichainGovernanceExecutor.json rename to simulations/vip-544/abi/OmnichainGovernanceExecutor.json diff --git a/simulations/vip-538/abi/VenusRiskStewardReceiver.json b/simulations/vip-544/abi/VenusRiskStewardReceiver.json similarity index 100% rename from simulations/vip-538/abi/VenusRiskStewardReceiver.json rename to simulations/vip-544/abi/VenusRiskStewardReceiver.json diff --git a/simulations/vip-538/arbitrumsepolia.ts b/simulations/vip-544/arbitrumsepolia.ts similarity index 95% rename from simulations/vip-538/arbitrumsepolia.ts rename to simulations/vip-544/arbitrumsepolia.ts index af9626e1d..b4078e94f 100644 --- a/simulations/vip-538/arbitrumsepolia.ts +++ b/simulations/vip-544/arbitrumsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vip538, { +import vip544, { ACCESS_CONTROL_MANAGER_ARBITRUMSEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_ARBITRUMSEPOLIA, -} from "../../vips/vip-538/bsctestnet1"; +} from "../../vips/vip-544/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(138822251, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/basesepolia.ts b/simulations/vip-544/basesepolia.ts similarity index 93% rename from simulations/vip-538/basesepolia.ts rename to simulations/vip-544/basesepolia.ts index bf5377ea8..fe6fdd4cc 100644 --- a/simulations/vip-538/basesepolia.ts +++ b/simulations/vip-544/basesepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; -import vip538, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-544/bsctestnet1"; +import vip544, { ACCESS_CONTROL_MANAGER_BASESEPOLIA, MARKET_CAP_RISK_STEWARD_BASESEPOLIA, -} from "../../vips/vip-538/bsctestnet2"; +} from "../../vips/vip-544/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(23964088, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/bscmainnet.ts b/simulations/vip-544/bscmainnet.ts similarity index 99% rename from simulations/vip-538/bscmainnet.ts rename to simulations/vip-544/bscmainnet.ts index b43baee08..d9bf7f0a5 100644 --- a/simulations/vip-538/bscmainnet.ts +++ b/simulations/vip-544/bscmainnet.ts @@ -8,10 +8,10 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import vip538, { +import vip544, { MARKET_CAP_RISK_STEWARD_BSCMAINNET, RISK_STEWARD_RECEIVER_BSCMAINNET, -} from "../../vips/vip-538/bscmainnet"; +} from "../../vips/vip-544/bscmainnet"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; @@ -32,7 +32,7 @@ const UNCHANGED_REWARD_FACET = "0xc2F6bDCEa4907E8CB7480d3d315bc01c125fb63C"; const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000"; -forking(56676950, async () => { +forking(61240501, async () => { const provider = ethers.provider; let unitroller: Contract; let acm: Contract; @@ -110,7 +110,7 @@ forking(56676950, async () => { }); }); - testVip("vip-538", await vip538(), { + testVip("vip-544", await vip544(), { callbackAfterExecution: async (txResponse: TransactionResponse) => { await expectEvents( txResponse, diff --git a/simulations/vip-538/bsctestnet-addendum.ts b/simulations/vip-544/bsctestnet-addendum.ts similarity index 98% rename from simulations/vip-538/bsctestnet-addendum.ts rename to simulations/vip-544/bsctestnet-addendum.ts index c123c3aeb..53d664cac 100644 --- a/simulations/vip-538/bsctestnet-addendum.ts +++ b/simulations/vip-544/bsctestnet-addendum.ts @@ -6,7 +6,7 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import { vip538_Addendum } from "./../../vips/vip-538/bsctestnet-addendum"; +import { vip544_Addendum } from "./../../vips/vip-544/bsctestnet-addendum"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import DIAMOND_ABI from "./abi/Diamond.json"; @@ -72,7 +72,7 @@ forking(56931937, async () => { }); }); - testVip("vip-538-addendum", await vip538_Addendum(), { + testVip("vip-544-addendum", await vip544_Addendum(), { callbackAfterExecution: async (txResponse: TransactionResponse) => { await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); }, diff --git a/simulations/vip-538/bsctestnet.ts b/simulations/vip-544/bsctestnet.ts similarity index 97% rename from simulations/vip-538/bsctestnet.ts rename to simulations/vip-544/bsctestnet.ts index 0c83082e3..a1b65cc94 100644 --- a/simulations/vip-538/bsctestnet.ts +++ b/simulations/vip-544/bsctestnet.ts @@ -5,13 +5,13 @@ import { ethers } from "hardhat"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; -import vip538, { +import vip544, { ACCESS_CONTROL_MANAGER_BSC_TESTNET, ANY_TARGET_CONTRACT, BSC_TESTNET_CORE_COMPTROLLER, MARKET_CAP_RISK_STEWARD_BSC_TESTNET, NORMAL_TIMELOCK_BSC_TESTNET, -} from "../../vips/vip-538/bsctestnet1"; +} from "../../vips/vip-544/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import COMPTROLLER_ABI from "./abi/Comproller.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; @@ -33,7 +33,7 @@ forking(48650752, async () => { await setBalance("0xCfD34AEB46b1CB4779c945854d405E91D27A1899", parseUnits("1000000", 18)); }); - testVip("vip538 Configuring Risk Stewards", await vip538(), { + testVip("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/opbnbtestnet.ts b/simulations/vip-544/opbnbtestnet.ts similarity index 95% rename from simulations/vip-538/opbnbtestnet.ts rename to simulations/vip-544/opbnbtestnet.ts index 622a5a186..6160e76b3 100644 --- a/simulations/vip-538/opbnbtestnet.ts +++ b/simulations/vip-544/opbnbtestnet.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vip538, { +import vip544, { ACCESS_CONTROL_MANAGER_OPBNBTESTNET, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_OPBNBTESTNET, -} from "../../vips/vip-538/bsctestnet1"; +} from "../../vips/vip-544/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(56951686, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/opsepolia.ts b/simulations/vip-544/opsepolia.ts similarity index 93% rename from simulations/vip-538/opsepolia.ts rename to simulations/vip-544/opsepolia.ts index 54ef3d0f9..458bdb021 100644 --- a/simulations/vip-538/opsepolia.ts +++ b/simulations/vip-544/opsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; -import vip538, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-544/bsctestnet1"; +import vip544, { ACCESS_CONTROL_MANAGER_OPSEPOLIA, MARKET_CAP_RISK_STEWARD_OPSEPOLIA, -} from "../../vips/vip-538/bsctestnet2"; +} from "../../vips/vip-544/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(25946983, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/sepolia.ts b/simulations/vip-544/sepolia.ts similarity index 95% rename from simulations/vip-538/sepolia.ts rename to simulations/vip-544/sepolia.ts index e27122056..af9707573 100644 --- a/simulations/vip-538/sepolia.ts +++ b/simulations/vip-544/sepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vip538, { +import vip544, { ACCESS_CONTROL_MANAGER_SEPOLIA, ANY_TARGET_CONTRACT, MARKET_CAP_RISK_STEWARD_SEPOLIA, -} from "../../vips/vip-538/bsctestnet1"; +} from "../../vips/vip-544/bsctestnet1"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -35,10 +35,10 @@ forking(8043152, async () => { executor = new ethers.Contract(sepolia.OMNICHAIN_GOVERNANCE_EXECUTOR, OMNICHAIN_GOVERNANCE_EXECUTOR_ABI, provider); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/unichainsepolia.ts b/simulations/vip-544/unichainsepolia.ts similarity index 93% rename from simulations/vip-538/unichainsepolia.ts rename to simulations/vip-544/unichainsepolia.ts index e62812a95..fec5b12f6 100644 --- a/simulations/vip-538/unichainsepolia.ts +++ b/simulations/vip-544/unichainsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; -import vip538, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-544/bsctestnet1"; +import vip544, { ACCESS_CONTROL_MANAGER_UNICHAINSEPOLIA, MARKET_CAP_RISK_STEWARD_UNICHAINSEPOLIA, -} from "../../vips/vip-538/bsctestnet2"; +} from "../../vips/vip-544/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(16844634, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/simulations/vip-538/utils/cur-params-bscmainnet.json b/simulations/vip-544/utils/cur-params-bscmainnet.json similarity index 100% rename from simulations/vip-538/utils/cur-params-bscmainnet.json rename to simulations/vip-544/utils/cur-params-bscmainnet.json diff --git a/simulations/vip-538/utils/cur-params-bsctestnet.json b/simulations/vip-544/utils/cur-params-bsctestnet.json similarity index 100% rename from simulations/vip-538/utils/cur-params-bsctestnet.json rename to simulations/vip-544/utils/cur-params-bsctestnet.json diff --git a/simulations/vip-538/zksyncsepolia.ts b/simulations/vip-544/zksyncsepolia.ts similarity index 93% rename from simulations/vip-538/zksyncsepolia.ts rename to simulations/vip-544/zksyncsepolia.ts index fe7724fbc..3959db71e 100644 --- a/simulations/vip-538/zksyncsepolia.ts +++ b/simulations/vip-544/zksyncsepolia.ts @@ -7,11 +7,11 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import { ANY_TARGET_CONTRACT } from "../../vips/vip-538/bsctestnet1"; -import vip538, { +import { ANY_TARGET_CONTRACT } from "../../vips/vip-544/bsctestnet1"; +import vip544, { ACCESS_CONTROL_MANAGER_ZKSYNCSEPOLIA, MARKET_CAP_RISK_STEWARD_ZKSYNCSEPOLIA, -} from "../../vips/vip-538/bsctestnet2"; +} from "../../vips/vip-544/bsctestnet2"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import ISOLATED_POOL_COMPTROLLER_ABI from "./abi/IsolatedPoolComptroller.json"; import OMNICHAIN_GOVERNANCE_EXECUTOR_ABI from "./abi/OmnichainGovernanceExecutor.json"; @@ -39,10 +39,10 @@ forking(4898583, async () => { ); lastProposalReceived = await executor.lastProposalReceived(); - await pretendExecutingVip(await vip538()); + await pretendExecutingVip(await vip544()); }); - testForkedNetworkVipCommands("vip538 Configuring Risk Stewards", await vip538(), { + testForkedNetworkVipCommands("vip544 Configuring Risk Stewards", await vip544(), { callbackAfterExecution: async txResponse => { await expectEvents( txResponse, diff --git a/vips/vip-538/bscmainnet.ts b/vips/vip-544/bscmainnet.ts similarity index 94% rename from vips/vip-538/bscmainnet.ts rename to vips/vip-544/bscmainnet.ts index 3f058aa0d..37143e142 100644 --- a/vips/vip-538/bscmainnet.ts +++ b/vips/vip-544/bscmainnet.ts @@ -3,7 +3,7 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -import { cutParams as params } from "../../simulations/vip-538/utils/cur-params-bscmainnet.json"; +import { cutParams as params } from "../../simulations/vip-544/utils/cur-params-bscmainnet.json"; const { bscmainnet } = NETWORK_ADDRESSES; @@ -14,10 +14,10 @@ export const ANY_TARGET_CONTRACT = ethers.constants.AddressZero; export const MORE_THAN_1_DAY = 86401; // 24 hours + 1 second export const cutParams = params; -export const vip538 = () => { +export const vip544 = () => { const meta = { version: "v2", - title: "VIP-538 [BNB Chain] Chaos Labs' Risk Oracle integration (1/2)", + title: "VIP-544 [BNB Chain] Chaos Labs' Risk Oracle integration (1/2)", description: `#### Summary If passed, following the community proposal “[Integrate Chaos Labs’ Risk Oracle to Venus Protocol](https://community.venus.io/t/integrate-chaos-labs-risk-oracle-to-venus-protocol/4569)” ([snapshot](https://snapshot.box/#/s:venus-xvs.eth/proposal/0x6d84d48a17981a84e3eb320139552306f70fd006d7f3d9df131e20002e98620c)), this VIP will integrate the Chaos Labs’ Risk Oracle into Venus Protocol on BNB Chain, allowing the update of the supply and borrow caps of the Venus markets (on Isolated Pools) on this chain without VIP’s, considering Chaos Labs recommendations. @@ -31,7 +31,7 @@ Moreover, this VIP would upgrade the implementation of the [Comptroller contract Main characteristics of the Risk Stewards enabled in this VIP: - Only the supply and borrow caps can be adjusted—either increased or decreased. All other risk parameters cannot be updated -- The new caps cannot be greater or lower than 50% of the current caps. For example, given the current supply cap of the market [WBNB on the Liquid Staked BNB pool](https://app.venus.io/#/isolated-pools/pool/0xd933909A4a2b7A4638903028f44D1d38ce27c352/market/0xe10E80B7FD3a29fE46E16C30CC8F4dd938B742e2?chainId=56) is 15K WBNB, Risk Stewards will be only able to set a new supply cap between 7.5K and 22.5K WBNB in one transaction. This limit can be modified with a VIP. +- The new caps cannot be greater or lower than 50% of the current caps. For example, given the current supply cap of the market [WBNB on the Liquid Staked BNB pool](https://app.venus.io/#/pool/0xd933909A4a2b7A4638903028f44D1d38ce27c352/market/0xe10E80B7FD3a29fE46E16C30CC8F4dd938B742e2?chainId=56&tab=supply) is 15K WBNB, Risk Stewards will be only able to set a new supply cap between 7.5K and 22.5K WBNB in one transaction. This limit can be modified with a VIP. - Risk Stewards can only update the supply cap for a specific market once every 24 hours. The same rule applies to borrow cap updates. This constraint can be modified with a VIP. - Risk Stewards will initially only be allowed to update markets in the Isolated Pools. In a separate VIP, they’ll also be granted permission to update markets in the Core Pool. This phased rollout is part of the overall security strategy. @@ -39,8 +39,6 @@ Main characteristics of the Risk Stewards enabled in this VIP: A new VIP will be proposed in the coming days to enable this integration for the markets in the Core pool on BNB Chain. Markets on other supported networks will be integrated at a later stage. -The second version of the Risk Stewards framework will allow Chaos Labs to propose VIPs and update a broader set of risk parameters, following the established governance process. - #### Security and additional considerations We applied the following security procedures for this upgrade: @@ -218,4 +216,4 @@ We applied the following security procedures for this upgrade: ); }; -export default vip538; +export default vip544; diff --git a/vips/vip-538/bsctestnet-addendum.ts b/vips/vip-544/bsctestnet-addendum.ts similarity index 85% rename from vips/vip-538/bsctestnet-addendum.ts rename to vips/vip-544/bsctestnet-addendum.ts index 65dd1b6cc..ccb8627b7 100644 --- a/vips/vip-538/bsctestnet-addendum.ts +++ b/vips/vip-544/bsctestnet-addendum.ts @@ -2,13 +2,13 @@ import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -import { cutParams as params } from "../../simulations/vip-538/utils/cur-params-bsctestnet.json"; +import { cutParams as params } from "../../simulations/vip-544/utils/cur-params-bsctestnet.json"; export const cutParams = params; const { bsctestnet } = NETWORK_ADDRESSES; -export const vip538_Addendum = () => { +export const vip544_Addendum = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -33,4 +33,4 @@ Configure Remote Risk Stewards ); }; -export default vip538_Addendum; +export default vip544_Addendum; diff --git a/vips/vip-538/bsctestnet1.ts b/vips/vip-544/bsctestnet1.ts similarity index 99% rename from vips/vip-538/bsctestnet1.ts rename to vips/vip-544/bsctestnet1.ts index a19b47bdf..aba4b90cc 100644 --- a/vips/vip-538/bsctestnet1.ts +++ b/vips/vip-544/bsctestnet1.ts @@ -141,7 +141,7 @@ export const permissions = ( ]; }; -const vip538 = () => { +const vip544 = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -268,4 +268,4 @@ Configure Remote Risk Stewards ); }; -export default vip538; +export default vip544; diff --git a/vips/vip-538/bsctestnet2.ts b/vips/vip-544/bsctestnet2.ts similarity index 99% rename from vips/vip-538/bsctestnet2.ts rename to vips/vip-544/bsctestnet2.ts index fcb4f80cd..ac96f1884 100644 --- a/vips/vip-538/bsctestnet2.ts +++ b/vips/vip-544/bsctestnet2.ts @@ -31,7 +31,7 @@ export const NORMAL_TIMELOCK_ZKSYNCSEPOLIA = "0x1730527a0f0930269313D77A317361b4 export const CRITIAL_TIMELOCK_ZKSYNCSEPOLIA = "0x0E6138bE0FA1915efC73670a20A10EFd720a6Cc8"; export const FAST_TRACK_TIMELOCK_ZKSYNCSEPOLIA = "0xb055e028b27d53a455a6c040a6952e44E9E615c4"; -const vip538 = () => { +const vip544 = () => { const meta = { version: "v2", title: "Configure Remote Risk Stewards", @@ -142,4 +142,4 @@ Configure Remote Risk Stewards ); }; -export default vip538; +export default vip544;