@gearbox-protocol/periphery-v3 1.0.8 → 1.1.0
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.
|
@@ -435,7 +435,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
435
435
|
|
|
436
436
|
result.supplyRate = pool.supplyRate();
|
|
437
437
|
|
|
438
|
-
result.version =
|
|
438
|
+
result.version = pool.version();
|
|
439
439
|
|
|
440
440
|
result.quotas = _getQuotas(_pool);
|
|
441
441
|
result.lirm = getLIRMData(pool.interestRateModel());
|
|
@@ -540,8 +540,14 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
540
540
|
unchecked {
|
|
541
541
|
for (uint256 i; i < len; ++i) {
|
|
542
542
|
quotas[i].token = quotaTokens[i];
|
|
543
|
-
(
|
|
544
|
-
|
|
543
|
+
(
|
|
544
|
+
quotas[i].rate,
|
|
545
|
+
,
|
|
546
|
+
quotas[i].quotaIncreaseFee,
|
|
547
|
+
quotas[i].totalQuoted,
|
|
548
|
+
quotas[i].limit,
|
|
549
|
+
quotas[i].isActive
|
|
550
|
+
) = pqk.getTokenQuotaParams(quotaTokens[i]);
|
|
545
551
|
}
|
|
546
552
|
}
|
|
547
553
|
}
|
|
@@ -567,8 +573,14 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
567
573
|
address token = quotaTokens[j];
|
|
568
574
|
quotaParams.token = token;
|
|
569
575
|
|
|
570
|
-
(
|
|
571
|
-
|
|
576
|
+
(
|
|
577
|
+
quotaParams.rate,
|
|
578
|
+
,
|
|
579
|
+
quotaParams.quotaIncreaseFee,
|
|
580
|
+
quotaParams.totalQuoted,
|
|
581
|
+
quotaParams.limit,
|
|
582
|
+
quotaParams.isActive
|
|
583
|
+
) = pqk.getTokenQuotaParams(token);
|
|
572
584
|
|
|
573
585
|
(
|
|
574
586
|
quotaParams.minRate,
|
package/contracts/data/Types.sol
CHANGED
|
@@ -24,6 +24,7 @@ struct QuotaInfo {
|
|
|
24
24
|
uint16 quotaIncreaseFee;
|
|
25
25
|
uint96 totalQuoted;
|
|
26
26
|
uint96 limit;
|
|
27
|
+
bool isActive;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
struct ContractAdapter {
|
|
@@ -151,6 +152,7 @@ struct GaugeQuotaParams {
|
|
|
151
152
|
uint16 quotaIncreaseFee;
|
|
152
153
|
uint96 totalQuoted;
|
|
153
154
|
uint96 limit;
|
|
155
|
+
bool isActive;
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
struct GaugeInfo {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// Gearbox Protocol. Generalized leverage for DeFi protocols
|
|
3
|
+
// (c) Gearbox Holdings, 2023
|
|
4
|
+
pragma solidity ^0.8.10;
|
|
5
|
+
|
|
6
|
+
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
7
|
+
import {IZapper} from "@gearbox-protocol/integrations-v3/contracts/interfaces/zappers/IZapper.sol";
|
|
8
|
+
import {IZapperRegistry} from "../interfaces/IZapperRegistry.sol";
|
|
9
|
+
import {ACLNonReentrantTrait} from "@gearbox-protocol/core-v3/contracts/traits/ACLNonReentrantTrait.sol";
|
|
10
|
+
import {ContractsRegisterTrait} from "@gearbox-protocol/core-v3/contracts/traits/ContractsRegisterTrait.sol";
|
|
11
|
+
|
|
12
|
+
contract ZapperRegister is ACLNonReentrantTrait, ContractsRegisterTrait, IZapperRegistry {
|
|
13
|
+
using EnumerableSet for EnumerableSet.AddressSet;
|
|
14
|
+
|
|
15
|
+
mapping(address => EnumerableSet.AddressSet) internal _zappersMap;
|
|
16
|
+
|
|
17
|
+
constructor(address addressProvider)
|
|
18
|
+
ACLNonReentrantTrait(addressProvider)
|
|
19
|
+
ContractsRegisterTrait(addressProvider)
|
|
20
|
+
{}
|
|
21
|
+
|
|
22
|
+
function addZapper(address zapper) external nonZeroAddress(zapper) controllerOnly {
|
|
23
|
+
address pool = IZapper(zapper).pool();
|
|
24
|
+
_ensureRegisteredPool(pool);
|
|
25
|
+
|
|
26
|
+
EnumerableSet.AddressSet storage zapperSet = _zappersMap[pool];
|
|
27
|
+
if (!zapperSet.contains(zapper)) {
|
|
28
|
+
zapperSet.add(zapper);
|
|
29
|
+
emit AddZapper(zapper);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function removeZapper(address zapper) external nonZeroAddress(zapper) controllerOnly {
|
|
34
|
+
EnumerableSet.AddressSet storage zapperSet = _zappersMap[IZapper(zapper).pool()];
|
|
35
|
+
if (zapperSet.contains(zapper)) {
|
|
36
|
+
zapperSet.remove(zapper);
|
|
37
|
+
emit RemoveZapper(zapper);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function zappers(address pool) external view override returns (address[] memory) {
|
|
42
|
+
return _zappersMap[pool].values();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// Gearbox Protocol. Generalized leverage for DeFi protocols
|
|
3
|
+
// (c) Gearbox Holdings, 2023
|
|
4
|
+
pragma solidity ^0.8.10;
|
|
5
|
+
|
|
6
|
+
interface IZapperRegistry {
|
|
7
|
+
event AddZapper(address);
|
|
8
|
+
event RemoveZapper(address);
|
|
9
|
+
|
|
10
|
+
function zappers(address pool) external view returns (address[] memory);
|
|
11
|
+
}
|
|
@@ -9,6 +9,8 @@ import {DataCompressorV2_10} from "../data/DataCompressor_2_1.sol";
|
|
|
9
9
|
import {DataCompressorV3_00} from "../data/DataCompressor_3_0.sol";
|
|
10
10
|
import {CreditAccountData, CreditManagerData, PoolData, TokenBalance, ContractAdapter} from "../data/Types.sol";
|
|
11
11
|
|
|
12
|
+
import {NetworkDetector} from "@gearbox-protocol/sdk-gov/contracts/NetworkDetector.sol";
|
|
13
|
+
|
|
12
14
|
import "forge-std/console.sol";
|
|
13
15
|
|
|
14
16
|
address constant ap = 0x5BcB06c56e8F28da0b038a373199240ca3F5a2f4;
|
|
@@ -17,7 +19,20 @@ contract DCTest {
|
|
|
17
19
|
DataCompressorV2_10 public dc2;
|
|
18
20
|
DataCompressorV3_00 public dc3;
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
uint256 chainId;
|
|
23
|
+
|
|
24
|
+
constructor() {
|
|
25
|
+
NetworkDetector nd = new NetworkDetector();
|
|
26
|
+
chainId = nd.chainId();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
modifier liveTestOnly() {
|
|
30
|
+
if (chainId == 1) {
|
|
31
|
+
_;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function setUp() public liveTestOnly {
|
|
21
36
|
dc2 = new DataCompressorV2_10(ap);
|
|
22
37
|
dc3 = new DataCompressorV3_00(ap);
|
|
23
38
|
}
|
|
@@ -94,7 +109,7 @@ contract DCTest {
|
|
|
94
109
|
}
|
|
95
110
|
}
|
|
96
111
|
|
|
97
|
-
function test_dc_01_pools() public view {
|
|
112
|
+
function test_dc_01_pools() public view liveTestOnly {
|
|
98
113
|
PoolData[] memory pools = dc2.getPoolsV1List();
|
|
99
114
|
console.log("V1 pools");
|
|
100
115
|
_printPools(pools);
|
|
@@ -104,7 +119,7 @@ contract DCTest {
|
|
|
104
119
|
_printPools(pools);
|
|
105
120
|
}
|
|
106
121
|
|
|
107
|
-
function test_dc_02_credit_managers() public view {
|
|
122
|
+
function test_dc_02_credit_managers() public view liveTestOnly {
|
|
108
123
|
CreditManagerData[] memory cms = dc2.getCreditManagersV2List();
|
|
109
124
|
console.log("V2 credit managers");
|
|
110
125
|
_printCreditManagers(cms);
|
|
@@ -114,7 +129,7 @@ contract DCTest {
|
|
|
114
129
|
_printCreditManagers(cms);
|
|
115
130
|
}
|
|
116
131
|
|
|
117
|
-
function test_dc_03_credit_accounts() public view {
|
|
132
|
+
function test_dc_03_credit_accounts() public view liveTestOnly {
|
|
118
133
|
CreditAccountData[] memory cas = dc2.getCreditAccountsByBorrower(address(this));
|
|
119
134
|
console.log("V2 credit accounts", cas.length);
|
|
120
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/periphery-v3",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": "git@github.com:Gearbox-protocol/periphery-v3.git",
|
|
6
6
|
"author": "Mikael <26343374+0xmikko@users.noreply.github.com>",
|
|
@@ -18,10 +18,13 @@
|
|
|
18
18
|
"@commitlint/cli": "^17.6.3",
|
|
19
19
|
"@commitlint/config-conventional": "17.6.0",
|
|
20
20
|
"@gearbox-protocol/core-v2": "1.19.0-base.14",
|
|
21
|
-
"@gearbox-protocol/core-v3": "^1.
|
|
21
|
+
"@gearbox-protocol/core-v3": "^1.39.0",
|
|
22
22
|
"@gearbox-protocol/oracles-v3": "^1.7.2",
|
|
23
23
|
"@gearbox-protocol/sdk-gov": "^1.5.10",
|
|
24
|
-
"@
|
|
24
|
+
"@gearbox-protocol/integrations-v3": "^1.16.0",
|
|
25
|
+
"@openzeppelin/contracts": "4.8.3"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
25
28
|
"husky": "^8.0.3",
|
|
26
29
|
"lint-staged": "^13.0.3",
|
|
27
30
|
"prettier": "^3.0.3"
|