diff --git a/simulations/vip-577/abi/ERC20.json b/simulations/vip-577/abi/ERC20.json new file mode 100644 index 000000000..3a509c9c4 --- /dev/null +++ b/simulations/vip-577/abi/ERC20.json @@ -0,0 +1,134 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-577/abi/comptroller.json b/simulations/vip-577/abi/comptroller.json new file mode 100644 index 000000000..d1801efd8 --- /dev/null +++ b/simulations/vip-577/abi/comptroller.json @@ -0,0 +1,2121 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "poolRegistry_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum Action", + "name": "action", + "type": "uint8" + } + ], + "name": "ActionPaused", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowActionNotPaused", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "name": "BorrowCapExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowCapIsNotZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expectedLessThanOrEqualTo", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "CollateralExceedsThreshold", + "type": "error" + }, + { + "inputs": [], + "name": "CollateralFactorIsNotZero", + "type": "error" + }, + { + "inputs": [], + "name": "ComptrollerMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "DelegationStatusUnchanged", + "type": "error" + }, + { + "inputs": [], + "name": "EnterMarketActionNotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "ExitMarketActionNotPaused", + "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": [], + "name": "LiquidateActionNotPaused", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketAlreadyListed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "MarketNotCollateral", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expectedGreaterThan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "MinimalCollateralViolated", + "type": "error" + }, + { + "inputs": [], + "name": "MintActionNotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "NonzeroBorrowBalance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "PriceError", + "type": "error" + }, + { + "inputs": [], + "name": "RedeemActionNotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "RepayActionNotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "SeizeActionNotPaused", + "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": "SupplyCapIsNotZero", + "type": "error" + }, + { + "inputs": [], + "name": "TooMuchRepay", + "type": "error" + }, + { + "inputs": [], + "name": "TransferActionNotPaused", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "expectedSender", + "type": "address" + }, + { + "internalType": "address", + "name": "actualSender", + "type": "address" + } + ], + "name": "UnexpectedSender", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum Action", + "name": "action", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPausedMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "approver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "DelegateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "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": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketSupported", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketUnlisted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationIncentiveMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationIncentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidationThresholdMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidationThresholdMantissa", + "type": "uint256" + } + ], + "name": "NewLiquidationThreshold", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMinLiquidatableCollateral", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinLiquidatableCollateral", + "type": "uint256" + } + ], + "name": "NewMinLiquidatableCollateral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "oldPriceOracle", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ResilientOracleInterface", + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": 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": "address", + "name": "rewardsDistributor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardToken", + "type": "address" + } + ], + "name": "NewRewardsDistributor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSupplyCap", + "type": "uint256" + } + ], + "name": "NewSupplyCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum 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" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedDelegates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowVerify", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "checkMembership", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "enterMarkets", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenAddress", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllMarkets", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAssetsIn", + "outputs": [ + { + "internalType": "contract VToken[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getBorrowingPower", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenModify", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "getHypotheticalAccountLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardDistributors", + "outputs": [ + { + "internalType": "contract RewardsDistributor[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "getRewardsByMarket", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "supplySpeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowSpeed", + "type": "uint256" + } + ], + "internalType": "struct ComptrollerStorage.RewardSpeeds[]", + "name": "rewardSpeeds", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "healAccount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "accessControlManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isComptroller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabled", + "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": "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": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "uint256", + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensToSeize", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationIncentiveMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "bool", + "name": "isListed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "collateralFactorMantissa", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationThresholdMantissa", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minLiquidatableCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "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": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract ResilientOracleInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "preBorrowHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "skipLiquidityCheck", + "type": "bool" + } + ], + "name": "preLiquidateHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "preMintHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "preRedeemHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "preRepayHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "address", + "name": "seizerContract", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "preSeizeHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "preTransferHook", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "prime", + "outputs": [ + { + "internalType": "contract IPrime", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "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": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "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": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "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": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "marketsList", + "type": "address[]" + }, + { + "internalType": "enum 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": "address", + "name": "vTokenBorrowed", + "type": "address" + }, + { + "internalType": "bool", + "name": "enable", + "type": "bool" + } + ], + "name": "setForcedLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidationIncentiveMantissa", + "type": "uint256" + } + ], + "name": "setLiquidationIncentive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "setMarketBorrowCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newSupplyCaps", + "type": "uint256[]" + } + ], + "name": "setMarketSupplyCaps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinLiquidatableCollateral", + "type": "uint256" + } + ], + "name": "setMinLiquidatableCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ResilientOracleInterface", + "name": "newOracle", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPrime", + "name": "_prime", + "type": "address" + } + ], + "name": "setPrimeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + } + ], + "name": "supportMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferVerify", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "unlistMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "updateDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "updatePrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-577/abi/prime.json b/simulations/vip-577/abi/prime.json new file mode 100644 index 000000000..e8bfa99ff --- /dev/null +++ b/simulations/vip-577/abi/prime.json @@ -0,0 +1,763 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_wrappedNativeToken", "type": "address" }, + { "internalType": "address", "name": "_nativeMarket", "type": "address" }, + { "internalType": "uint256", "name": "_blocksPerYear", "type": "uint256" }, + { "internalType": "uint256", "name": "_stakingPeriod", "type": "uint256" }, + { "internalType": "uint256", "name": "_minimumStakedXVS", "type": "uint256" }, + { "internalType": "uint256", "name": "_maximumXVSCap", "type": "uint256" }, + { "internalType": "bool", "name": "_timeBased", "type": "bool" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "AssetAlreadyExists", "type": "error" }, + { "inputs": [{ "internalType": "int256", "name": "x", "type": "int256" }], "name": "ExpTooLarge", "type": "error" }, + { "inputs": [], "name": "IneligibleToClaim", "type": "error" }, + { "inputs": [], "name": "InvalidAddress", "type": "error" }, + { "inputs": [], "name": "InvalidAlphaArguments", "type": "error" }, + { "inputs": [], "name": "InvalidBlocksPerYear", "type": "error" }, + { "inputs": [], "name": "InvalidComptroller", "type": "error" }, + { "inputs": [], "name": "InvalidFixedPoint", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "n", "type": "uint256" }, + { "internalType": "uint256", "name": "d", "type": "uint256" } + ], + "name": "InvalidFraction", + "type": "error" + }, + { "inputs": [], "name": "InvalidLength", "type": "error" }, + { "inputs": [], "name": "InvalidLimit", "type": "error" }, + { "inputs": [], "name": "InvalidTimeBasedConfiguration", "type": "error" }, + { "inputs": [], "name": "InvalidTimestamp", "type": "error" }, + { "inputs": [], "name": "InvalidVToken", "type": "error" }, + { + "inputs": [{ "internalType": "int256", "name": "x", "type": "int256" }], + "name": "LnNonRealResult", + "type": "error" + }, + { "inputs": [{ "internalType": "int256", "name": "x", "type": "int256" }], "name": "LnTooLarge", "type": "error" }, + { "inputs": [], "name": "MarketAlreadyExists", "type": "error" }, + { "inputs": [], "name": "MarketNotSupported", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "loopsLimit", "type": "uint256" }, + { "internalType": "uint256", "name": "requiredLoops", "type": "uint256" } + ], + "name": "MaxLoopsLimitExceeded", + "type": "error" + }, + { "inputs": [], "name": "NoScoreUpdatesRequired", "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": "UserHasNoPrimeToken", "type": "error" }, + { "inputs": [], "name": "WaitMoreTime", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint128", "name": "oldNumerator", "type": "uint128" }, + { "indexed": true, "internalType": "uint128", "name": "oldDenominator", "type": "uint128" }, + { "indexed": true, "internalType": "uint128", "name": "newNumerator", "type": "uint128" }, + { "indexed": false, "internalType": "uint128", "name": "newDenominator", "type": "uint128" } + ], + "name": "AlphaUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "market", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "InterestClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "comptroller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "market", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "supplyMultiplier", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "borrowMultiplier", "type": "uint256" } + ], + "name": "MarketAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMaxLoopsLimit", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newmaxLoopsLimit", "type": "uint256" } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "isIrrevocable", "type": "bool" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "oldIrrevocableLimit", "type": "uint256" }, + { "indexed": true, "internalType": "uint256", "name": "oldRevocableLimit", "type": "uint256" }, + { "indexed": true, "internalType": "uint256", "name": "newIrrevocableLimit", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newRevocableLimit", "type": "uint256" } + ], + "name": "MintLimitsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "market", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "oldSupplyMultiplier", "type": "uint256" }, + { "indexed": true, "internalType": "uint256", "name": "oldBorrowMultiplier", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newSupplyMultiplier", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newBorrowMultiplier", "type": "uint256" } + ], + "name": "MultiplierUpdated", + "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": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" } + ], + "name": "StakedAtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }], + "name": "TokenUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }], + "name": "UserScoreUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "MAXIMUM_XVS_CAP", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINIMUM_STAKED_XVS", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NATIVE_MARKET", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_PERIOD", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WRAPPED_NATIVE_TOKEN", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "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": "vToken", "type": "address" }], + "name": "accrueInterest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "address", "name": "market", "type": "address" } + ], + "name": "accrueInterestAndUpdateScore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "comptroller", "type": "address" }, + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "uint256", "name": "supplyMultiplier", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowMultiplier", "type": "uint256" } + ], + "name": "addMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "alphaDenominator", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alphaNumerator", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "blocksOrSecondsPerYear", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "calculateAPR", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "supplyAPR", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAPR", "type": "uint256" }, + { "internalType": "uint256", "name": "totalScore", "type": "uint256" }, + { "internalType": "uint256", "name": "userScore", "type": "uint256" }, + { "internalType": "uint256", "name": "xvsBalanceForScore", "type": "uint256" }, + { "internalType": "uint256", "name": "capital", "type": "uint256" }, + { "internalType": "uint256", "name": "cappedSupply", "type": "uint256" }, + { "internalType": "uint256", "name": "cappedBorrow", "type": "uint256" }, + { "internalType": "uint256", "name": "supplyCapUSD", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowCapUSD", "type": "uint256" } + ], + "internalType": "struct IPrime.APRInfo", + "name": "aprInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "claim", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "claimInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "claimInterest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "claimTimeRemaining", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptroller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "borrow", "type": "uint256" }, + { "internalType": "uint256", "name": "supply", "type": "uint256" }, + { "internalType": "uint256", "name": "xvsStaked", "type": "uint256" } + ], + "name": "estimateAPR", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "supplyAPR", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowAPR", "type": "uint256" }, + { "internalType": "uint256", "name": "totalScore", "type": "uint256" }, + { "internalType": "uint256", "name": "userScore", "type": "uint256" }, + { "internalType": "uint256", "name": "xvsBalanceForScore", "type": "uint256" }, + { "internalType": "uint256", "name": "capital", "type": "uint256" }, + { "internalType": "uint256", "name": "cappedSupply", "type": "uint256" }, + { "internalType": "uint256", "name": "cappedBorrow", "type": "uint256" }, + { "internalType": "uint256", "name": "supplyCapUSD", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowCapUSD", "type": "uint256" } + ], + "internalType": "struct IPrime.APRInfo", + "name": "aprInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllMarkets", + "outputs": [{ "internalType": "address[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBlockNumberOrTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getInterestAccrued", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "getPendingRewards", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "vToken", "type": "address" }, + { "internalType": "address", "name": "rewardToken", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "internalType": "struct PrimeStorageV1.PendingReward[]", + "name": "pendingRewards", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "incomeDistributionYearly", + "outputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "xvsVault_", "type": "address" }, + { "internalType": "address", "name": "xvsVaultRewardToken_", "type": "address" }, + { "internalType": "uint256", "name": "xvsVaultPoolId_", "type": "uint256" }, + { "internalType": "uint128", "name": "alphaNumerator_", "type": "uint128" }, + { "internalType": "uint128", "name": "alphaDenominator_", "type": "uint128" }, + { "internalType": "address", "name": "accessControlManager_", "type": "address" }, + { "internalType": "address", "name": "primeLiquidityProvider_", "type": "address" }, + { "internalType": "address", "name": "comptroller_", "type": "address" }, + { "internalType": "address", "name": "oracle_", "type": "address" }, + { "internalType": "uint256", "name": "loopsLimit_", "type": "uint256" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "poolRegistry_", "type": "address" }], + "name": "initializeV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "interests", + "outputs": [ + { "internalType": "uint256", "name": "accrued", "type": "uint256" }, + { "internalType": "uint256", "name": "score", "type": "uint256" }, + { "internalType": "uint256", "name": "rewardIndex", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "irrevocableLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "isScoreUpdated", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isTimeBased", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "isUserPrimeHolder", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bool", "name": "isIrrevocable", "type": "bool" }, + { "internalType": "address[]", "name": "users", "type": "address[]" } + ], + "name": "issue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "markets", + "outputs": [ + { "internalType": "uint256", "name": "supplyMultiplier", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowMultiplier", "type": "uint256" }, + { "internalType": "uint256", "name": "rewardIndex", "type": "uint256" }, + { "internalType": "uint256", "name": "sumOfMembersScore", "type": "uint256" }, + { "internalType": "bool", "name": "exists", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextScoreUpdateRoundId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [{ "internalType": "contract ResilientOracleInterface", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "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": [], + "name": "pendingScoreUpdates", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolRegistry", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "primeLiquidityProvider", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "revocableLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_irrevocableLimit", "type": "uint256" }, + { "internalType": "uint256", "name": "_revocableLimit", "type": "uint256" } + ], + "name": "setLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "loopsLimit", "type": "uint256" }], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "users", "type": "address[]" }, + { "internalType": "uint256[]", "name": "timestamps", "type": "uint256[]" } + ], + "name": "setStakedAt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "stakedAt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "togglePause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "tokens", + "outputs": [ + { "internalType": "bool", "name": "exists", "type": "bool" }, + { "internalType": "bool", "name": "isIrrevocable", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalIrrevocable", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalRevocable", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalScoreUpdatesRequired", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "unreleasedPLPIncome", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "_alphaNumerator", "type": "uint128" }, + { "internalType": "uint128", "name": "_alphaDenominator", "type": "uint128" } + ], + "name": "updateAlpha", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "market", "type": "address" }, + { "internalType": "uint256", "name": "supplyMultiplier", "type": "uint256" }, + { "internalType": "uint256", "name": "borrowMultiplier", "type": "uint256" } + ], + "name": "updateMultipliers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address[]", "name": "users", "type": "address[]" }], + "name": "updateScores", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "vTokenForAsset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], + "name": "xvsUpdated", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "xvsVault", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "xvsVaultPoolId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "xvsVaultRewardToken", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-577/abi/rewardsDistributor.json b/simulations/vip-577/abi/rewardsDistributor.json new file mode 100644 index 000000000..613cdee38 --- /dev/null +++ b/simulations/vip-577/abi/rewardsDistributor.json @@ -0,0 +1,990 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "loopsLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requiredLoops", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitExceeded", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "newBlock", + "type": "uint32" + } + ], + "name": "BorrowLastRewardingBlockUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "contributor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "ContributorRewardTokenSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "contributor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardAccrued", + "type": "uint256" + } + ], + "name": "ContributorRewardsUpdated", + "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": "rewardTokenDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardTokenTotal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardTokenBorrowIndex", + "type": "uint256" + } + ], + "name": "DistributedBorrowerRewardToken", + "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": "rewardTokenDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardTokenTotal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardTokenSupplyIndex", + "type": "uint256" + } + ], + "name": "DistributedSupplierRewardToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxLoopsLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newmaxLoopsLimit", + "type": "uint256" + } + ], + "name": "MaxLoopsLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "mantissa", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ExponentialNoError.Exp", + "name": "marketBorrowIndex", + "type": "tuple" + } + ], + "name": "RewardTokenBorrowIndexUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "RewardTokenBorrowSpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardTokenGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "RewardTokenSupplyIndexUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSpeed", + "type": "uint256" + } + ], + "name": "RewardTokenSupplySpeedUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "newBlock", + "type": "uint32" + } + ], + "name": "SupplyLastRewardingBlockUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "INITIAL_INDEX", + "outputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "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": "holder", + "type": "address" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + } + ], + "name": "claimRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "claimRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "mantissa", + "type": "uint256" + } + ], + "internalType": "struct ExponentialNoError.Exp", + "name": "marketBorrowIndex", + "type": "tuple" + } + ], + "name": "distributeBorrowerRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "internalType": "address", + "name": "supplier", + "type": "address" + } + ], + "name": "distributeSupplierRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "grantRewardToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Comptroller", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "rewardToken_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "loopsLimit_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "initializeMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "lastContributorBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLoopsLimit", + "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": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenBorrowSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastRewardingBlock", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenContributorSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenSupplySpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastRewardingBlock", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contributor", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rewardTokenSpeed", + "type": "uint256" + } + ], + "name": "setContributorRewardTokenSpeed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "supplyLastRewardingBlocks", + "type": "uint32[]" + }, + { + "internalType": "uint32[]", + "name": "borrowLastRewardingBlocks", + "type": "uint32[]" + } + ], + "name": "setLastRewardingBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "setMaxLoopsLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "supplySpeeds", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "borrowSpeeds", + "type": "uint256[]" + } + ], + "name": "setRewardTokenSpeeds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contributor", + "type": "address" + } + ], + "name": "updateContributorRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "mantissa", + "type": "uint256" + } + ], + "internalType": "struct ExponentialNoError.Exp", + "name": "marketBorrowIndex", + "type": "tuple" + } + ], + "name": "updateRewardTokenBorrowIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "updateRewardTokenSupplyIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-577/abi/vtoken.json b/simulations/vip-577/abi/vtoken.json new file mode 100644 index 000000000..1ce01e4a8 --- /dev/null +++ b/simulations/vip-577/abi/vtoken.json @@ -0,0 +1,2066 @@ +[ + { + "inputs": [ + { + "internalType": "bool", + "name": "timeBased_", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "blocksPerYear_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowRateMantissa_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "actualAddAmount", + "type": "uint256" + } + ], + "name": "AddReservesFactorFreshCheck", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowCashNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowFreshnessCheck", + "type": "error" + }, + { + "inputs": [], + "name": "DelegateNotApproved", + "type": "error" + }, + { + "inputs": [], + "name": "ForceLiquidateBorrowUnauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "HealBorrowUnauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBlocksPerYear", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTimeBasedConfiguration", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "LiquidateAccrueCollateralInterestFailed", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidateCloseAmountIsUintMax", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidateCloseAmountIsZero", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidateCollateralFreshnessCheck", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidateFreshnessCheck", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidateLiquidatorIsBorrower", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidateSeizeLiquidatorIsBorrower", + "type": "error" + }, + { + "inputs": [], + "name": "MintFreshnessCheck", + "type": "error" + }, + { + "inputs": [], + "name": "ProtocolSeizeShareTooBig", + "type": "error" + }, + { + "inputs": [], + "name": "RedeemFreshnessCheck", + "type": "error" + }, + { + "inputs": [], + "name": "RedeemTransferOutNotPossible", + "type": "error" + }, + { + "inputs": [], + "name": "ReduceReservesCashNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ReduceReservesCashValidation", + "type": "error" + }, + { + "inputs": [], + "name": "ReduceReservesFreshCheck", + "type": "error" + }, + { + "inputs": [], + "name": "RepayBorrowFreshnessCheck", + "type": "error" + }, + { + "inputs": [], + "name": "SetInterestRateModelFreshCheck", + "type": "error" + }, + { + "inputs": [], + "name": "SetReserveFactorBoundsCheck", + "type": "error" + }, + { + "inputs": [], + "name": "SetReserveFactorFreshCheck", + "type": "error" + }, + { + "inputs": [], + "name": "TransferNotAllowed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "calledContract", + "type": "address" + }, + { + "internalType": "string", + "name": "methodSignature", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "cashPrior", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "interestAccumulated", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtOld", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtNew", + "type": "uint256" + } + ], + "name": "BadDebtIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtOld", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtNew", + "type": "uint256" + } + ], + "name": "BadDebtRecovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "HealBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "vTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBalance", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAccessControlManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAccessControlManager", + "type": "address" + } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract ComptrollerInterface", + "name": "oldComptroller", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract ComptrollerInterface", + "name": "newComptroller", + "type": "address" + } + ], + "name": "NewComptroller", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract InterestRateModel", + "name": "oldInterestRateModel", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "NewMarketInterestRateModel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldProtocolSeizeShareMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newProtocolSeizeShareMantissa", + "type": "uint256" + } + ], + "name": "NewProtocolSeizeShare", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldProtocolShareReserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newProtocolShareReserve", + "type": "address" + } + ], + "name": "NewProtocolShareReserve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReduceReservesBlockOrTimestampDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReduceReservesBlockOrTimestampDelta", + "type": "uint256" + } + ], + "name": "NewReduceReservesBlockDelta", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldShortfall", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newShortfall", + "type": "address" + } + ], + "name": "NewShortfallContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ProtocolSeize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBalance", + "type": "uint256" + } + ], + "name": "Redeem", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "protocolShareReserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "SpreadReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SweepToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "NO_ERROR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } + ], + "name": "addReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "badDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "recoveredAmount_", + "type": "uint256" + } + ], + "name": "badDebtRecovered", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "blocksOrSecondsPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptroller", + "outputs": [ + { + "internalType": "contract ComptrollerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", + "name": "vTokenCollateral", + "type": "address" + }, + { + "internalType": "bool", + "name": "skipLiquidityCheck", + "type": "bool" + } + ], + "name": "forceLiquidateBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vTokenBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exchangeRate", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBlockNumberOrTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "healBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "underlying_", + "type": "address" + }, + { + "internalType": "contract ComptrollerInterface", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "contract InterestRateModel", + "name": "interestRateModel_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "decimals_", + "type": "uint8" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "shortfall", + "type": "address" + }, + { + "internalType": "address payable", + "name": "protocolShareReserve", + "type": "address" + } + ], + "internalType": "struct VTokenInterface.RiskManagementInit", + "name": "riskManagement", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "reserveFactorMantissa_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "internalType": "contract InterestRateModel", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isTimeBased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isVToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "contract VTokenInterface", + "name": "vTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mintBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolSeizeShareMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolShareReserve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "redeemer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlyingBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "reduceReserves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reduceReservesBlockDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reduceReservesBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrowBehalf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract InterestRateModel", + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "setInterestRateModel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newProtocolSeizeShareMantissa_", + "type": "uint256" + } + ], + "name": "setProtocolSeizeShare", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "protocolShareReserve_", + "type": "address" + } + ], + "name": "setProtocolShareReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newReduceReservesBlockOrTimestampDelta", + "type": "uint256" + } + ], + "name": "setReduceReservesBlockDelta", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "setReserveFactor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "shortfall_", + "type": "address" + } + ], + "name": "setShortfallContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shortfall", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + } + ], + "name": "sweepToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-577/arbitrumone.ts b/simulations/vip-577/arbitrumone.ts new file mode 100644 index 000000000..bf327c8e1 --- /dev/null +++ b/simulations/vip-577/arbitrumone.ts @@ -0,0 +1,235 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { expectEvents } from "src/utils"; +import { forking, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vip577, { + ADDRESS_DATA, + Actions, + PRIME_CONTRACT_ADDRESS, + VWETH_MARKET_ADDRESS, +} from "../../vips/vip-577/bscmainnet"; +import COMPTROLLER_ABI from "./abi/comptroller.json"; +import PRIME_ABI from "./abi/prime.json"; +import REWARDS_DISTRIBUTOR_ABI from "./abi/rewardsDistributor.json"; +import VTOKEN_ABI from "./abi/vtoken.json"; + +const provider = ethers.provider; +const arbitrumPools = ADDRESS_DATA.arbitrumone.pools; + +forking(411152865, async () => { + describe("Pre-VIP behavior", async () => { + for (const pool of arbitrumPools) { + describe(`${pool.name} Pool`, () => { + let comptroller: Contract; + + before(async () => { + comptroller = new ethers.Contract(pool.comptroller, COMPTROLLER_ABI, provider); + }); + + it("Check MINT pause state matches data", async () => { + for (const market of pool.markets) { + const isPaused = await comptroller.actionPaused(market.address, Actions.MINT); + expect(isPaused).to.be.equal(market.isMintActionPaused); + } + }); + + it("Check BORROW pause state matches data", async () => { + for (const market of pool.markets) { + const isPaused = await comptroller.actionPaused(market.address, Actions.BORROW); + expect(isPaused).to.be.equal(market.isBorrowActionPaused); + } + }); + + it("Check collateral factors match data", async () => { + for (const market of pool.markets) { + const marketData = await comptroller.markets(market.address); + expect(marketData.collateralFactorMantissa.toString()).to.be.equal(market.collateralFactor); + } + }); + + it("Check supply caps match data", async () => { + for (const market of pool.markets) { + const supplyCap = await comptroller.supplyCaps(market.address); + expect(supplyCap.toString()).to.be.equal(market.supplyCap); + } + }); + + it("Check borrow caps match data", async () => { + for (const market of pool.markets) { + const borrowCap = await comptroller.borrowCaps(market.address); + expect(borrowCap.toString()).to.be.equal(market.borrowCap); + } + }); + }); + } + + it("Check Prime multipliers for vWETH_LiquidStakedETH are greater than zero", async () => { + const prime = new ethers.Contract(PRIME_CONTRACT_ADDRESS.arbitrumone, PRIME_ABI, provider); + const marketData = await prime.markets(VWETH_MARKET_ADDRESS.arbitrumone); + + expect(marketData.supplyMultiplier).to.be.greaterThan(0); + expect(marketData.borrowMultiplier).to.be.greaterThan(0); + }); + }); + + testForkedNetworkVipCommands("VIP-577 Arbitrum One", await vip577(), { + callbackAfterExecution: async txResponse => { + const totals = ADDRESS_DATA.arbitrumone.totals!; + const totalActionPausedEvents = totals.totalMintPaused + totals.totalBorrowPaused; + + await expectEvents( + txResponse, + [COMPTROLLER_ABI, REWARDS_DISTRIBUTOR_ABI, PRIME_ABI], + [ + "NewSupplyCap", + "NewBorrowCap", + "ActionPausedMarket", + "NewCollateralFactor", + "RewardTokenSupplySpeedUpdated", + "RewardTokenBorrowSpeedUpdated", + "MultiplierUpdated", + ], + [ + totals.totalSupplyCap, + totals.totalBorrowCap, + totalActionPausedEvents, + totals.totalCollateralFactor, + totals.totalSupplySpeed, + totals.totalBorrowSpeed, + 1, // One MultiplierUpdated event for vWETH_LiquidStakedETH + ], + ); + }, + }); + + describe("Post-VIP behavior", async () => { + for (const pool of arbitrumPools) { + describe(`${pool.name} Pool`, () => { + let comptroller: Contract; + + before(async () => { + comptroller = new ethers.Contract(pool.comptroller, COMPTROLLER_ABI, provider); + }); + + it("Check all markets have CF set to zero, LT preserved", async () => { + for (const market of pool.markets) { + const marketData = await comptroller.markets(market.address); + expect(marketData.collateralFactorMantissa.toString()).to.be.equal("0"); + expect(marketData.liquidationThresholdMantissa.toString()).to.be.equal(market.liquidationThreshold); + } + }); + + it("Check MINT is paused for markets", async () => { + for (const market of pool.markets) { + const mintPaused = await comptroller.actionPaused(market.address, Actions.MINT); + expect(mintPaused).to.be.true; + } + }); + + it("Check BORROW is paused for markets", async () => { + for (const market of pool.markets) { + const borrowPaused = await comptroller.actionPaused(market.address, Actions.BORROW); + expect(borrowPaused).to.be.true; + } + }); + + it("Check supply caps are zero for markets", async () => { + for (const market of pool.markets) { + const supplyCap = await comptroller.supplyCaps(market.address); + expect(supplyCap).to.be.equal(0); + } + }); + + it("Check borrow caps are zero for markets", async () => { + for (const market of pool.markets) { + const borrowCap = await comptroller.borrowCaps(market.address); + expect(borrowCap).to.be.equal(0); + } + }); + }); + } + + it("Check reward speeds are set to zero for all markets", async () => { + for (const pool of arbitrumPools) { + for (const rd of pool.rewardDistributor) { + const rewardsDistributor = new ethers.Contract(rd.address, REWARDS_DISTRIBUTOR_ABI, provider); + + for (const market of pool.markets) { + const supplySpeed = await rewardsDistributor.rewardTokenSupplySpeeds(market.address); + const borrowSpeed = await rewardsDistributor.rewardTokenBorrowSpeeds(market.address); + + expect(supplySpeed).to.equal(0); + expect(borrowSpeed).to.equal(0); + } + } + } + }); + + it("Users should be able to claim rewards", async () => { + const holder = "0x8e6973e8b89adf1e16e5DB628ff7F84ef92c7039"; + const [signer] = await ethers.getSigners(); + + const distributor = await ethers.getContractAt( + REWARDS_DISTRIBUTOR_ABI, + "0x6204Bae72dE568384Ca4dA91735dc343a0C7bD6D", + signer, + ); + + const accruedBefore = await distributor.rewardTokenAccrued(holder); + await distributor["claimRewardToken(address)"](holder); + const accruedAfter = await distributor.rewardTokenAccrued(holder); + + expect(accruedAfter).to.be.lessThanOrEqual(accruedBefore); + }); + + it("Check Prime multipliers for vWETH_LiquidStakedETH are set to zero", async () => { + const prime = new ethers.Contract(PRIME_CONTRACT_ADDRESS.arbitrumone, PRIME_ABI, provider); + const marketData = await prime.markets(VWETH_MARKET_ADDRESS.arbitrumone); + + expect(marketData.supplyMultiplier).to.be.equal(0); + expect(marketData.borrowMultiplier).to.be.equal(0); + }); + }); + + describe("Critical Operations After Market Pause", async () => { + const WETH_MARKET = "0x39D6d13Ea59548637104E40e729E4aABE27FE106"; // vWETH_LiquidStakedETH + const COMPTROLLER = "0x52bAB1aF7Ff770551BD05b9FC2329a0Bf5E23F16"; // LiquidStakedETH Pool + + let vToken: Contract; + + before(async () => { + vToken = new ethers.Contract(WETH_MARKET, VTOKEN_ABI, provider); + }); + + it("Users can withdraw their supplied assets", async () => { + // Check if withdrawal is allowed (REDEEM not paused) + const comptroller = new ethers.Contract(COMPTROLLER, COMPTROLLER_ABI, provider); + const redeemPaused = await comptroller.actionPaused(WETH_MARKET, Actions.REDEEM); + expect(redeemPaused).to.be.false; + + // Use the specific address that minted vWETH + const supplierAddress = "0x7A6a943EA0AeDf91DfCb9984E1AB4963B2Ad906B"; + + let supplier = null; + const balance = await vToken.balanceOf(supplierAddress); + if (balance.gt(0)) { + await ethers.provider.send("hardhat_impersonateAccount", [supplierAddress]); + await ethers.provider.send("hardhat_setBalance", [supplierAddress, "0x1000000000000000000"]); + supplier = ethers.provider.getSigner(supplierAddress); + } + + if (supplier) { + const supplierAddress = await supplier.getAddress(); + const initialBalance = await vToken.balanceOf(supplierAddress); + const redeemAmount = initialBalance.div(10); + + await vToken.connect(supplier).redeem(redeemAmount); + + const finalBalance = await vToken.balanceOf(supplierAddress); + expect(finalBalance).to.be.lt(initialBalance); + } + }); + }); +}); diff --git a/simulations/vip-577/bscmainnet.ts b/simulations/vip-577/bscmainnet.ts new file mode 100644 index 000000000..375d9ccef --- /dev/null +++ b/simulations/vip-577/bscmainnet.ts @@ -0,0 +1,243 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { expectEvents } from "src/utils"; +import { forking, testVip } from "src/vip-framework"; + +import vip577, { ADDRESS_DATA, Actions } from "../../vips/vip-577/bscmainnet"; +import VTOKEN_ABI from "../vip-778/abi/vtoken.json"; +import ERC20_ABI from "./abi/ERC20.json"; +import COMPTROLLER_ABI from "./abi/comptroller.json"; +import REWARDS_DISTRIBUTOR_ABI from "./abi/rewardsDistributor.json"; + +const provider = ethers.provider; + +forking(71819752, async () => { + const bscPools = ADDRESS_DATA.bscmainnet.pools; + + describe("Pre-VIP behavior", async () => { + for (const pool of bscPools) { + describe(`${pool.name} Pool`, () => { + let comptroller: Contract; + + before(async () => { + comptroller = new ethers.Contract(pool.comptroller, COMPTROLLER_ABI, provider); + }); + + it("Check MINT pause state matches data", async () => { + for (const market of pool.markets) { + const isPaused = await comptroller.actionPaused(market.address, Actions.MINT); + expect(isPaused).to.be.equal(market.isMintActionPaused); + } + }); + + it("Check BORROW pause state matches data", async () => { + for (const market of pool.markets) { + const isPaused = await comptroller.actionPaused(market.address, Actions.BORROW); + expect(isPaused).to.be.equal(market.isBorrowActionPaused); + } + }); + + it("Check collateral factors match data", async () => { + for (const market of pool.markets) { + const marketData = await comptroller.markets(market.address); + expect(marketData.collateralFactorMantissa.toString()).to.be.equal(market.collateralFactor); + } + }); + + it("Check supply caps match data", async () => { + for (const market of pool.markets) { + const supplyCap = await comptroller.supplyCaps(market.address); + expect(supplyCap.toString()).to.be.equal(market.supplyCap); + } + }); + + it("Check borrow caps match data", async () => { + for (const market of pool.markets) { + const borrowCap = await comptroller.borrowCaps(market.address); + expect(borrowCap.toString()).to.be.equal(market.borrowCap); + } + }); + }); + } + }); + + testVip("VIP-577 BNB Chain", await vip577(), { + callbackAfterExecution: async txResponse => { + const totals = ADDRESS_DATA.bscmainnet.totals!; + const totalActionPausedEvents = totals.totalMintPaused + totals.totalBorrowPaused; + + await expectEvents( + txResponse, + [COMPTROLLER_ABI, REWARDS_DISTRIBUTOR_ABI], + [ + "NewSupplyCap", + "NewBorrowCap", + "ActionPausedMarket", + "NewCollateralFactor", + "RewardTokenSupplySpeedUpdated", + "RewardTokenBorrowSpeedUpdated", + ], + [ + totals.totalSupplyCap, + totals.totalBorrowCap, + totalActionPausedEvents, + totals.totalCollateralFactor, + totals.totalSupplySpeed, + totals.totalBorrowSpeed, + ], + ); + }, + }); + + describe("Post-VIP behavior", async () => { + for (const pool of bscPools) { + describe(`${pool.name} Pool`, () => { + let comptroller: Contract; + + before(async () => { + comptroller = new ethers.Contract(pool.comptroller, COMPTROLLER_ABI, provider); + }); + + it("Check all markets have CF set to zero, LT preserved", async () => { + for (const market of pool.markets) { + const marketData = await comptroller.markets(market.address); + expect(marketData.collateralFactorMantissa.toString()).to.be.equal("0"); + expect(marketData.liquidationThresholdMantissa.toString()).to.be.equal(market.liquidationThreshold); + } + }); + + it("Check MINT is paused for markets", async () => { + for (const market of pool.markets) { + const mintPaused = await comptroller.actionPaused(market.address, Actions.MINT); + expect(mintPaused).to.be.true; + } + }); + + it("Check BORROW is paused for markets", async () => { + for (const market of pool.markets) { + const borrowPaused = await comptroller.actionPaused(market.address, Actions.BORROW); + expect(borrowPaused).to.be.true; + } + }); + + it("Check supply caps are zero for markets", async () => { + for (const market of pool.markets) { + const supplyCap = await comptroller.supplyCaps(market.address); + expect(supplyCap).to.be.equal(0); + } + }); + + it("Check borrow caps are zero for markets", async () => { + for (const market of pool.markets) { + const borrowCap = await comptroller.borrowCaps(market.address); + expect(borrowCap).to.be.equal(0); + } + }); + }); + } + + it("Check reward speeds are set to zero for all markets", async () => { + for (const pool of bscPools) { + for (const rd of pool.rewardDistributor) { + const rewardsDistributor = new ethers.Contract(rd.address, REWARDS_DISTRIBUTOR_ABI, provider); + + for (const market of pool.markets) { + const supplySpeed = await rewardsDistributor.rewardTokenSupplySpeeds(market.address); + const borrowSpeed = await rewardsDistributor.rewardTokenBorrowSpeeds(market.address); + + expect(supplySpeed).to.equal(0); + expect(borrowSpeed).to.equal(0); + } + } + } + }); + }); + + describe("Critical Operations After Market Pause", async () => { + const USDT_MARKET = "0x1D8bBDE12B6b34140604E18e9f9c6e14deC16854"; // vUSDT_DeFi + const USDT_TOKEN = "0x55d398326f99059fF775485246999027B3197955"; + + let vToken: Contract; + let usdtToken: Contract; + + before(async () => { + vToken = new ethers.Contract(USDT_MARKET, VTOKEN_ABI, provider); + usdtToken = new ethers.Contract(USDT_TOKEN, ERC20_ABI, provider); + }); + + it("Users can withdraw their supplied assets", async () => { + // Find a user with vToken balance + const filter = vToken.filters.Transfer(null, null); + const events = await vToken.queryFilter(filter, -500, "latest"); + + let supplier = null; + for (const event of events.reverse()) { + if (event.args?.to && event.args.to !== ethers.constants.AddressZero) { + const balance = await vToken.balanceOf(event.args.to); + if (balance.gt(0)) { + await ethers.provider.send("hardhat_impersonateAccount", [event.args.to]); + await ethers.provider.send("hardhat_setBalance", [event.args.to, "0x1000000000000000000"]); + supplier = ethers.provider.getSigner(event.args.to); + break; + } + } + } + + if (supplier) { + const initialBalance = await vToken.balanceOf(await supplier.getAddress()); + const redeemAmount = initialBalance.div(10); + + await vToken.connect(supplier).redeem(redeemAmount); + + const finalBalance = await vToken.balanceOf(await supplier.getAddress()); + expect(finalBalance).to.be.lt(initialBalance); + } + }); + + it("Users can repay their borrows", async () => { + // Find a user with borrow balance + const filter = vToken.filters.Borrow(); + const events = await vToken.queryFilter(filter, -500, "latest"); + + let borrower = null; + for (const event of events.reverse()) { + if (event.args?.borrower) { + const borrowBalance = await vToken.borrowBalanceStored(event.args.borrower); + if (borrowBalance.gt(0)) { + await ethers.provider.send("hardhat_impersonateAccount", [event.args.borrower]); + await ethers.provider.send("hardhat_setBalance", [event.args.borrower, "0x1000000000000000000"]); + borrower = ethers.provider.getSigner(event.args.borrower); + + // Fund with USDT from a whale + const usdtFilter = usdtToken.filters.Transfer(); + const usdtEvents = await usdtToken.queryFilter(usdtFilter, -200, "latest"); + for (const usdtEvent of usdtEvents.reverse()) { + if (usdtEvent.args?.to) { + const balance = await usdtToken.balanceOf(usdtEvent.args.to); + if (balance.gt(ethers.utils.parseUnits("1000", 18))) { + await ethers.provider.send("hardhat_impersonateAccount", [usdtEvent.args.to]); + const whale = ethers.provider.getSigner(usdtEvent.args.to); + await usdtToken.connect(whale).transfer(event.args.borrower, ethers.utils.parseUnits("100", 18)); + break; + } + } + } + break; + } + } + } + + if (borrower) { + const initialBorrow = await vToken.borrowBalanceStored(await borrower.getAddress()); + const repayAmount = ethers.utils.parseUnits("1", 18); + + await usdtToken.connect(borrower).approve(USDT_MARKET, repayAmount); + await vToken.connect(borrower).repayBorrow(repayAmount); + + const finalBorrow = await vToken.borrowBalanceStored(await borrower.getAddress()); + expect(finalBorrow).to.be.lt(initialBorrow); + } + }); + }); +}); diff --git a/simulations/vip-577/ethereum.ts b/simulations/vip-577/ethereum.ts new file mode 100644 index 000000000..d6109d677 --- /dev/null +++ b/simulations/vip-577/ethereum.ts @@ -0,0 +1,218 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { expectEvents } from "src/utils"; +import { forking, testForkedNetworkVipCommands } from "src/vip-framework"; + +import vip577, { + ADDRESS_DATA, + Actions, + PRIME_CONTRACT_ADDRESS, + VWETH_MARKET_ADDRESS, +} from "../../vips/vip-577/bscmainnet"; +import COMPTROLLER_ABI from "./abi/comptroller.json"; +import PRIME_ABI from "./abi/prime.json"; +import REWARDS_DISTRIBUTOR_ABI from "./abi/rewardsDistributor.json"; +import VTOKEN_ABI from "./abi/vtoken.json"; + +const provider = ethers.provider; +const ethereumPools = ADDRESS_DATA.ethereum.pools; + +forking(24023389, async () => { + describe("Pre-VIP behavior", async () => { + for (const pool of ethereumPools) { + describe(`${pool.name} Pool`, () => { + let comptroller: Contract; + + before(async () => { + comptroller = new ethers.Contract(pool.comptroller, COMPTROLLER_ABI, provider); + }); + + it("Check MINT pause state matches data", async () => { + for (const market of pool.markets) { + const isPaused = await comptroller.actionPaused(market.address, Actions.MINT); + expect(isPaused).to.be.equal(market.isMintActionPaused); + } + }); + + it("Check BORROW pause state matches data", async () => { + for (const market of pool.markets) { + const isPaused = await comptroller.actionPaused(market.address, Actions.BORROW); + expect(isPaused).to.be.equal(market.isBorrowActionPaused); + } + }); + + it("Check collateral factors match data", async () => { + for (const market of pool.markets) { + const marketData = await comptroller.markets(market.address); + expect(marketData.collateralFactorMantissa.toString()).to.be.equal(market.collateralFactor); + } + }); + + it("Check supply caps match data", async () => { + for (const market of pool.markets) { + const supplyCap = await comptroller.supplyCaps(market.address); + expect(supplyCap.toString()).to.be.equal(market.supplyCap); + } + }); + + it("Check borrow caps match data", async () => { + for (const market of pool.markets) { + const borrowCap = await comptroller.borrowCaps(market.address); + expect(borrowCap.toString()).to.be.equal(market.borrowCap); + } + }); + }); + } + + it("Check Prime multipliers for vWETH_LiquidStakedETH are greater than zero", async () => { + const prime = new ethers.Contract(PRIME_CONTRACT_ADDRESS.ethereum, PRIME_ABI, provider); + const marketData = await prime.markets(VWETH_MARKET_ADDRESS.ethereum); + + expect(marketData.supplyMultiplier).to.be.greaterThan(0); + expect(marketData.borrowMultiplier).to.be.greaterThan(0); + }); + }); + + testForkedNetworkVipCommands("VIP-577 Ethereum", await vip577(), { + callbackAfterExecution: async txResponse => { + const totals = ADDRESS_DATA.ethereum.totals!; + const totalActionPausedEvents = totals.totalMintPaused + totals.totalBorrowPaused; + + await expectEvents( + txResponse, + [COMPTROLLER_ABI, REWARDS_DISTRIBUTOR_ABI, PRIME_ABI], + [ + "NewSupplyCap", + "NewBorrowCap", + "ActionPausedMarket", + "NewCollateralFactor", + "RewardTokenSupplySpeedUpdated", + "RewardTokenBorrowSpeedUpdated", + "MultiplierUpdated", + ], + [ + totals.totalSupplyCap, + totals.totalBorrowCap, + totalActionPausedEvents, + totals.totalCollateralFactor, + totals.totalSupplySpeed, + totals.totalBorrowSpeed, + 1, // One MultiplierUpdated event for vWETH_LiquidStakedETH + ], + ); + }, + }); + + describe("Post-VIP behavior", async () => { + for (const pool of ethereumPools) { + describe(`${pool.name} Pool`, () => { + let comptroller: Contract; + + before(async () => { + comptroller = new ethers.Contract(pool.comptroller, COMPTROLLER_ABI, provider); + }); + + it("Check all markets have CF set to zero, LT preserved", async () => { + for (const market of pool.markets) { + const marketData = await comptroller.markets(market.address); + expect(marketData.collateralFactorMantissa.toString()).to.be.equal("0"); + expect(marketData.liquidationThresholdMantissa.toString()).to.be.equal(market.liquidationThreshold); + } + }); + + it("Check MINT is paused for markets", async () => { + for (const market of pool.markets) { + const mintPaused = await comptroller.actionPaused(market.address, Actions.MINT); + expect(mintPaused).to.be.true; + } + }); + + it("Check BORROW is paused for markets", async () => { + for (const market of pool.markets) { + const borrowPaused = await comptroller.actionPaused(market.address, Actions.BORROW); + expect(borrowPaused).to.be.true; + } + }); + + it("Check supply caps are zero for markets", async () => { + for (const market of pool.markets) { + const supplyCap = await comptroller.supplyCaps(market.address); + expect(supplyCap).to.be.equal(0); + } + }); + + it("Check borrow caps are zero for markets", async () => { + for (const market of pool.markets) { + const borrowCap = await comptroller.borrowCaps(market.address); + expect(borrowCap).to.be.equal(0); + } + }); + }); + } + + it("Check reward speeds are set to zero for all markets", async () => { + for (const pool of ethereumPools) { + for (const rd of pool.rewardDistributor) { + const rewardsDistributor = new ethers.Contract(rd.address, REWARDS_DISTRIBUTOR_ABI, provider); + + for (const market of pool.markets) { + const supplySpeed = await rewardsDistributor.rewardTokenSupplySpeeds(market.address); + const borrowSpeed = await rewardsDistributor.rewardTokenBorrowSpeeds(market.address); + + expect(supplySpeed).to.equal(0); + expect(borrowSpeed).to.equal(0); + } + } + } + }); + + it("Check Prime multipliers for vWETH_LiquidStakedETH are set to zero", async () => { + const prime = new ethers.Contract(PRIME_CONTRACT_ADDRESS.ethereum, PRIME_ABI, provider); + const marketData = await prime.markets(VWETH_MARKET_ADDRESS.ethereum); + + expect(marketData.supplyMultiplier).to.be.equal(0); + expect(marketData.borrowMultiplier).to.be.equal(0); + }); + }); + + describe("Critical Operations After Market Pause", async () => { + const WETH_MARKET = "0xc82780Db1257C788F262FBbDA960B3706Dfdcaf2"; // vWETH_LiquidStakedETH + const COMPTROLLER = "0xF522cd0360EF8c2FF48B648d53EA1717Ec0F3Ac3"; // LiquidStakedETH Pool + + let vToken: Contract; + + before(async () => { + vToken = new ethers.Contract(WETH_MARKET, VTOKEN_ABI, provider); + }); + + it("Users can withdraw their supplied assets", async () => { + // Check if withdrawal is allowed (REDEEM not paused) + const comptroller = new ethers.Contract(COMPTROLLER, COMPTROLLER_ABI, provider); + const redeemPaused = await comptroller.actionPaused(WETH_MARKET, Actions.REDEEM); + expect(redeemPaused).to.be.false; + + // Use the specific address that minted vWETH + const supplierAddress = "0x61bbebB90Fbc89358E0b66f9b79581B1b7A94b63"; + + let supplier = null; + const balance = await vToken.balanceOf(supplierAddress); + if (balance.gt(0)) { + await ethers.provider.send("hardhat_impersonateAccount", [supplierAddress]); + await ethers.provider.send("hardhat_setBalance", [supplierAddress, "0x1000000000000000000"]); + supplier = ethers.provider.getSigner(supplierAddress); + } + + if (supplier) { + const supplierAddress = await supplier.getAddress(); + const initialBalance = await vToken.balanceOf(supplierAddress); + const redeemAmount = initialBalance.div(10); + + await vToken.connect(supplier).redeem(redeemAmount); + + const finalBalance = await vToken.balanceOf(supplierAddress); + expect(finalBalance).to.be.lt(initialBalance); + } + }); + }); +}); diff --git a/simulations/vip-577/utils/fetchMarketData.ts b/simulations/vip-577/utils/fetchMarketData.ts new file mode 100644 index 000000000..ca10b1df1 --- /dev/null +++ b/simulations/vip-577/utils/fetchMarketData.ts @@ -0,0 +1,332 @@ +import { providers } from "ethers"; +import fs from "fs"; +import { ethers } from "hardhat"; +import path from "path"; + +import ERC20_ABI from "../abi/ERC20.json"; +import COMPTROLLER_ABI from "../abi/comptroller.json"; +import REWARDS_DISTRIBUTOR_ABI from "../abi/rewardsDistributor.json"; + +// Configuration for different networks with isolated pools +const networkConfigs: { + [key: string]: { address: string; name: string }[]; +} = { + bscmainnet: [ + { address: "0x3344417c9360b963ca93A4e8305361AEde340Ab9", name: "DeFi" }, + { address: "0x1b43ea8622e76627B81665B1eCeBB4867566B963", name: "GameFi" }, + { address: "0xd933909A4a2b7A4638903028f44D1d38ce27c352", name: "LiquidStakedBNB" }, + ], + ethereum: [{ address: "0xF522cd0360EF8c2FF48B648d53EA1717Ec0F3Ac3", name: "LiquidStakedETH" }], + arbitrumone: [{ address: "0x52bAB1aF7Ff770551BD05b9FC2329a0Bf5E23F16", name: "LiquidStakedETH" }], +}; + +// Action enum values +const Actions = { + MINT: 0, + REDEEM: 1, + BORROW: 2, + REPAY: 3, + SEIZE: 4, + LIQUIDATE: 5, + TRANSFER: 6, + ENTER_MARKET: 7, + EXIT_MARKET: 8, +}; + +interface MarketData { + name: string; + address: string; + isMintActionPaused: boolean; + isBorrowActionPaused: boolean; + supplyCap: string; + borrowCap: string; + collateralFactor: string; + liquidationThreshold: string; +} + +interface RewardDistributorData { + address: string; + rewardToken: string; + balance: string; + marketsWithNonZeroSpeeds?: string[]; // List of market addresses with non-zero supply or borrow speeds +} + +interface PoolData { + name: string; + comptroller: string; + rewardDistributor: RewardDistributorData[]; + markets: MarketData[]; +} + +interface NetworkData { + pools: PoolData[]; + totals?: { + totalMintPaused: number; + totalBorrowPaused: number; + totalSupplyCap: number; + totalBorrowCap: number; + totalCollateralFactor: number; + totalSupplySpeed: number; + totalBorrowSpeed: number; + }; +} + +/** + * Fetches market data for a given comptroller + */ +async function fetchPoolData( + comptrollerAddress: string, + poolName: string, + provider: providers.Provider, +): Promise<{ + poolData: PoolData; + poolTotals: { + totalMintPaused: number; + totalBorrowPaused: number; + totalSupplyCap: number; + totalBorrowCap: number; + totalCollateralFactor: number; + totalSupplySpeed: number; + totalBorrowSpeed: number; + }; +}> { + console.log(`\nFetching data for ${poolName} pool (${comptrollerAddress})...`); + + const comptroller = new ethers.Contract(comptrollerAddress, COMPTROLLER_ABI, provider); + + // Get reward distributors + const rewardDistributors = await comptroller.getRewardDistributors(); + + // Get all markets first + const markets = await comptroller.getAllMarkets(); + + // Fetch reward distributor data and check speeds for each market + const rewardDistributorDataList: RewardDistributorData[] = []; + const marketRewardSpeeds: { + [marketAddress: string]: { [distributorAddress: string]: { supplySpeed: string; borrowSpeed: string } }; + } = {}; + + for (const rdAddress of rewardDistributors) { + try { + const rewardsDistributor = new ethers.Contract(rdAddress, REWARDS_DISTRIBUTOR_ABI, provider); + + // Get reward token address + const rewardTokenAddress = await rewardsDistributor.rewardToken(); + + // Get reward token balance of the distributor + const rewardToken = new ethers.Contract(rewardTokenAddress, ERC20_ABI, provider); + const balance = await rewardToken.balanceOf(rdAddress); + + // Check speeds for each market + const marketsWithNonZeroSpeeds: string[] = []; + + for (const marketAddress of markets) { + try { + const supplySpeed = await rewardsDistributor.rewardTokenSupplySpeeds(marketAddress); + const borrowSpeed = await rewardsDistributor.rewardTokenBorrowSpeeds(marketAddress); + + // Store the speeds for this market and distributor + if (!marketRewardSpeeds[marketAddress]) { + marketRewardSpeeds[marketAddress] = {}; + } + marketRewardSpeeds[marketAddress][rdAddress] = { + supplySpeed: supplySpeed.toString(), + borrowSpeed: borrowSpeed.toString(), + }; + + // If either speed is non-zero, add to the list + if (!supplySpeed.isZero() || !borrowSpeed.isZero()) { + marketsWithNonZeroSpeeds.push(marketAddress); + } + } catch (e) { + console.warn(` Warning: Could not fetch speeds for market ${marketAddress} in distributor ${rdAddress}`); + } + } + + rewardDistributorDataList.push({ + address: rdAddress, + rewardToken: rewardTokenAddress, + balance: balance.toString(), + marketsWithNonZeroSpeeds: marketsWithNonZeroSpeeds, + }); + } catch (e) { + console.warn(` Warning: Could not fetch data for reward distributor ${rdAddress}:`, e); + rewardDistributorDataList.push({ + address: rdAddress, + rewardToken: "Unknown", + balance: "0", + marketsWithNonZeroSpeeds: [], + }); + } + } + + // Fetch market data + const marketDataList: MarketData[] = []; + + for (const marketAddress of markets) { + // Get vToken symbol + let symbol = "Unknown"; + try { + const vToken = new ethers.Contract(marketAddress, ERC20_ABI, provider); + symbol = await vToken.symbol(); + } catch (e) { + console.warn(` Warning: Could not fetch symbol for ${marketAddress}`); + } + + // Get action paused states + const isMintPaused = await comptroller.actionPaused(marketAddress, Actions.MINT); + const isBorrowPaused = await comptroller.actionPaused(marketAddress, Actions.BORROW); + + // Get market data (collateral factor and liquidation threshold) + const marketData = await comptroller.markets(marketAddress); + + // Get caps + const supplyCap = await comptroller.supplyCaps(marketAddress); + const borrowCap = await comptroller.borrowCaps(marketAddress); + + // Only include markets that need at least one change + const needsMintPause = !isMintPaused; + const needsBorrowPause = !isBorrowPaused; + const needsSupplyCapZero = supplyCap.toString() !== "0"; + const needsBorrowCapZero = borrowCap.toString() !== "0"; + const needsCFZero = marketData.collateralFactorMantissa.toString() !== "0"; + + // Skip markets that are already fully deprecated + if (!needsMintPause && !needsBorrowPause && !needsSupplyCapZero && !needsBorrowCapZero && !needsCFZero) { + console.log(` Skipping ${symbol} - already fully deprecated`); + continue; + } + + const marketInfo: MarketData = { + name: symbol, + address: marketAddress, + isMintActionPaused: isMintPaused, + isBorrowActionPaused: isBorrowPaused, + supplyCap: supplyCap.toString(), + borrowCap: borrowCap.toString(), + collateralFactor: marketData.collateralFactorMantissa.toString(), + liquidationThreshold: marketData.liquidationThresholdMantissa.toString(), + }; + + marketDataList.push(marketInfo); + } + + // Calculate pool-level totals for aggregation (not stored in JSON) + const poolTotals = { + totalMintPaused: marketDataList.filter(m => !m.isMintActionPaused).length, + totalBorrowPaused: marketDataList.filter(m => !m.isBorrowActionPaused).length, + totalSupplyCap: marketDataList.filter(m => m.supplyCap !== "0").length, + totalBorrowCap: marketDataList.filter(m => m.borrowCap !== "0").length, + totalCollateralFactor: marketDataList.filter(m => m.collateralFactor !== "0").length, + totalSupplySpeed: 0, + totalBorrowSpeed: 0, + }; + + // Count reward speed events using stored speeds + for (const rd of rewardDistributorDataList) { + if (rd.marketsWithNonZeroSpeeds) { + for (const marketAddress of rd.marketsWithNonZeroSpeeds) { + const speeds = marketRewardSpeeds[marketAddress]?.[rd.address]; + if (speeds) { + if (speeds.supplySpeed !== "0") poolTotals.totalSupplySpeed++; + if (speeds.borrowSpeed !== "0") poolTotals.totalBorrowSpeed++; + } + } + } + } + + return { + poolData: { + name: poolName, + comptroller: comptrollerAddress, + rewardDistributor: rewardDistributorDataList, + markets: marketDataList, + }, + poolTotals, + }; +} + +/** + * Main function to fetch market data for given network and comptrollers + */ +async function fetchMarketData(network: string, comptrollers: { address: string; name: string }[]) { + console.log(`\n========================================`); + console.log(`Fetching market data for ${network}`); + console.log(`========================================`); + + const provider = ethers.provider; + + const pools: PoolData[] = []; + const totals = { + totalMintPaused: 0, + totalBorrowPaused: 0, + totalSupplyCap: 0, + totalBorrowCap: 0, + totalCollateralFactor: 0, + totalSupplySpeed: 0, + totalBorrowSpeed: 0, + }; + + for (const { address, name } of comptrollers) { + const { poolData, poolTotals } = await fetchPoolData(address, name, provider); + pools.push(poolData); + + // Accumulate totals + totals.totalMintPaused += poolTotals.totalMintPaused; + totals.totalBorrowPaused += poolTotals.totalBorrowPaused; + totals.totalSupplyCap += poolTotals.totalSupplyCap; + totals.totalBorrowCap += poolTotals.totalBorrowCap; + totals.totalCollateralFactor += poolTotals.totalCollateralFactor; + totals.totalSupplySpeed += poolTotals.totalSupplySpeed; + totals.totalBorrowSpeed += poolTotals.totalBorrowSpeed; + } + + return { + pools, + totals, + }; +} + +/** + * Generates JSON file with the fetched data + */ +function generateOutputFile(data: NetworkData, outputPath: string) { + // Write JSON file + fs.writeFileSync(outputPath, JSON.stringify(data, null, 2), "utf-8"); + console.log(`\n✅ Output JSON file generated: ${outputPath}`); +} + +async function main() { + const network = process.env.HARDHAT_NETWORK || "bscmainnet"; + + console.log(`Network: ${network}`); + const provider = ethers.provider; + const blockNumber = await provider.getBlockNumber(); + console.log(`Current block number: ${blockNumber}`); + + const comptrollers = networkConfigs[network]; + + if (!comptrollers) { + console.error(`No configuration found for network: ${network}`); + console.log(`Available networks: ${Object.keys(networkConfigs).join(", ")}`); + process.exit(1); + } + + const networkData = await fetchMarketData(network, comptrollers); + + // Generate output file + const outputPath = path.join(__dirname, `marketData_${network}.json`); + generateOutputFile(networkData, outputPath); +} + +// Allow the script to be run directly or imported +if (require.main === module) { + main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); +} + +export { fetchMarketData, fetchPoolData }; diff --git a/simulations/vip-577/utils/marketData_arbitrumone.json b/simulations/vip-577/utils/marketData_arbitrumone.json new file mode 100644 index 000000000..e78259287 --- /dev/null +++ b/simulations/vip-577/utils/marketData_arbitrumone.json @@ -0,0 +1,57 @@ +{ + "pools": [ + { + "name": "LiquidStakedETH", + "comptroller": "0x52bAB1aF7Ff770551BD05b9FC2329a0Bf5E23F16", + "rewardDistributor": [ + { + "address": "0x6204Bae72dE568384Ca4dA91735dc343a0C7bD6D", + "rewardToken": "0xc1Eb7689147C81aC840d4FF0D298489fc7986d52", + "balance": "278527416955914399830", + "marketsWithNonZeroSpeeds": [] + } + ], + "markets": [ + { + "name": "vwstETH_LiquidStakedETH", + "address": "0x9df6B5132135f14719696bBAe3C54BAb272fDb16", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "8000000000000000000000", + "borrowCap": "800000000000000000000", + "collateralFactor": "930000000000000000", + "liquidationThreshold": "950000000000000000" + }, + { + "name": "vweETH_LiquidStakedETH", + "address": "0x246a35E79a3a0618535A469aDaF5091cAA9f7E88", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "4600000000000000000000", + "borrowCap": "2300000000000000000000", + "collateralFactor": "930000000000000000", + "liquidationThreshold": "950000000000000000" + }, + { + "name": "vWETH_LiquidStakedETH", + "address": "0x39D6d13Ea59548637104E40e729E4aABE27FE106", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "14000000000000000000000", + "borrowCap": "12500000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "0" + } + ] + } + ], + "totals": { + "totalMintPaused": 3, + "totalBorrowPaused": 3, + "totalSupplyCap": 3, + "totalBorrowCap": 3, + "totalCollateralFactor": 2, + "totalSupplySpeed": 0, + "totalBorrowSpeed": 0 + } +} diff --git a/simulations/vip-577/utils/marketData_bscmainnet.json b/simulations/vip-577/utils/marketData_bscmainnet.json new file mode 100644 index 000000000..a2d2eeaf5 --- /dev/null +++ b/simulations/vip-577/utils/marketData_bscmainnet.json @@ -0,0 +1,267 @@ +{ + "pools": [ + { + "name": "DeFi", + "comptroller": "0x3344417c9360b963ca93A4e8305361AEde340Ab9", + "rewardDistributor": [ + { + "address": "0x7524116CEC937ef17B5998436F16d1306c4F7EF8", + "rewardToken": "0x965F527D9159dCe6288a2219DB51fc6Eef120dD1", + "balance": "10826880249756585447264", + "marketsWithNonZeroSpeeds": ["0x8f657dFD3a1354DEB4545765fE6840cc54AFd379"] + }, + { + "address": "0x14d9A428D0f35f81A30ca8D8b2F3974D3CccB98B", + "rewardToken": "0xf307910A4c7bbc79691fD374889b36d8531B08e3", + "balance": "180610887480506448821", + "marketsWithNonZeroSpeeds": ["0x53728FD51060a85ac41974C6C3Eb1DaE42776723"] + }, + { + "address": "0xD86FCff6CCF5C4E277E49e1dC01Ed4bcAb8260ba", + "rewardToken": "0x55d398326f99059fF775485246999027B3197955", + "balance": "242100991174034642479", + "marketsWithNonZeroSpeeds": ["0xFf1112ba7f88a53D4D23ED4e14A117A2aE17C6be"] + } + ], + "markets": [ + { + "name": "vankrBNB_DeFi", + "address": "0x53728FD51060a85ac41974C6C3Eb1DaE42776723", + "isMintActionPaused": true, + "isBorrowActionPaused": true, + "supplyCap": "500000000000000000000", + "borrowCap": "250000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "0" + }, + { + "name": "vBSW_DeFi", + "address": "0x8f657dFD3a1354DEB4545765fE6840cc54AFd379", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "3000000000000000000000000", + "borrowCap": "1500000000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "300000000000000000" + }, + { + "name": "vALPACA_DeFi", + "address": "0x02c5Fb0F26761093D297165e902e96D08576D344", + "isMintActionPaused": true, + "isBorrowActionPaused": true, + "supplyCap": "200000000000000000000000", + "borrowCap": "100000000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "300000000000000000" + }, + { + "name": "vUSDT_DeFi", + "address": "0x1D8bBDE12B6b34140604E18e9f9c6e14deC16854", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "1387500000000000000000000", + "borrowCap": "925000000000000000000000", + "collateralFactor": "750000000000000000", + "liquidationThreshold": "800000000000000000" + }, + { + "name": "vUSDD_DeFi", + "address": "0xA615467caE6B9E0bb98BC04B4411d9296fd1dFa0", + "isMintActionPaused": true, + "isBorrowActionPaused": true, + "supplyCap": "100000000000000000000000", + "borrowCap": "90000000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "700000000000000000" + }, + { + "name": "vANKR_DeFi", + "address": "0x19CE11C8817a1828D1d357DFBF62dCf5b0B2A362", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "2000000000000000000000000", + "borrowCap": "1000000000000000000000000", + "collateralFactor": "200000000000000000", + "liquidationThreshold": "300000000000000000" + }, + { + "name": "vTWT_DeFi", + "address": "0x736bf1D21A28b5DC19A1aC8cA71Fc2856C23c03F", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "700000000000000000000000", + "borrowCap": "100000000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "600000000000000000" + } + ] + }, + { + "name": "GameFi", + "comptroller": "0x1b43ea8622e76627B81665B1eCeBB4867566B963", + "rewardDistributor": [ + { + "address": "0x501a91b995Bd41177503A1A4144F3D25BFF869e1", + "rewardToken": "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E", + "balance": "28499337810038877", + "marketsWithNonZeroSpeeds": ["0xc353B7a1E13dDba393B5E120D4169Da7185aA2cb"] + }, + { + "address": "0x2517A3bEe42EA8f628926849B04870260164b555", + "rewardToken": "0x12BB890508c125661E03b09EC06E404bc9289040", + "balance": "3131101091320442557789045", + "marketsWithNonZeroSpeeds": ["0xE5FE5527A5b76C75eedE77FdFA6B80D52444A465"] + } + ], + "markets": [ + { + "name": "vRACA_GameFi", + "address": "0xE5FE5527A5b76C75eedE77FdFA6B80D52444A465", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "2000000000000000000000000000", + "borrowCap": "500000000000000000000000000", + "collateralFactor": "400000000000000000", + "liquidationThreshold": "500000000000000000" + }, + { + "name": "vFLOKI_GameFi", + "address": "0xc353B7a1E13dDba393B5E120D4169Da7185aA2cb", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "68000000000000000000", + "borrowCap": "32000000000000000000", + "collateralFactor": "400000000000000000", + "liquidationThreshold": "500000000000000000" + }, + { + "name": "vUSDT_GameFi", + "address": "0x4978591f17670A846137d9d613e333C38dc68A37", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "5000000000000000000000000", + "borrowCap": "3800000000000000000000000", + "collateralFactor": "750000000000000000", + "liquidationThreshold": "800000000000000000" + }, + { + "name": "vUSDD_GameFi", + "address": "0x9f2FD23bd0A5E08C5f2b9DD6CF9C96Bfb5fA515C", + "isMintActionPaused": true, + "isBorrowActionPaused": true, + "supplyCap": "100000000000000000000000", + "borrowCap": "90000000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "700000000000000000" + } + ] + }, + { + "name": "LiquidStakedBNB", + "comptroller": "0xd933909A4a2b7A4638903028f44D1d38ce27c352", + "rewardDistributor": [ + { + "address": "0x63aFCe42086c8302659CA0E21F4Eade27Ad85ded", + "rewardToken": "0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827", + "balance": "73600835394431915", + "marketsWithNonZeroSpeeds": ["0xBfe25459BA784e70E2D7a718Be99a1f3521cA17f"] + }, + { + "address": "0x79397BAc982718347406Ebb7A6a8845896fdD8dE", + "rewardToken": "0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16", + "balance": "930392604078923092", + "marketsWithNonZeroSpeeds": ["0xcc5D9e502574cda17215E70bC0B4546663785227"] + }, + { + "address": "0x6a7b50EccC721f0Fa9FD7879A7dF082cdA60Db78", + "rewardToken": "0x3BC5AC0dFdC871B365d159f728dd1B9A0B5481E8", + "balance": "165305599238584388805", + "marketsWithNonZeroSpeeds": ["0x5E21bF67a6af41c74C1773E4b473ca5ce8fd3791"] + }, + { + "address": "0xBE607b239a8776B47159e2b0E9E65a7F1DAA6478", + "rewardToken": "0x3BC5AC0dFdC871B365d159f728dd1B9A0B5481E8", + "balance": "97140189382108003638", + "marketsWithNonZeroSpeeds": ["0x5E21bF67a6af41c74C1773E4b473ca5ce8fd3791"] + }, + { + "address": "0x888E317606b4c590BBAD88653863e8B345702633", + "rewardToken": "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5", + "balance": "77094932546845335233", + "marketsWithNonZeroSpeeds": ["0xd3CC9d8f3689B83c91b7B59cAB4946B063EB894A"] + } + ], + "markets": [ + { + "name": "vankrBNB_LiquidStakedBNB", + "address": "0xBfe25459BA784e70E2D7a718Be99a1f3521cA17f", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "2000000000000000000000", + "borrowCap": "200000000000000000000", + "collateralFactor": "900000000000000000", + "liquidationThreshold": "930000000000000000" + }, + { + "name": "vBNBx_LiquidStakedBNB", + "address": "0x5E21bF67a6af41c74C1773E4b473ca5ce8fd3791", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "3000000000000000000000", + "borrowCap": "300000000000000000000", + "collateralFactor": "900000000000000000", + "liquidationThreshold": "930000000000000000" + }, + { + "name": "vWBNB_LiquidStakedBNB", + "address": "0xe10E80B7FD3a29fE46E16C30CC8F4dd938B742e2", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "15000000000000000000000", + "borrowCap": "12000000000000000000000", + "collateralFactor": "770000000000000000", + "liquidationThreshold": "800000000000000000" + }, + { + "name": "vslisBNB_LiquidStakedBNB", + "address": "0xd3CC9d8f3689B83c91b7B59cAB4946B063EB894A", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "3000000000000000000000", + "borrowCap": "300000000000000000000", + "collateralFactor": "900000000000000000", + "liquidationThreshold": "930000000000000000" + }, + { + "name": "vPT-clisBNB-24APR2025_LiquidStakedBNB", + "address": "0xA537ACf381b12Bbb91C58398b66D1D220f1C77c8", + "isMintActionPaused": true, + "isBorrowActionPaused": true, + "supplyCap": "2000000000000000000000", + "borrowCap": "0", + "collateralFactor": "0", + "liquidationThreshold": "850000000000000000" + }, + { + "name": "vasBNB_LiquidStakedBNB", + "address": "0x4A50a0a1c832190362e1491D5bB464b1bc2Bd288", + "isMintActionPaused": false, + "isBorrowActionPaused": true, + "supplyCap": "10000000000000000000000", + "borrowCap": "0", + "collateralFactor": "870000000000000000", + "liquidationThreshold": "900000000000000000" + } + ] + } + ], + "totals": { + "totalMintPaused": 12, + "totalBorrowPaused": 11, + "totalSupplyCap": 17, + "totalBorrowCap": 15, + "totalCollateralFactor": 10, + "totalSupplySpeed": 10, + "totalBorrowSpeed": 8 + } +} diff --git a/simulations/vip-577/utils/marketData_ethereum.json b/simulations/vip-577/utils/marketData_ethereum.json new file mode 100644 index 000000000..cc3f3843e --- /dev/null +++ b/simulations/vip-577/utils/marketData_ethereum.json @@ -0,0 +1,118 @@ +{ + "pools": [ + { + "name": "LiquidStakedETH", + "comptroller": "0xF522cd0360EF8c2FF48B648d53EA1717Ec0F3Ac3", + "rewardDistributor": [ + { + "address": "0x7A91bEd36D96E4e644d3A181c287E0fcf9E9cc98", + "rewardToken": "0xd3CC9d8f3689B83c91b7B59cAB4946B063EB894A", + "balance": "2983982832028474545366", + "marketsWithNonZeroSpeeds": [ + "0x4a240F0ee138697726C8a3E43eFE6Ac3593432CB", + "0xc82780Db1257C788F262FBbDA960B3706Dfdcaf2" + ] + }, + { + "address": "0xe72Aa7BaB160eaa2605964D2379AA56Cb4b9A1BB", + "rewardToken": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + "balance": "31795457217285580", + "marketsWithNonZeroSpeeds": ["0x4a240F0ee138697726C8a3E43eFE6Ac3593432CB"] + }, + { + "address": "0xDCB0CfA130496c749738Acbe2d6aA06C7C320f06", + "rewardToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "balance": "127875114", + "marketsWithNonZeroSpeeds": ["0xb4933AF59868986316Ed37fa865C829Eba2df0C7"] + }, + { + "address": "0x1e25CF968f12850003Db17E0Dba32108509C4359", + "rewardToken": "0xd3CC9d8f3689B83c91b7B59cAB4946B063EB894A", + "balance": "246375630488961337181", + "marketsWithNonZeroSpeeds": [] + } + ], + "markets": [ + { + "name": "vwstETH_LiquidStakedETH", + "address": "0x4a240F0ee138697726C8a3E43eFE6Ac3593432CB", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "20000000000000000000000", + "borrowCap": "10000000000000000000000", + "collateralFactor": "930000000000000000", + "liquidationThreshold": "950000000000000000" + }, + { + "name": "vWETH_LiquidStakedETH", + "address": "0xc82780Db1257C788F262FBbDA960B3706Dfdcaf2", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "20000000000000000000000", + "borrowCap": "18000000000000000000000", + "collateralFactor": "900000000000000000", + "liquidationThreshold": "930000000000000000" + }, + { + "name": "vweETH_LiquidStakedETH", + "address": "0xb4933AF59868986316Ed37fa865C829Eba2df0C7", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "50000000000000000000000", + "borrowCap": "25000000000000000000000", + "collateralFactor": "930000000000000000", + "liquidationThreshold": "950000000000000000" + }, + { + "name": "vsfrxETH_LiquidStakedETH", + "address": "0xF9E9Fe17C00a8B96a8ac20c4E344C8688D7b947E", + "isMintActionPaused": true, + "isBorrowActionPaused": true, + "supplyCap": "10000000000000000000000", + "borrowCap": "1000000000000000000000", + "collateralFactor": "0", + "liquidationThreshold": "930000000000000000" + }, + { + "name": "vezETH_LiquidStakedETH", + "address": "0xA854D35664c658280fFf27B6eDC6C4195c3229B3", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "14000000000000000000000", + "borrowCap": "1400000000000000000000", + "collateralFactor": "800000000000000000", + "liquidationThreshold": "850000000000000000" + }, + { + "name": "vweETHs_LiquidStakedETH", + "address": "0xEF26C64bC06A8dE4CA5D31f119835f9A1d9433b9", + "isMintActionPaused": false, + "isBorrowActionPaused": true, + "supplyCap": "180000000000000000000", + "borrowCap": "0", + "collateralFactor": "800000000000000000", + "liquidationThreshold": "850000000000000000" + }, + { + "name": "vpufETH_LiquidStakedETH", + "address": "0xE0ee5dDeBFe0abe0a4Af50299D68b74Cec31668e", + "isMintActionPaused": false, + "isBorrowActionPaused": false, + "supplyCap": "3000000000000000000000", + "borrowCap": "600000000000000000000", + "collateralFactor": "800000000000000000", + "liquidationThreshold": "850000000000000000" + } + ] + } + ], + "totals": { + "totalMintPaused": 6, + "totalBorrowPaused": 5, + "totalSupplyCap": 7, + "totalBorrowCap": 6, + "totalCollateralFactor": 6, + "totalSupplySpeed": 4, + "totalBorrowSpeed": 1 + } +} diff --git a/vips/vip-577/bscmainnet.ts b/vips/vip-577/bscmainnet.ts new file mode 100644 index 000000000..29f4a3e32 --- /dev/null +++ b/vips/vip-577/bscmainnet.ts @@ -0,0 +1,234 @@ +import { LzChainId, ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +import arbitrumoneData from "../../simulations/vip-577/utils/marketData_arbitrumone.json"; +import bscMainnetData from "../../simulations/vip-577/utils/marketData_bscmainnet.json"; +import ethereumData from "../../simulations/vip-577/utils/marketData_ethereum.json"; + +interface Market { + name: string; + address: string; + isMintActionPaused: boolean; + isBorrowActionPaused: boolean; + supplyCap: string; + borrowCap: string; + collateralFactor: string; + liquidationThreshold: string; +} + +interface RewardDistributor { + address: string; + rewardToken: string; + balance: string; + marketsWithNonZeroSpeeds?: string[]; +} + +interface Pool { + name: string; + comptroller: string; + rewardDistributor: RewardDistributor[]; + markets: Market[]; +} + +interface NetworkData { + pools: Pool[]; + totals?: { + totalMintPaused: number; + totalBorrowPaused: number; + totalSupplyCap: number; + totalBorrowCap: number; + totalCollateralFactor: number; + totalSupplySpeed: number; + totalBorrowSpeed: number; + }; +} + +export const ADDRESS_DATA = { + bscmainnet: bscMainnetData as NetworkData, + ethereum: ethereumData as NetworkData, + arbitrumone: arbitrumoneData as NetworkData, +}; + +export const PRIME_CONTRACT_ADDRESS = { + ethereum: "0x14C4525f47A7f7C984474979c57a2Dccb8EACB39", + arbitrumone: "0xFE69720424C954A2da05648a0FAC84f9bf11Ef49", +}; + +export const VWETH_MARKET_ADDRESS = { + ethereum: "0xc82780Db1257C788F262FBbDA960B3706Dfdcaf2", + arbitrumone: "0x39D6d13Ea59548637104E40e729E4aABE27FE106", +}; + +export const Actions = { + MINT: 0, + REDEEM: 1, + BORROW: 2, + REPAY: 3, + SEIZE: 4, + LIQUIDATE: 5, + TRANSFER: 6, + ENTER_MARKET: 7, + EXIT_MARKET: 8, +}; + +// Helper function to generate all deprecation commands for a pool +const generatePoolCommands = (pool: Pool, dstChainId?: LzChainId) => { + const commands = []; + const { comptroller, markets, rewardDistributor } = pool; + + // Pause MINT action for markets that aren't already paused + const marketsNeedingMintPause = markets.filter(m => !m.isMintActionPaused); + if (marketsNeedingMintPause.length > 0) { + commands.push({ + target: comptroller, + signature: "setActionsPaused(address[],uint8[],bool)", + params: [marketsNeedingMintPause.map(m => m.address), [Actions.MINT], true], + ...(dstChainId && { dstChainId }), + }); + } + + // Pause BORROW action for markets that aren't already paused + const marketsNeedingBorrowPause = markets.filter(m => !m.isBorrowActionPaused); + if (marketsNeedingBorrowPause.length > 0) { + commands.push({ + target: comptroller, + signature: "setActionsPaused(address[],uint8[],bool)", + params: [marketsNeedingBorrowPause.map(m => m.address), [Actions.BORROW], true], + ...(dstChainId && { dstChainId }), + }); + } + + // Set supply caps to 0 for markets with non-zero caps + const marketsNeedingSupplyCapZero = markets.filter(m => m.supplyCap !== "0"); + if (marketsNeedingSupplyCapZero.length > 0) { + commands.push({ + target: comptroller, + signature: "setMarketSupplyCaps(address[],uint256[])", + params: [marketsNeedingSupplyCapZero.map(m => m.address), marketsNeedingSupplyCapZero.map(() => 0)], + ...(dstChainId && { dstChainId }), + }); + } + + // Set borrow caps to 0 for markets with non-zero caps + const marketsNeedingBorrowCapZero = markets.filter(m => m.borrowCap !== "0"); + if (marketsNeedingBorrowCapZero.length > 0) { + commands.push({ + target: comptroller, + signature: "setMarketBorrowCaps(address[],uint256[])", + params: [marketsNeedingBorrowCapZero.map(m => m.address), marketsNeedingBorrowCapZero.map(() => 0)], + ...(dstChainId && { dstChainId }), + }); + } + + // Set collateral factor to 0 for markets with non-zero CF (preserving liquidation threshold) + const marketsNeedingCFZero = markets.filter(m => m.collateralFactor !== "0"); + for (const market of marketsNeedingCFZero) { + commands.push({ + target: comptroller, + signature: "setCollateralFactor(address,uint256,uint256)", + params: [market.address, 0, market.liquidationThreshold], + ...(dstChainId && { dstChainId }), + }); + } + + // Set reward token speeds to 0 for markets with active rewards + for (const distributor of rewardDistributor) { + if (distributor.marketsWithNonZeroSpeeds?.length) { + const marketAddresses = distributor.marketsWithNonZeroSpeeds; + commands.push({ + target: distributor.address, + signature: "setRewardTokenSpeeds(address[],uint256[],uint256[])", + params: [marketAddresses, marketAddresses.map(() => 0), marketAddresses.map(() => 0)], + ...(dstChainId && { dstChainId }), + }); + } + } + + return commands; +}; + +export const vip577 = () => { + const meta = { + version: "v2", + title: "VIP-577 Pause and Sunset Preparation for Isolated Pools on BNB Chain, Ethereum, and Arbitrum One", + description: ` + #### Summary +This proposal is informed by the Venus community forum publication [Isolated Pools Sunset](https://community.venus.io/t/isolated-pools-sunset/5603). The community post outlines the rationale for initiating the sunset process for isolated pools within the Venus V4 protocol, citing low utilisation, limited liquidity, minimal revenue contribution, and the availability of isolated E-Mode groups in the core pool that provide similar functionality in a more capital-efficient manner. + +If passed, this VIP will deprecate isolated pools across multiple networks as part of the Isolated Lending (IL) deprecation flow. + +#### Description + +This VIP will perform the following actions for each market in the specified isolated pools: + +**BNB Chain:** +- **DeFi Pool**: 4 markets (vBSW, vANKR, vUSDT, vTWT) +- **GameFi Pool**: 3 markets (vUSDT, vFLOKI, vRACA) +- **LiquidStakedBNB Pool**: 5 markets (vasBNB, vankrBNB, vslisBNB, vWBNB, vBNBx) + +**Ethereum:** +- **LiquidStakedETH Pool**: 6 markets (vezETH, vwstETH, vweETH, vWETH, vPufETH, vweETHs) + +**Arbitrum One:** +- **LiquidStakedETH Pool**: 3 markets (vWETH, vweETH, vwstETH) + +**Total: 21 markets across 3 networks** + +For each market, the VIP will: +1. Pause Mint and Borrow actions +2. Set supply and borrow caps to 0 +3. Set collateral factor to 0 (liquidation thresholds will remain unchanged to protect existing positions) + +Additionally, for each isolated pool: +4. Set reward token supply and borrow speeds to 0 for all markets in the RewardsDistributor contracts +5. Set supply and borrow multipliers to 0 for markets present in the Prime contracts. + +These actions will effectively deprecate the markets while allowing users to: +- Repay their borrows +- Withdraw their supplied assets +- Liquidate unhealthy positions (liquidation threshold unchanged) + +#### Security and additional considerations + +We applied the following security procedures for this upgrade: + +- **VIP execution simulation**: in a simulation environment, validating the markets are properly deprecated with the correct parameters +- **Deployment on testnet**: the same deprecation flow has been tested on testnet`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + // BNB Chain commands + ...ADDRESS_DATA.bscmainnet.pools.flatMap(pool => generatePoolCommands(pool)), + + // Ethereum commands + ...ADDRESS_DATA.ethereum.pools.flatMap(pool => generatePoolCommands(pool, LzChainId.ethereum)), + + // Arbitrum One commands + ...ADDRESS_DATA.arbitrumone.pools.flatMap(pool => generatePoolCommands(pool, LzChainId.arbitrumone)), + + // Set Prime multipliers to zero for vWETH_LiquidStakedETH on Ethereum + { + target: PRIME_CONTRACT_ADDRESS.ethereum, + signature: "updateMultipliers(address,uint256,uint256)", + params: [VWETH_MARKET_ADDRESS.ethereum, 0, 0], + dstChainId: LzChainId.ethereum, + }, + + // Set Prime multipliers to zero for vWETH_LiquidStakedETH on Arbitrum One + { + target: PRIME_CONTRACT_ADDRESS.arbitrumone, + signature: "updateMultipliers(address,uint256,uint256)", + params: [VWETH_MARKET_ADDRESS.arbitrumone, 0, 0], + dstChainId: LzChainId.arbitrumone, + }, + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip577;