FillOrderTo 1inch Swap and Allowance Fix in FiberRouter #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces enhancements and new features to the
FiberRouter
smart contract, along with updates to its dependencies (OneInchSwap
andOneInchDecoder
contracts). The primary focus is on facilitating and optimizing the execution of thefillOrderTo
operation involving the 1inch aggregator to accommodate new token swaps. Moreover, to resolve the allowance issue, the allowance check condition is added.Changes Introduced
1.
handleFillOrderTo
Function (InFiberRouter
)handleFillOrderTo
has been introduced to streamline the execution of thefillOrderTo
operation.2. Updates in Dependencies
OneInchSwap Contract:
fillOrderTo
function in theOneInchSwap
contract has been updated to align with the changes inFiberRouter
.OneInchDecoder Contract:
decodeFillOrderTo
function has been introduced to decode data related to thefillOrderTo
operation.3. Resolved SafeERC20 Allowance Issue:**
To address the "
execution reverted: SafeERC20: approve from non-zero to non-zero allowance
" error encountered during swaps, the following condition has been added in both thewithdrawSignedAndSwapOneInch
and_swapAndCrossOneInch
functions of FiberRouter.This modification ensures that the allowance is appropriately managed, avoiding the mentioned error during token swaps on the 1inch aggregator. The contract now resets the allowance to zero before setting it to the intended swap amount, ensuring a seamless and error-free execution of swaps.
4. Testing Scripts Added
Additional Notes
This pull request brings significant improvements to the FiberRouter contract, enhancing its capabilities in handling 1inch aggregator swaps and providing a more reliable and efficient trading experience for users. The combination of new features, dependency updates, and issue resolution contributes to the overall robustness and functionality of MultiSwap.