@venusprotocol/protocol-reserve 1.0.0-dev.2 → 1.0.0-dev.4
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/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +1 -1
- package/artifacts/@venusprotocol/isolated-pools/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.dbg.json +4 -0
- package/artifacts/@venusprotocol/isolated-pools/contracts/MaxLoopsLimitHelper.sol/MaxLoopsLimitHelper.json +59 -0
- package/artifacts/build-info/a2183051939bab7702059953f3ccadf7.json +1 -0
- package/artifacts/contracts/Interfaces/ComptrollerInterface.sol/ComptrollerInterface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces/IIncomeDestination.sol/IIncomeDestination.dbg.json +1 -1
- package/artifacts/contracts/Interfaces/IPrime.sol/IPrime.dbg.json +1 -1
- package/artifacts/contracts/Interfaces/IProtocolShareReserve.sol/IProtocolShareReserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces/IVToken.sol/IVToken.dbg.json +1 -1
- package/artifacts/contracts/Interfaces/PoolRegistryInterface.sol/PoolRegistryInterface.dbg.json +1 -1
- package/artifacts/contracts/ProtocolReserve/ProtocolShareReserve.sol/ProtocolShareReserve.dbg.json +1 -1
- package/artifacts/contracts/ProtocolReserve/ProtocolShareReserve.sol/ProtocolShareReserve.json +55 -27
- package/artifacts/contracts/Test/Mocks/MockToken.sol/MockToken.dbg.json +1 -1
- package/contracts/ProtocolReserve/ProtocolShareReserve.sol +105 -40
- package/package.json +4 -1
- package/typechain/@openzeppelin/contracts-upgradeable/index.ts +3 -0
- package/typechain/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.ts +72 -0
- package/typechain/@openzeppelin/contracts-upgradeable/security/index.ts +4 -0
- package/typechain/@venusprotocol/index.ts +3 -0
- package/typechain/@venusprotocol/isolated-pools/contracts/MaxLoopsLimitHelper.ts +119 -0
- package/typechain/@venusprotocol/isolated-pools/contracts/index.ts +4 -0
- package/typechain/@venusprotocol/isolated-pools/index.ts +8 -0
- package/typechain/contracts/ProtocolReserve/ProtocolShareReserve.ts +50 -28
- package/typechain/factories/@openzeppelin/contracts-upgradeable/index.ts +1 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable__factory.ts +44 -0
- package/typechain/factories/@openzeppelin/contracts-upgradeable/security/index.ts +4 -0
- package/typechain/factories/@venusprotocol/index.ts +1 -0
- package/typechain/factories/@venusprotocol/isolated-pools/contracts/MaxLoopsLimitHelper__factory.ts +75 -0
- package/typechain/factories/@venusprotocol/isolated-pools/contracts/index.ts +4 -0
- package/typechain/factories/@venusprotocol/isolated-pools/index.ts +4 -0
- package/typechain/factories/contracts/ProtocolReserve/ProtocolShareReserve__factory.ts +54 -26
- package/typechain/hardhat.d.ts +18 -0
- package/typechain/index.ts +4 -0
- package/artifacts/build-info/c112788394311939ef4c47b76cde5898.json +0 -1
|
@@ -3,6 +3,8 @@ pragma solidity 0.8.13;
|
|
|
3
3
|
|
|
4
4
|
import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
|
|
5
5
|
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
|
|
6
|
+
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
7
|
+
import { MaxLoopsLimitHelper } from "@venusprotocol/isolated-pools/contracts/MaxLoopsLimitHelper.sol";
|
|
6
8
|
|
|
7
9
|
import { IProtocolShareReserve } from "../Interfaces/IProtocolShareReserve.sol";
|
|
8
10
|
import { ComptrollerInterface } from "../Interfaces/ComptrollerInterface.sol";
|
|
@@ -14,13 +16,19 @@ import { IIncomeDestination } from "../Interfaces/IIncomeDestination.sol";
|
|
|
14
16
|
error InvalidAddress();
|
|
15
17
|
error UnsupportedAsset();
|
|
16
18
|
error InvalidTotalPercentage();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
error InvalidMaxLoopsLimit();
|
|
20
|
+
|
|
21
|
+
contract ProtocolShareReserve is
|
|
22
|
+
AccessControlledV8,
|
|
23
|
+
ReentrancyGuardUpgradeable,
|
|
24
|
+
MaxLoopsLimitHelper,
|
|
25
|
+
IProtocolShareReserve
|
|
26
|
+
{
|
|
19
27
|
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
20
28
|
|
|
21
29
|
/// @notice protocol income is categorized into two schemas.
|
|
22
|
-
/// The first schema is
|
|
23
|
-
/// The second schema is for
|
|
30
|
+
/// The first schema is the default one
|
|
31
|
+
/// The second schema is for spread income from prime markets in core protocol
|
|
24
32
|
enum Schema {
|
|
25
33
|
DEFAULT,
|
|
26
34
|
SPREAD_PRIME_CORE
|
|
@@ -77,9 +85,6 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
77
85
|
Schema schema
|
|
78
86
|
);
|
|
79
87
|
|
|
80
|
-
/// @notice Event emitted after a income distribution target is configured
|
|
81
|
-
event DestinationConfigured(address indexed destination, uint percent, Schema schema);
|
|
82
|
-
|
|
83
88
|
/// @notice Event emitted when an asset is released to a target
|
|
84
89
|
event AssetReleased(
|
|
85
90
|
address indexed destination,
|
|
@@ -127,85 +132,98 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
127
132
|
/**
|
|
128
133
|
* @dev Initializes the deployer to owner.
|
|
129
134
|
* @param _accessControlManager The address of ACM contract
|
|
135
|
+
* @param _loopsLimit Limit for the loops in the contract to avoid DOS
|
|
130
136
|
*/
|
|
131
|
-
function initialize(address _accessControlManager) external initializer {
|
|
137
|
+
function initialize(address _accessControlManager, uint256 _loopsLimit) external initializer {
|
|
132
138
|
__AccessControlled_init(_accessControlManager);
|
|
139
|
+
__ReentrancyGuard_init();
|
|
140
|
+
_setMaxLoopsLimit(_loopsLimit);
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
/**
|
|
136
144
|
* @dev Pool registry setter.
|
|
137
145
|
* @param _poolRegistry Address of the pool registry
|
|
138
146
|
*/
|
|
139
|
-
function setPoolRegistry(address _poolRegistry) external {
|
|
140
|
-
_checkAccessAllowed("setPoolRegistry(address)");
|
|
147
|
+
function setPoolRegistry(address _poolRegistry) external onlyOwner {
|
|
141
148
|
if (_poolRegistry == address(0)) revert InvalidAddress();
|
|
142
|
-
|
|
149
|
+
emit PoolRegistryUpdated(poolRegistry, _poolRegistry);
|
|
143
150
|
poolRegistry = _poolRegistry;
|
|
144
|
-
emit PoolRegistryUpdated(oldPoolRegistry, poolRegistry);
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
/**
|
|
148
154
|
* @dev Prime contract address setter.
|
|
149
155
|
* @param _prime Address of the prime contract
|
|
150
156
|
*/
|
|
151
|
-
function setPrime(address _prime) external {
|
|
152
|
-
_checkAccessAllowed("setPrime(address)");
|
|
157
|
+
function setPrime(address _prime) external onlyOwner {
|
|
153
158
|
if (_prime == address(0)) revert InvalidAddress();
|
|
154
|
-
|
|
159
|
+
emit PrimeUpdated(prime, _prime);
|
|
155
160
|
prime = _prime;
|
|
156
|
-
emit PrimeUpdated(oldPrime, prime);
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
/**
|
|
160
164
|
* @dev Add or update destination targets based on destination address
|
|
161
165
|
* @param configs configurations of the destinations.
|
|
162
166
|
*/
|
|
163
|
-
function addOrUpdateDistributionConfigs(DistributionConfig[] memory configs) external {
|
|
164
|
-
_checkAccessAllowed("addOrUpdateDistributionConfigs(DistributionConfig)");
|
|
167
|
+
function addOrUpdateDistributionConfigs(DistributionConfig[] memory configs) external nonReentrant {
|
|
168
|
+
_checkAccessAllowed("addOrUpdateDistributionConfigs(DistributionConfig[])");
|
|
165
169
|
|
|
166
170
|
//we need to accrue and release funds to prime before updating the distribution configuration
|
|
167
171
|
//because prime relies on getUnreleasedFunds and its return value may change after config update
|
|
168
172
|
_accrueAndReleaseFundsToPrime();
|
|
169
173
|
|
|
170
|
-
for (
|
|
174
|
+
for (uint256 i = 0; i < configs.length; ) {
|
|
171
175
|
DistributionConfig memory _config = configs[i];
|
|
172
176
|
require(_config.destination != address(0), "ProtocolShareReserve: Destination address invalid");
|
|
173
177
|
|
|
174
178
|
bool updated = false;
|
|
175
|
-
for (
|
|
179
|
+
for (uint256 j = 0; j < distributionTargets.length; ) {
|
|
176
180
|
DistributionConfig storage config = distributionTargets[j];
|
|
177
181
|
|
|
178
182
|
if (_config.schema == config.schema && config.destination == _config.destination) {
|
|
179
183
|
emit DistributionConfigUpdated(
|
|
180
|
-
|
|
184
|
+
_config.destination,
|
|
181
185
|
config.percentage,
|
|
182
186
|
_config.percentage,
|
|
183
|
-
|
|
187
|
+
_config.schema
|
|
184
188
|
);
|
|
185
189
|
config.percentage = _config.percentage;
|
|
186
190
|
updated = true;
|
|
187
191
|
break;
|
|
188
192
|
}
|
|
193
|
+
|
|
194
|
+
unchecked {
|
|
195
|
+
++j;
|
|
196
|
+
}
|
|
189
197
|
}
|
|
190
198
|
|
|
191
199
|
if (!updated) {
|
|
192
200
|
distributionTargets.push(_config);
|
|
193
201
|
emit DistributionConfigAdded(_config.destination, _config.percentage, _config.schema);
|
|
194
202
|
}
|
|
203
|
+
|
|
204
|
+
unchecked {
|
|
205
|
+
++i;
|
|
206
|
+
}
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
_ensurePercentages();
|
|
210
|
+
_ensureMaxLoops(distributionTargets.length);
|
|
198
211
|
}
|
|
199
212
|
|
|
200
213
|
/**
|
|
201
214
|
* @dev Release funds
|
|
215
|
+
* @param comptroller the comptroller address of the pool
|
|
202
216
|
* @param assets assets to be released to distribution targets
|
|
203
217
|
*/
|
|
204
|
-
function releaseFunds(address comptroller, address[] memory assets) external {
|
|
218
|
+
function releaseFunds(address comptroller, address[] memory assets) external nonReentrant {
|
|
205
219
|
_accruePrimeInterest();
|
|
206
220
|
|
|
207
|
-
for (
|
|
221
|
+
for (uint256 i = 0; i < assets.length; ) {
|
|
208
222
|
_releaseFund(comptroller, assets[i]);
|
|
223
|
+
|
|
224
|
+
unchecked {
|
|
225
|
+
++i;
|
|
226
|
+
}
|
|
209
227
|
}
|
|
210
228
|
}
|
|
211
229
|
|
|
@@ -222,12 +240,16 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
222
240
|
address destination,
|
|
223
241
|
address asset
|
|
224
242
|
) external view returns (uint256) {
|
|
225
|
-
for (
|
|
243
|
+
for (uint256 i = 0; i < distributionTargets.length; ) {
|
|
226
244
|
DistributionConfig storage _config = distributionTargets[i];
|
|
227
245
|
if (_config.schema == schema && _config.destination == destination) {
|
|
228
246
|
uint256 total = assetsReserves[comptroller][asset][schema];
|
|
229
247
|
return (total * _config.percentage) / MAX_PERCENT;
|
|
230
248
|
}
|
|
249
|
+
|
|
250
|
+
unchecked {
|
|
251
|
+
++i;
|
|
252
|
+
}
|
|
231
253
|
}
|
|
232
254
|
}
|
|
233
255
|
|
|
@@ -242,12 +264,13 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
242
264
|
* @dev Update the reserve of the asset for the specific pool after transferring to the protocol share reserve.
|
|
243
265
|
* @param comptroller Comptroller address(pool)
|
|
244
266
|
* @param asset Asset address.
|
|
267
|
+
* @param incomeType type of income
|
|
245
268
|
*/
|
|
246
269
|
function updateAssetsState(
|
|
247
270
|
address comptroller,
|
|
248
271
|
address asset,
|
|
249
272
|
IncomeType incomeType
|
|
250
|
-
) public override(IProtocolShareReserve) {
|
|
273
|
+
) public override(IProtocolShareReserve) nonReentrant {
|
|
251
274
|
if (!ComptrollerInterface(comptroller).isComptroller()) revert InvalidAddress();
|
|
252
275
|
if (asset == address(0)) revert InvalidAddress();
|
|
253
276
|
if (
|
|
@@ -277,10 +300,14 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
277
300
|
*/
|
|
278
301
|
function _accrueAndReleaseFundsToPrime() internal {
|
|
279
302
|
address[] memory markets = IPrime(prime).allMarkets();
|
|
280
|
-
for (
|
|
303
|
+
for (uint256 i = 0; i < markets.length; ) {
|
|
281
304
|
address market = markets[i];
|
|
282
305
|
IPrime(prime).accrueInterest(market);
|
|
283
306
|
_releaseFund(CORE_POOL_COMPTROLLER, _getUnderlying(market));
|
|
307
|
+
|
|
308
|
+
unchecked {
|
|
309
|
+
++i;
|
|
310
|
+
}
|
|
284
311
|
}
|
|
285
312
|
}
|
|
286
313
|
|
|
@@ -290,29 +317,40 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
290
317
|
*/
|
|
291
318
|
function _accruePrimeInterest() internal {
|
|
292
319
|
address[] memory markets = IPrime(prime).allMarkets();
|
|
293
|
-
for (
|
|
320
|
+
for (uint256 i = 0; i < markets.length; ) {
|
|
294
321
|
address market = markets[i];
|
|
295
322
|
IPrime(prime).accrueInterest(market);
|
|
323
|
+
|
|
324
|
+
unchecked {
|
|
325
|
+
++i;
|
|
326
|
+
}
|
|
296
327
|
}
|
|
297
328
|
}
|
|
298
329
|
|
|
330
|
+
/**
|
|
331
|
+
* @dev asset from a particular pool to be release to distribution targets
|
|
332
|
+
* @param comptroller Comptroller address(pool)
|
|
333
|
+
* @param asset Asset address.
|
|
334
|
+
*/
|
|
299
335
|
function _releaseFund(address comptroller, address asset) internal {
|
|
300
336
|
uint256 totalSchemas = uint256(type(Schema).max) + 1;
|
|
301
|
-
|
|
337
|
+
uint256[] memory schemaBalances = new uint256[](totalSchemas);
|
|
302
338
|
uint256 totalBalance;
|
|
303
|
-
|
|
304
|
-
for (uint schemaValue; schemaValue < totalSchemas; ++schemaValue) {
|
|
339
|
+
for (uint256 schemaValue; schemaValue < totalSchemas; ) {
|
|
305
340
|
schemaBalances[schemaValue] = assetsReserves[comptroller][asset][Schema(schemaValue)];
|
|
306
341
|
totalBalance += schemaBalances[schemaValue];
|
|
342
|
+
|
|
343
|
+
unchecked {
|
|
344
|
+
++schemaValue;
|
|
345
|
+
}
|
|
307
346
|
}
|
|
308
347
|
|
|
309
348
|
if (totalBalance == 0) {
|
|
310
349
|
return;
|
|
311
350
|
}
|
|
312
351
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
for (uint i = 0; i < distributionTargets.length; ++i) {
|
|
352
|
+
uint256[] memory totalTransferAmounts = new uint256[](totalSchemas);
|
|
353
|
+
for (uint256 i = 0; i < distributionTargets.length; ) {
|
|
316
354
|
DistributionConfig memory _config = distributionTargets[i];
|
|
317
355
|
|
|
318
356
|
uint256 transferAmount = (schemaBalances[uint256(_config.schema)] * _config.percentage) / MAX_PERCENT;
|
|
@@ -322,10 +360,14 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
322
360
|
IIncomeDestination(_config.destination).updateAssetsState(comptroller, asset);
|
|
323
361
|
|
|
324
362
|
emit AssetReleased(_config.destination, asset, _config.schema, _config.percentage, transferAmount);
|
|
363
|
+
|
|
364
|
+
unchecked {
|
|
365
|
+
++i;
|
|
366
|
+
}
|
|
325
367
|
}
|
|
326
368
|
|
|
327
|
-
|
|
328
|
-
for (
|
|
369
|
+
uint256[] memory newSchemaBalances = new uint256[](totalSchemas);
|
|
370
|
+
for (uint256 schemaValue = 0; schemaValue < totalSchemas; ) {
|
|
329
371
|
newSchemaBalances[schemaValue] = schemaBalances[schemaValue] - totalTransferAmounts[schemaValue];
|
|
330
372
|
assetsReserves[comptroller][asset][Schema(schemaValue)] = newSchemaBalances[schemaValue];
|
|
331
373
|
totalAssetReserve[asset] = totalAssetReserve[asset] - totalTransferAmounts[schemaValue];
|
|
@@ -337,9 +379,20 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
337
379
|
schemaBalances[schemaValue],
|
|
338
380
|
newSchemaBalances[schemaValue]
|
|
339
381
|
);
|
|
382
|
+
|
|
383
|
+
unchecked {
|
|
384
|
+
++schemaValue;
|
|
385
|
+
}
|
|
340
386
|
}
|
|
341
387
|
}
|
|
342
388
|
|
|
389
|
+
/**
|
|
390
|
+
* @dev Returns the schema based on comptroller, asset and income type
|
|
391
|
+
* @param comptroller Comptroller address(pool)
|
|
392
|
+
* @param asset Asset address.
|
|
393
|
+
* @param incomeType type of income
|
|
394
|
+
* @return schema schema for distribution
|
|
395
|
+
*/
|
|
343
396
|
function getSchema(
|
|
344
397
|
address comptroller,
|
|
345
398
|
address asset,
|
|
@@ -355,19 +408,31 @@ contract ProtocolShareReserve is AccessControlledV8, IProtocolShareReserve {
|
|
|
355
408
|
|
|
356
409
|
function _ensurePercentages() internal view {
|
|
357
410
|
uint256 totalSchemas = uint256(type(Schema).max) + 1;
|
|
358
|
-
|
|
411
|
+
uint256[] memory totalPercentages = new uint256[](totalSchemas);
|
|
359
412
|
|
|
360
|
-
for (
|
|
413
|
+
for (uint256 i = 0; i < distributionTargets.length; ) {
|
|
361
414
|
DistributionConfig memory config = distributionTargets[i];
|
|
362
415
|
totalPercentages[uint256(config.schema)] += config.percentage;
|
|
363
|
-
}
|
|
364
416
|
|
|
365
|
-
|
|
417
|
+
unchecked {
|
|
418
|
+
++i;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
for (uint256 schemaValue = 0; schemaValue < totalSchemas; ) {
|
|
366
422
|
if (totalPercentages[schemaValue] != MAX_PERCENT && totalPercentages[schemaValue] != 0)
|
|
367
423
|
revert InvalidTotalPercentage();
|
|
424
|
+
|
|
425
|
+
unchecked {
|
|
426
|
+
++schemaValue;
|
|
427
|
+
}
|
|
368
428
|
}
|
|
369
429
|
}
|
|
370
430
|
|
|
431
|
+
/**
|
|
432
|
+
* @dev Returns the underlying asset address for the vToken
|
|
433
|
+
* @param vToken vToken address
|
|
434
|
+
* @return asset address of asset
|
|
435
|
+
*/
|
|
371
436
|
function _getUnderlying(address vToken) internal view returns (address) {
|
|
372
437
|
if (vToken == vBNB) {
|
|
373
438
|
return WBNB;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venusprotocol/protocol-reserve",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "1.0.0-dev.
|
|
4
|
+
"version": "1.0.0-dev.4",
|
|
5
5
|
"author": "",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18.0.0"
|
|
@@ -109,5 +109,8 @@
|
|
|
109
109
|
"tsconfig-paths": "^4.1.2",
|
|
110
110
|
"typechain": "^8.1.1",
|
|
111
111
|
"typescript": "^4.9.3"
|
|
112
|
+
},
|
|
113
|
+
"dependencies": {
|
|
114
|
+
"@venusprotocol/isolated-pools": "^1.3.0"
|
|
112
115
|
}
|
|
113
116
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
import type * as access from "./access";
|
|
7
7
|
import type * as proxy from "./proxy";
|
|
8
|
+
import type * as security from "./security";
|
|
8
9
|
import type * as token from "./token";
|
|
9
10
|
import type * as utils from "./utils";
|
|
10
11
|
|
|
@@ -12,6 +13,8 @@ export type { access };
|
|
|
12
13
|
|
|
13
14
|
export type { proxy };
|
|
14
15
|
|
|
16
|
+
export type { security };
|
|
17
|
+
|
|
15
18
|
export type { token };
|
|
16
19
|
|
|
17
20
|
export type { utils };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
import type {
|
|
7
|
+
TypedEventFilter,
|
|
8
|
+
TypedEvent,
|
|
9
|
+
TypedListener,
|
|
10
|
+
OnEvent,
|
|
11
|
+
PromiseOrValue,
|
|
12
|
+
} from "../../../common";
|
|
13
|
+
import type { EventFragment } from "@ethersproject/abi";
|
|
14
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
15
|
+
import type { BaseContract, Signer, utils } from "ethers";
|
|
16
|
+
|
|
17
|
+
export interface ReentrancyGuardUpgradeableInterface extends utils.Interface {
|
|
18
|
+
functions: {};
|
|
19
|
+
|
|
20
|
+
events: {
|
|
21
|
+
"Initialized(uint8)": EventFragment;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface InitializedEventObject {
|
|
28
|
+
version: number;
|
|
29
|
+
}
|
|
30
|
+
export type InitializedEvent = TypedEvent<[number], InitializedEventObject>;
|
|
31
|
+
|
|
32
|
+
export type InitializedEventFilter = TypedEventFilter<InitializedEvent>;
|
|
33
|
+
|
|
34
|
+
export interface ReentrancyGuardUpgradeable extends BaseContract {
|
|
35
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
36
|
+
attach(addressOrName: string): this;
|
|
37
|
+
deployed(): Promise<this>;
|
|
38
|
+
|
|
39
|
+
interface: ReentrancyGuardUpgradeableInterface;
|
|
40
|
+
|
|
41
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
42
|
+
event: TypedEventFilter<TEvent>,
|
|
43
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
44
|
+
toBlock?: string | number | undefined
|
|
45
|
+
): Promise<Array<TEvent>>;
|
|
46
|
+
|
|
47
|
+
listeners<TEvent extends TypedEvent>(
|
|
48
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
49
|
+
): Array<TypedListener<TEvent>>;
|
|
50
|
+
listeners(eventName?: string): Array<Listener>;
|
|
51
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
52
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
53
|
+
): this;
|
|
54
|
+
removeAllListeners(eventName?: string): this;
|
|
55
|
+
off: OnEvent<this>;
|
|
56
|
+
on: OnEvent<this>;
|
|
57
|
+
once: OnEvent<this>;
|
|
58
|
+
removeListener: OnEvent<this>;
|
|
59
|
+
|
|
60
|
+
functions: {};
|
|
61
|
+
|
|
62
|
+
callStatic: {};
|
|
63
|
+
|
|
64
|
+
filters: {
|
|
65
|
+
"Initialized(uint8)"(version?: null): InitializedEventFilter;
|
|
66
|
+
Initialized(version?: null): InitializedEventFilter;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
estimateGas: {};
|
|
70
|
+
|
|
71
|
+
populateTransaction: {};
|
|
72
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
import type {
|
|
7
|
+
TypedEventFilter,
|
|
8
|
+
TypedEvent,
|
|
9
|
+
TypedListener,
|
|
10
|
+
OnEvent,
|
|
11
|
+
PromiseOrValue,
|
|
12
|
+
} from "../../../common";
|
|
13
|
+
import type {
|
|
14
|
+
FunctionFragment,
|
|
15
|
+
Result,
|
|
16
|
+
EventFragment,
|
|
17
|
+
} from "@ethersproject/abi";
|
|
18
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
19
|
+
import type {
|
|
20
|
+
BaseContract,
|
|
21
|
+
BigNumber,
|
|
22
|
+
BytesLike,
|
|
23
|
+
CallOverrides,
|
|
24
|
+
PopulatedTransaction,
|
|
25
|
+
Signer,
|
|
26
|
+
utils,
|
|
27
|
+
} from "ethers";
|
|
28
|
+
|
|
29
|
+
export interface MaxLoopsLimitHelperInterface extends utils.Interface {
|
|
30
|
+
functions: {
|
|
31
|
+
"maxLoopsLimit()": FunctionFragment;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
getFunction(nameOrSignatureOrTopic: "maxLoopsLimit"): FunctionFragment;
|
|
35
|
+
|
|
36
|
+
encodeFunctionData(
|
|
37
|
+
functionFragment: "maxLoopsLimit",
|
|
38
|
+
values?: undefined
|
|
39
|
+
): string;
|
|
40
|
+
|
|
41
|
+
decodeFunctionResult(
|
|
42
|
+
functionFragment: "maxLoopsLimit",
|
|
43
|
+
data: BytesLike
|
|
44
|
+
): Result;
|
|
45
|
+
|
|
46
|
+
events: {
|
|
47
|
+
"MaxLoopsLimitUpdated(uint256,uint256)": EventFragment;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
getEvent(nameOrSignatureOrTopic: "MaxLoopsLimitUpdated"): EventFragment;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface MaxLoopsLimitUpdatedEventObject {
|
|
54
|
+
oldMaxLoopsLimit: BigNumber;
|
|
55
|
+
newmaxLoopsLimit: BigNumber;
|
|
56
|
+
}
|
|
57
|
+
export type MaxLoopsLimitUpdatedEvent = TypedEvent<
|
|
58
|
+
[BigNumber, BigNumber],
|
|
59
|
+
MaxLoopsLimitUpdatedEventObject
|
|
60
|
+
>;
|
|
61
|
+
|
|
62
|
+
export type MaxLoopsLimitUpdatedEventFilter =
|
|
63
|
+
TypedEventFilter<MaxLoopsLimitUpdatedEvent>;
|
|
64
|
+
|
|
65
|
+
export interface MaxLoopsLimitHelper extends BaseContract {
|
|
66
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
67
|
+
attach(addressOrName: string): this;
|
|
68
|
+
deployed(): Promise<this>;
|
|
69
|
+
|
|
70
|
+
interface: MaxLoopsLimitHelperInterface;
|
|
71
|
+
|
|
72
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
73
|
+
event: TypedEventFilter<TEvent>,
|
|
74
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
75
|
+
toBlock?: string | number | undefined
|
|
76
|
+
): Promise<Array<TEvent>>;
|
|
77
|
+
|
|
78
|
+
listeners<TEvent extends TypedEvent>(
|
|
79
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
80
|
+
): Array<TypedListener<TEvent>>;
|
|
81
|
+
listeners(eventName?: string): Array<Listener>;
|
|
82
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
83
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
84
|
+
): this;
|
|
85
|
+
removeAllListeners(eventName?: string): this;
|
|
86
|
+
off: OnEvent<this>;
|
|
87
|
+
on: OnEvent<this>;
|
|
88
|
+
once: OnEvent<this>;
|
|
89
|
+
removeListener: OnEvent<this>;
|
|
90
|
+
|
|
91
|
+
functions: {
|
|
92
|
+
maxLoopsLimit(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
maxLoopsLimit(overrides?: CallOverrides): Promise<BigNumber>;
|
|
96
|
+
|
|
97
|
+
callStatic: {
|
|
98
|
+
maxLoopsLimit(overrides?: CallOverrides): Promise<BigNumber>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
filters: {
|
|
102
|
+
"MaxLoopsLimitUpdated(uint256,uint256)"(
|
|
103
|
+
oldMaxLoopsLimit?: null,
|
|
104
|
+
newmaxLoopsLimit?: null
|
|
105
|
+
): MaxLoopsLimitUpdatedEventFilter;
|
|
106
|
+
MaxLoopsLimitUpdated(
|
|
107
|
+
oldMaxLoopsLimit?: null,
|
|
108
|
+
newmaxLoopsLimit?: null
|
|
109
|
+
): MaxLoopsLimitUpdatedEventFilter;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
estimateGas: {
|
|
113
|
+
maxLoopsLimit(overrides?: CallOverrides): Promise<BigNumber>;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
populateTransaction: {
|
|
117
|
+
maxLoopsLimit(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
118
|
+
};
|
|
119
|
+
}
|