Skip to content

Commit 8b9c940

Browse files
authored
feat: attach suite (#35)
* feat: attach suite * chore: update deps * chore: update deps * feat: cleanup - update deps - remove some legacy from compressors - remove obsolete scripts
1 parent ddff68e commit 8b9c940

File tree

18 files changed

+65
-1775
lines changed

18 files changed

+65
-1775
lines changed

contracts/compressors/PriceFeedCompressor.sol

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {ILegacyPriceFeed, ILegacyPriceOracle, Legacy} from "../libraries/Legacy.
1414
import {AP_PRICE_FEED_COMPRESSOR} from "../libraries/Literals.sol";
1515
import {NestedPriceFeeds} from "../libraries/NestedPriceFeeds.sol";
1616

17-
import {BPTWeightedPriceFeedSerializer} from "../serializers/oracles/BPTWeightedPriceFeedSerializer.sol";
1817
import {BoundedPriceFeedSerializer} from "../serializers/oracles/BoundedPriceFeedSerializer.sol";
1918
import {LPPriceFeedSerializer} from "../serializers/oracles/LPPriceFeedSerializer.sol";
2019
import {PendleTWAPPTPriceFeedSerializer} from "../serializers/oracles/PendleTWAPPTPriceFeedSerializer.sol";
@@ -49,17 +48,12 @@ contract PriceFeedCompressor is BaseCompressor, IPriceFeedCompressor {
4948
constructor(address addressProvider_) BaseCompressor(addressProvider_) {
5049
// these types can be serialized as generic LP price feeds
5150
address lpSerializer = address(new LPPriceFeedSerializer());
52-
serializers["PRICE_FEED::BALANCER_STABLE"] = lpSerializer;
5351
serializers["PRICE_FEED::CURVE_STABLE"] = lpSerializer;
5452
serializers["PRICE_FEED::CURVE_CRYPTO"] = lpSerializer;
55-
serializers["PRICE_FEED::CURVE_USD"] = lpSerializer;
5653
serializers["PRICE_FEED::ERC4626"] = lpSerializer;
57-
serializers["PRICE_FEED::MELLOW_LRT"] = lpSerializer;
5854
serializers["PRICE_FEED::WSTETH"] = lpSerializer;
59-
serializers["PRICE_FEED::YEARN"] = lpSerializer;
6055

6156
// these types need special serialization
62-
serializers["PRICE_FEED::BALANCER_WEIGHTED"] = address(new BPTWeightedPriceFeedSerializer());
6357
serializers["PRICE_FEED::BOUNDED"] = address(new BoundedPriceFeedSerializer());
6458
serializers["PRICE_FEED::PENDLE_PT_TWAP"] = address(new PendleTWAPPTPriceFeedSerializer());
6559
serializers["PRICE_FEED::PYTH"] = address(new PythPriceFeedSerializer());
@@ -150,10 +144,7 @@ contract PriceFeedCompressor is BaseCompressor, IPriceFeedCompressor {
150144
if (priceFeed == address(0)) continue;
151145

152146
priceFeedMap[priceFeedMapSize++] = PriceFeedMapEntry({
153-
token: token,
154-
reserve: reserve,
155-
priceFeed: priceFeed,
156-
stalenessPeriod: stalenessPeriod
147+
token: token, reserve: reserve, priceFeed: priceFeed, stalenessPeriod: stalenessPeriod
157148
});
158149
}
159150
// trim array to its actual size in case some tokens don't have reserve price feeds

contracts/serializers/oracles/BPTWeightedPriceFeedSerializer.sol

Lines changed: 0 additions & 26 deletions
This file was deleted.

contracts/test/ForkTest.sol

Lines changed: 0 additions & 63 deletions
This file was deleted.

contracts/test/migration/cloners/IntegrationCloner.sol

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import {IACL} from "@gearbox-protocol/permissionless/contracts/interfaces/IACL.s
1010
import {IAdapter} from "@gearbox-protocol/core-v3/contracts/interfaces/base/IAdapter.sol";
1111
import {ICreditManagerV3} from "@gearbox-protocol/core-v3/contracts/interfaces/ICreditManagerV3.sol";
1212

13-
import {ConvexStakedPositionToken} from
14-
"@gearbox-protocol/integrations-v3/contracts/helpers/convex/ConvexV1_StakedPositionToken.sol";
15-
import {StakingRewardsPhantomToken} from
16-
"@gearbox-protocol/integrations-v3/contracts/helpers/sky/StakingRewardsPhantomToken.sol";
13+
import {
14+
ConvexStakedPositionToken
15+
} from "@gearbox-protocol/integrations-v3/contracts/helpers/convex/ConvexV1_StakedPositionToken.sol";
16+
import {
17+
StakingRewardsPhantomToken
18+
} from "@gearbox-protocol/integrations-v3/contracts/helpers/sky/StakingRewardsPhantomToken.sol";
1719
import {IBaseRewardPool} from "@gearbox-protocol/integrations-v3/contracts/integrations/convex/IBaseRewardPool.sol";
1820

1921
import {
@@ -24,12 +26,9 @@ import {
2426
UniswapV3Adapter,
2527
UniswapV3PoolStatus
2628
} from "@gearbox-protocol/integrations-v3/contracts/adapters/uniswap/UniswapV3.sol";
27-
import {YearnV2Adapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/yearn/YearnV2.sol";
2829
import {ERC4626Adapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/erc4626/ERC4626Adapter.sol";
2930
import {LidoV1Adapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/lido/LidoV1.sol";
3031
import {WstETHV1Adapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/lido/WstETHV1.sol";
31-
import {BalancerV2VaultAdapter} from
32-
"@gearbox-protocol/integrations-v3/contracts/adapters/balancer/BalancerV2VaultAdapter.sol";
3332
import {
3433
CamelotV3Adapter,
3534
CamelotV3PoolStatus
@@ -40,23 +39,25 @@ import {CurveV1Adapter2Assets} from "@gearbox-protocol/integrations-v3/contracts
4039
import {CurveV1Adapter3Assets} from "@gearbox-protocol/integrations-v3/contracts/adapters/curve/CurveV1_3.sol";
4140
import {CurveV1Adapter4Assets} from "@gearbox-protocol/integrations-v3/contracts/adapters/curve/CurveV1_4.sol";
4241
import {CurveV1AdapterStableNG} from "@gearbox-protocol/integrations-v3/contracts/adapters/curve/CurveV1_StableNG.sol";
43-
import {ConvexV1BaseRewardPoolAdapter} from
44-
"@gearbox-protocol/integrations-v3/contracts/adapters/convex/ConvexV1_BaseRewardPool.sol";
42+
import {
43+
ConvexV1BaseRewardPoolAdapter
44+
} from "@gearbox-protocol/integrations-v3/contracts/adapters/convex/ConvexV1_BaseRewardPool.sol";
4545
import {ConvexV1BoosterAdapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/convex/ConvexV1_Booster.sol";
4646
import {
4747
VelodromeV2RouterAdapter,
4848
VelodromeV2PoolStatus
4949
} from "@gearbox-protocol/integrations-v3/contracts/adapters/velodrome/VelodromeV2RouterAdapter.sol";
5050
import {DaiUsdsAdapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/sky/DaiUsdsAdapter.sol";
51-
import {StakingRewardsAdapter} from "@gearbox-protocol/integrations-v3/contracts/adapters/sky/StakingRewardsAdapter.sol";
52-
import {BalancerV3RouterAdapter} from
53-
"@gearbox-protocol/integrations-v3/contracts/adapters/balancer/BalancerV3RouterAdapter.sol";
5451
import {
55-
MellowVaultAdapter,
56-
MellowUnderlyingStatus
57-
} from "@gearbox-protocol/integrations-v3/contracts/adapters/mellow/MellowVaultAdapter.sol";
58-
import {Mellow4626VaultAdapter} from
59-
"@gearbox-protocol/integrations-v3/contracts/adapters/mellow/Mellow4626VaultAdapter.sol";
52+
StakingRewardsAdapter
53+
} from "@gearbox-protocol/integrations-v3/contracts/adapters/sky/StakingRewardsAdapter.sol";
54+
import {
55+
BalancerV3RouterAdapter,
56+
BalancerV3PoolStatus
57+
} from "@gearbox-protocol/integrations-v3/contracts/adapters/balancer/BalancerV3RouterAdapter.sol";
58+
import {
59+
Mellow4626VaultAdapter
60+
} from "@gearbox-protocol/integrations-v3/contracts/adapters/mellow/Mellow4626VaultAdapter.sol";
6061

6162
interface IOldAdapter {
6263
function _gearboxAdapterType() external view returns (AdapterType aType);
@@ -170,11 +171,6 @@ contract IntegrationCloner is Test {
170171
// }
171172
// }
172173
}
173-
/// YEARN V2
174-
else if (aType == AdapterType.YEARN_V2) {
175-
vm.prank(configurator);
176-
newAdapter = address(new YearnV2Adapter(newCreditManager, targetContract));
177-
}
178174
/// ERC4626
179175
else if (aType == AdapterType.ERC4626_VAULT) {
180176
vm.prank(configurator);
@@ -190,15 +186,6 @@ contract IntegrationCloner is Test {
190186
vm.prank(configurator);
191187
newAdapter = address(new WstETHV1Adapter(newCreditManager, targetContract));
192188
}
193-
/// BALANCER VAULT
194-
else if (aType == AdapterType.BALANCER_VAULT) {
195-
vm.prank(configurator);
196-
newAdapter = address(new BalancerV2VaultAdapter(newCreditManager, targetContract));
197-
198-
/// CLONE BALANCER POOLS
199-
/// event: SetPoolStatus(poolId, newStatus);
200-
/// function: setPoolStatus(bytes32 poolId, PoolStatus newStatus)
201-
}
202189
/// CAMELOT V3
203190
else if (aType == AdapterType.CAMELOT_V3_ROUTER) {
204191
vm.prank(configurator);
@@ -329,40 +316,15 @@ contract IntegrationCloner is Test {
329316
vm.prank(configurator);
330317
newAdapter = address(new StakingRewardsAdapter(newCreditManager, targetContract, stakedPhantomToken, 0));
331318
}
332-
/// MELLOW LRT VAULT
333-
else if (aType == AdapterType.MELLOW_LRT_VAULT) {
334-
vm.prank(configurator);
335-
newAdapter = address(new MellowVaultAdapter(newCreditManager, targetContract));
336-
337-
// uint256 collateralTokensCount = ICreditManagerV3(newCreditManager).collateralTokensCount();
338-
339-
// for (uint256 i = 0; i < collateralTokensCount; ++i) {
340-
// address token = ICreditManagerV3(oldCreditManager).getTokenByMask(1 << i);
341-
342-
// if (IOldMellowVaultAdapter(oldAdapter).isUnderlyingAllowed(token)) {
343-
// MellowUnderlyingStatus[] memory underlyings = new MellowUnderlyingStatus[](1);
344-
// underlyings[0] = MellowUnderlyingStatus({underlying: token, allowed: true});
345-
346-
// vm.prank(configurator);
347-
// MellowVaultAdapter(newAdapter).setUnderlyingStatusBatch(underlyings);
348-
// }
349-
// }
350-
}
351319
/// BALANCER V3
352320
else if (aType == AdapterType.BALANCER_V3_ROUTER) {
353321
vm.prank(configurator);
354322
newAdapter = address(new BalancerV3RouterAdapter(newCreditManager, targetContract));
355323

356-
address[] memory pools = BalancerV3RouterAdapter(oldAdapter).getAllowedPools();
357-
358-
bool[] memory statuses = new bool[](pools.length);
359-
360-
for (uint256 i = 0; i < pools.length; ++i) {
361-
statuses[i] = true;
362-
}
324+
BalancerV3PoolStatus[] memory pools = BalancerV3RouterAdapter(oldAdapter).getAllowedPools();
363325

364326
vm.prank(configurator);
365-
BalancerV3RouterAdapter(newAdapter).setPoolStatusBatch(pools, statuses);
327+
BalancerV3RouterAdapter(newAdapter).setPoolStatusBatch(pools);
366328
}
367329
/// MELLOW ERC4626 VAULT
368330
else if (aType == AdapterType.MELLOW_ERC4626_VAULT) {

0 commit comments

Comments
 (0)