From 2bcf88ed2604d89de8a1d4024d3ff3aec8d9e410 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Wed, 16 Oct 2024 11:48:24 +0200 Subject: [PATCH 1/4] feat: Move approval from transferProxy to Augustus --- .../paraswap-adapters/BaseParaSwapBuyAdapter.sol | 5 ++--- .../paraswap-adapters/BaseParaSwapSellAdapter.sol | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol index abff3e87..55af2fa2 100644 --- a/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol @@ -75,8 +75,7 @@ abstract contract BaseParaSwapBuyAdapter is BaseParaSwapAdapter { require(balanceBeforeAssetFrom >= maxAmountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP'); uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this)); - address tokenTransferProxy = augustus.getTokenTransferProxy(); - assetToSwapFrom.safeApprove(tokenTransferProxy, maxAmountToSwap); + assetToSwapFrom.safeApprove(address(augustus), maxAmountToSwap); if (toAmountOffset != 0) { // Ensure 256 bit (32 bytes) toAmountOffset value is within bounds of the @@ -102,7 +101,7 @@ abstract contract BaseParaSwapBuyAdapter is BaseParaSwapAdapter { } // Reset allowance - assetToSwapFrom.safeApprove(tokenTransferProxy, 0); + assetToSwapFrom.safeApprove(address(augustus), 0); uint256 balanceAfterAssetFrom = assetToSwapFrom.balanceOf(address(this)); amountSold = balanceBeforeAssetFrom - balanceAfterAssetFrom; diff --git a/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol index 2b5a306f..a55b900a 100644 --- a/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol @@ -72,9 +72,7 @@ abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter { require(balanceBeforeAssetFrom >= amountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP'); uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this)); - address tokenTransferProxy = augustus.getTokenTransferProxy(); - assetToSwapFrom.safeApprove(tokenTransferProxy, 0); - assetToSwapFrom.safeApprove(tokenTransferProxy, amountToSwap); + assetToSwapFrom.safeApprove(address(augustus), amountToSwap); if (fromAmountOffset != 0) { // Ensure 256 bit (32 bytes) fromAmount value is within bounds of the @@ -99,6 +97,9 @@ abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter { } } + // Reset allowance + assetToSwapFrom.safeApprove(address(augustus), 0); + require( assetToSwapFrom.balanceOf(address(this)) == balanceBeforeAssetFrom - amountToSwap, 'WRONG_BALANCE_AFTER_SWAP' From 8a63c4dcf8bfdd970e65fe6542c71507d42f2ac7 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Wed, 16 Oct 2024 12:22:55 +0200 Subject: [PATCH 2/4] test: Fix tests --- .../BaseParaSwapBuyAdapter.sol | 14 +++++-------- .../BaseParaSwapSellAdapter.sol | 11 +++++----- .../ParaSwapLiquiditySwapAdapter.sol | 12 ++++------- .../ParaSwapRepayAdapter.sol | 3 +-- .../ParaSwapWithdrawSwapAdapter.sol | 3 +-- .../interfaces/IFeeClaimer.sol | 8 +++---- .../interfaces/IParaSwapAugustus.sol | 6 ------ .../mocks/swap/MockParaSwapAugustus.sol | 21 +++++++------------ .../mocks/swap/MockParaSwapFeeClaimer.sol | 7 ------- .../swap/MockParaSwapTokenTransferProxy.sol | 16 -------------- .../paraswap-adapters/ParaswapAdapters.t.sol | 14 ++++++------- 11 files changed, 34 insertions(+), 81 deletions(-) delete mode 100644 src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol delete mode 100644 src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol diff --git a/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol index 55af2fa2..9f8ffc21 100644 --- a/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol @@ -6,7 +6,6 @@ import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {PercentageMath} from '../../protocol/libraries/math/PercentageMath.sol'; import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol'; import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol'; -import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol'; import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol'; import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol'; @@ -49,12 +48,9 @@ abstract contract BaseParaSwapBuyAdapter is BaseParaSwapAdapter { uint256 maxAmountToSwap, uint256 amountToReceive ) internal returns (uint256 amountSold, uint256 amountBought) { - (bytes memory buyCalldata, IParaSwapAugustus augustus) = abi.decode( - paraswapData, - (bytes, IParaSwapAugustus) - ); + (bytes memory buyCalldata, address augustus) = abi.decode(paraswapData, (bytes, address)); - require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS'); + require(AUGUSTUS_REGISTRY.isValidAugustus(augustus), 'INVALID_AUGUSTUS'); { uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom); @@ -75,7 +71,7 @@ abstract contract BaseParaSwapBuyAdapter is BaseParaSwapAdapter { require(balanceBeforeAssetFrom >= maxAmountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP'); uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this)); - assetToSwapFrom.safeApprove(address(augustus), maxAmountToSwap); + assetToSwapFrom.safeApprove(augustus, maxAmountToSwap); if (toAmountOffset != 0) { // Ensure 256 bit (32 bytes) toAmountOffset value is within bounds of the @@ -91,7 +87,7 @@ abstract contract BaseParaSwapBuyAdapter is BaseParaSwapAdapter { mstore(add(buyCalldata, add(toAmountOffset, 32)), amountToReceive) } } - (bool success, ) = address(augustus).call(buyCalldata); + (bool success, ) = augustus.call(buyCalldata); if (!success) { // Copy revert reason from call assembly { @@ -101,7 +97,7 @@ abstract contract BaseParaSwapBuyAdapter is BaseParaSwapAdapter { } // Reset allowance - assetToSwapFrom.safeApprove(address(augustus), 0); + assetToSwapFrom.safeApprove(augustus, 0); uint256 balanceAfterAssetFrom = assetToSwapFrom.balanceOf(address(this)); amountSold = balanceBeforeAssetFrom - balanceAfterAssetFrom; diff --git a/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol index a55b900a..5a34f60e 100644 --- a/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol @@ -6,7 +6,6 @@ import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {PercentageMath} from '../../protocol/libraries/math/PercentageMath.sol'; import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol'; import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol'; -import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol'; import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol'; import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol'; @@ -45,13 +44,13 @@ abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter { function _sellOnParaSwap( uint256 fromAmountOffset, bytes memory swapCalldata, - IParaSwapAugustus augustus, + address augustus, IERC20Detailed assetToSwapFrom, IERC20Detailed assetToSwapTo, uint256 amountToSwap, uint256 minAmountToReceive ) internal returns (uint256 amountReceived) { - require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS'); + require(AUGUSTUS_REGISTRY.isValidAugustus(augustus), 'INVALID_AUGUSTUS'); { uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom); @@ -72,7 +71,7 @@ abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter { require(balanceBeforeAssetFrom >= amountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP'); uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this)); - assetToSwapFrom.safeApprove(address(augustus), amountToSwap); + assetToSwapFrom.safeApprove(augustus, amountToSwap); if (fromAmountOffset != 0) { // Ensure 256 bit (32 bytes) fromAmount value is within bounds of the @@ -88,7 +87,7 @@ abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter { mstore(add(swapCalldata, add(fromAmountOffset, 32)), amountToSwap) } } - (bool success, ) = address(augustus).call(swapCalldata); + (bool success, ) = augustus.call(swapCalldata); if (!success) { // Copy revert reason from call assembly { @@ -98,7 +97,7 @@ abstract contract BaseParaSwapSellAdapter is BaseParaSwapAdapter { } // Reset allowance - assetToSwapFrom.safeApprove(address(augustus), 0); + assetToSwapFrom.safeApprove(augustus, 0); require( assetToSwapFrom.balanceOf(address(this)) == balanceBeforeAssetFrom - amountToSwap, diff --git a/src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol b/src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol index db855a33..b488089f 100644 --- a/src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol @@ -8,7 +8,6 @@ import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol'; import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol'; -import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol'; import {ReentrancyGuard} from '../../dependencies/openzeppelin/ReentrancyGuard.sol'; /** @@ -63,12 +62,9 @@ contract ParaSwapLiquiditySwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuar uint256 minAmountToReceive, uint256 swapAllBalanceOffset, bytes memory swapCalldata, - IParaSwapAugustus augustus, + address augustus, PermitSignature memory permitParams - ) = abi.decode( - params, - (IERC20Detailed, uint256, uint256, bytes, IParaSwapAugustus, PermitSignature) - ); + ) = abi.decode(params, (IERC20Detailed, uint256, uint256, bytes, address, PermitSignature)); _swapLiquidity( swapAllBalanceOffset, @@ -106,7 +102,7 @@ contract ParaSwapLiquiditySwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuar uint256 minAmountToReceive, uint256 swapAllBalanceOffset, bytes calldata swapCalldata, - IParaSwapAugustus augustus, + address augustus, PermitSignature calldata permitParams ) external nonReentrant { IERC20WithPermit aToken = IERC20WithPermit( @@ -158,7 +154,7 @@ contract ParaSwapLiquiditySwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuar function _swapLiquidity( uint256 swapAllBalanceOffset, bytes memory swapCalldata, - IParaSwapAugustus augustus, + address augustus, PermitSignature memory permitParams, uint256 flashLoanAmount, uint256 premium, diff --git a/src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol b/src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol index 659aae7c..25d2ccc2 100644 --- a/src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol @@ -10,7 +10,6 @@ import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {BaseParaSwapBuyAdapter} from './BaseParaSwapBuyAdapter.sol'; import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol'; -import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol'; import {ReentrancyGuard} from '../../dependencies/openzeppelin/ReentrancyGuard.sol'; /** @@ -57,7 +56,7 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard { * uint256 debtRateMode Rate mode of the debt to be repaid * bytes paraswapData Paraswap Data * * bytes buyCallData Call data for augustus - * * IParaSwapAugustus augustus Address of Augustus Swapper + * * address augustus Address of Augustus Swapper * PermitSignature permitParams Struct containing the permit signatures, set to all zeroes if not used */ function executeOperation( diff --git a/src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol b/src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol index 2522ee88..79e5d792 100644 --- a/src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol +++ b/src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol @@ -7,7 +7,6 @@ import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.so import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol'; import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol'; import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol'; -import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol'; import {ReentrancyGuard} from '../../dependencies/openzeppelin/ReentrancyGuard.sol'; contract ParaSwapWithdrawSwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuard { @@ -50,7 +49,7 @@ contract ParaSwapWithdrawSwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuard uint256 minAmountToReceive, uint256 swapAllBalanceOffset, bytes calldata swapCalldata, - IParaSwapAugustus augustus, + address augustus, PermitSignature calldata permitParams ) external nonReentrant { IERC20WithPermit aToken = IERC20WithPermit( diff --git a/src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol b/src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol index 161bcd51..70c8f28b 100644 --- a/src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol +++ b/src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol @@ -19,7 +19,7 @@ interface IFeeClaimer { * the call will fail if withdrawer have zero balance in the contract * @param _token address of the ERC20 token * @param _recipient address - * @return true if the withdraw was successfull + * @return true if the withdraw was successful */ function withdrawAllERC20(IERC20 _token, address _recipient) external returns (bool); @@ -29,7 +29,7 @@ interface IFeeClaimer { * the call will fail if withdrawer have zero balance in the contract * @param _tokens list of addresses of the ERC20 token * @param _recipient address of recipient - * @return true if the withdraw was successfull + * @return true if the withdraw was successful */ function batchWithdrawAllERC20( address[] calldata _tokens, @@ -42,7 +42,7 @@ interface IFeeClaimer { * the call will fail if withdrawer have zero balance in the contract * @param _token address of the ERC20 token * @param _recipient address - * @return true if the withdraw was successfull + * @return true if the withdraw was successful */ function withdrawSomeERC20( IERC20 _token, @@ -57,7 +57,7 @@ interface IFeeClaimer { * @param _tokens address of the ERC20 tokens * @param _tokenAmounts array of amounts * @param _recipient destination account addresses - * @return true if the withdraw was successfull + * @return true if the withdraw was successful */ function batchWithdrawSomeERC20( IERC20[] calldata _tokens, diff --git a/src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol b/src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol deleted file mode 100644 index 3b5191ac..00000000 --- a/src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; - -interface IParaSwapAugustus { - function getTokenTransferProxy() external view returns (address); -} diff --git a/src/contracts/mocks/swap/MockParaSwapAugustus.sol b/src/contracts/mocks/swap/MockParaSwapAugustus.sol index 5970c3b7..ce5c0076 100644 --- a/src/contracts/mocks/swap/MockParaSwapAugustus.sol +++ b/src/contracts/mocks/swap/MockParaSwapAugustus.sol @@ -1,13 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.10; -import {IParaSwapAugustus} from '../../extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol'; -import {MockParaSwapTokenTransferProxy} from './MockParaSwapTokenTransferProxy.sol'; import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol'; import {MintableERC20} from '../tokens/MintableERC20.sol'; -contract MockParaSwapAugustus is IParaSwapAugustus { - MockParaSwapTokenTransferProxy immutable TOKEN_TRANSFER_PROXY; +contract MockParaSwapAugustus { bool _expectingSwap; address _expectedFromToken; address _expectedToToken; @@ -20,14 +17,6 @@ contract MockParaSwapAugustus is IParaSwapAugustus { uint256 _expectedToAmountMax; uint256 _expectedToAmountMin; - constructor() { - TOKEN_TRANSFER_PROXY = new MockParaSwapTokenTransferProxy(); - } - - function getTokenTransferProxy() external view override returns (address) { - return address(TOKEN_TRANSFER_PROXY); - } - function expectSwap( address fromToken, address toToken, @@ -72,7 +61,7 @@ contract MockParaSwapAugustus is IParaSwapAugustus { 'From amount out of range' ); require(_receivedAmount >= toAmount, 'Received amount of tokens are less than expected'); - TOKEN_TRANSFER_PROXY.transferFrom(fromToken, msg.sender, address(this), fromAmount); + _transferFrom(fromToken, msg.sender, address(this), fromAmount); MintableERC20(toToken).mint(_receivedAmount); IERC20(toToken).transfer(msg.sender, _receivedAmount); _expectingSwap = false; @@ -93,9 +82,13 @@ contract MockParaSwapAugustus is IParaSwapAugustus { 'To amount out of range' ); require(_fromAmount <= fromAmount, 'From amount of tokens are higher than expected'); - TOKEN_TRANSFER_PROXY.transferFrom(fromToken, msg.sender, address(this), _fromAmount); + _transferFrom(fromToken, msg.sender, address(this), _fromAmount); MintableERC20(toToken).mint(msg.sender, toAmount); _expectingSwap = false; return fromAmount; } + + function _transferFrom(address token, address from, address to, uint256 amount) internal { + IERC20(token).transferFrom(from, to, amount); + } } diff --git a/src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol b/src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol index 80f41d19..c45771d7 100644 --- a/src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol +++ b/src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol @@ -2,19 +2,12 @@ pragma solidity ^0.8.10; import {IFeeClaimer} from '../../extensions/paraswap-adapters/interfaces/IFeeClaimer.sol'; -import {MockParaSwapTokenTransferProxy} from './MockParaSwapTokenTransferProxy.sol'; import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol'; import {MintableERC20} from '../tokens/MintableERC20.sol'; contract MockParaSwapFeeClaimer is IFeeClaimer { - MockParaSwapTokenTransferProxy immutable TOKEN_TRANSFER_PROXY; - mapping(address => mapping(address => uint256)) internal _fees; - constructor() { - TOKEN_TRANSFER_PROXY = new MockParaSwapTokenTransferProxy(); - } - function registerFee(address _account, IERC20 _token, uint256 _fee) external { _fees[_account][address(_token)] += _fee; } diff --git a/src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol b/src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol deleted file mode 100644 index b36e6a44..00000000 --- a/src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; - -import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol'; -import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol'; - -contract MockParaSwapTokenTransferProxy is Ownable { - function transferFrom( - address token, - address from, - address to, - uint256 amount - ) external onlyOwner { - IERC20(token).transferFrom(from, to, amount); - } -} diff --git a/tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol b/tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol index 42674e83..097f6a1b 100644 --- a/tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol +++ b/tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import {ParaSwapLiquiditySwapAdapter, IParaSwapAugustus} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol'; +import {ParaSwapLiquiditySwapAdapter} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol'; import {ParaSwapRepayAdapter, IParaSwapAugustusRegistry} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol'; import {ParaSwapWithdrawSwapAdapter} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol'; import {AaveParaSwapFeeClaimer, IERC20} from '../../../src/contracts/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol'; @@ -325,7 +325,7 @@ contract ParaswapAdaptersTest is TestnetProcedures { expectedUsdxAmount, 0, augustusInput, - IParaSwapAugustus(address(mockParaSwapAugustus)), + address(mockParaSwapAugustus), emptyPermit ); } @@ -387,7 +387,7 @@ contract ParaswapAdaptersTest is TestnetProcedures { expectedUsdxAmount, 0, augustusInput, - IParaSwapAugustus(address(mockParaSwapAugustus)), + address(mockParaSwapAugustus), permitInput ); } @@ -429,7 +429,7 @@ contract ParaswapAdaptersTest is TestnetProcedures { expectedUsdxAmount, amountToSwap, augustusInput, - IParaSwapAugustus(address(mockParaSwapAugustus)), + address(mockParaSwapAugustus), emptyPermit ); } @@ -809,7 +809,7 @@ contract ParaswapAdaptersTest is TestnetProcedures { expectedUsdxAmount, 0, augustusInput, - IParaSwapAugustus(address(mockParaSwapAugustus)), + address(mockParaSwapAugustus), emptyPermit ); @@ -871,7 +871,7 @@ contract ParaswapAdaptersTest is TestnetProcedures { expectedUsdxAmount, 0, augustusInput, - IParaSwapAugustus(address(mockParaSwapAugustus)), + address(mockParaSwapAugustus), permitInput ); @@ -914,7 +914,7 @@ contract ParaswapAdaptersTest is TestnetProcedures { expectedUsdxAmount, amountToSwap, augustusInput, - IParaSwapAugustus(address(mockParaSwapAugustus)), + address(mockParaSwapAugustus), emptyPermit ); From 4156eb186b3d4e043cf9a46221a866c730a2a1d8 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Wed, 16 Oct 2024 13:00:55 +0200 Subject: [PATCH 3/4] fix: Fix lint --- certora/stata/harness/pool/SymbolicLendingPool.sol | 5 +---- tests/extensions/static-a-token/StataTokenV2Pausable.t.sol | 2 +- tests/extensions/static-a-token/StataTokenV2Permit.sol | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/certora/stata/harness/pool/SymbolicLendingPool.sol b/certora/stata/harness/pool/SymbolicLendingPool.sol index 1051ae1e..c64d5874 100644 --- a/certora/stata/harness/pool/SymbolicLendingPool.sol +++ b/certora/stata/harness/pool/SymbolicLendingPool.sol @@ -93,10 +93,7 @@ contract SymbolicLendingPool { return reserve.configuration; } - function getVirtualUnderlyingBalance( - address asset - ) external view virtual returns (uint128) { + function getVirtualUnderlyingBalance(address asset) external view virtual returns (uint128) { return reserve.virtualUnderlyingBalance; } - } diff --git a/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol b/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol index 894c1eff..daf4fcf5 100644 --- a/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol +++ b/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: BUSL-1.1 +g// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.10; import {PausableUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol'; diff --git a/tests/extensions/static-a-token/StataTokenV2Permit.sol b/tests/extensions/static-a-token/StataTokenV2Permit.sol index d24b1ab7..a7277698 100644 --- a/tests/extensions/static-a-token/StataTokenV2Permit.sol +++ b/tests/extensions/static-a-token/StataTokenV2Permit.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: BUSL-1.1 +t // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.10; import {ERC20PermitUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PermitUpgradeable.sol'; From 5de93919c994d9bdd209790d3dbf7aaa526646ce Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Wed, 16 Oct 2024 13:01:46 +0200 Subject: [PATCH 4/4] fix: Fix typo --- tests/extensions/static-a-token/StataTokenV2Pausable.t.sol | 2 +- tests/extensions/static-a-token/StataTokenV2Permit.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol b/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol index daf4fcf5..894c1eff 100644 --- a/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol +++ b/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol @@ -1,4 +1,4 @@ -g// SPDX-License-Identifier: BUSL-1.1 +// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.10; import {PausableUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol'; diff --git a/tests/extensions/static-a-token/StataTokenV2Permit.sol b/tests/extensions/static-a-token/StataTokenV2Permit.sol index a7277698..d24b1ab7 100644 --- a/tests/extensions/static-a-token/StataTokenV2Permit.sol +++ b/tests/extensions/static-a-token/StataTokenV2Permit.sol @@ -1,4 +1,4 @@ -t // SPDX-License-Identifier: BUSL-1.1 +// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.10; import {ERC20PermitUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PermitUpgradeable.sol';