@venusprotocol/isolated-pools 1.0.0-dev.8 → 1.0.0-dev.9

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.
Files changed (210) hide show
  1. package/README.md +1 -11
  2. package/contracts/Comptroller.sol +1 -1
  3. package/contracts/Pool/PoolRegistry.sol +39 -207
  4. package/contracts/lib/imports.sol +11 -0
  5. package/dist/deploy/006-deploy-factories.js +1 -32
  6. package/dist/deploy/007-access-control-configure.js +2 -6
  7. package/dist/deploy/009-deploy-pools.js +84 -23
  8. package/package.json +1 -1
  9. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +0 -4
  10. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.json +0 -215
  11. package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +0 -4
  12. package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.json +0 -183
  13. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +0 -4
  14. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json +0 -63
  15. package/artifacts/@openzeppelin/contracts/interfaces/IERC1967.sol/IERC1967.dbg.json +0 -4
  16. package/artifacts/@openzeppelin/contracts/interfaces/IERC1967.sol/IERC1967.json +0 -56
  17. package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +0 -4
  18. package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.json +0 -24
  19. package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +0 -4
  20. package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.json +0 -56
  21. package/artifacts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.dbg.json +0 -4
  22. package/artifacts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.json +0 -19
  23. package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.dbg.json +0 -4
  24. package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.json +0 -80
  25. package/artifacts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +0 -4
  26. package/artifacts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.json +0 -24
  27. package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +0 -4
  28. package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +0 -113
  29. package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +0 -4
  30. package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +0 -297
  31. package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +0 -4
  32. package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +0 -194
  33. package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +0 -4
  34. package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json +0 -233
  35. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +0 -4
  36. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +0 -10
  37. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +0 -4
  38. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +0 -10
  39. package/artifacts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +0 -4
  40. package/artifacts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.json +0 -10
  41. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +0 -4
  42. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +0 -10
  43. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +0 -4
  44. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +0 -30
  45. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +0 -4
  46. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +0 -30
  47. package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +0 -4
  48. package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.json +0 -10
  49. package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +0 -4
  50. package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +0 -10
  51. package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +0 -4
  52. package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +0 -115
  53. package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +0 -4
  54. package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.json +0 -76
  55. package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +0 -4
  56. package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.json +0 -24
  57. package/artifacts/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol/ReentrancyGuardUpgradeable.dbg.json +0 -4
  58. package/artifacts/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol/ReentrancyGuardUpgradeable.json +0 -24
  59. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +0 -4
  60. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.json +0 -194
  61. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.dbg.json +0 -4
  62. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.json +0 -86
  63. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.dbg.json +0 -4
  64. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.json +0 -10
  65. package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +0 -4
  66. package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.json +0 -10
  67. package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +0 -4
  68. package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.json +0 -24
  69. package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.dbg.json +0 -4
  70. package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.json +0 -369
  71. package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +0 -4
  72. package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.json +0 -181
  73. package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +0 -4
  74. package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.json +0 -282
  75. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.dbg.json +0 -4
  76. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.json +0 -40
  77. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/OracleInterface.dbg.json +0 -4
  78. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/OracleInterface.json +0 -30
  79. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.dbg.json +0 -4
  80. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.json +0 -43
  81. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/TwapInterface.dbg.json +0 -4
  82. package/artifacts/@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol/TwapInterface.json +0 -49
  83. package/artifacts/build-info/8c02b3a8e3642dffe55772a8d2bed46f.json +0 -1
  84. package/artifacts/build-info/f19d689bc99e63a20dd2a17a14e2b84a.json +0 -1
  85. package/artifacts/contracts/BaseJumpRateModelV2.sol/BaseJumpRateModelV2.dbg.json +0 -4
  86. package/artifacts/contracts/BaseJumpRateModelV2.sol/BaseJumpRateModelV2.json +0 -276
  87. package/artifacts/contracts/Comptroller.sol/Comptroller.dbg.json +0 -4
  88. package/artifacts/contracts/Comptroller.sol/Comptroller.json +0 -1667
  89. package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerInterface.dbg.json +0 -4
  90. package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerInterface.json +0 -285
  91. package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerViewInterface.dbg.json +0 -4
  92. package/artifacts/contracts/ComptrollerInterface.sol/ComptrollerViewInterface.json +0 -170
  93. package/artifacts/contracts/ComptrollerStorage.sol/ComptrollerStorage.dbg.json +0 -4
  94. package/artifacts/contracts/ComptrollerStorage.sol/ComptrollerStorage.json +0 -173
  95. package/artifacts/contracts/ErrorReporter.sol/TokenErrorReporter.dbg.json +0 -4
  96. package/artifacts/contracts/ErrorReporter.sol/TokenErrorReporter.json +0 -156
  97. package/artifacts/contracts/ExponentialNoError.sol/ExponentialNoError.dbg.json +0 -4
  98. package/artifacts/contracts/ExponentialNoError.sol/ExponentialNoError.json +0 -10
  99. package/artifacts/contracts/Factories/JumpRateModelFactory.sol/JumpRateModelFactory.dbg.json +0 -4
  100. package/artifacts/contracts/Factories/JumpRateModelFactory.sol/JumpRateModelFactory.json +0 -50
  101. package/artifacts/contracts/Factories/VTokenProxyFactory.sol/VTokenProxyFactory.dbg.json +0 -4
  102. package/artifacts/contracts/Factories/VTokenProxyFactory.sol/VTokenProxyFactory.json +0 -191
  103. package/artifacts/contracts/Factories/WhitePaperInterestRateModelFactory.sol/WhitePaperInterestRateModelFactory.dbg.json +0 -4
  104. package/artifacts/contracts/Factories/WhitePaperInterestRateModelFactory.sol/WhitePaperInterestRateModelFactory.json +0 -35
  105. package/artifacts/contracts/IPancakeswapV2Router.sol/IPancakeswapV2Router.dbg.json +0 -4
  106. package/artifacts/contracts/IPancakeswapV2Router.sol/IPancakeswapV2Router.json +0 -50
  107. package/artifacts/contracts/InterestRateModel.sol/InterestRateModel.dbg.json +0 -4
  108. package/artifacts/contracts/InterestRateModel.sol/InterestRateModel.json +0 -97
  109. package/artifacts/contracts/JumpRateModelV2.sol/JumpRateModelV2.dbg.json +0 -4
  110. package/artifacts/contracts/JumpRateModelV2.sol/JumpRateModelV2.json +0 -307
  111. package/artifacts/contracts/Lens/PoolLens.sol/PoolLens.dbg.json +0 -4
  112. package/artifacts/contracts/Lens/PoolLens.sol/PoolLens.json +0 -1087
  113. package/artifacts/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.dbg.json +0 -4
  114. package/artifacts/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.json +0 -59
  115. package/artifacts/contracts/Pool/PoolRegistry.sol/PoolRegistry.dbg.json +0 -4
  116. package/artifacts/contracts/Pool/PoolRegistry.sol/PoolRegistry.json +0 -923
  117. package/artifacts/contracts/Pool/PoolRegistryInterface.sol/PoolRegistryInterface.dbg.json +0 -4
  118. package/artifacts/contracts/Pool/PoolRegistryInterface.sol/PoolRegistryInterface.json +0 -176
  119. package/artifacts/contracts/Proxy/UpgradeableBeacon.sol/Beacon.dbg.json +0 -4
  120. package/artifacts/contracts/Proxy/UpgradeableBeacon.sol/Beacon.json +0 -113
  121. package/artifacts/contracts/Rewards/RewardsDistributor.sol/RewardsDistributor.dbg.json +0 -4
  122. package/artifacts/contracts/Rewards/RewardsDistributor.sol/RewardsDistributor.json +0 -928
  123. package/artifacts/contracts/RiskFund/IProtocolShareReserve.sol/IProtocolShareReserve.dbg.json +0 -4
  124. package/artifacts/contracts/RiskFund/IProtocolShareReserve.sol/IProtocolShareReserve.json +0 -29
  125. package/artifacts/contracts/RiskFund/IRiskFund.sol/IRiskFund.dbg.json +0 -4
  126. package/artifacts/contracts/RiskFund/IRiskFund.sol/IRiskFund.json +0 -101
  127. package/artifacts/contracts/RiskFund/ProtocolShareReserve.sol/ProtocolShareReserve.dbg.json +0 -4
  128. package/artifacts/contracts/RiskFund/ProtocolShareReserve.sol/ProtocolShareReserve.json +0 -296
  129. package/artifacts/contracts/RiskFund/ReserveHelpers.sol/ReserveHelpers.dbg.json +0 -4
  130. package/artifacts/contracts/RiskFund/ReserveHelpers.sol/ReserveHelpers.json +0 -83
  131. package/artifacts/contracts/RiskFund/RiskFund.sol/RiskFund.dbg.json +0 -4
  132. package/artifacts/contracts/RiskFund/RiskFund.sol/RiskFund.json +0 -615
  133. package/artifacts/contracts/Shortfall/IShortfall.sol/IShortfall.dbg.json +0 -4
  134. package/artifacts/contracts/Shortfall/IShortfall.sol/IShortfall.json +0 -24
  135. package/artifacts/contracts/Shortfall/Shortfall.sol/Shortfall.dbg.json +0 -4
  136. package/artifacts/contracts/Shortfall/Shortfall.sol/Shortfall.json +0 -756
  137. package/artifacts/contracts/VToken.sol/VToken.dbg.json +0 -4
  138. package/artifacts/contracts/VToken.sol/VToken.json +0 -1850
  139. package/artifacts/contracts/VTokenInterfaces.sol/VTokenInterface.dbg.json +0 -4
  140. package/artifacts/contracts/VTokenInterfaces.sol/VTokenInterface.json +0 -1398
  141. package/artifacts/contracts/VTokenInterfaces.sol/VTokenStorage.dbg.json +0 -4
  142. package/artifacts/contracts/VTokenInterfaces.sol/VTokenStorage.json +0 -219
  143. package/artifacts/contracts/WhitePaperInterestRateModel.sol/WhitePaperInterestRateModel.dbg.json +0 -4
  144. package/artifacts/contracts/WhitePaperInterestRateModel.sol/WhitePaperInterestRateModel.json +0 -192
  145. package/artifacts/contracts/test/ComptrollerHarness.sol/ComptrollerHarness.dbg.json +0 -4
  146. package/artifacts/contracts/test/ComptrollerHarness.sol/ComptrollerHarness.json +0 -1712
  147. package/artifacts/contracts/test/ComptrollerHarness.sol/EchoTypesComptroller.dbg.json +0 -4
  148. package/artifacts/contracts/test/ComptrollerHarness.sol/EchoTypesComptroller.json +0 -94
  149. package/artifacts/contracts/test/ComptrollerScenario.sol/ComptrollerScenario.dbg.json +0 -4
  150. package/artifacts/contracts/test/ComptrollerScenario.sol/ComptrollerScenario.json +0 -1744
  151. package/artifacts/contracts/test/ERC20.sol/ERC20.dbg.json +0 -4
  152. package/artifacts/contracts/test/ERC20.sol/ERC20.json +0 -194
  153. package/artifacts/contracts/test/ERC20.sol/ERC20Base.dbg.json +0 -4
  154. package/artifacts/contracts/test/ERC20.sol/ERC20Base.json +0 -141
  155. package/artifacts/contracts/test/ERC20.sol/ERC20Harness.dbg.json +0 -4
  156. package/artifacts/contracts/test/ERC20.sol/ERC20Harness.json +0 -351
  157. package/artifacts/contracts/test/ERC20.sol/ERC20NS.dbg.json +0 -4
  158. package/artifacts/contracts/test/ERC20.sol/ERC20NS.json +0 -182
  159. package/artifacts/contracts/test/ERC20.sol/NonStandardToken.dbg.json +0 -4
  160. package/artifacts/contracts/test/ERC20.sol/NonStandardToken.json +0 -247
  161. package/artifacts/contracts/test/ERC20.sol/StandardToken.dbg.json +0 -4
  162. package/artifacts/contracts/test/ERC20.sol/StandardToken.json +0 -259
  163. package/artifacts/contracts/test/EvilToken.sol/EvilToken.dbg.json +0 -4
  164. package/artifacts/contracts/test/EvilToken.sol/EvilToken.json +0 -303
  165. package/artifacts/contracts/test/FaucetToken.sol/FaucetNonStandardToken.dbg.json +0 -4
  166. package/artifacts/contracts/test/FaucetToken.sol/FaucetNonStandardToken.json +0 -265
  167. package/artifacts/contracts/test/FaucetToken.sol/FaucetToken.dbg.json +0 -4
  168. package/artifacts/contracts/test/FaucetToken.sol/FaucetToken.json +0 -277
  169. package/artifacts/contracts/test/FaucetToken.sol/FaucetTokenReEntrantHarness.dbg.json +0 -4
  170. package/artifacts/contracts/test/FaucetToken.sol/FaucetTokenReEntrantHarness.json +0 -313
  171. package/artifacts/contracts/test/FeeToken.sol/FeeToken.dbg.json +0 -4
  172. package/artifacts/contracts/test/FeeToken.sol/FeeToken.json +0 -313
  173. package/artifacts/contracts/test/HarnessMaxLoopsLimitHelper.sol/HarnessMaxLoopsLimitHelper.dbg.json +0 -4
  174. package/artifacts/contracts/test/HarnessMaxLoopsLimitHelper.sol/HarnessMaxLoopsLimitHelper.json +0 -85
  175. package/artifacts/contracts/test/MockDeflationaryToken.sol/MockDeflatingToken.dbg.json +0 -4
  176. package/artifacts/contracts/test/MockDeflationaryToken.sol/MockDeflatingToken.json +0 -332
  177. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IERC20.dbg.json +0 -4
  178. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IERC20.json +0 -233
  179. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeFactory.dbg.json +0 -4
  180. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeFactory.json +0 -187
  181. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakePair.dbg.json +0 -4
  182. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakePair.json +0 -668
  183. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter01.dbg.json +0 -4
  184. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter01.json +0 -760
  185. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter02.dbg.json +0 -4
  186. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IPancakeRouter02.json +0 -962
  187. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IWETH.dbg.json +0 -4
  188. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/IWETH.json +0 -55
  189. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeLibrary.dbg.json +0 -4
  190. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeLibrary.json +0 -10
  191. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeRouter.dbg.json +0 -4
  192. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/PancakeRouter.json +0 -982
  193. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/SafeMath.dbg.json +0 -4
  194. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/SafeMath.json +0 -10
  195. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/TransferHelper.dbg.json +0 -4
  196. package/artifacts/contracts/test/Mocks/MockPancakeSwap.sol/TransferHelper.json +0 -10
  197. package/artifacts/contracts/test/Mocks/MockPriceOracle.sol/MockPriceOracle.dbg.json +0 -4
  198. package/artifacts/contracts/test/Mocks/MockPriceOracle.sol/MockPriceOracle.json +0 -85
  199. package/artifacts/contracts/test/Mocks/MockToken.sol/MockToken.dbg.json +0 -4
  200. package/artifacts/contracts/test/Mocks/MockToken.sol/MockToken.json +0 -315
  201. package/artifacts/contracts/test/SafeMath.sol/SafeMath.dbg.json +0 -4
  202. package/artifacts/contracts/test/SafeMath.sol/SafeMath.json +0 -10
  203. package/artifacts/contracts/test/UpgradedVToken.sol/UpgradedVToken.dbg.json +0 -4
  204. package/artifacts/contracts/test/UpgradedVToken.sol/UpgradedVToken.json +0 -1946
  205. package/artifacts/contracts/test/VTokenHarness.sol/VTokenHarness.dbg.json +0 -4
  206. package/artifacts/contracts/test/VTokenHarness.sol/VTokenHarness.json +0 -2306
  207. package/contracts/Factories/JumpRateModelFactory.sol +0 -26
  208. package/contracts/Factories/VTokenProxyFactory.sol +0 -53
  209. package/contracts/Factories/WhitePaperInterestRateModelFactory.sol +0 -12
  210. package/contracts/Proxy/UpgradeableBeacon.sol +0 -10
