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

Feat: Classic Liquidity Pool #177

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Conversation

lucasmagnus
Copy link
Collaborator

Add ClassicLiquidityPoolHandler for Managing Classic Liquidity Pools on Stellar

Description

This PR introduces the ClassicLiquidityPoolHandler class, which provides an interface for managing liquidity pools on the Stellar network using the classic model. The new class allows creating handlers from existing liquidity pool IDs, adding trustlines, and performing deposit and withdrawal operations within the pool.

Key Features

  • Create handler from liquidity pool ID: The static function fromLiquidityPoolId allows initializing the handler by using an existing liquidity pool ID, querying associated assets, and configuring the handler automatically.

  • Add Trustline: The addTrustline method adds a trustline for the liquidity pool asset to a specific Stellar account.

  • Deposit to the Pool: The deposit method allows executing deposit operations for two assets into the pool, respecting specified minimum and maximum prices.

  • Withdraw from the Pool: The withdraw method enables performing liquidity withdrawal operations from the pool, specifying the minimum amount of each asset to receive in the transaction.

@lucasmagnus lucasmagnus added the classic Stellar classic-related changes label Oct 11, 2024
@lucasmagnus lucasmagnus requested a review from fazzatti October 11, 2024 02:45
@lucasmagnus lucasmagnus self-assigned this Oct 11, 2024
Copy link

Package Line Rate Branch Rate Health
src 100% 100%
src.stellar-plus 100% 100%
src.stellar-plus.account 100% 100%
src.stellar-plus.account.account-handler.default 100% 88%
src.stellar-plus.account.account-handler.freighter 100% 100%
src.stellar-plus.account.base 100% 100%
src.stellar-plus.asset 100% 100%
src.stellar-plus.asset.classic 82% 83%
src.stellar-plus.asset.soroban-token 91% 100%
src.stellar-plus.asset.stellar-asset-contract 100% 100%
src.stellar-plus.channel-accounts 94% 80%
src.stellar-plus.core 100% 100%
src.stellar-plus.core.contract-engine 99% 88%
src.stellar-plus.core.pipelines.build-transaction 100% 100%
src.stellar-plus.core.pipelines.classic-sign-requirements 100% 98%
src.stellar-plus.core.pipelines.classic-transaction 94% 67%
src.stellar-plus.core.pipelines.fee-bump 100% 100%
src.stellar-plus.core.pipelines.sign-transaction 100% 100%
src.stellar-plus.core.pipelines.simulate-transaction 96% 100%
src.stellar-plus.core.pipelines.soroban-auth 96% 83%
src.stellar-plus.core.pipelines.soroban-get-transaction 100% 93%
src.stellar-plus.core.pipelines.soroban-transaction 96% 74%
src.stellar-plus.core.pipelines.submit-transaction 100% 100%
src.stellar-plus.error 95% 95%
src.stellar-plus.error.helpers 85% 76%
src.stellar-plus.horizon 100% 100%
src.stellar-plus.markets 100% 100%
src.stellar-plus.markets.classic-liquidity-pool 72% 60%
src.stellar-plus.network 100% 100%
src.stellar-plus.rpc 100% 100%
src.stellar-plus.rpc.default-handler 100% 100%
src.stellar-plus.rpc.validation-cloud-handler 18% 22%
src.stellar-plus.soroban.contracts.certificate-of-deposit 33% 33%
src.stellar-plus.test.mocks 80% 75%
src.stellar-plus.test.stellar-test-ledger 100% 100%
src.stellar-plus.utils 100% 100%
src.stellar-plus.utils.pipeline 100% 100%
src.stellar-plus.utils.pipeline.conveyor-belts 97% 100%
src.stellar-plus.utils.pipeline.multi-belt-pipeline 100% 50%
src.stellar-plus.utils.pipeline.plugins 87% 100%
src.stellar-plus.utils.pipeline.plugins.classic-transaction 100% 100%
src.stellar-plus.utils.pipeline.plugins.classic-transaction.channel-accounts 100% 100%
src.stellar-plus.utils.pipeline.plugins.generic 100% 100%
src.stellar-plus.utils.pipeline.plugins.generic.debug 81% 50%
src.stellar-plus.utils.pipeline.plugins.generic.inject-preprocess-parameter 50% 0%
src.stellar-plus.utils.pipeline.plugins.simulate-transaction 100% 100%
src.stellar-plus.utils.pipeline.plugins.simulate-transaction.auto-restore 22% 0%
src.stellar-plus.utils.pipeline.plugins.simulate-transaction.extract-auth-entries-output 18% 0%
src.stellar-plus.utils.pipeline.plugins.simulate-transaction.extract-invocation-output 92% 0%
src.stellar-plus.utils.pipeline.plugins.simulate-transaction.extract-transaction-resources 100% 76%
src.stellar-plus.utils.pipeline.plugins.soroban-get-transaction 100% 100%
src.stellar-plus.utils.pipeline.plugins.soroban-get-transaction.extract-contract-id 100% 75%
src.stellar-plus.utils.pipeline.plugins.soroban-get-transaction.extract-fee-charged 100% 100%
src.stellar-plus.utils.pipeline.plugins.soroban-get-transaction.extract-invocation-output 100% 75%
src.stellar-plus.utils.pipeline.plugins.soroban-get-transaction.extract-wasm-hash 100% 75%
src.stellar-plus.utils.pipeline.plugins.soroban-transaction 100% 100%
src.stellar-plus.utils.pipeline.plugins.soroban-transaction.channel-accounts 87% 83%
src.stellar-plus.utils.pipeline.plugins.soroban-transaction.profiler 87% 56%
src.stellar-plus.utils.pipeline.plugins.submit-transaction 100% 100%
src.stellar-plus.utils.pipeline.plugins.submit-transaction.fee-bump 91% 25%
src.stellar-plus.utils.profiler.profiling-handler 96% 85%
src.stellar-plus.utils.regex 100% 100%
src.stellar-plus.utils.unit-conversion 100% 100%
src.tests.utils 82% 100%
Summary 88% (1715 / 1952) 80% (755 / 941)

@lucasmagnus lucasmagnus marked this pull request as ready for review October 11, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
classic Stellar classic-related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant