diff --git a/simulations/vip-545/abi/DefaultProxyAdmin.json b/simulations/vip-545/abi/DefaultProxyAdmin.json new file mode 100644 index 000000000..9801cfcc7 --- /dev/null +++ b/simulations/vip-545/abi/DefaultProxyAdmin.json @@ -0,0 +1,76 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "changeProxyAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }], + "name": "getProxyAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }], + "name": "getProxyImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "implementation", "type": "address" } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract TransparentUpgradeableProxy", "name": "proxy", "type": "address" }, + { "internalType": "address", "name": "implementation", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "upgradeAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } +] diff --git a/simulations/vip-545/abi/Diamond.json b/simulations/vip-545/abi/Diamond.json new file mode 100644 index 000000000..5cd47085c --- /dev/null +++ b/simulations/vip-545/abi/Diamond.json @@ -0,0 +1,860 @@ +[ + { + "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" + }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "contract Unitroller", + "name": "unitroller", + "type": "address" + } + ], + "name": "_become", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "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" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedDelegates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [ + { + "internalType": "address", + "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": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptrollerLens", + "outputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "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": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "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" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "name": "facetPosition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.Facet[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabledForUser", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidatorContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "bool", + "name": "isVenus", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minReleaseAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mintedVAIs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract ResilientOracleInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prime", + "outputs": [ + { + "internalType": "contract IPrime", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "releaseStartBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "repayVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryPercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaiController", + "outputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaiMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaiVaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplySpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "venusVAIVaultRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-545/abi/TransparentUpgradeableProxy.json b/simulations/vip-545/abi/TransparentUpgradeableProxy.json new file mode 100644 index 000000000..249ab61da --- /dev/null +++ b/simulations/vip-545/abi/TransparentUpgradeableProxy.json @@ -0,0 +1,72 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_logic", "type": "address" }, + { "internalType": "address", "name": "admin_", "type": "address" }, + { "internalType": "bytes", "name": "_data", "type": "bytes" } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "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": [{ "internalType": "address", "name": "newAdmin", "type": "address" }], + "name": "changeAdmin", + "outputs": [], + "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" } +] diff --git a/simulations/vip-545/abi/Unitroller.json b/simulations/vip-545/abi/Unitroller.json new file mode 100644 index 000000000..ab07e1b7c --- /dev/null +++ b/simulations/vip-545/abi/Unitroller.json @@ -0,0 +1,122 @@ +[ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newImplementation", "type": "address" } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingImplementation", "type": "address" } + ], + "name": "NewPendingImplementation", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptImplementation", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newPendingImplementation", "type": "address" }], + "name": "_setPendingImplementation", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "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": "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" + } +] diff --git a/simulations/vip-545/abi/VAIContoller.json b/simulations/vip-545/abi/VAIContoller.json new file mode 100644 index 000000000..99d02ff85 --- /dev/null +++ b/simulations/vip-545/abi/VAIContoller.json @@ -0,0 +1,122 @@ +[ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newImplementation", "type": "address" } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingImplementation", "type": "address" } + ], + "name": "NewPendingImplementation", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "_acceptImplementation", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "newPendingImplementation", "type": "address" }], + "name": "_setPendingImplementation", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "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": "pendingVAIControllerImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "vaiControllerImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-545/abi/VBep20Delegator.json b/simulations/vip-545/abi/VBep20Delegator.json new file mode 100644 index 000000000..c0187a7ca --- /dev/null +++ b/simulations/vip-545/abi/VBep20Delegator.json @@ -0,0 +1,688 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "underlying_", "type": "address" }, + { "internalType": "contract ComptrollerInterface", "name": "comptroller_", "type": "address" }, + { "internalType": "contract InterestRateModel", "name": "interestRateModel_", "type": "address" }, + { "internalType": "uint256", "name": "initialExchangeRateMantissa_", "type": "uint256" }, + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, + { "internalType": "address payable", "name": "admin_", "type": "address" }, + { "internalType": "address", "name": "implementation_", "type": "address" }, + { "internalType": "bytes", "name": "becomeImplementationData", "type": "bytes" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "cashPrior", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interestAccumulated", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowIndex", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "error", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "info", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "detail", "type": "uint256" } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "liquidator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "address", "name": "vTokenCollateral", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "minter", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "mintAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "mintTokens", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { "indexed": false, "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldImplementation", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newImplementation", "type": "address" } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldPendingAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newPendingAdmin", "type": "address" } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldReserveFactorMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "redeemer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "redeemTokens", "type": "uint256" } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "payer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accountBorrows", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "totalBorrows", "type": "uint256" } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "benefactor", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "addAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "admin", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newTotalReserves", "type": "uint256" } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { "payable": true, "stateMutability": "payable", "type": "fallback" }, + { + "constant": false, + "inputs": [], + "name": "_acceptAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "addAmount", "type": "uint256" }], + "name": "_addReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "reduceAmount", "type": "uint256" }], + "name": "_reduceReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract ComptrollerInterface", "name": "newComptroller", "type": "address" }], + "name": "_setComptroller", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "implementation_", "type": "address" }, + { "internalType": "bool", "name": "allowResign", "type": "bool" }, + { "internalType": "bytes", "name": "becomeImplementationData", "type": "bytes" } + ], + "name": "_setImplementation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "contract InterestRateModel", "name": "newInterestRateModel", "type": "address" }], + "name": "_setInterestRateModel", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address payable", "name": "newPendingAdmin", "type": "address" }], + "name": "_setPendingAdmin", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "newReserveFactorMantissa", "type": "uint256" }], + "name": "_setReserveFactor", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "balanceOfUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }], + "name": "borrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "borrowBalanceStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "contract ComptrollerInterface", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "delegateToImplementation", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "bytes", "name": "data", "type": "bytes" }], + "name": "delegateToViewImplementation", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getAccountSnapshot", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [{ "internalType": "contract InterestRateModel", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isVToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" }, + { "internalType": "contract VTokenInterface", "name": "vTokenCollateral", "type": "address" } + ], + "name": "liquidateBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "mintAmount", "type": "uint256" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pendingAdmin", + "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemTokens", "type": "uint256" }], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "redeemAmount", "type": "uint256" }], + "name": "redeemUnderlying", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "uint256", "name": "repayAmount", "type": "uint256" }], + "name": "repayBorrow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "repayAmount", "type": "uint256" } + ], + "name": "repayBorrowBehalf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "liquidator", "type": "address" }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizeTokens", "type": "uint256" } + ], + "name": "seize", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-545/bscmainnet.ts b/simulations/vip-545/bscmainnet.ts new file mode 100644 index 000000000..4a3243a40 --- /dev/null +++ b/simulations/vip-545/bscmainnet.ts @@ -0,0 +1,225 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { expectEvents, setMaxStalePeriodInBinanceOracle, setMaxStalePeriodInChainlinkOracle } from "src/utils"; +import { forking, testVip } from "src/vip-framework"; +import { checkCorePoolComptroller } from "src/vip-framework/checks/checkCorePoolComptroller"; + +import { WBNBMarketSpec, vip543 } from "../../vips/vip-543/bscmainnet"; +import vip544 from "../../vips/vip-544/bscmainnet"; +import vip545, { + DEFAULT_PROXY_ADMIN, + DIAMOND, + LIQUIDATOR, + LIQUIDATOR_IMPL, + LIQUIDATOR_PROXY_ADMIN, + VAI_CONTROLLER, + VAI_CONTROLLER_IMPL, + VTOKEN_DELEGATE, + vBNB_ADMIN, + vBNB_ADMIN_IMPL, + vTokens, +} from "../../vips/vip-545/bscmainnet"; +import DIAMOND_ABI from "./abi/Diamond.json"; +import TRANSPARENT_PROXY_ABI from "./abi/TransparentUpgradeableProxy.json"; +import UNITROLLER_ABI from "./abi/Unitroller.json"; +import VAI_CONTROLLER_ABI from "./abi/VAIContoller.json"; +import VBEP20_DELEGATOR_ABI from "./abi/VBep20Delegator.json"; + +const { bscmainnet } = NETWORK_ADDRESSES; +const CHAINLINK_WBNB_FEED = "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE"; + +const OLD_REWARD_FACET = "0xc2F6bDCEa4907E8CB7480d3d315bc01c125fb63C"; +const OLD_SETTER_FACET = "0x9D1fdD581Bd6E638A7b98ac5567248A0c4E88f64"; +const OLD_MARKET_FACET = "0x94573965fbCCAC5cD4558208A8cCB3F18E71B7Db"; +const OLD_POLICY_FACET = "0x5bb2Dfe996629E558Cd5BDBfC4c0eC7367BB96E9"; + +const NEW_REWARD_FACET = "0x05e4C8f3dbb6c2eaD4eB1f28611FA7180e79f428"; +const NEW_SETTER_FACET = "0x92B26cb819335DA336f59480F0ca30F9a3f18E0a"; +const NEW_MARKET_FACET = "0xd47c074c219E6947BB350D9aD220eE20fCCC6549"; +const NEW_POLICY_FACET = "0xF2095BeCa3030D43976ED46D5ca488D58354E8c9"; + +let marketFacetFunctionSelectors: string[]; +let policyFacetFunctionSelectors: string[]; +let rewardFacetFuntionSelectors: string[]; +let setterFacetFuntionSelectors: string[]; +let unitroller: Contract; + +forking(60902107, async () => { + before(async () => { + await setMaxStalePeriodInChainlinkOracle( + NETWORK_ADDRESSES.bscmainnet.CHAINLINK_ORACLE, + WBNBMarketSpec.vToken.underlying.address, + CHAINLINK_WBNB_FEED, + NETWORK_ADDRESSES.bscmainnet.NORMAL_TIMELOCK, + 315360000, + ); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "BNB"); + unitroller = new ethers.Contract(bscmainnet.UNITROLLER, DIAMOND_ABI, ethers.provider); + }); + + testVip("vip-543", await vip543()); + testVip("vip-544", await vip544()); + const defaultProxyAdmin = await ethers.provider.getSigner(DEFAULT_PROXY_ADMIN); + + describe("Pre-VIP behavior", async () => { + before(async () => { + rewardFacetFuntionSelectors = await unitroller.facetFunctionSelectors(OLD_REWARD_FACET); + setterFacetFuntionSelectors = await unitroller.facetFunctionSelectors(OLD_SETTER_FACET); + marketFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_MARKET_FACET); + policyFacetFunctionSelectors = await unitroller.facetFunctionSelectors(OLD_POLICY_FACET); + }); + + describe("facets", 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(OLD_REWARD_FACET)).to.deep.equal(rewardFacetFuntionSelectors); + expect(await unitroller.facetFunctionSelectors(NEW_REWARD_FACET)).to.deep.equal([]); + }); + + 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(OLD_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); + expect(await unitroller.facetAddresses()).to.not.include(NEW_REWARD_FACET); + }); + }); + + describe("check implementation", async () => { + it("check vBNBAdmin implementation", async () => { + const vBNBAdmin = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, vBNB_ADMIN)) as Contract; + const impl = await vBNBAdmin.connect(defaultProxyAdmin).callStatic.implementation(); + expect(impl).to.equal("0xaA8D9558d8D45666552a72CECbdd0a746aeaCDc9"); + }); + + it("check comptroller implementation", async () => { + const unitroller = (await ethers.getContractAt(UNITROLLER_ABI, bscmainnet.UNITROLLER)) as Contract; + const impl = await unitroller.comptrollerImplementation(); + expect(impl).to.equal("0x347ba9559fFC65A94af0F6a513037Cd4982b7b18"); + }); + + it("check liquidator implementation", async () => { + const liquidatorProxyAdmin = await ethers.getSigner(LIQUIDATOR_PROXY_ADMIN); + const liquidator = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, LIQUIDATOR)) as Contract; + const impl = await liquidator.connect(liquidatorProxyAdmin).callStatic.implementation(); + expect(impl).to.equal("0xE26cE9b5FDd602225cCcC4cef7FAE596Dcf2A965"); + }); + + it("check VAIController implementation", async () => { + const vaiController = (await ethers.getContractAt(VAI_CONTROLLER_ABI, VAI_CONTROLLER)) as Contract; + const impl = await vaiController.vaiControllerImplementation(); + expect(impl).to.equal("0xF1A8B40CA68d08EFfa31a16a83f4fd9b5c174872"); + }); + + for (const [name, address] of Object.entries(vTokens)) { + it(`check ${name} implementation`, async () => { + const vToken = (await ethers.getContractAt(VBEP20_DELEGATOR_ABI, address)) as Contract; + const impl = await vToken.callStatic.implementation(); + expect(impl).to.equal("0x6E5cFf66C7b671fA1D5782866D80BD15955d79F6"); + }); + } + }); + }); + + testVip("VIP-545", await vip545(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); + await expectEvents(txResponse, [UNITROLLER_ABI], ["NewImplementation"], [41]); + }, + }); + + describe("Post-VIP behavior", async () => { + describe("facets", async () => { + it("market facet function selectors should be updated for new facet address", async () => { + const expectSelectors = [...marketFacetFunctionSelectors].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 expectSelectors = [...policyFacetFunctionSelectors].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 () => { + const expectSelectors = [...setterFacetFuntionSelectors].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 be updated for new facet address", async () => { + const expectSelectors = [...rewardFacetFuntionSelectors].sort(); + const updatedSelectors = [...(await unitroller.facetFunctionSelectors(NEW_REWARD_FACET))].sort(); + + expect(updatedSelectors).to.deep.equal(expectSelectors); + expect(await unitroller.facetFunctionSelectors(OLD_REWARD_FACET)).to.deep.equal([]); + }); + }); + + describe("check implementation", async () => { + it("check vBNBAdmin implementation", async () => { + const vBNBAdmin = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, vBNB_ADMIN)) as Contract; + const impl = await vBNBAdmin.connect(defaultProxyAdmin).callStatic.implementation(); + expect(impl).to.equal(vBNB_ADMIN_IMPL); + }); + + it("check comptroller implementation", async () => { + const unitroller = (await ethers.getContractAt(UNITROLLER_ABI, bscmainnet.UNITROLLER)) as Contract; + const impl = await unitroller.comptrollerImplementation(); + expect(impl).to.equal(DIAMOND); + }); + + it("check liquidator implementation", async () => { + const liquidatorProxyAdmin = await ethers.getSigner(LIQUIDATOR_PROXY_ADMIN); + const liquidator = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, LIQUIDATOR)) as Contract; + const impl = await liquidator.connect(liquidatorProxyAdmin).callStatic.implementation(); + expect(impl).to.equal(LIQUIDATOR_IMPL); + }); + + it("check VAIController implementation", async () => { + const vaiController = (await ethers.getContractAt(VAI_CONTROLLER_ABI, VAI_CONTROLLER)) as Contract; + const impl = await vaiController.vaiControllerImplementation(); + expect(impl).to.equal(VAI_CONTROLLER_IMPL); + }); + + for (const [name, address] of Object.entries(vTokens)) { + it(`check ${name} implementation`, async () => { + const vToken = (await ethers.getContractAt(VBEP20_DELEGATOR_ABI, address)) as Contract; + const impl = await vToken.callStatic.implementation(); + expect(impl).to.equal(VTOKEN_DELEGATE); + }); + } + }); + + describe("generic tests", async () => { + checkCorePoolComptroller(); + }); + }); +}); diff --git a/simulations/vip-545/bsctestnet.ts b/simulations/vip-545/bsctestnet.ts new file mode 100644 index 000000000..aa7f928af --- /dev/null +++ b/simulations/vip-545/bsctestnet.ts @@ -0,0 +1,121 @@ +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 { checkCorePoolComptroller } from "src/vip-framework/checks/checkCorePoolComptroller"; + +import vip545, { + DEFAULT_PROXY_ADMIN, + DIAMOND, + LIQUIDATOR, + LIQUIDATOR_IMPL, + LIQUIDATOR_PROXY_ADMIN, + VAI_CONTROLLER, + VAI_CONTROLLER_IMPL, + VTOKEN_DELEGATE, + vBNB_ADMIN, + vBNB_ADMIN_IMPL, + vTokens, +} from "../../vips/vip-545/bsctestnet"; +import DIAMOND_ABI from "./abi/Diamond.json"; +import TRANSPARENT_PROXY_ABI from "./abi/TransparentUpgradeableProxy.json"; +import UNITROLLER_ABI from "./abi/Unitroller.json"; +import VAI_CONTROLLER_ABI from "./abi/VAIContoller.json"; +import VBEP20_DELEGATOR_ABI from "./abi/VBep20Delegator.json"; + +const { bsctestnet } = NETWORK_ADDRESSES; + +forking(64855555, async () => { + const defaultProxyAdmin = await ethers.provider.getSigner(DEFAULT_PROXY_ADMIN); + + describe("Pre-VIP behavior", async () => { + describe("check implementation", async () => { + it("check vBNBAdmin implementation", async () => { + const vBNBAdmin = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, vBNB_ADMIN)) as Contract; + const impl = await vBNBAdmin.connect(defaultProxyAdmin).callStatic.implementation(); + expect(impl).to.equal("0x90c891bb2b1821ADE159ECa6FbA0418b2bD1b86D"); + }); + + it("check comptroller implementation", async () => { + const unitroller = (await ethers.getContractAt(UNITROLLER_ABI, bsctestnet.UNITROLLER)) as Contract; + const impl = await unitroller.comptrollerImplementation(); + expect(impl).to.equal("0x1D5F9752bA40cF7047db2E24Cb6Aa196E3c334DA"); + }); + + it("check liquidator implementation", async () => { + const liquidatorProxyAdmin = await ethers.getSigner(LIQUIDATOR_PROXY_ADMIN); + const liquidator = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, LIQUIDATOR)) as Contract; + const impl = await liquidator.connect(liquidatorProxyAdmin).callStatic.implementation(); + expect(impl).to.equal("0x83372155Dd4A4306af82795d5A27d40188ED1F3B"); + }); + + it("check VAIController implementation", async () => { + const vaiController = (await ethers.getContractAt(VAI_CONTROLLER_ABI, VAI_CONTROLLER)) as Contract; + const impl = await vaiController.vaiControllerImplementation(); + expect(impl).to.equal("0xDFcbfb82a416B5CEbB80FECFbBF4E055299931FF"); + }); + + for (const [name, address] of Object.entries(vTokens)) { + it(`check ${name} implementation`, async () => { + const vToken = (await ethers.getContractAt(VBEP20_DELEGATOR_ABI, address)) as Contract; + const impl = await vToken.callStatic.implementation(); + if (name === "vSolvBTC") { + expect(impl).to.equal("0x67ce26cAC0E1dF3901BA2d9c5d9dd6cc4F645454"); + return; + } + expect(impl).to.equal("0xad6aa8Bb4829560412A94AA930745f407BF8000B"); + }); + } + }); + }); + + testVip("VIP-545", await vip545(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [DIAMOND_ABI], ["DiamondCut"], [1]); + await expectEvents(txResponse, [UNITROLLER_ABI], ["NewImplementation"], [35]); + }, + }); + + describe("Post-VIP behavior", async () => { + describe("check implementation", async () => { + it("check vBNBAdmin implementation", async () => { + const vBNBAdmin = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, vBNB_ADMIN)) as Contract; + const impl = await vBNBAdmin.connect(defaultProxyAdmin).callStatic.implementation(); + expect(impl).to.equal(vBNB_ADMIN_IMPL); + }); + + it("check comptroller implementation", async () => { + const unitroller = (await ethers.getContractAt(UNITROLLER_ABI, bsctestnet.UNITROLLER)) as Contract; + const impl = await unitroller.comptrollerImplementation(); + expect(impl).to.equal(DIAMOND); + }); + + it("check liquidator implementation", async () => { + const liquidatorProxyAdmin = await ethers.getSigner(LIQUIDATOR_PROXY_ADMIN); + const liquidator = (await ethers.getContractAt(TRANSPARENT_PROXY_ABI, LIQUIDATOR)) as Contract; + const impl = await liquidator.connect(liquidatorProxyAdmin).callStatic.implementation(); + expect(impl).to.equal(LIQUIDATOR_IMPL); + }); + + it("check VAIController implementation", async () => { + const vaiController = (await ethers.getContractAt(VAI_CONTROLLER_ABI, VAI_CONTROLLER)) as Contract; + const impl = await vaiController.vaiControllerImplementation(); + expect(impl).to.equal(VAI_CONTROLLER_IMPL); + }); + + for (const [name, address] of Object.entries(vTokens)) { + it(`check ${name} implementation`, async () => { + const vToken = (await ethers.getContractAt(VBEP20_DELEGATOR_ABI, address)) as Contract; + const impl = await vToken.callStatic.implementation(); + expect(impl).to.equal(VTOKEN_DELEGATE); + }); + } + }); + + describe("generic tests", async () => { + checkCorePoolComptroller(); + }); + }); +}); diff --git a/src/networkAddresses.ts b/src/networkAddresses.ts index 89e6c36f6..93ca561e5 100644 --- a/src/networkAddresses.ts +++ b/src/networkAddresses.ts @@ -35,8 +35,9 @@ export const NETWORK_ADDRESSES = { ETH_CHAINLINK_FEED: "0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e", USDT_CHAINLINK_FEED: "0xB97Ad0E74fa7d920791E90258A6E2085088b4320", CHAINLINK_ORACLE: oracleBscmainnetContracts.addresses.ChainlinkOracle, - COMPTROLLER_LENS: bscmainnetDeployedContracts.addresses.ComptrollerLens, + COMPTROLLER_LENS: "0x9D228f57227839a9c514077c3909c9992F7900Af", GENERIC_TEST_USER_ACCOUNT: "0xF977814e90dA44bFA03b6295A0616a897441aceC", + GENERIC_ETH_ACCOUNT: "0xF77055DBFAfdD56578Ace54E62e749d12802ce36", XVS_VAULT_PROXY: bscmainnetDeployedContracts.addresses.XVSVaultProxy, XVS: bscmainnetDeployedContracts.addresses.XVS, VAI_UNITROLLER: bscmainnetDeployedContracts.addresses.VaiUnitroller, @@ -60,8 +61,9 @@ export const NETWORK_ADDRESSES = { ETH_CHAINLINK_FEED: "0x143db3CEEfbdfe5631aDD3E50f7614B6ba708BA7", USDT_CHAINLINK_FEED: "0xEca2605f0BCF2BA5966372C99837b1F182d3D620", CHAINLINK_ORACLE: oracleBsctestnetContracts.addresses.ChainlinkOracle, - COMPTROLLER_LENS: bsctestnetDeployedContracts.addresses.ComptrollerLens, + COMPTROLLER_LENS: "0x3ec96D6a9a14ee57aB83F81BB7386EBE515936D1", GENERIC_TEST_USER_ACCOUNT: "0xB7314B8e69DCD32a72aC163679628117E90d3746", + GENERIC_ETH_ACCOUNT: "0x804512132AA9E0c81Aab9Ef2113E05EC380d3cfc", XVS_VAULT_PROXY: bsctestnetDeployedContracts.addresses.XVSVaultProxy, XVS: bsctestnetDeployedContracts.addresses.XVS, VAI_UNITROLLER: bsctestnetDeployedContracts.addresses.VaiUnitroller, diff --git a/src/vip-framework/checks/checkCorePoolComptroller.ts b/src/vip-framework/checks/checkCorePoolComptroller.ts index c7c6c0909..aba668706 100644 --- a/src/vip-framework/checks/checkCorePoolComptroller.ts +++ b/src/vip-framework/checks/checkCorePoolComptroller.ts @@ -1,4 +1,4 @@ -import { impersonateAccount } from "@nomicfoundation/hardhat-network-helpers"; +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; import mainnetGovernance from "@venusprotocol/governance-contracts/deployments/bscmainnet_addresses.json"; import testnetGovernance from "@venusprotocol/governance-contracts/deployments/bsctestnet_addresses.json"; import mainnet from "@venusprotocol/venus-protocol/deployments/bscmainnet_addresses.json"; @@ -21,10 +21,10 @@ let ETH = mainnet.addresses.ETH; let NORMAL_TIMELOCK = mainnetGovernance.addresses.NormalTimelock; let XVS = mainnet.addresses.XVS; let COMPTROLLER = mainnet.addresses.Unitroller; -let LENS = mainnet.addresses.ComptrollerLens; +let LENS = NETWORK_ADDRESSES.bscmainnet.COMPTROLLER_LENS; let ETH_FEED = NETWORK_ADDRESSES.bscmainnet.ETH_CHAINLINK_FEED; let USDT_FEED = NETWORK_ADDRESSES.bscmainnet.USDT_CHAINLINK_FEED; -let ACCOUNT = NETWORK_ADDRESSES.bscmainnet.GENERIC_TEST_USER_ACCOUNT; +let ACCOUNT = NETWORK_ADDRESSES.bscmainnet.GENERIC_ETH_ACCOUNT; let CHAINLINK_ORACLE = NETWORK_ADDRESSES.bscmainnet.CHAINLINK_ORACLE; if (FORKED_NETWORK === "bsctestnet") { @@ -37,7 +37,7 @@ if (FORKED_NETWORK === "bsctestnet") { COMPTROLLER = testnet.addresses.Unitroller; ETH_FEED = NETWORK_ADDRESSES.bsctestnet.ETH_CHAINLINK_FEED; USDT_FEED = NETWORK_ADDRESSES.bsctestnet.USDT_CHAINLINK_FEED; - ACCOUNT = NETWORK_ADDRESSES.bsctestnet.GENERIC_TEST_USER_ACCOUNT; + ACCOUNT = NETWORK_ADDRESSES.bsctestnet.GENERIC_ETH_ACCOUNT; CHAINLINK_ORACLE = NETWORK_ADDRESSES.bsctestnet.CHAINLINK_ORACLE; LENS = NETWORK_ADDRESSES[FORKED_NETWORK].COMPTROLLER_LENS; @@ -56,6 +56,7 @@ export const checkCorePoolComptroller = () => { before(async () => { await impersonateAccount(ACCOUNT); await impersonateAccount(NORMAL_TIMELOCK); + await setBalance(ACCOUNT, parseUnits("1", 18)); const signer = await ethers.getSigner(ACCOUNT); timelockSigner = await ethers.getSigner(NORMAL_TIMELOCK); @@ -86,11 +87,16 @@ export const checkCorePoolComptroller = () => { let usdtBalance = await usdt.balanceOf(ACCOUNT); const usdtDecimals = await usdt.decimals(); + await comptroller + .connect(timelockSigner) + ._setMarketBorrowCaps([vusdt.address], [parseUnits("10000000000", usdtDecimals)]); await vusdt.borrow(parseUnits("100", usdtDecimals)); expect(await usdt.balanceOf(ACCOUNT)).to.gt(usdtBalance); const originalXVSBalance = await xvs.balanceOf(ACCOUNT); - await expect(comptroller["claimVenus(address)"](ACCOUNT)).to.be.not.reverted; + await expect( + comptroller["claimVenus(address[],address[],bool,bool,bool)"]([ACCOUNT], [vusdt.address], true, true, true), + ).to.be.not.reverted; expect(await xvs.balanceOf(ACCOUNT)).to.be.greaterThanOrEqual(originalXVSBalance); usdtBalance = await usdt.balanceOf(ACCOUNT); diff --git a/vips/vip-545/bscmainnet.ts b/vips/vip-545/bscmainnet.ts new file mode 100644 index 000000000..93bf95286 --- /dev/null +++ b/vips/vip-545/bscmainnet.ts @@ -0,0 +1,190 @@ +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { ProposalMeta, ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +import { cutParams as params } from "./cut-params-mainnet.json"; + +const { bscmainnet } = NETWORK_ADDRESSES; + +export const vBNB_ADMIN = "0x9A7890534d9d91d473F28cB97962d176e2B65f1d"; +export const vBNB_ADMIN_IMPL = "0xae2713FbdF95d914182f7055ec1Ff6C64F41c275"; +export const DEFAULT_PROXY_ADMIN = "0x6beb6D2695B67FEb73ad4f172E8E2975497187e4"; +export const DIAMOND = "0xb61a58aCA9F39dEA8C22F4c9a377C68a1Ea3723C"; +export const COMPTROLLER_LENS = "0x9D228f57227839a9c514077c3909c9992F7900Af"; +export const LIQUIDATOR = "0x0870793286aada55d39ce7f82fb2766e8004cf43"; +export const LIQUIDATOR_IMPL = "0x1da2Fe628F50C14bc2A873A96B6D10392830621f"; +export const LIQUIDATOR_PROXY_ADMIN = "0x2b40B43AC5F7949905b0d2Ed9D6154a8ce06084a"; +export const VAI_CONTROLLER = "0x004065D34C6b18cE4370ced1CeBDE94865DbFAFE"; +export const VAI_CONTROLLER_IMPL = "0xE4109433CEE11172dcCaE80d9c3bcDDFF4A7Cf57"; +export const VTOKEN_DELEGATE = "0xA674296091B703e38dB2f3a937f02334627dCdaD"; + +export const vTokens = { + vAAVE: "0x26DA28954763B92139ED49283625ceCAf52C6f94", + vADA: "0x9A0AF7FDb2065Ce470D72664DE73cAE409dA28Ec", + vasBNB: "0xCC1dB43a06d97f736C7B045AedD03C6707c09BDF", + vBCH: "0x5F0388EBc2B94FA8E123F404b79cCF5f40b29176", + vBETH: "0x972207A639CC1B374B893cc33Fa251b55CEB7c07", + vBTC: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", + vBUSD: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + vCAKE: "0x86aC3974e2BD0d60825230fa6F355fF11409df5c", + vDAI: "0x334b3eCB4DCa3593BCCC3c7EBD1A1C1d1780FBF1", + vDOGE: "0xec3422Ef92B2fb59e84c8B02Ba73F1fE84Ed8D71", + vDOT: "0x1610bc33319e9398de5f57B33a5b184c806aD217", + vETH: "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", + vFDUSD: "0xC4eF4229FEc74Ccfe17B2bdeF7715fAC740BA0ba", + vFIL: "0xf91d58b5aE142DAcC749f58A49FCBac340Cb0343", + vLINK: "0x650b940a1033B8A1b1873f78730FcFC73ec11f1f", + vlisUSD: "0x689E0daB47Ab16bcae87Ec18491692BF621Dc6Ab", + vLTC: "0x57A5297F2cB2c0AaC9D554660acd6D385Ab50c6B", + vMATIC: "0x5c9476FcD6a4F9a3654139721c949c2233bBbBc8", + "vPT-sUSDE-26JUN2025": "0x9e4E5fed5Ac5B9F732d0D850A615206330Bf1866", + vSOL: "0xBf515bA4D1b52FFdCeaBF20d31D705Ce789F2cEC", + vSolvBTC: "0xf841cb62c19fCd4fF5CD0AaB5939f3140BaaC3Ea", + vsUSDe: "0x699658323d58eE25c69F1a29d476946ab011bD18", + vSXP: "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", + vTHE: "0x86e06EAfa6A1eA631Eab51DE500E3D474933739f", + vTRX: "0xC5D3466aA484B040eE977073fcF337f2c00071c1", + vTRXOLD: "0x61eDcFe8Dd6bA3c891CB9bEc2dc7657B3B422E93", + vTUSD: "0xBf762cd5991cA1DCdDaC9ae5C638F5B5Dc3Bee6E", + vTUSDOLD: "0x08CEB3F4a7ed3500cA0982bcd0FC7816688084c3", + vTWT: "0x4d41a36D04D97785bcEA57b057C412b278e6Edcc", + vUNI: "0x27FF564707786720C71A2e5c1490A63266683612", + vUSDC: "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", + vUSDe: "0x74ca6930108F775CC667894EEa33843e691680d7", + vUSDT: "0xfD5840Cd36d94D7229439859C0112a4185BC0255", + vUSD1: "0x0C1DA220D301155b87318B90692Da8dc43B67340", + vWBETH: "0x6CFdEc747f37DAf3b87a35a1D9c8AD3063A1A8A0", + vWBNB: "0x6bCa74586218dB34cdB402295796b79663d816e9", + vXRP: "0xB248a295732e0225acd3337607cc01068e3b9c10", + vxSolvBTC: "0xd804dE60aFD05EE6B89aab5D152258fD461B07D5", + vXVS: "0x151B1e2635A717bcDc836ECd6FbB62B674FE3E1D", +}; + +export const vip545 = () => { + const meta: ProposalMeta = { + version: "v2", + title: "VIP-545 [BNB Chain] Upgrade Solidity Version for Venus Core Pool Smart Contracts", + description: `#### Summary + +If passed, following the community proposal “[Proposal: Upgrade Solidity Version for Venus Core Pool Smart Contracts on BNB Chain](https://community.venus.io/t/proposal-upgrade-solidity-version-for-venus-core-pool-smart-contracts-on-bnb-chain/5272) ”, this VIP will upgrade the implementation of the following contracts on BNB Chain: + +- [Core Pool Comptroller](https://bscscan.com/address/0xfD36E2c2a6789Db23113685031d7F16329158384) +- [VBNBAdmin](https://bscscan.com/address/0x9A7890534d9d91d473F28cB97962d176e2B65f1d) +- [Liquidator](https://bscscan.com/address/0x0870793286aada55d39ce7f82fb2766e8004cf43) +- [VAIController](http://bscscan.com/address/0x004065D34C6b18cE4370ced1CeBDE94865DbFAFE) +- Every VToken in the BNB Chain Core pool + +No new features are included. The only changes are those required after updating the Solidity version from 0.5.16 to 0.8.25. + +#### Description + +Why this upgrade: + +- **Modern, Secure Language Version**: Solidity 0.8.25 includes many improvements in **safety**, **performance**, and **readability**, and comes with **built-in overflow checks**, which remove the need for third-party libraries like 'SafeMath'. +- **Proven Stability**: This version has been **battle-tested** across the Ethereum ecosystem since its release in [2024](https://soliditylang.org/blog/2024/03/14/solidity-0.8.25-release-announcement/). It’s already in use across multiple parts of Venus, including the **Oracles**. +- **Developer Efficiency**: Standardizing on a modern version of Solidity will make it easier for developers to maintain, audit, and extend the protocol going forward. + +#### Security and additional considerations + +We applied the following security procedures for this upgrade: + +- **Audits**: [Certik](https://www.certik.com/), [Quantstamp](https://quantstamp.com/) and [HashDit](https://www.hashdit.io/) have audited the deployed code +- **VIP execution simulation**: in a simulation environment, validating the new implementations and the usual behaviour of the protocol +- **Deployment on testnet**: the same upgrades have been performed on BNB Chain testnet, and used in the Venus Protocol testnet deployment + +#### Audit reports + +- [Certik audit report](https://github.com/VenusProtocol/venus-protocol/blob/develop/audits/142_upgradeSolidity8_certik_20250824.pdf) (2025/08/24) +- [Quantstamp audit report](https://github.com/VenusProtocol/venus-protocol/blob/develop/audits/143_upgradeSolidity8_quantstamp_20250829.pdf) (2025/08/29) + +#### Deployed contracts + +BNB Chain new implementations: + +- [vBNBAdmin](http://bscscan.com/address/0xae2713FbdF95d914182f7055ec1Ff6C64F41c275) +- [Diamond](https://bscscan.com/address/0xb61a58aCA9F39dEA8C22F4c9a377C68a1Ea3723C) (Unitroller implementation) +- [Liquidator](https://bscscan.com/address/0x1da2Fe628F50C14bc2A873A96B6D10392830621f) +- [VAIController](https://bscscan.com/address/0xE4109433CEE11172dcCaE80d9c3bcDDFF4A7Cf57) +- [VTokenDelegate](https://bscscan.com/address/0xA674296091B703e38dB2f3a937f02334627dCdaD) +- Facets: + - [Market facet](https://bscscan.com/address/0xd47c074c219E6947BB350D9aD220eE20fCCC6549) + - [Setter facet](https://bscscan.com/address/0x92B26cb819335DA336f59480F0ca30F9a3f18E0a) + - [Policy facet](https://bscscan.com/address/0xF2095BeCa3030D43976ED46D5ca488D58354E8c9) + - [Reward facet](https://bscscan.com/address/0x05e4C8f3dbb6c2eaD4eB1f28611FA7180e79f428) + +BNB Chain testnet new implementations: + +- [vBNBAdmin](https://testnet.bscscan.com/address/0x04109575c1dbB4ac2e59e60c783800ea10441BBe) +- [Diamond](https://testnet.bscscan.com/address/0x649616739bab52E2A98BC74d93c896Ca45944359) (Unitroller implementation) +- [Liquidator](https://testnet.bscscan.com/address/0xe442A62E3B1956EC5B42e06aA0E293A0cB300406) +- [VAIController](https://testnet.bscscan.com/address/0x5864e8BE0d4AD825feD65115a4f109f850A65aF7) +- [VTokenDelegate](https://testnet.bscscan.com/address/0x585C508aF088123d990182a19e655ebB0e540CA1) +- Facets: + - [Market facet](https://testnet.bscscan.com/address/0x1c7B1e28A43619123F0bF9DB8aeEc64aA535b9EC) + - [Setter facet](https://testnet.bscscan.com/address/0xeD1fd1D134b10dF8F84BbC3C89881A929B0c6F47) + - [Policy facet](https://testnet.bscscan.com/address/0x642EE02aFBE47C69c0980Ea61131cD97884058a7) + - [Reward facet](https://testnet.bscscan.com/address/0x1C10F03827530f514Ba14065ec3D5f1496f35418) + +#### References + +- [VIP simulation](https://github.com/VenusProtocol/vips/pull/610) +- [Solidity 0.8 codebase](https://github.com/VenusProtocol/venus-protocol/pull/607)`, + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds or not", + }; + + return makeProposal( + [ + { + target: bscmainnet.UNITROLLER, + signature: "diamondCut((address,uint8,bytes4[])[])", + params: [params], + }, + { + target: DEFAULT_PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [vBNB_ADMIN, vBNB_ADMIN_IMPL], + }, + { + target: bscmainnet.UNITROLLER, + signature: "_setPendingImplementation(address)", + params: [DIAMOND], + }, + { + target: DIAMOND, + signature: "_become(address)", + params: [bscmainnet.UNITROLLER], + }, + { + target: bscmainnet.UNITROLLER, + signature: "_setComptrollerLens(address)", + params: [COMPTROLLER_LENS], + }, + { + target: LIQUIDATOR_PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [LIQUIDATOR, LIQUIDATOR_IMPL], + }, + { + target: VAI_CONTROLLER, + signature: "_setPendingImplementation(address)", + params: [VAI_CONTROLLER_IMPL], + }, + { + target: VAI_CONTROLLER_IMPL, + signature: "_become(address)", + params: [VAI_CONTROLLER], + }, + ...Object.values(vTokens).map(vToken => ({ + target: vToken, + signature: "_setImplementation(address,bool,bytes)", + params: [VTOKEN_DELEGATE, false, "0x"], + })), + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip545; diff --git a/vips/vip-545/bsctestnet.ts b/vips/vip-545/bsctestnet.ts new file mode 100644 index 000000000..a2b6e2882 --- /dev/null +++ b/vips/vip-545/bsctestnet.ts @@ -0,0 +1,120 @@ +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { ProposalMeta, ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +import { cutParams as params } from "./cut-params-testnet.json"; + +const { bsctestnet } = NETWORK_ADDRESSES; + +export const vBNB_ADMIN = "0x04109575c1dbB4ac2e59e60c783800ea10441BBe"; +export const vBNB_ADMIN_IMPL = "0x920863fB3965fc411A1c0aC610C768F4347570fE"; +export const DEFAULT_PROXY_ADMIN = "0x7877ffd62649b6a1557b55d4c20fcbab17344c91"; +export const DIAMOND = "0x649616739bab52E2A98BC74d93c896Ca45944359"; +export const COMPTROLLER_LENS = "0x3ec96D6a9a14ee57aB83F81BB7386EBE515936D1"; +export const LIQUIDATOR = "0x55AEABa76ecf144031Ef64E222166eb28Cb4865F"; +export const LIQUIDATOR_IMPL = "0xe442A62E3B1956EC5B42e06aA0E293A0cB300406"; +export const LIQUIDATOR_PROXY_ADMIN = "0x1469AeB2768931f979a1c957692e32Aa802dd55a"; +export const VAI_CONTROLLER = "0xf70C3C6b749BbAb89C081737334E74C9aFD4BE16"; +export const VAI_CONTROLLER_IMPL = "0x5864e8BE0d4AD825feD65115a4f109f850A65aF7"; +export const VTOKEN_DELEGATE = "0x585C508aF088123d990182a19e655ebB0e540CA1"; + +export const vTokens = { + vAAVE: "0x714db6c38A17883964B68a07d56cE331501d9eb6", + vADA: "0x37C28DE42bA3d22217995D146FC684B2326Ede64", + vasBNB: "0x73F506Aefd5e169D48Ea21A373B9B0a200E37585", + vBTC: "0xb6e9322C49FD75a367Fcb17B0Fcd62C5070EbCBe", + vBUSD: "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + vCAKE: "0xeDaC03D29ff74b5fDc0CC936F6288312e1459BC6", + vDOGE: "0xF912d3001CAf6DC4ADD366A62Cc9115B4303c9A9", + vETH: "0x162D005F0Fff510E54958Cfc5CF32A3180A84aab", + vFDUSD: "0xF06e662a00796c122AaAE935EC4F0Be3F74f5636", + vlisUSD: "0x9447b1D4Bd192f25416B6aCc3B7f06be2f7D6309", + vLTC: "0xAfc13BC065ABeE838540823431055D2ea52eBA52", + vMATIC: "0x3619bdDc61189F33365CC572DF3a68FB3b316516", + "vPT-sUSDE-26JUN2025": "0x90535B06ddB00453a5e5f2bC094d498F1cc86032", + vSOL: "0xbd9EB061444665Df7282Ec0888b72D60aC41Eb8C", + vSolvBTC: "0xA38110ae4451A86ab754695057d5B5a9BEAd0387", + vsUSDe: "0x8c8A1a0b6e1cb8058037F7bF24de6b79Aca5B7B0", + vSXP: "0x74469281310195A04840Daf6EdF576F559a3dE80", + vTHE: "0x39A239F5117BFaC7a1b0b3A517c454113323451d", + vTRX: "0x6AF3Fdb3282c5bb6926269Db10837fa8Aec67C04", + vTRXOLD: "0x369Fea97f6fB7510755DCA389088d9E2e2819278", + vTUSD: "0xEFAACF73CE2D38ED40991f29E72B12C74bd4cf23", + vTUSDOLD: "0x3A00d9B02781f47d033BAd62edc55fBF8D083Fb0", + vTWT: "0x95DaED37fdD3F557b3A5cCEb7D50Be65b36721DF", + vUNI: "0x171B468b52d7027F12cEF90cd065d6776a25E24e", + vUSDC: "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", + vUSDe: "0x86f8DfB7CA84455174EE9C3edd94867b51Da46BD", + vUSDF: "0x140d5Da2cE9fb9A8725cabdDB2Fe8ea831342C78", + vUSDT: "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", + vUSD1: "0x519e61D2CDA04184FB086bbD2322C1bfEa0917Cf", + vWBETH: "0x35566ED3AF9E537Be487C98b1811cDf95ad0C32b", + vXRP: "0x488aB2826a154da01CC4CC16A8C83d4720D3cA2C", + vxSolvBTC: "0x97cB97B05697c377C0bd09feDce67DBd86B7aB1e", + vXVS: "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", +}; + +export const vip545 = () => { + const meta: ProposalMeta = { + version: "v2", + title: "VIP-545 Upgrade solidity on BNB Core pool (0.5 -> 0.8)", + description: `Upgrade solidity on BNB Core pool (0.5 -> 0.8)`, + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds or not", + }; + + return makeProposal( + [ + { + target: bsctestnet.UNITROLLER, + signature: "diamondCut((address,uint8,bytes4[])[])", + params: [params], + }, + { + target: DEFAULT_PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [vBNB_ADMIN, vBNB_ADMIN_IMPL], + }, + { + target: bsctestnet.UNITROLLER, + signature: "_setPendingImplementation(address)", + params: [DIAMOND], + }, + { + target: DIAMOND, + signature: "_become(address)", + params: [bsctestnet.UNITROLLER], + }, + { + target: bsctestnet.UNITROLLER, + signature: "_setComptrollerLens(address)", + params: [COMPTROLLER_LENS], + }, + { + target: LIQUIDATOR_PROXY_ADMIN, + signature: "upgrade(address,address)", + params: [LIQUIDATOR, LIQUIDATOR_IMPL], + }, + { + target: VAI_CONTROLLER, + signature: "_setPendingImplementation(address)", + params: [VAI_CONTROLLER_IMPL], + }, + { + target: VAI_CONTROLLER_IMPL, + signature: "_become(address)", + params: [VAI_CONTROLLER], + }, + ...Object.values(vTokens).map(vToken => ({ + target: vToken, + signature: "_setImplementation(address,bool,bytes)", + params: [VTOKEN_DELEGATE, false, "0x"], + })), + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip545; diff --git a/vips/vip-545/cut-params-mainnet.json b/vips/vip-545/cut-params-mainnet.json new file mode 100644 index 000000000..8711319bc --- /dev/null +++ b/vips/vip-545/cut-params-mainnet.json @@ -0,0 +1,102 @@ +{ + "cutParams": [ + [ + "0xd47c074c219E6947BB350D9aD220eE20fCCC6549", + 1, + [ + "0x3d98a1e5", + "0xcab4f84c", + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0xc488847b", + "0xa78dc775", + "0x0686dab6", + "0xddbf54fd", + "0xc5b4db55" + ] + ], + [ + "0xF2095BeCa3030D43976ED46D5ca488D58354E8c9", + 1, + [ + "0x528a174c", + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x05e4C8f3dbb6c2eaD4eB1f28611FA7180e79f428", + 1, + [ + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0xbf32442d", + "0xededbae6", + "0x655f0725" + ] + ], + [ + "0x92B26cb819335DA336f59480F0ca30F9a3f18E0a", + 1, + [ + "0x24aaa220", + "0x12348e96", + "0x5cc4fdeb", + "0x8b3113f6", + "0xa8431081", + "0x186db48f", + "0xd136af44", + "0x530e784f", + "0xc32094c7", + "0xf519fc30", + "0x2b5d790c", + "0x317b0b77", + "0xe4028eee", + "0x9bf34cbb", + "0x522c656b", + "0x17db2163", + "0x4fd42e17", + "0xbb857450", + "0x607ef6c1", + "0x51a485e4", + "0x5f5af1aa", + "0x55ee1fe1", + "0x9460c8b5", + "0x2a6a6065", + "0xd24febad", + "0x9cfdd9e6", + "0x2ec04124", + "0x4e0853db", + "0x6662c7c9", + "0x919a3736", + "0x4ef233fc", + "0xfd51a3ad" + ] + ] + ] +} diff --git a/vips/vip-545/cut-params-testnet.json b/vips/vip-545/cut-params-testnet.json new file mode 100644 index 000000000..0c75a4790 --- /dev/null +++ b/vips/vip-545/cut-params-testnet.json @@ -0,0 +1,102 @@ +{ + "cutParams": [ + [ + "0x1c7B1e28A43619123F0bF9DB8aeEc64aA535b9EC", + 1, + [ + "0xa76b3fda", + "0x929fe9a1", + "0xc2998238", + "0xede4edd0", + "0xb0772d0b", + "0xabfceffc", + "0x007e3dd2", + "0x3d98a1e5", + "0xc488847b", + "0xa78dc775", + "0xcab4f84c", + "0x0686dab6", + "0xddbf54fd", + "0xc5b4db55" + ] + ], + [ + "0x642EE02aFBE47C69c0980Ea61131cD97884058a7", + 1, + [ + "0xead1a8a0", + "0xda3d454c", + "0x5c778605", + "0x5ec88c79", + "0x528a174c", + "0x4e79238f", + "0x5fc7e71e", + "0x47ef3b3b", + "0x4ef4c3e1", + "0x41c728b9", + "0xeabe7d91", + "0x51dff989", + "0x24008a62", + "0x1ededc91", + "0xd02f7351", + "0x6d35bf91", + "0xbdcdc258", + "0x6a56947e" + ] + ], + [ + "0x1C10F03827530f514Ba14065ec3D5f1496f35418", + 1, + [ + "0xa7604b41", + "0xe85a2960", + "0x70bf66f0", + "0x86df31ee", + "0xadcd5fb9", + "0xd09c54ba", + "0x7858524d", + "0xbf32442d", + "0xededbae6", + "0x655f0725" + ] + ], + [ + "0xeD1fd1D134b10dF8F84BbC3C89881A929B0c6F47", + 1, + [ + "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" + ] + ] + ] +}