package/README.md CHANGED
@@ -12,20 +12,10 @@ The first generation of lending pools, including the Venus Core Pool, aggregate
12
12
 
13
13
  ### PoolRegistry
14
14
 
15
- The Isolated Pools architecture centers around the `PoolRegistry` contract. The `PoolRegistry` maintains a directory of isolated lending pools and can perform actions like creating and registering new pools, adding new markets to existing pools, setting and updating the pool's required metadata, and providing the getter methods to get information on the pools.
15
+ The Isolated Pools architecture centers around the `PoolRegistry` contract. The `PoolRegistry` maintains a directory of isolated lending pools and can perform actions like registering new pools, adding new markets to existing pools, setting and updating the pool's required metadata, and providing the getter methods to get information on the pools.
16
16
 
17
17
  ![image](https://user-images.githubusercontent.com/47150934/236290058-6b14a499-7afe-46e4-bca6-d72e3db8a28e.png)
18
18
 
19
- ### Factories
20
-
21
- There are three factory contracts:
22
-
23
- - JumpRateModelFactory
24
- - VTokenProxyFactory
25
- - WhiteRateInterestModelFactory
26
-
27
- These contracts are designed to deploy contracts when adding markets to a pool. In particular, the `JumpRateModelFactory` and `WhiteRateInterestModelFactory` deploy contracts for the rate model based on which was chosen for the market. The `VtokenProxyFactory` is used to generate a new `vToken` proxy for each market when it is added to a pool.
28
-
29
19
  ### Risk Fund
30
20
 
31
21
  The risk fund concerns three main contracts:
@@ -734,7 +734,7 @@ contract Comptroller is
734
734
  * @notice Sets the closeFactor to use when liquidating borrows
735
735
  * @param newCloseFactorMantissa New close factor, scaled by 1e18
736
736
  * @custom:event Emits NewCloseFactor on success
737
- * @custom:access Only Governance
737
+ * @custom:access Controlled by AccessControlManager
738
738
  */
739
739
  function setCloseFactor(uint256 newCloseFactorMantissa) external {
740
740
  _checkAccessAllowed("setCloseFactor(uint256)");
@@ -2,24 +2,13 @@
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 { BeaconProxy } from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
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
  /**
@@ -47,27 +36,10 @@ import { ensureNonzeroAddress } from "../lib/validators.sol";
47
36
  contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegistryInterface {
48
37
  using SafeERC20Upgradeable for IERC20Upgradeable;
49
38
 
50
- enum InterestRateModels {
51
- WhitePaper,
52
- JumpRate
53
- }
54
-
55
39
  struct AddMarketInput {
56
- address comptroller;
57
- address asset;
58
- uint8 decimals;
59
- string name;
60
- string symbol;
61
- InterestRateModels rateModel;
62
- uint256 baseRatePerYear;
63
- uint256 multiplierPerYear;
64
- uint256 jumpMultiplierPerYear;
65
- uint256 kink_;
40
+ VToken vToken;
66
41
  uint256 collateralFactor;
67
42
  uint256 liquidationThreshold;
68
- uint256 reserveFactor;
69
- AccessControlManager accessControlManager;
70
- address beaconAddress;
71
43
  uint256 initialSupply;
72
44
  address vTokenReceiver;
73
45
  uint256 supplyCap;
@@ -76,31 +48,6 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
76
48
 
77
49
  uint256 internal constant MAX_POOL_NAME_LENGTH = 100;
78
50
 
79
- /**
80
- * @notice VTokenProxyFactory contract address
81
- */
82
- VTokenProxyFactory public vTokenFactory;
83
-
84
- /**
85
- * @notice JumpRateModelFactory contract address
86
- */
87
- JumpRateModelFactory public jumpRateFactory;
88
-
89
- /**
90
- * @notice WhitePaperInterestRateModelFactory contract address
91
- */
92
- WhitePaperInterestRateModelFactory public whitePaperFactory;
93
-
94
- /**
95
- * @notice Shortfall contract address
96
- */
97
- Shortfall public shortfall;
98
-
99
- /**
100
- * @notice Shortfall contract address
101
- */
102
- address payable public protocolShareReserve;
103
-
104
51
  /**
105
52
  * @notice Maps pool's comptroller address to metadata.
106
53
  */
@@ -155,16 +102,6 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
155
102
  */
156
103
  event MarketAdded(address indexed comptroller, address indexed vTokenAddress);
157
104
 
158
- /**
159
- * @notice Event emitted when shortfall contract address is changed
160
- */
161
- event NewShortfallContract(address indexed oldShortfall, address indexed newShortfall);
162
-
163
- /**
164
- * @notice Event emitted when protocol share reserve contract address is changed
165
- */
166
- event NewProtocolShareReserve(address indexed oldProtocolShareReserve, address indexed newProtocolShareReserve);
167
-
168
105
  /// @custom:oz-upgrades-unsafe-allow constructor
169
106
  constructor() {
170
107
  // Note that the contract is upgradeable. Use initialize() or reinitializers
@@ -174,163 +111,73 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
174
111
 
175
112
  /**
176
113
  * @dev Initializes the deployer to owner
177
- * @param vTokenFactory_ vToken factory address
178
- * @param jumpRateFactory_ jump rate factory address
179
- * @param whitePaperFactory_ white paper factory address
180
- * @param protocolShareReserve_ protocol's shares reserve address
181
- * @param shortfall_ Shortfall contract address
182
114
  * @param accessControlManager_ AccessControlManager contract address
183
- * @custom:error ZeroAddressNotAllowed is thrown when shortfall contract address is zero
184
- * @custom:error ZeroAddressNotAllowed is thrown when protocol share reserve address is zero
185
115
  */
186
- function initialize(
187
- VTokenProxyFactory vTokenFactory_,
188
- JumpRateModelFactory jumpRateFactory_,
189
- WhitePaperInterestRateModelFactory whitePaperFactory_,
190
- Shortfall shortfall_,
191
- address payable protocolShareReserve_,
192
- address accessControlManager_
193
- ) external initializer {
116
+ function initialize(address accessControlManager_) external initializer {
194
117
  __Ownable2Step_init();
195
118
  __AccessControlled_init_unchained(accessControlManager_);
196
-
197
- vTokenFactory = vTokenFactory_;
198
- jumpRateFactory = jumpRateFactory_;
199
- whitePaperFactory = whitePaperFactory_;
200
- _setShortfallContract(shortfall_);
201
- _setProtocolShareReserve(protocolShareReserve_);
202
119
  }
203
120
 
204
121
  /**
205
- * @notice Sets protocol share reserve contract address
206
- * @param protocolShareReserve_ The address of the protocol share reserve contract
207
- * @custom:error ZeroAddressNotAllowed is thrown when protocol share reserve address is zero
208
- * @custom:access Only Governance
209
- */
210
- function setProtocolShareReserve(address payable protocolShareReserve_) external onlyOwner {
211
- _setProtocolShareReserve(protocolShareReserve_);
212
- }
213
-
214
- /**
215
- * @notice Sets shortfall contract address
216
- * @param shortfall_ The address of the shortfall contract
217
- * @custom:error ZeroAddressNotAllowed is thrown when shortfall contract address is zero
218
- * @custom:access Only Governance
219
- */
220
- function setShortfallContract(Shortfall shortfall_) external onlyOwner {
221
- _setShortfallContract(shortfall_);
222
- }
223
-
224
- /**
225
- * @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
226
124
  * @param name The name of the pool
227
- * @param beaconAddress The upgradeable beacon contract address for Comptroller implementation
125
+ * @param comptroller Pool's Comptroller contract
228
126
  * @param closeFactor The pool's close factor (scaled by 1e18)
229
127
  * @param liquidationIncentive The pool's liquidation incentive (scaled by 1e18)
230
128
  * @param minLiquidatableCollateral Minimal collateral for regular (non-batch) liquidations flow
231
- * @param priceOracle The pool's price oracle address
232
- * @param maxLoopsLimit The maximum number of iterations the loops can perform
233
- * @param accessControlManager AccessControlManager contract address
234
129
  * @return index The index of the registered Venus pool
235
- * @return proxyAddress The the Comptroller proxy address
236
- * @custom:error ZeroAddressNotAllowed is thrown when Comptroller beacon address is zero
130
+ * @custom:error ZeroAddressNotAllowed is thrown when Comptroller address is zero
237
131
  * @custom:error ZeroAddressNotAllowed is thrown when price oracle address is zero
238
132
  */
239
- function createRegistryPool(
133
+ function addPool(
240
134
  string calldata name,
241
- address beaconAddress,
135
+ Comptroller comptroller,
242
136
  uint256 closeFactor,
243
137
  uint256 liquidationIncentive,
244
- uint256 minLiquidatableCollateral,
245
- address priceOracle,
246
- uint256 maxLoopsLimit,
247
- address accessControlManager
248
- ) external virtual returns (uint256 index, address proxyAddress) {
249
- _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)");
250
141
  // Input validation
251
- ensureNonzeroAddress(beaconAddress);
252
- ensureNonzeroAddress(priceOracle);
253
-
254
- BeaconProxy proxy = new BeaconProxy(
255
- beaconAddress,
256
- abi.encodeWithSelector(Comptroller.initialize.selector, maxLoopsLimit, accessControlManager)
257
- );
142
+ ensureNonzeroAddress(address(comptroller));
143
+ ensureNonzeroAddress(address(comptroller.oracle()));
258
144
 
259
- proxyAddress = address(proxy);
260
- Comptroller comptrollerProxy = Comptroller(proxyAddress);
261
-
262
- uint256 poolId = _registerPool(name, proxyAddress);
145
+ uint256 poolId = _registerPool(name, address(comptroller));
263
146
 
264
147
  // Set Venus pool parameters
265
- comptrollerProxy.setCloseFactor(closeFactor);
266
- comptrollerProxy.setLiquidationIncentive(liquidationIncentive);
267
- comptrollerProxy.setMinLiquidatableCollateral(minLiquidatableCollateral);
268
- comptrollerProxy.setPriceOracle(ResilientOracleInterface(priceOracle));
269
-
270
- // Start transferring ownership to msg.sender
271
- comptrollerProxy.transferOwnership(msg.sender);
148
+ comptroller.setCloseFactor(closeFactor);
149
+ comptroller.setLiquidationIncentive(liquidationIncentive);
150
+ comptroller.setMinLiquidatableCollateral(minLiquidatableCollateral);
272
151
 
273
- return (poolId, proxyAddress);
152
+ return poolId;
274
153
  }
275
154
 
276
155
  /**
277
- * @notice Add a market to an existing pool and then mint to provide initial supply.
278
- * @param input The structure describing the parameters for adding a market to a pool.
279
- * @custom:error ZeroAddressNotAllowed is thrown when Comptroller address is zero
280
- * @custom:error ZeroAddressNotAllowed is thrown when asset address is zero
281
- * @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
282
159
  * @custom:error ZeroAddressNotAllowed is thrown when vTokenReceiver address is zero
283
160
  */
284
161
  function addMarket(AddMarketInput memory input) external {
285
162
  _checkAccessAllowed("addMarket(AddMarketInput)");
286
- ensureNonzeroAddress(input.comptroller);
287
- ensureNonzeroAddress(input.asset);
288
- ensureNonzeroAddress(input.beaconAddress);
163
+ ensureNonzeroAddress(address(input.vToken));
289
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);
290
173
 
174
+ require(_poolByComptroller[comptrollerAddress].creator != address(0), "PoolRegistry: Pool not registered");
291
175
  // solhint-disable-next-line reason-string
292
176
  require(
293
- _vTokens[input.comptroller][input.asset] == address(0),
177
+ _vTokens[comptrollerAddress][underlyingAddress] == address(0),
294
178
  "PoolRegistry: Market already added for asset comptroller combination"
295
179
  );
296
180
 
297
- require(input.initialSupply > 0, "PoolRegistry: initialSupply is zero");
298
-
299
- InterestRateModel rate;
300
- if (input.rateModel == InterestRateModels.JumpRate) {
301
- rate = InterestRateModel(
302
- jumpRateFactory.deploy(
303
- input.baseRatePerYear,
304
- input.multiplierPerYear,
305
- input.jumpMultiplierPerYear,
306
- input.kink_,
307
- input.accessControlManager
308
- )
309
- );
310
- } else {
311
- rate = InterestRateModel(whitePaperFactory.deploy(input.baseRatePerYear, input.multiplierPerYear));
312
- }
313
-
314
- Comptroller comptroller = Comptroller(input.comptroller);
315
- uint256 underlyingDecimals = IERC20Metadata(input.asset).decimals();
316
-
317
- VTokenProxyFactory.VTokenArgs memory initializeArgs = VTokenProxyFactory.VTokenArgs(
318
- input.asset,
319
- comptroller,
320
- rate,
321
- 10**(underlyingDecimals + 18 - input.decimals),
322
- input.name,
323
- input.symbol,
324
- input.decimals,
325
- msg.sender,
326
- input.accessControlManager,
327
- VTokenInterface.RiskManagementInit(address(shortfall), protocolShareReserve),
328
- input.beaconAddress,
329
- input.reserveFactor
330
- );
331
-
332
- VToken vToken = vTokenFactory.deployVTokenProxy(initializeArgs);
333
-
334
181
  comptroller.supportMarket(vToken);
335
182
  comptroller.setCollateralFactor(vToken, input.collateralFactor, input.liquidationThreshold);
336
183
 
@@ -345,16 +192,15 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
345
192
  comptroller.setMarketSupplyCaps(vTokens, newSupplyCaps);
346
193
  comptroller.setMarketBorrowCaps(vTokens, newBorrowCaps);
347
194
 
348
- _vTokens[input.comptroller][input.asset] = address(vToken);
349
- _supportedPools[input.asset].push(input.comptroller);
195
+ _vTokens[comptrollerAddress][underlyingAddress] = vTokenAddress;
196
+ _supportedPools[underlyingAddress].push(comptrollerAddress);
350
197
 
351
- IERC20Upgradeable token = IERC20Upgradeable(input.asset);
352
- uint256 amountToSupply = _transferIn(token, msg.sender, input.initialSupply);
353
- token.approve(address(vToken), 0);
354
- token.approve(address(vToken), amountToSupply);
198
+ uint256 amountToSupply = _transferIn(underlying, msg.sender, input.initialSupply);
199
+ underlying.approve(vTokenAddress, 0);
200
+ underlying.approve(vTokenAddress, amountToSupply);
355
201
  vToken.mintBehalf(input.vTokenReceiver, amountToSupply);
356
202
 
357
- emit MarketAdded(address(comptroller), address(vToken));
203
+ emit MarketAdded(comptrollerAddress, vTokenAddress);
358
204
  }
359
205
 
360
206
  /**
@@ -457,20 +303,6 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist
457
303
  return balanceAfter - balanceBefore;
458
304
  }
459
305
 
460
- function _setShortfallContract(Shortfall shortfall_) internal {
461
- ensureNonzeroAddress(address(shortfall_));
462
- address oldShortfall = address(shortfall);
463
- shortfall = shortfall_;
464
- emit NewShortfallContract(oldShortfall, address(shortfall_));
465
- }
466
-
467
- function _setProtocolShareReserve(address payable protocolShareReserve_) internal {
468
- ensureNonzeroAddress(protocolShareReserve_);
469
- address oldProtocolShareReserve = protocolShareReserve;
470
- protocolShareReserve = protocolShareReserve_;
471
- emit NewProtocolShareReserve(oldProtocolShareReserve, protocolShareReserve_);
472
- }
473
-
474
306
  function _ensureValidName(string calldata name) internal pure {
475
307
  require(bytes(name).length <= MAX_POOL_NAME_LENGTH, "Pool's name is too large");
476
308
  }
@@ -0,0 +1,11 @@
1
+ // SPDX-License-Identifier: BSD-3-Clause
2
+ pragma solidity 0.8.13;
3
+
4
+ // This file is needed to make hardhat and typechain generate artifacts for
5
+ // contracts we depend on (e.g. in tests or deployments) but not use directly.
6
+ // Another way to do this would be to use hardhat-dependency-compiler, but
7
+ // since we only have a couple of dependencies, installing a separate package
8
+ // seems an overhead.
9
+
10
+ import { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
11
+ import { BeaconProxy } from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
@@ -1,12 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const hardhat_1 = require("hardhat");
4
- const ADDRESS_ONE = "0x0000000000000000000000000000000000000001";
5
- const treasuryAddresses = {
6
- hardhat: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
7
- bsctestnet: "0xFEA1c651A47FE29dB9b1bf3cC1f224d8D9CFF68C",
8
- bscmainnet: "0xF322942f644A996A617BD29c16bd7d231d9F35E9", // Venus Treasury
9
- };
10
4
  const acmAddresses = {
11
5
  bsctestnet: "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA",
12
6
  bscmainnet: "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555",
@@ -23,24 +17,6 @@ const func = async function (hre) {
23
17
  else {
24
18
  accessControlManager = await hardhat_1.ethers.getContract("AccessControlManager");
25
19
  }
26
- const vBep20Factory = await deploy("VTokenProxyFactory", {
27
- from: deployer,
28
- args: [],
29
- log: true,
30
- autoMine: true, // speed up deployment on local network (ganache, hardhat), no effect on live networks
31
- });
32
- const jumpRateModelFactory = await deploy("JumpRateModelFactory", {
33
- from: deployer,
34
- args: [],
35
- log: true,
36
- autoMine: true,
37
- });
38
- const whitePaperRateFactory = await deploy("WhitePaperInterestRateModelFactory", {
39
- from: deployer,
40
- args: [],
41
- log: true,
42
- autoMine: true,
43
- });
44
20
  await deploy("PoolRegistry", {
45
21
  from: deployer,
46
22
  contract: "PoolRegistry",
@@ -49,14 +25,7 @@ const func = async function (hre) {
49
25
  proxyContract: "OpenZeppelinTransparentProxy",
50
26
  execute: {
51
27
  methodName: "initialize",
52
- args: [
53
- vBep20Factory.address,
54
- jumpRateModelFactory.address,
55
- whitePaperRateFactory.address,
56
- ADDRESS_ONE,
57
- treasuryAddresses[hre.network.name],
58
- accessControlManager.address,
59
- ],
28
+ args: [accessControlManager.address],
60
29
  },
61
30
  upgradeIndex: 0,
62
31
  },
@@ -10,7 +10,6 @@ const func = async function (hre) {
10
10
  const { deploy } = deployments;
11
11
  const { deployer } = await getNamedAccounts();
12
12
  const poolRegistry = await hardhat_1.ethers.getContract("PoolRegistry");
13
- const vBep20Factory = await hardhat_1.ethers.getContract("VTokenProxyFactory");
14
13
  let accessControlManager;
15
14
  if (hre.network.live) {
16
15
  const networkName = hre.network.name === "bscmainnet" ? "bscmainnet" : "bsctestnet";
@@ -51,15 +50,12 @@ const func = async function (hre) {
51
50
  tx = await accessControlManager.giveCallPermission(hardhat_1.ethers.constants.AddressZero, "supportMarket(address)", poolRegistry.address);
52
51
  await tx.wait();
53
52
  console.log("DEFAULT_ADMIN | PoolRegistry | supportMarket(address)");
54
- tx = await accessControlManager.giveCallPermission(hardhat_1.ethers.constants.AddressZero, "setInterestRateModel(address)", vBep20Factory.address);
55
- await tx.wait();
56
- console.log("DEFAULT_ADMIN | VTokenProxyFactory | setInterestRateModel(address)");
57
53
  tx = await accessControlManager.giveCallPermission(hardhat_1.ethers.constants.AddressZero, "swapPoolsAssets(address[],uint256[],address[][])", deployer);
58
54
  await tx.wait();
59
55
  console.log("DEFAULT_ADMIN | Deployer | swapPoolsAssets(address[],uint256[])");
60
- tx = await accessControlManager.giveCallPermission(poolRegistry.address, "createRegistryPool(string,address,uint256,uint256,uint256,address,uint256,address)", deployer);
56
+ tx = await accessControlManager.giveCallPermission(poolRegistry.address, "addPool(string,address,uint256,uint256,uint256)", deployer);
61
57
  await tx.wait();
62
- console.log("PoolRegistry | Deployer | createRegistryPool(string,address,uint256,uint256,uint256,address,uint256,address)");
58
+ console.log("PoolRegistry | Deployer | addPool(string,address,uint256,uint256,uint256)");
63
59
  tx = await accessControlManager.giveCallPermission(poolRegistry.address, "addMarket(AddMarketInput)", deployer);
64
60
  await tx.wait();
65
61
  console.log("PoolRegistry | Deployer | addMarket(AddMarketInput)");
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ethers_1 = require("ethers");
4
+ const utils_1 = require("ethers/lib/utils");
3
5
  const hardhat_1 = require("hardhat");
4
6
  const deploymentConfig_1 = require("../helpers/deploymentConfig");
7
+ const deploymentConfig_2 = require("../helpers/deploymentConfig");
8
+ const ADDRESS_ONE = "0x0000000000000000000000000000000000000001";
5
9
  const treasuryAddresses = {
10
+ hardhat: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
6
11
  bsctestnet: "0xFEA1c651A47FE29dB9b1bf3cC1f224d8D9CFF68C",
7
12
  bscmainnet: "0xF322942f644A996A617BD29c16bd7d231d9F35E9", // Venus Treasury
8
13
  };
@@ -10,6 +15,9 @@ const acmAddresses = {
10
15
  bsctestnet: "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA",
11
16
  bscmainnet: "0x4788629ABc6cFCA10F9f969efdEAa1cF70c23555",
12
17
  };
18
+ const mantissaToBps = (num) => {
19
+ return ethers_1.BigNumber.from(num).div((0, utils_1.parseUnits)("1", 14)).toString();
20
+ };
13
21
  const func = async function (hre) {
14
22
  const { deployments, getNamedAccounts } = hre;
15
23
  const { deploy } = deployments;
@@ -34,15 +42,15 @@ const func = async function (hre) {
34
42
  log: true,
35
43
  autoMine: true,
36
44
  });
37
- const ComptrollerBeacon = await deploy("ComptrollerBeacon", {
38
- contract: "Beacon",
45
+ const comptrollerBeacon = await deploy("ComptrollerBeacon", {
46
+ contract: "UpgradeableBeacon",
39
47
  from: deployer,
40
48
  args: [comptrollerImpl.address],
41
49
  log: true,
42
50
  autoMine: true,
43
51
  });
44
52
  // VToken Beacon
45
- const vTokenImpl = await deploy("VtokenImpl", {
53
+ const vTokenImpl = await deploy("VTokenImpl", {
46
54
  contract: "VToken",
47
55
  from: deployer,
48
56
  args: [],
@@ -50,27 +58,41 @@ const func = async function (hre) {
50
58
  autoMine: true,
51
59
  });
52
60
  const vTokenBeacon = await deploy("VTokenBeacon", {
53
- contract: "Beacon",
61
+ contract: "UpgradeableBeacon",
54
62
  from: deployer,
55
63
  args: [vTokenImpl.address],
56
64
  log: true,
57
65
  autoMine: true,
58
66
  });
59
67
  const { tokensConfig, poolConfig } = await (0, deploymentConfig_1.getConfig)(hre.network.name);
60
- let pools = await poolRegistry.callStatic.getAllPools();
68
+ const pools = await poolRegistry.callStatic.getAllPools();
61
69
  for (let i = 0; i < poolConfig.length; i++) {
62
70
  const pool = poolConfig[i];
63
71
  let comptrollerProxy;
64
72
  if (i >= pools.length) {
73
+ // Deploying a proxy for Comptroller
74
+ console.log("Deploying a proxy for Comptroller");
75
+ const Comptroller = await hardhat_1.ethers.getContractFactory("Comptroller");
76
+ comptrollerProxy = await deploy(`Comptroller_${pool.name}`, {
77
+ from: deployer,
78
+ contract: "BeaconProxy",
79
+ args: [
80
+ comptrollerBeacon.address,
81
+ Comptroller.interface.encodeFunctionData("initialize", [maxLoopsLimit, accessControlManager.address]),
82
+ ],
83
+ log: true,
84
+ autoMine: true,
85
+ });
86
+ // Deploying a proxy for Comptroller
87
+ console.log("Setting price oracle for Comptroller");
88
+ const comptroller = await hardhat_1.ethers.getContractAt("Comptroller", comptrollerProxy.address);
89
+ tx = await comptroller.setPriceOracle(priceOracle.address);
90
+ await tx.wait();
65
91
  // Create pool
66
92
  console.log("Registering new pool with name " + pool.name);
67
- tx = await poolRegistry.createRegistryPool(pool.name, ComptrollerBeacon.address, pool.closeFactor, pool.liquidationIncentive, pool.minLiquidatableCollateral, priceOracle.address, maxLoopsLimit, accessControlManager.address);
93
+ tx = await poolRegistry.addPool(pool.name, comptroller.address, pool.closeFactor, pool.liquidationIncentive, pool.minLiquidatableCollateral);
68
94
  await tx.wait();
69
95
  console.log("New Pool Registered");
70
- pools = await poolRegistry.callStatic.getAllPools();
71
- comptrollerProxy = await hardhat_1.ethers.getContractAt("Comptroller", pools[i].comptroller);
72
- tx = await comptrollerProxy.acceptOwnership();
73
- await tx.wait();
74
96
  }
75
97
  else {
76
98
  comptrollerProxy = await hardhat_1.ethers.getContractAt("Comptroller", pools[i].comptroller);
@@ -90,26 +112,65 @@ const func = async function (hre) {
90
112
  tokenContract = await hardhat_1.ethers.getContractAt("@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20", token.tokenAddress);
91
113
  // Make sure that deployer has at least `initialSupply` balance of the token
92
114
  }
115
+ let rateModelAddress;
116
+ if (rateModel === deploymentConfig_2.InterestRateModels.JumpRate.toString()) {
117
+ const [b, m, j, k] = [baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_].map(mantissaToBps);
118
+ const rateModelName = `JumpRateModelV2_base${b}bps_slope${m}bps_jump${j}bps_kink${k}bps`;
119
+ console.log(`Deploying interest rate model ${rateModelName}`);
120
+ const result = await deploy(rateModelName, {
121
+ from: deployer,
122
+ contract: "JumpRateModelV2",
123
+ args: [baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_, accessControlManager.address],
124
+ log: true,
125
+ autoMine: true,
126
+ });
127
+ rateModelAddress = result.address;
128
+ }
129
+ else {
130
+ const [b, m] = [baseRatePerYear, multiplierPerYear].map(mantissaToBps);
131
+ const rateModelName = `WhitePaperInterestRateModel_base${b}bps_slope${m}bps`;
132
+ console.log(`Deploying interest rate model ${rateModelName}`);
133
+ const result = await deploy(rateModelName, {
134
+ from: deployer,
135
+ contract: "WhitePaperInterestRateModel",
136
+ args: [baseRatePerYear, multiplierPerYear],
137
+ log: true,
138
+ autoMine: true,
139
+ });
140
+ rateModelAddress = result.address;
141
+ }
142
+ console.log(`Deploying VToken proxy for ${symbol}`);
143
+ const VToken = await hardhat_1.ethers.getContractFactory("VToken");
144
+ const underlyingDecimals = Number(await tokenContract.decimals());
145
+ const vTokenDecimals = 8;
146
+ const args = [
147
+ tokenContract.address,
148
+ comptrollerProxy.address,
149
+ rateModelAddress,
150
+ (0, utils_1.parseUnits)("1", underlyingDecimals + 18 - vTokenDecimals),
151
+ name,
152
+ symbol,
153
+ vTokenDecimals,
154
+ deployer,
155
+ accessControlManager.address,
156
+ [treasuryAddresses[hre.network.name], ADDRESS_ONE],
157
+ reserveFactor,
158
+ ];
159
+ const vToken = await deploy(`VToken_${name}`, {
160
+ from: deployer,
161
+ contract: "BeaconProxy",
162
+ args: [vTokenBeacon.address, VToken.interface.encodeFunctionData("initialize", args)],
163
+ log: true,
164
+ autoMine: true,
165
+ });
93
166
  console.log("Approving PoolRegistry for: " + initialSupply);
94
167
  tx = await tokenContract.approve(poolRegistry.address, initialSupply);
95
168
  await tx.wait(1);
96
169
  console.log("Adding market " + name + " to pool " + pool.name);
97
170
  tx = await poolRegistry.addMarket({
98
- comptroller: comptrollerProxy.address,
99
- asset: tokenContract.address,
100
- decimals: 8,
101
- name: name,
102
- symbol: symbol,
103
- rateModel: rateModel,
104
- baseRatePerYear: baseRatePerYear,
105
- multiplierPerYear: multiplierPerYear,
106
- jumpMultiplierPerYear: jumpMultiplierPerYear,
107
- kink_: kink_,
171
+ vToken: vToken.address,
108
172
  collateralFactor: collateralFactor,
109
173
  liquidationThreshold: liquidationThreshold,
110
- reserveFactor: reserveFactor,
111
- accessControlManager: accessControlManager.address,
112
- beaconAddress: vTokenBeacon.address,
113
174
  initialSupply: initialSupply,
114
175
  vTokenReceiver: hre.network.name === "hardhat" ? deployer : treasuryAddresses[hre.network.name],
115
176
  supplyCap: supplyCap,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venusprotocol/isolated-pools",
3
- "version": "1.0.0-dev.8",
3
+ "version": "1.0.0-dev.9",
4
4
  "description": "",
5
5
  "files": [
6
6
  "artifacts",
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/8c02b3a8e3642dffe55772a8d2bed46f.json"
4
- }