Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquidity Management and Cancellation of Failed Withdrawals #44

Merged
merged 5 commits into from
Feb 28, 2024

Conversation

raviansalman
Copy link
Contributor

@raviansalman raviansalman commented Feb 21, 2024

Overview

This pull request introduces enhancements and features to the FundManager contract for liquidity management functionality by introducing a base contract LiquidityManagerRole. Moreover, it introduces the functionality of cancellation of failed withdrawals. The notable changes include:

MultiSwap Contract Changes:

  1. Base Contract: LiquidityManagerRole

    • Abstract contract providing a foundation for liquidity management roles.
    • Modifiers and functions added to set liquidity manager addresses and withdrawal address.
    • setLiquidityManagers: A setter function to set the addresses of the primary and secondary liquidity managers.
    • setLiquidityManagerWithdrawal: A setter function to set the withdrawal addresses for the liquidity manager and bot.
    • removeLiquidityByManager: A function called by onlyLiquidityManager for withdrawal of liquidity from the FundManager.
    • Introduces onlyLiquidityManager modifier for designated liquidity managers.
    • Introduced FillOrderRFQTo function in 1inchDecoder, 1inchSwap and FiberRouter contracts.
  2. Derived Contract: FundManager

    • FundManager now derived from LiquidityManagerRole.
    • Specific liquidity management functions moved to LiquidityManagerRole.
  3. New Modifiers:

    • onlySettlementManager: A modifier allowing only the designated settlementManager to execute certain functions. It checks if the sender is equal to the settlementManager address.
  4. New Setter Function:

    • setSettlementManager: A setter function to set the address of the settlement manager.
  5. New Cancel Withdrawal Functions (Settlement Engine Related):

    • cancelFailedWithdrawSigned: A function to cancel a signed token withdrawal initiated by the router. Only the settlementManager can execute this function. This helps in managing failed withdrawal transactions within the context of the settlement engine.
    • cancelFailedWithdrawSignedOneInch: A function to cancel a signed OneInch token withdrawal initiated by the router. Similar to the previous function, it's exclusive to the settlementManager and is designed to handle failed OneInch token withdrawals within the settlement engine.
  6. New Event:

    • FailedWithdrawalCancelled: A new event emitted when a withdrawal is canceled. It provides information about the canceled withdrawal, including the settlement manager, recipient, token, amount, and salt.
    • Event LiquidityRemovedByManager emitted when liquidity is removed by a manager.

Additional Changes:

  • Natspecs Corrections: Corrected and added NatSpec comments in the FiberRouter and FundManager contract for improved documentation and readability.
  • Configuration Script: Added a new script (configContracts.js) for calling the configuration-related functions of multiswap contracts. This script facilitates the configuration process and ensures smooth interaction with the contracts.

@taha-abbasi taha-abbasi self-requested a review February 22, 2024 14:53
Copy link
Member

@taha-abbasi taha-abbasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salmanferrum Let's simplify the flow by having only one withdrawal address configured. The withdrawal address is only to be configured by the owner.

Remove any logic that checks for the bot vs manager to route the withdrawal to the correct address, as this will not be needed.

We will assign the manager role to a multi-sig and the bot, so both can call the withdrawal function, and the funds will go to the single configured address.

Make sure that setLiquidityManagerWithdrawal is configurable only by owner and configurable to only one address.

@taha-abbasi
Copy link
Member

Approved by @naiemk

@taha-abbasi taha-abbasi merged commit 7462375 into ferrumnet:develop Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants