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: Allow cancel inactive limit orders #711

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jcompagni10
Copy link
Contributor

@jcompagni10 jcompagni10 commented Sep 5, 2024

Allow inactive limit orders to be canceled instead of withdrawn.
This new behavior has 2 benefits.

  1. Right now it takes at least 1 extra query to figure out if a tranche is inactive. If it's inactive you can currently only call withdraw. If we allow cancel you can always safely call cancel to completely remove your position.
  2. This is very nice for astroport. Their goal is to get the value of a position at any given time. If they can always call SimulateCancel they can reduce this down to a single query instead of 2.

related PRs
neutron-org/neutron-integration-tests#355

@jcompagni10
Copy link
Contributor Author

@joldie777
Copy link
Contributor

Please attach a succesfull testrun

Copy link
Contributor

@sotnikov-s sotnikov-s left a comment

Choose a reason for hiding this comment

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

the rest LGTM

@@ -59,20 +59,20 @@ func (k Keeper) ExecuteCancelLimitOrder(
) (makerCoinOut, takerCoinOut sdk.Coin, tradePairID *types.TradePairID, error error) {
trancheUser, found := k.GetLimitOrderTrancheUser(ctx, callerAddr.String(), trancheKey)
if !found {
return sdk.Coin{}, sdk.Coin{}, nil, types.ErrActiveLimitOrderNotFound
return sdk.Coin{}, sdk.Coin{}, nil, types.ErrValidLimitOrderTrancheNotFound
Copy link
Contributor

Choose a reason for hiding this comment

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

according to the error definition, it's a wrapped error supposed to be here, isn't it? Here and at the line 75. Just like below at the line 88

@jcompagni10
Copy link
Contributor Author

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.

4 participants