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

Add Linked List Historical Oracle implementation #5

Open
6 tasks done
0xsuryansh opened this issue Feb 27, 2024 · 0 comments · May be fixed by #6
Open
6 tasks done

Add Linked List Historical Oracle implementation #5

0xsuryansh opened this issue Feb 27, 2024 · 0 comments · May be fixed by #6
Assignees

Comments

@0xsuryansh
Copy link
Member

0xsuryansh commented Feb 27, 2024

GitHub Issue Title:

Develop Liquidity Change Tracking Functionality with Linked List for Guardian Contract

Issue Description:

Background:

Our current implementation of the Guardian contract lacks an efficient way to track and manage liquidity changes over time for various tokens. We require a system that can dynamically track these changes, enforce withdrawal rate limits, and optimize gas usage during contract interactions.

Objective:

The goal is to develop a functionality within the Guardian contract that utilizes a linked list structure to track liquidity changes (LiqChangeNode) for each token. This system should efficiently manage historical data, enforce rate limits, and allow for dynamic updates as time progresses.

Key Requirements:

  1. Linked List Implementation: Develop a linked list structure where each node (LiqChangeNode) represents a liquidity change event (inflow or outflow) with an associated timestamp.

  2. Historical Liquidity Tracking: The system must maintain a historical record of liquidity changes for each token, allowing the contract to calculate current and future liquidity based on past events.

  3. Dynamic Time Window Management: Implement functionality to dynamically add new liquidity events to the tail of the list and remove outdated events from the head, based on the withdrawalPeriod for each token.

  4. Rate Limit Enforcement: Utilize the linked list to enforce withdrawal rate limits per token. The contract should be able to assess if a withdrawal request exceeds the set limits by examining the liquidity changes within the relevant time frame.

  5. Grace Period Handling: After a rate limit breach, the system should support a grace period where withdrawals can be temporarily allowed under certain conditions (e.g., admin override).

  6. Gas Optimization: Include mechanisms to clear irrelevant historical data from the linked list to optimize gas costs for future interactions with the contract.

  7. Documentation and Testing: Provide comprehensive documentation for the new functionality, including its design, usage, and limitations. Also, develop a suite of tests to cover various scenarios, including edge cases, to ensure reliability and security.

Acceptance Criteria:

  • Linked list structure for tracking liquidity changes is implemented and integrated with the Guardian contract.
  • Functionality for adding and removing liquidity change events from the linked list is fully operational and gas-efficient.
  • Withdrawal rate limits can be enforced based on the liquidity changes recorded in the linked list.
  • Grace period functionality is correctly handled post-rate limit breaches.
  • Gas optimization measures for managing historical data in the linked list are implemented.
  • Comprehensive documentation and a full suite of tests are provided.

Assignees:

@0xsuryansh 0xsuryansh linked a pull request Feb 28, 2024 that will close this issue
@0xsuryansh 0xsuryansh self-assigned this 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 a pull request may close this issue.

1 participant