-
Notifications
You must be signed in to change notification settings - Fork 22
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: single-side liquidity provision #345
feat: single-side liquidity provision #345
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/v2_contracts #345 +/- ##
========================================================
+ Coverage 89.86% 90.08% +0.21%
========================================================
Files 261 261
Lines 27339 27784 +445
========================================================
+ Hits 24569 25029 +460
+ Misses 2770 2755 -15 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice small change
I like this implementation but on second view it looks like Osmosis does do a swap before provision rather than only providing to one side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Would be nice to make sure that we get the same amount of LP tokens when providing single sided liquidity VS swapping 50% of the assets in the pool and then providing liquidity in the correct ratio
@@ -98,19 +120,19 @@ pub fn provide_liquidity( | |||
|
|||
share | |||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there's no else case can we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an else case
contracts/liquidity_hub/pool-manager/src/tests/integration_tests.rs
Outdated
Show resolved
Hide resolved
contracts/liquidity_hub/pool-manager/src/tests/integration_tests.rs
Outdated
Show resolved
Hide resolved
Good point. Let's explore doing it this way. |
c87ebaa
to
5b550a5
Compare
Schema generation had missing jobs:
Please run |
Schema generation had missing jobs:
Please run |
cfaf507
to
a694b5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM nice job adding good coverage over it and finding the issue with fees ⭐
@@ -99,36 +103,60 @@ pub fn perform_swap( | |||
if offer_asset.denom == pools[0].denom { | |||
pair_info.assets[0].amount += offer_amount; | |||
pair_info.assets[1].amount -= swap_computation.return_amount; | |||
pair_info.assets[1].amount -= swap_computation.protocol_fee_amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great spot on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done, made a few general comments but it's looking good ser
ContractError::AssetMismatch {} | ||
); | ||
|
||
let receiver = receiver.unwrap_or_else(|| info.sender.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want to validate the address is correct here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
Description and Motivation
Enables single-side liquidity provision. Closes #310
Related Issues
Checklist:
Update index.md
)cargo fmt --all --
.cargo clippy -- -D warnings
.cargo schema
.