From 1c71d64db245cee61047ad51da2f0a8b5e28a06a Mon Sep 17 00:00:00 2001 From: Domen Grabec Date: Wed, 8 Nov 2023 00:47:54 +0100 Subject: [PATCH] safely approve assets where required --- .../strategies/balancer/BalancerMetaPoolStrategy.sol | 7 +++++++ .../contracts/strategies/balancer/BaseBalancerStrategy.sol | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol b/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol index 9d3fadba1a..68a60e032c 100644 --- a/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol +++ b/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol @@ -553,6 +553,13 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { */ function _approveAsset(address _asset) internal { IERC20 asset = IERC20(_asset); + /* Double approve is not required with the assets supported by the + * strategies today. This is defensive, future proof programming + * in case we ever utilize this asset for OUSD supporting non completely + * ERC20 compliant tokens (e.g. USDT) + */ + // slither-disable-next-line unused-return + asset.approve(address(balancerVault), 0); // slither-disable-next-line unused-return asset.approve(address(balancerVault), type(uint256).max); } diff --git a/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol b/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol index 97609a192d..82ac7efd80 100644 --- a/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol +++ b/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol @@ -516,8 +516,6 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy { // Balancer vault for BPT token (required for removing liquidity) // slither-disable-next-line unused-return - pToken.approve(address(balancerVault), 0); - // slither-disable-next-line unused-return pToken.approve(address(balancerVault), type(uint256).max); }