Skip to content

Commit

Permalink
feat: minor adapter improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhovitsky committed Jul 24, 2024
1 parent da91339 commit 46b303f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contracts/adapters/convex/ConvexV1_BaseRewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ contract ConvexV1BaseRewardPoolAdapter is AbstractAdapter, IConvexV1BaseRewardPo
external
override
creditFacadeOnly // U:[CVX1R-3]
returns (bool enableSafePrices)
returns (bool)
{
address creditAccount = _creditAccount(); // U:[CVX1R-10]

Expand Down
17 changes: 11 additions & 6 deletions contracts/adapters/convex/ConvexV1_Booster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,23 @@ contract ConvexV1BoosterAdapter is AbstractAdapter, IConvexV1BoosterAdapter {
return _supportedPids.values();
}

struct Pool {
uint256 pid;
address curveToken;
address convexToken;
address phantomToken;
}

/// @notice Serialized adapter parameters
function serialize() external view returns (bytes memory serializedData) {
uint256[] memory supportedPids = getSupportedPids();
address[] memory supportedPhantomTokens = new address[](supportedPids.length);

uint256 len = supportedPids.length;

Pool[] memory supportedPools = new Pool[](len);
for (uint256 i = 0; i < len; ++i) {
supportedPhantomTokens[i] = pidToPhantomToken[supportedPids[i]];
uint256 pid = supportedPids[i];
supportedPools[i] = Pool(pid, pidToCurveToken[pid], pidToConvexToken[pid], pidToPhantomToken[pid]);
}

serializedData = abi.encode(creditManager, targetContract, supportedPids, supportedPhantomTokens);
serializedData = abi.encode(creditManager, targetContract, supportedPools);
}

// ------------- //
Expand Down
4 changes: 3 additions & 1 deletion contracts/adapters/lido/LidoV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ contract LidoV1Adapter is AbstractAdapter, ILidoV1Adapter {

uint256 balance = IERC20(weth).balanceOf(creditAccount); // U:[LDO1-4]
if (balance > leftoverAmount) {
_submit(balance - leftoverAmount);
unchecked {
_submit(balance - leftoverAmount);
}
}
return false;
}
Expand Down
3 changes: 0 additions & 3 deletions contracts/adapters/zircuit/ZircuitPoolAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ contract ZircuitPoolAdapter is AbstractAdapter, IZircuitPoolAdapter {
address token = cm.getTokenByMask(1 << i);
try IPhantomToken(token).getPhantomTokenInfo() returns (address target, address depositedToken) {
if (target == targetContract) {
_getMaskOrRevert(token);
_getMaskOrRevert(depositedToken);

tokenToPhantomToken[depositedToken] = token;
if (_supportedUnderlyings.add(depositedToken)) emit AddSupportedUnderlying(depositedToken, token);
}
Expand Down

0 comments on commit 46b303f

Please sign in to comment.