@@ -9,6 +9,7 @@ import { ISmardexPair } from "@smardex-dex-contracts/contracts/ethereum/core/v2/
9
9
import { ISmardexSwapCallback } from
10
10
"@smardex-dex-contracts/contracts/ethereum/core/v2/interfaces/ISmardexSwapCallback.sol " ;
11
11
import { SmardexLibrary } from "@smardex-dex-contracts/contracts/ethereum/core/v2/libraries/SmardexLibrary.sol " ;
12
+ import { FixedPointMathLib } from "solady/src/utils/FixedPointMathLib.sol " ;
12
13
13
14
import { IFeeCollectorCallback } from "./../interfaces/UsdnProtocol/IFeeCollectorCallback.sol " ;
14
15
import { IAutoSwapperWusdnSdex } from "./../interfaces/Utils/IAutoSwapperWusdnSdex.sol " ;
@@ -36,10 +37,10 @@ contract AutoSwapperWusdnSdex is
36
37
ISmardexPair internal constant SMARDEX_WUSDN_SDEX_PAIR = ISmardexPair (0x11443f5B134c37903705e64129BEFc20e35a3725 );
37
38
38
39
/// @notice Fee rates for LP on the SmarDex pair.
39
- uint128 immutable FEE_LP;
40
+ uint128 internal immutable FEE_LP;
40
41
41
42
/// @notice Fee rates for the pool on the SmarDex pair.
42
- uint128 immutable FEE_POOL;
43
+ uint128 internal immutable FEE_POOL;
43
44
44
45
/// @notice Allowed slippage for swaps (in basis points).
45
46
uint256 internal _swapSlippage = 100 ; // 1%
@@ -61,7 +62,7 @@ contract AutoSwapperWusdnSdex is
61
62
uint256 wusdnAmount = WUSDN.balanceOf (address (this ));
62
63
63
64
uint256 quoteAmountSdexOut = _quoteAmountOut (wusdnAmount);
64
- uint256 minSdexAmount = quoteAmountSdexOut * ( BPS_DIVISOR - _swapSlippage) / BPS_DIVISOR;
65
+ uint256 minSdexAmount = FixedPointMathLib. mulDiv ( quoteAmountSdexOut, BPS_DIVISOR - _swapSlippage, BPS_DIVISOR) ;
65
66
(int256 amountSdexOut ,) = SMARDEX_WUSDN_SDEX_PAIR.swap (address (0xdead ), false , int256 (wusdnAmount), "" );
66
67
67
68
if (uint256 (- amountSdexOut) < minSdexAmount) {
@@ -83,6 +84,11 @@ contract AutoSwapperWusdnSdex is
83
84
IERC20 (token).safeTransfer (to, amount);
84
85
}
85
86
87
+ /// @inheritdoc IAutoSwapperWusdnSdex
88
+ function getSwapSlippage () external view returns (uint256 ) {
89
+ return _swapSlippage;
90
+ }
91
+
86
92
/// @inheritdoc IAutoSwapperWusdnSdex
87
93
function updateSwapSlippage (uint256 newSwapSlippage ) external onlyOwner {
88
94
if (newSwapSlippage == 0 ) {
0 commit comments