Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: minor fixes #135

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 3 additions & 1 deletion contracts/interfaces/zappers/IZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.23;

interface IZapper {
import {IVersion} from "@gearbox-protocol/core-v3/contracts/interfaces/base/IVersion.sol";

interface IZapper is IVersion {
function pool() external view returns (address);

function underlying() external view returns (address);
Expand Down
3 changes: 3 additions & 0 deletions contracts/test/unit/zappers/ZapperBase.harness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ pragma solidity ^0.8.23;
import {ZapperBase} from "../../../zappers/ZapperBase.sol";

contract ZapperBaseHarness is ZapperBase {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_HARNESS";

event ConvertTokenInToUnderlying(uint256 tokenInAmount, uint256 assets);
event ConvertUnderlyingToTokenIn(uint256 assets, uint256 tokenInAmount, address receiver);
event ConvertSharesToTokenOut(uint256 shares, uint256 tokenOutAmount, address receiver);
Expand Down
2 changes: 1 addition & 1 deletion contracts/zappers/ERC20ZapperBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ abstract contract ERC20ZapperBase is ZapperBase, IERC20ZapperDeposits {
bytes32 s
) external returns (uint256 tokenOutAmount) {
_permitAllowed(tokenIn(), nonce, expiry, v, r, s);
tokenOutAmount = _deposit(tokenInAmount, receiver, false, referralCode);
tokenOutAmount = _deposit(tokenInAmount, receiver, true, referralCode);
}
}
3 changes: 3 additions & 0 deletions contracts/zappers/UnderlyingDepositZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {ZapperBase} from "./ZapperBase.sol";
/// @title Underlying deposit zapper
/// @notice Zapper that allows to deposit underlying token into a pool in one call using permit
contract UnderlyingDepositZapper is UnderlyingTrait, DepositTrait {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_UNDERLYING_DEPOSIT";

constructor(address pool) ZapperBase(pool) {}
}
3 changes: 3 additions & 0 deletions contracts/zappers/UnderlyingFarmingZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {ZapperBase} from "./ZapperBase.sol";
/// @title Underlying farming zapper
/// @notice Zapper that allows to deposit underlying token into a pool and stake shares in 1inch farming contract
contract UnderlyingFarmingZapper is UnderlyingTrait, FarmingTrait {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_UNDERLYING_FARMING";

constructor(address pool, address farmingPool) ZapperBase(pool) FarmingTrait(farmingPool) {}
}
3 changes: 3 additions & 0 deletions contracts/zappers/WETHDepositZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {ZapperBase} from "./ZapperBase.sol";
/// @title WETH deposit zapper
/// @notice Zapper that allows to deposit ETH directly into a WETH pool
contract WETHDepositZapper is WETHTrait, DepositTrait {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_WETH_DEPOSIT";

constructor(address pool) ZapperBase(pool) {}
}
3 changes: 3 additions & 0 deletions contracts/zappers/WETHFarmingZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {ZapperBase} from "./ZapperBase.sol";
/// @title WETH farming zapper
/// @notice Zapper that allows to deposit ETH directly into a WETH pool and stake shares in 1inch farming contract
contract WETHFarmingZapper is WETHTrait, FarmingTrait {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_WETH_FARMING";

constructor(address pool, address farmingPool) ZapperBase(pool) FarmingTrait(farmingPool) {}
}
3 changes: 3 additions & 0 deletions contracts/zappers/WstETHDepositZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {ZapperBase} from "./ZapperBase.sol";
/// @title wstETH deposit zapper
/// @notice Zapper that allows to deposit stETH directly into a wstETH pool
contract WstETHDepositZapper is WstETHTrait, DepositTrait {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_WSTETH_DEPOSIT";

constructor(address pool) ZapperBase(pool) WstETHTrait() {}
}
3 changes: 3 additions & 0 deletions contracts/zappers/WstETHFarmingZapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ import {ZapperBase} from "./ZapperBase.sol";
/// @title wstETH farming zapper
/// @notice Zapper that allows to deposit stETH directly into a wstETH pool and stake shares in 1inch farming contract
contract WstETHFarmingZapper is WstETHTrait, FarmingTrait {
uint256 public constant override version = 3_10;
bytes32 public constant override contractType = "ZAP_WSTETH_FARMING";

constructor(address pool, address farmingPool) ZapperBase(pool) WstETHTrait() FarmingTrait(farmingPool) {}
}
Loading