Submitted by Soliditors, also found by Soliditors, windhustler (1, 2), gesha17, wangxx2026, NentoR, and peanuts
The StargateBridgeAdapter relies on a fixed fee calculation (0.06% of the current Stargate fee), but as explained in the Stargate documentation, fees can be automatically adjusted to meet demand. (here)
This reward can be adjusted (StargateFeeLibraryV02.sol#L68) to To incentivize users to conduct swaps that refill native asset balances.
A problem arises because the StargateBridgeAdapter doesnt account for this variable fee.
Then the callback function (triggered on the target chain) will receive a token amount greater than amountIn. StargateBridgeAdapter.sol#L207
As you can see, here the difference between the received amount StargateBridgeAdapter.sol#L188 and swapParams.amountIn gets lost in the adapter.
Its recommended approve the amountLD instead of the swapParams.amountIn . This way, all token received during the callback will be transfered.
