Skip to content

Commit 80415db

Browse files
committed
fix: properly handle WETH's deposit on fallback in PoolCompressor
1 parent f74f22a commit 80415db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

contracts/compressors/PoolCompressor.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {PoolQuotaKeeperState, QuotaTokenParams} from "../types/PoolQuotaKeeperSt
1616
import {RateKeeperState, Rate} from "../types/RateKeeperState.sol";
1717

1818
import {RAY} from "@gearbox-protocol/core-v3/contracts/libraries/Constants.sol";
19+
import {OptionalCall} from "@gearbox-protocol/core-v3/contracts/libraries/OptionalCall.sol";
1920
import {IRateKeeper} from "@gearbox-protocol/core-v3/contracts/interfaces/base/IRateKeeper.sol";
2021

2122
import {IPoolCompressor} from "../interfaces/IPoolCompressor.sol";
@@ -46,9 +47,12 @@ contract PoolCompressor is IPoolCompressor {
4647
// CONTRACT PARAMETERS
4748
//
4849
bytes32 defaultContractType = "POOL";
49-
try IUSDT(_pool.underlyingToken()).basisPointsRate() {
50-
defaultContractType = "POOL::USDT";
51-
} catch {}
50+
(bool success,) = OptionalCall.staticCallOptionalSafe({
51+
target: _pool.underlyingToken(),
52+
data: abi.encodeWithSelector(IUSDT.basisPointsRate.selector),
53+
gasAllowance: 10000
54+
});
55+
if (success) defaultContractType = "POOL::USDT";
5256
result.baseParams = BaseLib.getBaseParams(pool, defaultContractType, address(0));
5357

5458
//

0 commit comments

Comments
 (0)