diff --git a/contracts/adapters/convex/ConvexV1_BaseRewardPool.sol b/contracts/adapters/convex/ConvexV1_BaseRewardPool.sol index 4af79a29..7fc26273 100644 --- a/contracts/adapters/convex/ConvexV1_BaseRewardPool.sol +++ b/contracts/adapters/convex/ConvexV1_BaseRewardPool.sol @@ -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] diff --git a/contracts/adapters/convex/ConvexV1_Booster.sol b/contracts/adapters/convex/ConvexV1_Booster.sol index 30c42421..1885fc55 100644 --- a/contracts/adapters/convex/ConvexV1_Booster.sol +++ b/contracts/adapters/convex/ConvexV1_Booster.sol @@ -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); } // ------------- // diff --git a/contracts/adapters/lido/LidoV1.sol b/contracts/adapters/lido/LidoV1.sol index 108626a7..261ad7e5 100644 --- a/contracts/adapters/lido/LidoV1.sol +++ b/contracts/adapters/lido/LidoV1.sol @@ -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; } diff --git a/contracts/adapters/zircuit/ZircuitPoolAdapter.sol b/contracts/adapters/zircuit/ZircuitPoolAdapter.sol index d707482e..6332fb0a 100644 --- a/contracts/adapters/zircuit/ZircuitPoolAdapter.sol +++ b/contracts/adapters/zircuit/ZircuitPoolAdapter.sol @@ -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); } diff --git a/contracts/interfaces/zappers/IZapper.sol b/contracts/interfaces/zappers/IZapper.sol index e8558cdf..685fd0a3 100644 --- a/contracts/interfaces/zappers/IZapper.sol +++ b/contracts/interfaces/zappers/IZapper.sol @@ -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); diff --git a/contracts/test/unit/zappers/ZapperBase.harness.sol b/contracts/test/unit/zappers/ZapperBase.harness.sol index 1465d0c6..e4274cf4 100644 --- a/contracts/test/unit/zappers/ZapperBase.harness.sol +++ b/contracts/test/unit/zappers/ZapperBase.harness.sol @@ -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); diff --git a/contracts/zappers/ERC20ZapperBase.sol b/contracts/zappers/ERC20ZapperBase.sol index b82a226b..c6d302f6 100644 --- a/contracts/zappers/ERC20ZapperBase.sol +++ b/contracts/zappers/ERC20ZapperBase.sol @@ -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); } } diff --git a/contracts/zappers/UnderlyingDepositZapper.sol b/contracts/zappers/UnderlyingDepositZapper.sol index d9ed52c7..ea01773d 100644 --- a/contracts/zappers/UnderlyingDepositZapper.sol +++ b/contracts/zappers/UnderlyingDepositZapper.sol @@ -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) {} } diff --git a/contracts/zappers/UnderlyingFarmingZapper.sol b/contracts/zappers/UnderlyingFarmingZapper.sol index 9983913c..2e10333e 100644 --- a/contracts/zappers/UnderlyingFarmingZapper.sol +++ b/contracts/zappers/UnderlyingFarmingZapper.sol @@ -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) {} } diff --git a/contracts/zappers/WETHDepositZapper.sol b/contracts/zappers/WETHDepositZapper.sol index b64b62d3..c04dc24e 100644 --- a/contracts/zappers/WETHDepositZapper.sol +++ b/contracts/zappers/WETHDepositZapper.sol @@ -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) {} } diff --git a/contracts/zappers/WETHFarmingZapper.sol b/contracts/zappers/WETHFarmingZapper.sol index d15dd399..c948de02 100644 --- a/contracts/zappers/WETHFarmingZapper.sol +++ b/contracts/zappers/WETHFarmingZapper.sol @@ -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) {} } diff --git a/contracts/zappers/WstETHDepositZapper.sol b/contracts/zappers/WstETHDepositZapper.sol index 75bbc954..f1adcf87 100644 --- a/contracts/zappers/WstETHDepositZapper.sol +++ b/contracts/zappers/WstETHDepositZapper.sol @@ -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() {} } diff --git a/contracts/zappers/WstETHFarmingZapper.sol b/contracts/zappers/WstETHFarmingZapper.sol index f56665db..e17356d4 100644 --- a/contracts/zappers/WstETHFarmingZapper.sol +++ b/contracts/zappers/WstETHFarmingZapper.sol @@ -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) {} }