@venusprotocol/isolated-pools 1.0.0-dev.1 → 1.0.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -11
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.json +215 -0
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.json +183 -0
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json +63 -0
- package/artifacts/@openzeppelin/contracts/interfaces/IERC1967.sol/IERC1967.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/interfaces/IERC1967.sol/IERC1967.json +56 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.json +24 -0
- package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.json +56 -0
- package/artifacts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.json +19 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.json +80 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.json +24 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +113 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +297 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +194 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json +233 -0
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +30 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +30 -0
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +10 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +115 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.json +76 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.json +24 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol/ReentrancyGuardUpgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol/ReentrancyGuardUpgradeable.json +24 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.json +194 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.json +86 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.json +10 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.json +10 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.json +24 -0
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.dbg.json +4 -0
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.json +369 -0
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +4 -0
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.json +181 -0
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +4 -0
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.json +282 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.dbg.json +4 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.json +40 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/OracleInterface.dbg.json +4 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/OracleInterface.json +30 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.dbg.json +4 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.json +43 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/TwapInterface.dbg.json +4 -0
- package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/TwapInterface.json +49 -0
- package/artifacts/build-info/5d0b3e7c7d317c28bfc8eca20c31f64e.json +1 -0
- package/artifacts/build-info/f19d689bc99e63a20dd2a17a14e2b84a.json +1 -0
- package/artifacts/contracts/BaseJumpRateModelV2.sol/BaseJumpRateModelV2.dbg.json +4 -0
- package/artifacts/contracts/BaseJumpRateModelV2.sol/BaseJumpRateModelV2.json +276 -0
- package/artifacts/contracts/Comptroller.sol/Comptroller.dbg.json +4 -0
- package/artifacts/contracts/Comptroller.sol/Comptroller.json +1667 -0
- package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerInterface.dbg.json +4 -0
- package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerInterface.json +285 -0
- package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerViewInterface.dbg.json +4 -0
- package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerViewInterface.json +170 -0
- package/artifacts/contracts/ComptrollerStorage.sol/ComptrollerStorage.dbg.json +4 -0
- package/artifacts/contracts/ComptrollerStorage.sol/ComptrollerStorage.json +173 -0
- package/artifacts/contracts/ErrorReporter.sol/TokenErrorReporter.dbg.json +4 -0
- package/artifacts/contracts/ErrorReporter.sol/TokenErrorReporter.json +156 -0
- package/artifacts/contracts/ExponentialNoError.sol/ExponentialNoError.dbg.json +4 -0
- package/artifacts/contracts/ExponentialNoError.sol/ExponentialNoError.json +10 -0
- package/artifacts/contracts/IPancakeswapV2Router.sol/IPancakeswapV2Router.dbg.json +4 -0
- package/artifacts/contracts/IPancakeswapV2Router.sol/IPancakeswapV2Router.json +50 -0
- package/artifacts/contracts/InterestRateModel.sol/InterestRateModel.dbg.json +4 -0
- package/artifacts/contracts/InterestRateModel.sol/InterestRateModel.json +97 -0
- package/artifacts/contracts/JumpRateModelV2.sol/JumpRateModelV2.dbg.json +4 -0
- package/artifacts/contracts/JumpRateModelV2.sol/JumpRateModelV2.json +307 -0
- package/artifacts/contracts/Lens/PoolLens.sol/PoolLens.dbg.json +4 -0
- package/artifacts/contracts/Lens/PoolLens.sol/PoolLens.json +1087 -0
- package/artifacts/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.dbg.json +4 -0
- package/artifacts/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.json +59 -0
- package/artifacts/contracts/Pool/PoolRegistry.sol/PoolRegistry.dbg.json +4 -0
- package/artifacts/contracts/Pool/PoolRegistry.sol/PoolRegistry.json +689 -0
- package/artifacts/contracts/Pool/PoolRegistryInterface.sol/PoolRegistryInterface.dbg.json +4 -0
- package/artifacts/contracts/Pool/PoolRegistryInterface.sol/PoolRegistryInterface.json +176 -0
- package/artifacts/contracts/Rewards/RewardsDistributor.sol/RewardsDistributor.dbg.json +4 -0
- package/artifacts/contracts/Rewards/RewardsDistributor.sol/RewardsDistributor.json +928 -0
- package/artifacts/contracts/RiskFund/IProtocolShareReserve.sol/IProtocolShareReserve.dbg.json +4 -0
- package/artifacts/contracts/RiskFund/IProtocolShareReserve.sol/IProtocolShareReserve.json +29 -0
- package/artifacts/contracts/RiskFund/IRiskFund.sol/IRiskFund.dbg.json +4 -0
- package/artifacts/contracts/RiskFund/IRiskFund.sol/IRiskFund.json +101 -0
- package/artifacts/contracts/RiskFund/ProtocolShareReserve.sol/ProtocolShareReserve.dbg.json +4 -0
- package/artifacts/contracts/RiskFund/ProtocolShareReserve.sol/ProtocolShareReserve.json +296 -0
- package/artifacts/contracts/RiskFund/ReserveHelpers.sol/ReserveHelpers.dbg.json +4 -0
- package/artifacts/contracts/RiskFund/ReserveHelpers.sol/ReserveHelpers.json +83 -0
- package/artifacts/contracts/RiskFund/RiskFund.sol/RiskFund.dbg.json +4 -0
- package/artifacts/contracts/RiskFund/RiskFund.sol/RiskFund.json +596 -0
- package/artifacts/contracts/Shortfall/IShortfall.sol/IShortfall.dbg.json +4 -0
- package/artifacts/contracts/Shortfall/IShortfall.sol/IShortfall.json +24 -0
- package/artifacts/contracts/Shortfall/Shortfall.sol/Shortfall.dbg.json +4 -0
- package/artifacts/contracts/Shortfall/Shortfall.sol/Shortfall.json +761 -0
- package/artifacts/contracts/VToken.sol/VToken.dbg.json +4 -0
- package/artifacts/contracts/VToken.sol/VToken.json +1850 -0
- package/artifacts/contracts/VTokenInterfaces.sol/VTokenInterface.dbg.json +4 -0
- package/artifacts/contracts/VTokenInterfaces.sol/VTokenInterface.json +1398 -0
- package/artifacts/contracts/VTokenInterfaces.sol/VTokenStorage.dbg.json +4 -0
- package/artifacts/contracts/VTokenInterfaces.sol/VTokenStorage.json +219 -0
- package/artifacts/contracts/WhitePaperInterestRateModel.sol/WhitePaperInterestRateModel.dbg.json +4 -0
- package/artifacts/contracts/WhitePaperInterestRateModel.sol/WhitePaperInterestRateModel.json +192 -0
- package/artifacts/contracts/test/ComptrollerHarness.sol/ComptrollerHarness.dbg.json +4 -0
- package/artifacts/contracts/test/ComptrollerHarness.sol/ComptrollerHarness.json +1712 -0
- package/artifacts/contracts/test/ComptrollerHarness.sol/EchoTypesComptroller.dbg.json +4 -0
- package/artifacts/contracts/test/ComptrollerHarness.sol/EchoTypesComptroller.json +94 -0
- package/artifacts/contracts/test/ComptrollerScenario.sol/ComptrollerScenario.dbg.json +4 -0
- package/artifacts/contracts/test/ComptrollerScenario.sol/ComptrollerScenario.json +1744 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20.dbg.json +4 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20.json +194 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20Base.dbg.json +4 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20Base.json +141 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20Harness.dbg.json +4 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20Harness.json +351 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20NS.dbg.json +4 -0
- package/artifacts/contracts/test/ERC20.sol/ERC20NS.json +182 -0
- package/artifacts/contracts/test/ERC20.sol/NonStandardToken.dbg.json +4 -0
- package/artifacts/contracts/test/ERC20.sol/NonStandardToken.json +247 -0
- package/artifacts/contracts/test/ERC20.sol/StandardToken.dbg.json +4 -0
- package/artifacts/contracts/test/ERC20.sol/StandardToken.json +259 -0
- package/artifacts/contracts/test/EvilToken.sol/EvilToken.dbg.json +4 -0
- package/artifacts/contracts/test/EvilToken.sol/EvilToken.json +303 -0
- package/artifacts/contracts/test/FaucetToken.sol/FaucetNonStandardToken.dbg.json +4 -0
- package/artifacts/contracts/test/FaucetToken.sol/FaucetNonStandardToken.json +265 -0
- package/artifacts/contracts/test/FaucetToken.sol/FaucetToken.dbg.json +4 -0
- package/artifacts/contracts/test/FaucetToken.sol/FaucetToken.json +277 -0
- package/artifacts/contracts/test/FaucetToken.sol/FaucetTokenReEntrantHarness.dbg.json +4 -0
- package/artifacts/contracts/test/FaucetToken.sol/FaucetTokenReEntrantHarness.json +313 -0
- package/artifacts/contracts/test/FeeToken.sol/FeeToken.dbg.json +4 -0
- package/artifacts/contracts/test/FeeToken.sol/FeeToken.json +313 -0
- package/artifacts/contracts/test/HarnessMaxLoopsLimitHelper.sol/HarnessMaxLoopsLimitHelper.dbg.json +4 -0
- package/artifacts/contracts/test/HarnessMaxLoopsLimitHelper.sol/HarnessMaxLoopsLimitHelper.json +85 -0
- package/artifacts/contracts/test/MockDeflationaryToken.sol/MockDeflatingToken.dbg.json +4 -0
- package/artifacts/contracts/test/MockDeflationaryToken.sol/MockDeflatingToken.json +332 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IERC20.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IERC20.json +233 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeFactory.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeFactory.json +187 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakePair.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakePair.json +668 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter01.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter01.json +760 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter02.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter02.json +962 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IWETH.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IWETH.json +55 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeLibrary.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeLibrary.json +10 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeRouter.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeRouter.json +982 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/SafeMath.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/SafeMath.json +10 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/TransferHelper.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/TransferHelper.json +10 -0
- package/artifacts/contracts/test/Mocks/MockPriceOracle.sol/MockPriceOracle.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockPriceOracle.sol/MockPriceOracle.json +85 -0
- package/artifacts/contracts/test/Mocks/MockToken.sol/MockToken.dbg.json +4 -0
- package/artifacts/contracts/test/Mocks/MockToken.sol/MockToken.json +315 -0
- package/artifacts/contracts/test/SafeMath.sol/SafeMath.dbg.json +4 -0
- package/artifacts/contracts/test/SafeMath.sol/SafeMath.json +10 -0
- package/artifacts/contracts/test/UpgradedVToken.sol/UpgradedVToken.dbg.json +4 -0
- package/artifacts/contracts/test/UpgradedVToken.sol/UpgradedVToken.json +1946 -0
- package/artifacts/contracts/test/VTokenHarness.sol/VTokenHarness.dbg.json +4 -0
- package/artifacts/contracts/test/VTokenHarness.sol/VTokenHarness.json +2306 -0
- package/contracts/BaseJumpRateModelV2.sol +4 -3
- package/contracts/Comptroller.sol +40 -15
- package/contracts/ComptrollerInterface.sol +10 -0
- package/contracts/ComptrollerStorage.sol +5 -0
- package/contracts/ErrorReporter.sol +5 -0
- package/contracts/ExponentialNoError.sol +0 -7
- package/contracts/Lens/PoolLens.sol +13 -0
- package/contracts/MaxLoopsLimitHelper.sol +5 -0
- package/contracts/Pool/PoolRegistry.sol +58 -206
- package/contracts/Pool/PoolRegistryInterface.sol +12 -7
- package/contracts/Rewards/RewardsDistributor.sol +15 -0
- package/contracts/RiskFund/IProtocolShareReserve.sol +5 -0
- package/contracts/RiskFund/IRiskFund.sol +5 -0
- package/contracts/RiskFund/ProtocolShareReserve.sol +5 -0
- package/contracts/RiskFund/ReserveHelpers.sol +5 -0
- package/contracts/RiskFund/RiskFund.sol +5 -5
- package/contracts/Shortfall/IShortfall.sol +5 -0
- package/contracts/Shortfall/Shortfall.sol +33 -22
- package/contracts/VToken.sol +31 -9
- package/contracts/VTokenInterfaces.sol +10 -0
- package/contracts/WhitePaperInterestRateModel.sol +1 -1
- package/contracts/lib/imports.sol +11 -0
- package/contracts/test/MockDeflationaryToken.sol +113 -0
- package/dist/deploy/001-deploy-mock-tokens.d.ts +3 -0
- package/dist/deploy/001-deploy-mock-tokens.js +23 -0
- package/dist/deploy/002-price-oracle.d.ts +2 -0
- package/dist/deploy/002-price-oracle.js +9 -0
- package/dist/deploy/003-price-oracle-configure-feeds.d.ts +2 -0
- package/dist/deploy/003-price-oracle-configure-feeds.js +9 -0
- package/{deploy/004-swap-router.ts → dist/deploy/004-swap-router.d.ts} +0 -3
- package/dist/deploy/004-swap-router.js +8 -0
- package/dist/deploy/005-access-control.d.ts +3 -0
- package/dist/deploy/005-access-control.js +16 -0
- package/dist/deploy/006-deploy-factories.d.ts +3 -0
- package/dist/deploy/006-deploy-factories.js +37 -0
- package/dist/deploy/007-access-control-configure.d.ts +3 -0
- package/dist/deploy/007-access-control-configure.js +69 -0
- package/dist/deploy/008-deploy-pool-lens.d.ts +3 -0
- package/dist/deploy/008-deploy-pool-lens.js +15 -0
- package/dist/deploy/009-deploy-pools.d.ts +3 -0
- package/dist/deploy/009-deploy-pools.js +186 -0
- package/dist/deploy/010-rewards.d.ts +3 -0
- package/dist/deploy/010-rewards.js +76 -0
- package/dist/deploy/011-transfer-pools-ownership.d.ts +3 -0
- package/dist/deploy/011-transfer-pools-ownership.js +75 -0
- package/dist/deploy/012-riskfund-protocolshare.d.ts +3 -0
- package/dist/deploy/012-riskfund-protocolshare.js +139 -0
- package/dist/deploy/013-transfer-funds-ownership.d.ts +3 -0
- package/dist/deploy/013-transfer-funds-ownership.js +46 -0
- package/dist/hardhat.config.d.ts +14 -0
- package/dist/hardhat.config.js +237 -0
- package/dist/helpers/deploymentConfig.d.ts +59 -0
- package/dist/helpers/deploymentConfig.js +836 -0
- package/dist/helpers/utils.d.ts +3 -0
- package/dist/helpers/utils.js +28 -0
- package/package.json +3 -11
- package/contracts/Factories/JumpRateModelFactory.sol +0 -26
- package/contracts/Factories/VTokenProxyFactory.sol +0 -53
- package/contracts/Factories/WhitePaperInterestRateModelFactory.sol +0 -12
- package/contracts/Proxy/UpgradeableBeacon.sol +0 -10
- package/deploy/001-deploy-mock-tokens.ts +0 -29
- package/deploy/002-price-oracle.ts +0 -7
- package/deploy/003-price-oracle-configure-feeds.ts +0 -7
- package/deploy/005-access-control.ts +0 -20
- package/deploy/006-deploy-factories.ts +0 -82
- package/deploy/007-access-control-configure.ts +0 -142
- package/deploy/008-deploy-pool-lens.ts +0 -19
- package/deploy/009-deploy-pools.ts +0 -171
- package/deploy/010-rewards.ts +0 -84
- package/deploy/011-transfer-pools-ownership.ts +0 -93
- package/deploy/012-riskfund-protocolshare.ts +0 -140
- package/deploy/013-transfer-funds-ownership.ts +0 -63
- package/helpers/deploymentConfig.ts +0 -897
- package/helpers/utils.ts +0 -24
|
@@ -8,8 +8,9 @@ import { BLOCKS_PER_YEAR, EXP_SCALE, MANTISSA_ONE } from "./lib/constants.sol";
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @title Logic for Compound's JumpRateModel Contract V2.
|
|
11
|
-
* @author Compound (modified by Dharma Labs,
|
|
12
|
-
* @notice
|
|
11
|
+
* @author Compound (modified by Dharma Labs, Arr00 and Venus)
|
|
12
|
+
* @notice An interest rate model with a steep increase after a certain utilization threshold called **kink** is reached.
|
|
13
|
+
* The parameters of this interest rate model can be adjusted by the owner. Version 2 modifies Version 1 by enabling updateable parameters.
|
|
13
14
|
*/
|
|
14
15
|
abstract contract BaseJumpRateModelV2 is InterestRateModel {
|
|
15
16
|
/**
|
|
@@ -134,7 +135,7 @@ abstract contract BaseJumpRateModelV2 is InterestRateModel {
|
|
|
134
135
|
uint256 reserves,
|
|
135
136
|
uint256 badDebt
|
|
136
137
|
) public pure returns (uint256) {
|
|
137
|
-
// Utilization rate is 0 when there are no borrows
|
|
138
|
+
// Utilization rate is 0 when there are no borrows and badDebt
|
|
138
139
|
if ((borrows + badDebt) == 0) {
|
|
139
140
|
return 0;
|
|
140
141
|
}
|
|
@@ -14,7 +14,27 @@ import { MaxLoopsLimitHelper } from "./MaxLoopsLimitHelper.sol";
|
|
|
14
14
|
import { ensureNonzeroAddress } from "./lib/validators.sol";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @title Comptroller
|
|
17
|
+
* @title Comptroller
|
|
18
|
+
* @author Venus
|
|
19
|
+
* @notice The Comptroller is designed to provide checks for all minting, redeeming, transferring, borrowing, lending, repaying, liquidating,
|
|
20
|
+
* and seizing done by the `vToken` contract. Each pool has one `Comptroller` checking these interactions across markets. When a user interacts
|
|
21
|
+
* with a given market by one of these main actions, a call is made to a corresponding hook in the associated `Comptroller`, which either allows
|
|
22
|
+
* or reverts the transaction. These hooks also update supply and borrow rewards as they are called. The comptroller holds the logic for assessing
|
|
23
|
+
* liquidity snapshots of an account via the collateral factor and liquidation threshold. This check determines the collateral needed for a borrow,
|
|
24
|
+
* as well as how much of a borrow may be liquidated. A user may borrow a portion of their collateral with the maximum amount determined by the
|
|
25
|
+
* markets collateral factor. However, if their borrowed amount exceeds an amount calculated using the market’s corresponding liquidation threshold,
|
|
26
|
+
* the borrow is eligible for liquidation.
|
|
27
|
+
*
|
|
28
|
+
* The `Comptroller` also includes two functions `liquidateAccount()` and `healAccount()`, which are meant to handle accounts that do not exceed
|
|
29
|
+
* the `minLiquidatableCollateral` for the `Comptroller`:
|
|
30
|
+
*
|
|
31
|
+
* - `healAccount()`: This function is called to seize all of a given user’s collateral, requiring the `msg.sender` repay a certain percentage
|
|
32
|
+
* of the debt calculated by `collateral/(borrows*liquidationIncentive)`. The function can only be called if the calculated percentage does not exceed
|
|
33
|
+
* 100%, because otherwise no `badDebt` would be created and `liquidateAccount()` should be used instead. The difference in the actual amount of debt
|
|
34
|
+
* and debt paid off is recorded as `badDebt` for each market, which can then be auctioned off for the risk reserves of the associated pool.
|
|
35
|
+
* - `liquidateAccount()`: This function can only be called if the collateral seized will cover all borrows of an account, as well as the liquidation
|
|
36
|
+
* incentive. Otherwise, the pool will incur bad debt, in which case the function `healAccount()` should be used instead. This function skips the logic
|
|
37
|
+
* verifying that the repay amount does not exceed the close factor.
|
|
18
38
|
*/
|
|
19
39
|
contract Comptroller is
|
|
20
40
|
Ownable2StepUpgradeable,
|
|
@@ -92,6 +112,9 @@ contract Comptroller is
|
|
|
92
112
|
/// @notice Thrown when a market has an unexpected comptroller
|
|
93
113
|
error ComptrollerMismatch();
|
|
94
114
|
|
|
115
|
+
/// @notice Thrown when user is not member of market
|
|
116
|
+
error MarketNotCollateral(address vToken, address user);
|
|
117
|
+
|
|
95
118
|
/**
|
|
96
119
|
* @notice Thrown during the liquidation if user's total collateral amount is lower than
|
|
97
120
|
* a predefined threshold. In this case only batch liquidations (either liquidateAccount
|
|
@@ -158,10 +181,6 @@ contract Comptroller is
|
|
|
158
181
|
function enterMarkets(address[] memory vTokens) external override returns (uint256[] memory) {
|
|
159
182
|
uint256 len = vTokens.length;
|
|
160
183
|
|
|
161
|
-
uint256 accountAssetsLen = accountAssets[msg.sender].length;
|
|
162
|
-
|
|
163
|
-
_ensureMaxLoops(accountAssetsLen + len);
|
|
164
|
-
|
|
165
184
|
uint256[] memory results = new uint256[](len);
|
|
166
185
|
for (uint256 i; i < len; ++i) {
|
|
167
186
|
VToken vToken = VToken(vTokens[i]);
|
|
@@ -334,9 +353,6 @@ contract Comptroller is
|
|
|
334
353
|
) external override {
|
|
335
354
|
_checkActionPauseState(vToken, Action.BORROW);
|
|
336
355
|
|
|
337
|
-
//Update the prices of tokens
|
|
338
|
-
updatePrices(borrower);
|
|
339
|
-
|
|
340
356
|
if (!markets[vToken].isListed) {
|
|
341
357
|
revert MarketNotListed(address(vToken));
|
|
342
358
|
}
|
|
@@ -344,11 +360,14 @@ contract Comptroller is
|
|
|
344
360
|
if (!markets[vToken].accountMembership[borrower]) {
|
|
345
361
|
// only vTokens may call borrowAllowed if borrower not in market
|
|
346
362
|
_checkSenderIs(vToken);
|
|
347
|
-
|
|
363
|
+
|
|
348
364
|
// attempt to add borrower to the market or revert
|
|
349
365
|
_addToMarket(VToken(msg.sender), borrower);
|
|
350
366
|
}
|
|
351
367
|
|
|
368
|
+
// Update the prices of tokens
|
|
369
|
+
updatePrices(borrower);
|
|
370
|
+
|
|
352
371
|
if (oracle.getUnderlyingPrice(vToken) == 0) {
|
|
353
372
|
revert PriceError(address(vToken));
|
|
354
373
|
}
|
|
@@ -442,7 +461,7 @@ contract Comptroller is
|
|
|
442
461
|
// Action.SEIZE on it
|
|
443
462
|
_checkActionPauseState(vTokenBorrowed, Action.LIQUIDATE);
|
|
444
463
|
|
|
445
|
-
//Update the prices of tokens
|
|
464
|
+
// Update the prices of tokens
|
|
446
465
|
updatePrices(borrower);
|
|
447
466
|
|
|
448
467
|
if (!markets[vTokenBorrowed].isListed) {
|
|
@@ -503,7 +522,9 @@ contract Comptroller is
|
|
|
503
522
|
// Action.LIQUIDATE on it
|
|
504
523
|
_checkActionPauseState(vTokenCollateral, Action.SEIZE);
|
|
505
524
|
|
|
506
|
-
|
|
525
|
+
Market storage market = markets[vTokenCollateral];
|
|
526
|
+
|
|
527
|
+
if (!market.isListed) {
|
|
507
528
|
revert MarketNotListed(vTokenCollateral);
|
|
508
529
|
}
|
|
509
530
|
|
|
@@ -524,6 +545,10 @@ contract Comptroller is
|
|
|
524
545
|
}
|
|
525
546
|
}
|
|
526
547
|
|
|
548
|
+
if (!market.accountMembership[borrower]) {
|
|
549
|
+
revert MarketNotCollateral(vTokenCollateral, borrower);
|
|
550
|
+
}
|
|
551
|
+
|
|
527
552
|
// Keep the flywheel moving
|
|
528
553
|
uint256 rewardDistributorsCount = rewardsDistributors.length;
|
|
529
554
|
|
|
@@ -616,7 +641,7 @@ contract Comptroller is
|
|
|
616
641
|
);
|
|
617
642
|
|
|
618
643
|
Exp memory percentage = div_(collateral, scaledBorrows);
|
|
619
|
-
if (
|
|
644
|
+
if (lessThanExp(Exp({ mantissa: MANTISSA_ONE }), percentage)) {
|
|
620
645
|
revert CollateralExceedsThreshold(scaledBorrows.mantissa, collateral.mantissa);
|
|
621
646
|
}
|
|
622
647
|
|
|
@@ -676,7 +701,7 @@ contract Comptroller is
|
|
|
676
701
|
|
|
677
702
|
uint256 ordersCount = orders.length;
|
|
678
703
|
|
|
679
|
-
_ensureMaxLoops(ordersCount);
|
|
704
|
+
_ensureMaxLoops(ordersCount / 2);
|
|
680
705
|
|
|
681
706
|
for (uint256 i; i < ordersCount; ++i) {
|
|
682
707
|
if (!markets[address(orders[i].vTokenBorrowed)].isListed) {
|
|
@@ -709,7 +734,7 @@ contract Comptroller is
|
|
|
709
734
|
* @notice Sets the closeFactor to use when liquidating borrows
|
|
710
735
|
* @param newCloseFactorMantissa New close factor, scaled by 1e18
|
|
711
736
|
* @custom:event Emits NewCloseFactor on success
|
|
712
|
-
* @custom:access
|
|
737
|
+
* @custom:access Controlled by AccessControlManager
|
|
713
738
|
*/
|
|
714
739
|
function setCloseFactor(uint256 newCloseFactorMantissa) external {
|
|
715
740
|
_checkAccessAllowed("setCloseFactor(uint256)");
|
|
@@ -1304,7 +1329,7 @@ contract Comptroller is
|
|
|
1304
1329
|
return;
|
|
1305
1330
|
}
|
|
1306
1331
|
|
|
1307
|
-
//Update the prices of tokens
|
|
1332
|
+
// Update the prices of tokens
|
|
1308
1333
|
updatePrices(redeemer);
|
|
1309
1334
|
|
|
1310
1335
|
/* Otherwise, perform a hypothetical liquidity check to guard against shortfall */
|
|
@@ -6,6 +6,11 @@ import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interf
|
|
|
6
6
|
import { VToken } from "./VToken.sol";
|
|
7
7
|
import { RewardsDistributor } from "./Rewards/RewardsDistributor.sol";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @title ComptrollerInterface
|
|
11
|
+
* @author Venus
|
|
12
|
+
* @notice Interface implemented by the `Comptroller` contract.
|
|
13
|
+
*/
|
|
9
14
|
interface ComptrollerInterface {
|
|
10
15
|
/*** Assets You Are In ***/
|
|
11
16
|
|
|
@@ -70,6 +75,11 @@ interface ComptrollerInterface {
|
|
|
70
75
|
function getAllMarkets() external view returns (VToken[] memory);
|
|
71
76
|
}
|
|
72
77
|
|
|
78
|
+
/**
|
|
79
|
+
* @title ComptrollerViewInterface
|
|
80
|
+
* @author Venus
|
|
81
|
+
* @notice Interface implemented by the `Comptroller` contract, including only some util view functions.
|
|
82
|
+
*/
|
|
73
83
|
interface ComptrollerViewInterface {
|
|
74
84
|
function markets(address) external view returns (bool, uint256);
|
|
75
85
|
|
|
@@ -6,6 +6,11 @@ import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interf
|
|
|
6
6
|
import { VToken } from "./VToken.sol";
|
|
7
7
|
import { RewardsDistributor } from "./Rewards/RewardsDistributor.sol";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @title ComptrollerStorage
|
|
11
|
+
* @author Venus
|
|
12
|
+
* @notice Storage layout for the `Comptroller` contract.
|
|
13
|
+
*/
|
|
9
14
|
contract ComptrollerStorage {
|
|
10
15
|
struct LiquidationOrder {
|
|
11
16
|
VToken vTokenCollateral;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @title TokenErrorReporter
|
|
6
|
+
* @author Venus
|
|
7
|
+
* @notice Errors that can be thrown by the `VToken` contract.
|
|
8
|
+
*/
|
|
4
9
|
contract TokenErrorReporter {
|
|
5
10
|
uint256 public constant NO_ERROR = 0; // support legacy return codes
|
|
6
11
|
|
|
@@ -62,13 +62,6 @@ contract ExponentialNoError {
|
|
|
62
62
|
return left.mantissa < right.mantissa;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
* @dev Checks if first Exp is less than or equal second Exp.
|
|
67
|
-
*/
|
|
68
|
-
function lessThanOrEqualExp(Exp memory left, Exp memory right) internal pure returns (bool) {
|
|
69
|
-
return left.mantissa <= right.mantissa;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
65
|
function safe224(uint256 n, string memory errorMessage) internal pure returns (uint224) {
|
|
73
66
|
require(n <= type(uint224).max, errorMessage);
|
|
74
67
|
return uint224(n);
|
|
@@ -12,6 +12,19 @@ import { PoolRegistryInterface } from "../Pool/PoolRegistryInterface.sol";
|
|
|
12
12
|
import { PoolRegistry } from "../Pool/PoolRegistry.sol";
|
|
13
13
|
import { RewardsDistributor } from "../Rewards/RewardsDistributor.sol";
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @title PoolLens
|
|
17
|
+
* @author Venus
|
|
18
|
+
* @notice The `PoolLens` contract is designed to retrieve important information for each registered pool. A list of essential information
|
|
19
|
+
* for all pools within the lending protocol can be acquired through the function `getAllPools()`. Additionally, the following records can be
|
|
20
|
+
* looked up for specific pools and markets:
|
|
21
|
+
- the vToken balance of a given user;
|
|
22
|
+
- the pool data (oracle address, associated vToken, liquidation incentive, etc) of a pool via its associated comptroller address;
|
|
23
|
+
- the vToken address in a pool for a given asset;
|
|
24
|
+
- a list of all pools that support an asset;
|
|
25
|
+
- the underlying asset price of a vToken;
|
|
26
|
+
- the metadata (exchange/borrow/supply rate, total supply, collateral factor, etc) of any vToken.
|
|
27
|
+
*/
|
|
15
28
|
contract PoolLens is ExponentialNoError {
|
|
16
29
|
/**
|
|
17
30
|
* @dev Struct for PoolDetails.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @title MaxLoopsLimitHelper
|
|
6
|
+
* @author Venus
|
|
7
|
+
* @notice Abstract contract used to avoid collection with too many items that would generate gas errors and DoS.
|
|
8
|
+
*/
|
|
4
9
|
abstract contract MaxLoopsLimitHelper {
|
|
5
10
|
// Limit for the loops to avoid the DOS
|
|
6
11
|
uint256 public maxLoopsLimit;
|
|
@@ -2,54 +2,44 @@
|
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
5
|
-
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
6
5
|
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
7
|
-
import {
|
|
8
|
-
import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
9
|
-
import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
|
|
10
|
-
import { AccessControlManager } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol";
|
|
6
|
+
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
|
|
11
7
|
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
|
|
12
8
|
|
|
13
9
|
import { PoolRegistryInterface } from "./PoolRegistryInterface.sol";
|
|
14
10
|
import { Comptroller } from "../Comptroller.sol";
|
|
15
|
-
import { VTokenProxyFactory } from "../Factories/VTokenProxyFactory.sol";
|
|
16
|
-
import { JumpRateModelFactory } from "../Factories/JumpRateModelFactory.sol";
|
|
17
|
-
import { WhitePaperInterestRateModelFactory } from "../Factories/WhitePaperInterestRateModelFactory.sol";
|
|
18
|
-
import { WhitePaperInterestRateModel } from "../WhitePaperInterestRateModel.sol";
|
|
19
11
|
import { VToken } from "../VToken.sol";
|
|
20
|
-
import { InterestRateModel } from "../InterestRateModel.sol";
|
|
21
|
-
import { Shortfall } from "../Shortfall/Shortfall.sol";
|
|
22
|
-
import { VTokenInterface } from "../VTokenInterfaces.sol";
|
|
23
12
|
import { ensureNonzeroAddress } from "../lib/validators.sol";
|
|
24
13
|
|
|
25
14
|
/**
|
|
26
15
|
* @title PoolRegistry
|
|
27
|
-
* @
|
|
16
|
+
* @author Venus
|
|
17
|
+
* @notice The Isolated Pools architecture centers around the `PoolRegistry` contract. The `PoolRegistry` maintains a directory of isolated lending
|
|
18
|
+
* pools and can perform actions like creating and registering new pools, adding new markets to existing pools, setting and updating the pool's required
|
|
19
|
+
* metadata, and providing the getter methods to get information on the pools.
|
|
20
|
+
*
|
|
21
|
+
* Isolated lending has three main components: PoolRegistry, pools, and markets. The PoolRegistry is responsible for managing pools.
|
|
22
|
+
* It can create new pools, update pool metadata and manage markets within pools. PoolRegistry contains getter methods to get the details of
|
|
23
|
+
* any existing pool like `getVTokenForAsset` and `getPoolsSupportedByAsset`. It also contains methods for updating pool metadata (`updatePoolMetadata`)
|
|
24
|
+
* and setting pool name (`setPoolName`).
|
|
25
|
+
*
|
|
26
|
+
* The directory of pools is managed through two mappings: `_poolByComptroller` which is a hashmap with the comptroller address as the key and `VenusPool` as
|
|
27
|
+
* the value and `_poolsByID` which is an array of comptroller addresses. Individual pools can be accessed by calling `getPoolByComptroller` with the pool's
|
|
28
|
+
* comptroller address. `_poolsByID` is used to iterate through all of the pools.
|
|
29
|
+
*
|
|
30
|
+
* PoolRegistry also contains a map of asset addresses called `_supportedPools` that maps to an array of assets suppored by each pool. This array of pools by
|
|
31
|
+
* asset is retrieved by calling `getPoolsSupportedByAsset`.
|
|
32
|
+
*
|
|
33
|
+
* PoolRegistry registers new isolated pools in the directory with the `createRegistryPool` method. Isolated pools are composed of independent markets with
|
|
34
|
+
* specific assets and custom risk management configurations according to their markets.
|
|
28
35
|
*/
|
|
29
36
|
contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegistryInterface {
|
|
30
37
|
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
31
38
|
|
|
32
|
-
enum InterestRateModels {
|
|
33
|
-
WhitePaper,
|
|
34
|
-
JumpRate
|
|
35
|
-
}
|
|
36
|
-
|
|
37
39
|
struct AddMarketInput {
|
|
38
|
-
|
|
39
|
-
address asset;
|
|
40
|
-
uint8 decimals;
|
|
41
|
-
string name;
|
|
42
|
-
string symbol;
|
|
43
|
-
InterestRateModels rateModel;
|
|
44
|
-
uint256 baseRatePerYear;
|
|
45
|
-
uint256 multiplierPerYear;
|
|
46
|
-
uint256 jumpMultiplierPerYear;
|
|
47
|
-
uint256 kink_;
|
|
40
|
+
VToken vToken;
|
|
48
41
|
uint256 collateralFactor;
|
|
49
42
|
uint256 liquidationThreshold;
|
|
50
|
-
uint256 reserveFactor;
|
|
51
|
-
AccessControlManager accessControlManager;
|
|
52
|
-
address beaconAddress;
|
|
53
43
|
uint256 initialSupply;
|
|
54
44
|
address vTokenReceiver;
|
|
55
45
|
uint256 supplyCap;
|
|
@@ -58,31 +48,6 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
|
|
|
58
48
|
|
|
59
49
|
uint256 internal constant MAX_POOL_NAME_LENGTH = 100;
|
|
60
50
|
|
|
61
|
-
/**
|
|
62
|
-
* @notice VTokenProxyFactory contract address
|
|
63
|
-
*/
|
|
64
|
-
VTokenProxyFactory public vTokenFactory;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @notice JumpRateModelFactory contract address
|
|
68
|
-
*/
|
|
69
|
-
JumpRateModelFactory public jumpRateFactory;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @notice WhitePaperInterestRateModelFactory contract address
|
|
73
|
-
*/
|
|
74
|
-
WhitePaperInterestRateModelFactory public whitePaperFactory;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @notice Shortfall contract address
|
|
78
|
-
*/
|
|
79
|
-
Shortfall public shortfall;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @notice Shortfall contract address
|
|
83
|
-
*/
|
|
84
|
-
address payable public protocolShareReserve;
|
|
85
|
-
|
|
86
51
|
/**
|
|
87
52
|
* @notice Maps pool's comptroller address to metadata.
|
|
88
53
|
*/
|
|
@@ -137,16 +102,6 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
|
|
|
137
102
|
*/
|
|
138
103
|
event MarketAdded(address indexed comptroller, address indexed vTokenAddress);
|
|
139
104
|
|
|
140
|
-
/**
|
|
141
|
-
* @notice Event emitted when shortfall contract address is changed
|
|
142
|
-
*/
|
|
143
|
-
event NewShortfallContract(address indexed oldShortfall, address indexed newShortfall);
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @notice Event emitted when protocol share reserve contract address is changed
|
|
147
|
-
*/
|
|
148
|
-
event NewProtocolShareReserve(address indexed oldProtocolShareReserve, address indexed newProtocolShareReserve);
|
|
149
|
-
|
|
150
105
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
151
106
|
constructor() {
|
|
152
107
|
// Note that the contract is upgradeable. Use initialize() or reinitializers
|
|
@@ -156,161 +111,73 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
|
|
|
156
111
|
|
|
157
112
|
/**
|
|
158
113
|
* @dev Initializes the deployer to owner
|
|
159
|
-
* @param vTokenFactory_ vToken factory address
|
|
160
|
-
* @param jumpRateFactory_ jump rate factory address
|
|
161
|
-
* @param whitePaperFactory_ white paper factory address
|
|
162
|
-
* @param protocolShareReserve_ protocol's shares reserve address
|
|
163
|
-
* @param shortfall_ Shortfall contract address
|
|
164
114
|
* @param accessControlManager_ AccessControlManager contract address
|
|
165
|
-
* @custom:error ZeroAddressNotAllowed is thrown when shortfall contract address is zero
|
|
166
|
-
* @custom:error ZeroAddressNotAllowed is thrown when protocol share reserve address is zero
|
|
167
115
|
*/
|
|
168
|
-
function initialize(
|
|
169
|
-
VTokenProxyFactory vTokenFactory_,
|
|
170
|
-
JumpRateModelFactory jumpRateFactory_,
|
|
171
|
-
WhitePaperInterestRateModelFactory whitePaperFactory_,
|
|
172
|
-
Shortfall shortfall_,
|
|
173
|
-
address payable protocolShareReserve_,
|
|
174
|
-
address accessControlManager_
|
|
175
|
-
) external initializer {
|
|
116
|
+
function initialize(address accessControlManager_) external initializer {
|
|
176
117
|
__Ownable2Step_init();
|
|
177
118
|
__AccessControlled_init_unchained(accessControlManager_);
|
|
178
|
-
|
|
179
|
-
vTokenFactory = vTokenFactory_;
|
|
180
|
-
jumpRateFactory = jumpRateFactory_;
|
|
181
|
-
whitePaperFactory = whitePaperFactory_;
|
|
182
|
-
_setShortfallContract(shortfall_);
|
|
183
|
-
_setProtocolShareReserve(protocolShareReserve_);
|
|
184
119
|
}
|
|
185
120
|
|
|
186
121
|
/**
|
|
187
|
-
* @notice
|
|
188
|
-
* @
|
|
189
|
-
* @custom:error ZeroAddressNotAllowed is thrown when protocol share reserve address is zero
|
|
190
|
-
* @custom:access Only Governance
|
|
191
|
-
*/
|
|
192
|
-
function setProtocolShareReserve(address payable protocolShareReserve_) external onlyOwner {
|
|
193
|
-
_setProtocolShareReserve(protocolShareReserve_);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @notice Sets shortfall contract address
|
|
198
|
-
* @param shortfall_ The address of the shortfall contract
|
|
199
|
-
* @custom:error ZeroAddressNotAllowed is thrown when shortfall contract address is zero
|
|
200
|
-
* @custom:access Only Governance
|
|
201
|
-
*/
|
|
202
|
-
function setShortfallContract(Shortfall shortfall_) external onlyOwner {
|
|
203
|
-
_setShortfallContract(shortfall_);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @dev Deploys a new Venus pool and adds to the directory.
|
|
122
|
+
* @notice Adds a new Venus pool to the directory
|
|
123
|
+
* @dev Price oracle must be configured before adding a pool
|
|
208
124
|
* @param name The name of the pool
|
|
209
|
-
* @param
|
|
125
|
+
* @param comptroller Pool's Comptroller contract
|
|
210
126
|
* @param closeFactor The pool's close factor (scaled by 1e18)
|
|
211
127
|
* @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18)
|
|
212
128
|
* @param minLiquidatableCollateral Minimal collateral for regular (non-batch) liquidations flow
|
|
213
|
-
* @param priceOracle The pool's price oracle address
|
|
214
|
-
* @param maxLoopsLimit The maximum number of iterations the loops can perform
|
|
215
|
-
* @param accessControlManager AccessControlManager contract address
|
|
216
129
|
* @return index The index of the registered Venus pool
|
|
217
|
-
* @
|
|
218
|
-
* @custom:error ZeroAddressNotAllowed is thrown when Comptroller beacon address is zero
|
|
130
|
+
* @custom:error ZeroAddressNotAllowed is thrown when Comptroller address is zero
|
|
219
131
|
* @custom:error ZeroAddressNotAllowed is thrown when price oracle address is zero
|
|
220
132
|
*/
|
|
221
|
-
function
|
|
133
|
+
function addPool(
|
|
222
134
|
string calldata name,
|
|
223
|
-
|
|
135
|
+
Comptroller comptroller,
|
|
224
136
|
uint256 closeFactor,
|
|
225
137
|
uint256 liquidationIncentive,
|
|
226
|
-
uint256 minLiquidatableCollateral
|
|
227
|
-
|
|
228
|
-
uint256
|
|
229
|
-
address accessControlManager
|
|
230
|
-
) external virtual returns (uint256 index, address proxyAddress) {
|
|
231
|
-
_checkAccessAllowed("createRegistryPool(string,address,uint256,uint256,uint256,address,uint256,address)");
|
|
138
|
+
uint256 minLiquidatableCollateral
|
|
139
|
+
) external virtual returns (uint256 index) {
|
|
140
|
+
_checkAccessAllowed("addPool(string,address,uint256,uint256,uint256)");
|
|
232
141
|
// Input validation
|
|
233
|
-
ensureNonzeroAddress(
|
|
234
|
-
ensureNonzeroAddress(
|
|
235
|
-
|
|
236
|
-
BeaconProxy proxy = new BeaconProxy(
|
|
237
|
-
beaconAddress,
|
|
238
|
-
abi.encodeWithSelector(Comptroller.initialize.selector, maxLoopsLimit, accessControlManager)
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
proxyAddress = address(proxy);
|
|
242
|
-
Comptroller comptrollerProxy = Comptroller(proxyAddress);
|
|
142
|
+
ensureNonzeroAddress(address(comptroller));
|
|
143
|
+
ensureNonzeroAddress(address(comptroller.oracle()));
|
|
243
144
|
|
|
244
|
-
uint256 poolId = _registerPool(name,
|
|
145
|
+
uint256 poolId = _registerPool(name, address(comptroller));
|
|
245
146
|
|
|
246
147
|
// Set Venus pool parameters
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
comptrollerProxy.setPriceOracle(ResilientOracleInterface(priceOracle));
|
|
148
|
+
comptroller.setCloseFactor(closeFactor);
|
|
149
|
+
comptroller.setLiquidationIncentive(liquidationIncentive);
|
|
150
|
+
comptroller.setMinLiquidatableCollateral(minLiquidatableCollateral);
|
|
251
151
|
|
|
252
|
-
|
|
253
|
-
comptrollerProxy.transferOwnership(msg.sender);
|
|
254
|
-
|
|
255
|
-
return (poolId, proxyAddress);
|
|
152
|
+
return poolId;
|
|
256
153
|
}
|
|
257
154
|
|
|
258
155
|
/**
|
|
259
|
-
* @notice Add a market to an existing pool and then mint to provide initial supply
|
|
260
|
-
* @param input The structure describing the parameters for adding a market to a pool
|
|
261
|
-
* @custom:error ZeroAddressNotAllowed is thrown when
|
|
262
|
-
* @custom:error ZeroAddressNotAllowed is thrown when asset address is zero
|
|
263
|
-
* @custom:error ZeroAddressNotAllowed is thrown when VToken beacon address is zero
|
|
156
|
+
* @notice Add a market to an existing pool and then mint to provide initial supply
|
|
157
|
+
* @param input The structure describing the parameters for adding a market to a pool
|
|
158
|
+
* @custom:error ZeroAddressNotAllowed is thrown when vToken address is zero
|
|
264
159
|
* @custom:error ZeroAddressNotAllowed is thrown when vTokenReceiver address is zero
|
|
265
160
|
*/
|
|
266
161
|
function addMarket(AddMarketInput memory input) external {
|
|
267
162
|
_checkAccessAllowed("addMarket(AddMarketInput)");
|
|
268
|
-
ensureNonzeroAddress(input.
|
|
269
|
-
ensureNonzeroAddress(input.asset);
|
|
270
|
-
ensureNonzeroAddress(input.beaconAddress);
|
|
163
|
+
ensureNonzeroAddress(address(input.vToken));
|
|
271
164
|
ensureNonzeroAddress(input.vTokenReceiver);
|
|
165
|
+
require(input.initialSupply > 0, "PoolRegistry: initialSupply is zero");
|
|
166
|
+
|
|
167
|
+
VToken vToken = input.vToken;
|
|
168
|
+
address vTokenAddress = address(vToken);
|
|
169
|
+
address comptrollerAddress = address(vToken.comptroller());
|
|
170
|
+
Comptroller comptroller = Comptroller(comptrollerAddress);
|
|
171
|
+
address underlyingAddress = vToken.underlying();
|
|
172
|
+
IERC20Upgradeable underlying = IERC20Upgradeable(underlyingAddress);
|
|
272
173
|
|
|
174
|
+
require(_poolByComptroller[comptrollerAddress].creator != address(0), "PoolRegistry: Pool not registered");
|
|
273
175
|
// solhint-disable-next-line reason-string
|
|
274
176
|
require(
|
|
275
|
-
_vTokens[
|
|
177
|
+
_vTokens[comptrollerAddress][underlyingAddress] == address(0),
|
|
276
178
|
"PoolRegistry: Market already added for asset comptroller combination"
|
|
277
179
|
);
|
|
278
180
|
|
|
279
|
-
InterestRateModel rate;
|
|
280
|
-
if (input.rateModel == InterestRateModels.JumpRate) {
|
|
281
|
-
rate = InterestRateModel(
|
|
282
|
-
jumpRateFactory.deploy(
|
|
283
|
-
input.baseRatePerYear,
|
|
284
|
-
input.multiplierPerYear,
|
|
285
|
-
input.jumpMultiplierPerYear,
|
|
286
|
-
input.kink_,
|
|
287
|
-
input.accessControlManager
|
|
288
|
-
)
|
|
289
|
-
);
|
|
290
|
-
} else {
|
|
291
|
-
rate = InterestRateModel(whitePaperFactory.deploy(input.baseRatePerYear, input.multiplierPerYear));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
Comptroller comptroller = Comptroller(input.comptroller);
|
|
295
|
-
uint256 underlyingDecimals = IERC20Metadata(input.asset).decimals();
|
|
296
|
-
|
|
297
|
-
VTokenProxyFactory.VTokenArgs memory initializeArgs = VTokenProxyFactory.VTokenArgs(
|
|
298
|
-
input.asset,
|
|
299
|
-
comptroller,
|
|
300
|
-
rate,
|
|
301
|
-
10**(underlyingDecimals + 18 - input.decimals),
|
|
302
|
-
input.name,
|
|
303
|
-
input.symbol,
|
|
304
|
-
input.decimals,
|
|
305
|
-
msg.sender,
|
|
306
|
-
input.accessControlManager,
|
|
307
|
-
VTokenInterface.RiskManagementInit(address(shortfall), protocolShareReserve),
|
|
308
|
-
input.beaconAddress,
|
|
309
|
-
input.reserveFactor
|
|
310
|
-
);
|
|
311
|
-
|
|
312
|
-
VToken vToken = vTokenFactory.deployVTokenProxy(initializeArgs);
|
|
313
|
-
|
|
314
181
|
comptroller.supportMarket(vToken);
|
|
315
182
|
comptroller.setCollateralFactor(vToken, input.collateralFactor, input.liquidationThreshold);
|
|
316
183
|
|
|
@@ -325,16 +192,15 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
|
|
|
325
192
|
comptroller.setMarketSupplyCaps(vTokens, newSupplyCaps);
|
|
326
193
|
comptroller.setMarketBorrowCaps(vTokens, newBorrowCaps);
|
|
327
194
|
|
|
328
|
-
_vTokens[
|
|
329
|
-
_supportedPools[
|
|
195
|
+
_vTokens[comptrollerAddress][underlyingAddress] = vTokenAddress;
|
|
196
|
+
_supportedPools[underlyingAddress].push(comptrollerAddress);
|
|
330
197
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
token.approve(address(vToken), amountToSupply);
|
|
198
|
+
uint256 amountToSupply = _transferIn(underlying, msg.sender, input.initialSupply);
|
|
199
|
+
underlying.approve(vTokenAddress, 0);
|
|
200
|
+
underlying.approve(vTokenAddress, amountToSupply);
|
|
335
201
|
vToken.mintBehalf(input.vTokenReceiver, amountToSupply);
|
|
336
202
|
|
|
337
|
-
emit MarketAdded(
|
|
203
|
+
emit MarketAdded(comptrollerAddress, vTokenAddress);
|
|
338
204
|
}
|
|
339
205
|
|
|
340
206
|
/**
|
|
@@ -437,20 +303,6 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
|
|
|
437
303
|
return balanceAfter - balanceBefore;
|
|
438
304
|
}
|
|
439
305
|
|
|
440
|
-
function _setShortfallContract(Shortfall shortfall_) internal {
|
|
441
|
-
ensureNonzeroAddress(address(shortfall_));
|
|
442
|
-
address oldShortfall = address(shortfall);
|
|
443
|
-
shortfall = shortfall_;
|
|
444
|
-
emit NewShortfallContract(oldShortfall, address(shortfall_));
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
function _setProtocolShareReserve(address payable protocolShareReserve_) internal {
|
|
448
|
-
ensureNonzeroAddress(protocolShareReserve_);
|
|
449
|
-
address oldProtocolShareReserve = protocolShareReserve;
|
|
450
|
-
protocolShareReserve = protocolShareReserve_;
|
|
451
|
-
emit NewProtocolShareReserve(oldProtocolShareReserve, protocolShareReserve_);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
306
|
function _ensureValidName(string calldata name) internal pure {
|
|
455
307
|
require(bytes(name).length <= MAX_POOL_NAME_LENGTH, "Pool's name is too large");
|
|
456
308
|
}
|