From 30fc818e44fa91c21424da04a38332e792e0feb5 Mon Sep 17 00:00:00 2001 From: Domen Grabec Date: Wed, 29 Nov 2023 17:48:06 +0100 Subject: [PATCH] safeApprove an asset so it won't revert in case of USDT --- .../strategies/balancer/BalancerMetaPoolStrategy.sol | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol b/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol index 3f8deaef29..247e6dabde 100644 --- a/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol +++ b/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol @@ -622,14 +622,17 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { */ function _approveAsset(address _asset) internal { IERC20 asset = IERC20(_asset); - /* Double approve is not required with the assets supported by the + /* Double safeApprove 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) + * ERC20 compliant tokens (e.g. USDT). + * + * SafeApprove (instead of only approve) is also required because USDT's + * approve doesn't return a value which causes the call to revert. */ // slither-disable-next-line unused-return - asset.approve(address(balancerVault), 0); + asset.safeApprove(address(balancerVault), 0); // slither-disable-next-line unused-return - asset.approve(address(balancerVault), type(uint256).max); + asset.safeApprove(address(balancerVault), type(uint256).max); } }