feat(liquidity): add incremental top_up_pair_liquidity - #323
Open
mxrtins04 wants to merge 1 commit into
Open
Conversation
Contributor
|
@mxrtins04 solid and well-scoped, merging now 🚢 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
top_up_pair_liquidity(caller, source, destination, delta)as an additive counterpart toset_pair_liquidity.compute_route_feedebits PairLiquidity viasaturating_sub, but the only existing restore path (set_pair_liquidity) overwrites the value absolutely, so a stale oracle read can erase concurrent debits. This entrypoint increments instead of overwriting.Changes
src/lib.rs: newtop_up_pair_liquidity(env: Env, caller: Address, source: Symbol, destination: Symbol, delta: i128)entrypoint, dual admin-or-oracle auth,AmountMustBePositiveon non-positive delta,saturating_addaccumulation, i128::MAX sentinel preserved, inline testsREADME.md: added entrypoint to error lists, registration-first invariant lists, paused sweep tables, liquidity consumption section, event referencedocs/abi.md: documented signature, params, auth rules, errors, event emissionsdocs/roles.md: documented dual-auth policy and oracle responsibilityTesting
cargo fmt --all -- --check,cargo build,cargo testall passSecurity / rollback notes
set_pair_liquidityorcompute_route_feebehavior; purely additiverequire_pair_registered), consistent with other liquidity operationsCloses #201