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

EstimateTradeBasedOnPriceImpact Query #6167

Merged
merged 112 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
361c74f
query: user<>clPool positions breakdown for superfluid (#5600) (#5607)
mergify[bot] Jun 22, 2023
fff520d
Remove unused state-sync github action (#5604) (#5605)
mergify[bot] Jun 23, 2023
201a3a7
fix: remove duplicate suite (#5610) (#5613)
mergify[bot] Jun 23, 2023
88eeb27
chore: remove tf bank hooks from v16.x (#5614)
p0mvn Jun 23, 2023
c8c008b
Improve build Github Actions (#5603) (#5618)
mergify[bot] Jun 23, 2023
da70057
[ci] Paralleze go tests github actions (#5602) (#5619)
mergify[bot] Jun 23, 2023
e852b32
Ci improvements/remove double caching (#5620) (#5622)
mergify[bot] Jun 23, 2023
cacee3b
Remove proto deserialization from HasPosition (#5616) (#5629)
mergify[bot] Jun 26, 2023
81785b7
Update swagger gen (#5626)
mattverse Jun 26, 2023
90a4480
Backport: Emited IBC errors should also be logged (#5480) (#5632)
mergify[bot] Jun 27, 2023
0ef1efc
fix: upgrade handler dai amount change (#5633) (#5640)
mergify[bot] Jun 27, 2023
f94f29f
repro infinite loop in swap logic (#5609) (#5649)
mergify[bot] Jun 27, 2023
69670a1
misc: final cleanup from audit results (#5641) (#5651)
mergify[bot] Jun 27, 2023
37e2e1e
Revert "Optimize Genesis for CL Module (#5453)" (#5631) (#5653)
mergify[bot] Jun 27, 2023
456a9ee
Reduce clmath test compilation time, fix discrepancy in rounding (#56…
mergify[bot] Jun 27, 2023
738c8f0
fix: modify v16 upgrade handler (#5659) (#5660)
mergify[bot] Jun 28, 2023
1c321b5
Update test script deps (#5658) (#5661)
mergify[bot] Jun 28, 2023
da0b96b
Fix testing errors in tick tests (#5662) (#5666)
mergify[bot] Jun 28, 2023
8951969
fix: cl sf positions per user per pool query (#5668) (#5669)
mergify[bot] Jun 29, 2023
511fc9b
upgrade handler ascii (#5671) (#5676)
mergify[bot] Jun 29, 2023
bc3a51e
sf positions cl patch (#5682) (#5683)
mergify[bot] Jun 29, 2023
a40ddc6
Introduce ResetTest, use in CL for 2x test speedup (#5611) (#5689)
mergify[bot] Jun 30, 2023
0b4a322
refactor/fix: swap step iteration limit (#5647) (#5688)
mergify[bot] Jun 30, 2023
8af0801
Driveby apptesting changes I made, while looking at other testing thi…
mergify[bot] Jun 30, 2023
0414d41
Add redirect tosnapshot endpoint, add our public nodes addrbook (#569…
mergify[bot] Jul 1, 2023
0b64208
chore: query total liquidity across all cl pools (#5670) (#5709)
mergify[bot] Jul 1, 2023
1b24525
chore: cl unbonding positions query (#5684) (#5711)
mergify[bot] Jul 2, 2023
e6a3ecf
precision increase solution to infinite loop bug (#5612) (#5712)
mergify[bot] Jul 2, 2023
aab9b79
Add lock reward receiver testing script, add minor fix for cli comman…
mergify[bot] Jul 2, 2023
9d43309
refactor/security: prevent same execution price exploit within the sa…
mergify[bot] Jul 2, 2023
2690f13
fix(CL): negative amount out consumed (#5695) (#5714)
mergify[bot] Jul 2, 2023
cd1f6fe
Speedup approx script (#5654) (#5720)
mergify[bot] Jul 2, 2023
8b199a7
chore: update sdk fork dep (backport #5716) (#5718)
mergify[bot] Jul 2, 2023
db2f738
[CL: Audit] Superfluid Migration audit / cleanup (#5615) (#5717)
mergify[bot] Jul 2, 2023
bcff0f6
CLI fix: `create-gauge` exact args (#5663) (#5719)
mergify[bot] Jul 2, 2023
1207669
fix: cw pool import export genesis (backport #5696) (#5715)
mergify[bot] Jul 2, 2023
21bb48f
chore: bump sdk with state breaking barberry fix (#5721) (#5722)
mergify[bot] Jul 3, 2023
7e3ee54
chore: update in-repo dep tags to be from release branch (#5729)
p0mvn Jul 3, 2023
e7bdbdd
fix: accept neg lock ID for migration (#5727) (#5730)
mergify[bot] Jul 3, 2023
78dd587
feat: e2e parallel (#5598) (#5739)
mergify[bot] Jul 3, 2023
bcaccbd
fix: e2e short (#5746) (#5748)
mergify[bot] Jul 3, 2023
1c8ae27
[CL][tests]: Add all remaining intended test vectors from original tr…
mergify[bot] Jul 5, 2023
cea1a48
[E2E] Add ParseEvent function (#5710) (#5744)
mergify[bot] Jul 5, 2023
410016d
fix: temp cl swap bug solution (#5754) (#5756)
mergify[bot] Jul 5, 2023
b0539b0
Add e2e initialization workflow (#5732) (#5758)
mergify[bot] Jul 5, 2023
9968df4
feat: lock existing position and sfs (#5745) (#5760)
mergify[bot] Jul 5, 2023
a16d969
Docs/Fix: Update Broken Links (#5728) (#5759)
mergify[bot] Jul 5, 2023
b4adcf9
test: parallel fuzz swap test suite (#5755) (#5757)
mergify[bot] Jul 5, 2023
9a16ee7
fix tx fees cli cmd (#5763) (#5765)
mergify[bot] Jul 5, 2023
fb9f0de
[fix] Fix no-lock gauge CLI (#5753) (#5766)
mergify[bot] Jul 5, 2023
cb27648
test(CL): add swaps in given out to fuzz suite and fix deterministic …
mergify[bot] Jul 5, 2023
63fcf59
Fix generate docs CI (#5642) (#5762)
mergify[bot] Jul 5, 2023
b5d0deb
tests(CL): improve fuzz suite with many random LPs and removing posit…
mergify[bot] Jul 6, 2023
d59a29d
chore(deps): bump actions/setup-go from 2 to 4 (#5770) (#5772)
mergify[bot] Jul 6, 2023
19e25c5
Add Business Source License from @NickPullman (#5773) (#5774)
mergify[bot] Jul 6, 2023
19b1f06
Remove Pools and LiquidityNetInDirection queries from wasmbinding lis…
mergify[bot] Jul 6, 2023
ae79814
fix: CL swap fuzz error (#5778) (#5780)
mergify[bot] Jul 6, 2023
26198bc
fix unbonding error check (#5779) (#5781)
mergify[bot] Jul 6, 2023
8e41b22
Add debug command for conversion to proto marshalled bytes (#5750) (#…
mergify[bot] Jul 6, 2023
d72fe81
reafactor(CL): tick spacing 100 upgrade handler (#5782) (#5783)
mergify[bot] Jul 6, 2023
4cdce70
chore: add v16 binary json (#5791) (#5792)
mergify[bot] Jul 8, 2023
b9525be
chore: v16 upgrade guide (#5793) (#5794)
mergify[bot] Jul 8, 2023
9bf1171
chore: add missing cli queries CL (backport #5796) (#5797)
mergify[bot] Jul 9, 2023
e4991d7
update pool uptime accum to now in query (#5799) (#5800)
mergify[bot] Jul 9, 2023
0f1c8fd
fix cl readme typo (#5816) (#5818)
mergify[bot] Jul 12, 2023
5835088
Update README.md (#5814) (#5817)
mergify[bot] Jul 12, 2023
8506b37
comments on deprecateds in WhitelistedQuery wasmbinding (#5751) (#5811)
mergify[bot] Jul 12, 2023
fcc3b5b
Revert "feat: lock existing position and sfs (#5745) (#5760)" (#5821)
czarcas7ic Jul 12, 2023
37728e8
chore: cosmovisor hashes and v16.1.0 tag updates (#5824) (#5826)
mergify[bot] Jul 13, 2023
b79fa16
chore: set correct binary name for v16 (#5828) (#5829)
mergify[bot] Jul 13, 2023
ca856c1
Fix the superfluid query (backport #5831) (#5832)
mergify[bot] Jul 13, 2023
8102ef4
Delete printlns that made it to prod (#5835) (#5836)
mergify[bot] Jul 14, 2023
1059bce
[Chore] Add amino name for tx msgs (backport #5784) (#5787)
mergify[bot] Jul 14, 2023
a44fff7
Make GetSuperfluidLockByLockId more cleary indicate if its found or n…
mergify[bot] Jul 15, 2023
0dcae33
chore: increase initial amounts for one localosmosis acc (#5798) (#5844)
mergify[bot] Jul 15, 2023
d230ede
Adding estimate query based on price impact
VitalyV1337 Jul 31, 2023
b7b5076
Fixing bugs in CalculateSpotPrice and EstimateTrade
VitalyV1337 Aug 10, 2023
f660a40
Fixing query and adding tests
VitalyV1337 Aug 11, 2023
6071b7c
Merge branch 'main' of https://github.com/entrypoint-labs/osmosis int…
VitalyV1337 Aug 11, 2023
a5118e6
Running proto-gen
VitalyV1337 Aug 11, 2023
af9584c
Fixing test issues
VitalyV1337 Aug 11, 2023
b85a1d6
Adding docs
VitalyV1337 Aug 15, 2023
31cd6cf
Merge branch 'main' of https://github.com/entrypoint-labs/osmosis int…
VitalyV1337 Aug 15, 2023
9b35be0
Generated protofile changes
invalid-email-address Aug 15, 2023
4028dfa
adding query.yml entry
VitalyV1337 Aug 18, 2023
9bbac73
Adding PR fixes and changing query
VitalyV1337 Aug 23, 2023
b303023
fixing null pointer bug
VitalyV1337 Aug 23, 2023
f014048
Removing comment
VitalyV1337 Aug 25, 2023
fa8f66b
PR fixes
VitalyV1337 Aug 25, 2023
84fd4ed
Merge branch 'main' of https://github.com/entrypoint-labs/osmosis int…
VitalyV1337 Aug 25, 2023
1c9f675
Reverting unwanted PR
VitalyV1337 Aug 25, 2023
bc453e2
Removing leading lines
VitalyV1337 Aug 25, 2023
8fced2a
Update docs
migueldingli1997 Aug 25, 2023
0aba283
Updating changelog
VitalyV1337 Aug 25, 2023
dc74cdd
Pr fixes, small refactoring and doc updates
VitalyV1337 Sep 4, 2023
50e5e39
Merge branch 'main' of https://github.com/entrypoint-zone/osmosis int…
VitalyV1337 Sep 4, 2023
ad8d772
Fixing proto file
VitalyV1337 Sep 4, 2023
b433443
Adding PR fixes, refactoring code from query to router.
VitalyV1337 Sep 19, 2023
4be6f68
Adding comment to abs
VitalyV1337 Sep 19, 2023
ea86d7e
Merge branch 'main' into estimate-trades-query
VitalyV1337 Sep 19, 2023
bbec82b
Generated protofile changes
invalid-email-address Sep 19, 2023
0bcbe6b
Merge branch 'main' into estimate-trades-query
VitalyV1337 Sep 20, 2023
1ccb6cf
Adding comment to abs
VitalyV1337 Sep 20, 2023
13859d5
Generated protofile changes
invalid-email-address Sep 20, 2023
d58f508
Running proto and lintin
VitalyV1337 Sep 22, 2023
1908f00
Merge remote-tracking branch 'origin/estimate-trades-query' into esti…
VitalyV1337 Sep 22, 2023
d28fcee
Merge branch 'main' into estimate-trades-query
VitalyV1337 Sep 22, 2023
5e01229
Running lint
VitalyV1337 Sep 22, 2023
d426271
Running goimports
VitalyV1337 Sep 22, 2023
61e902f
Merge branch 'main' into estimate-trades-query
VitalyV1337 Sep 25, 2023
332a39b
updating query proto wrap
VitalyV1337 Sep 25, 2023
01daf69
Merge branch 'main' into estimate-trades-query
VitalyV1337 Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Fixes mainnet bugs w/ incorrect accumulation sumtrees, and CL handling for a bal

### API breaks

* [#6167](https://github.com/osmosis-labs/osmosis/pull/6167) add EstimateTradeBasedOnPriceImpact query to x/poolmanager.
* [#6238](https://github.com/osmosis-labs/osmosis/pull/6238) switch osmomath to sdkmath types and rename BigDec constructors to contain "Big" in the name.
* Note: with the update, the Dec and Int do not get initialized to zero values
by default in proto marhaling/unmarshaling. Instead, they get set to nil values.
Expand Down
6 changes: 3 additions & 3 deletions client/docs/static/openapi/index.html

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions client/docs/static/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4198,6 +4198,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -4447,6 +4448,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -4700,6 +4702,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -4874,6 +4877,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -5313,6 +5317,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -5565,6 +5570,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -8052,6 +8058,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -8373,6 +8380,7 @@ paths:
- Query
"/osmosis/superfluid/v1beta1/account_delegated_cl_positions/{delegator_address}":
get:
summary: Returns all of a user's full range CL positions that are superfluid staked.
operationId: UserConcentratedSuperfluidPositionsDelegated
responses:
"200":
Expand Down Expand Up @@ -32673,6 +32681,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -32826,6 +32835,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -32974,6 +32984,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33099,6 +33110,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33227,6 +33239,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33430,6 +33443,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33583,6 +33597,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33705,6 +33720,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand All @@ -33719,6 +33735,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35036,6 +35053,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down
20 changes: 20 additions & 0 deletions client/docs/static/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4557,6 +4557,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -4833,6 +4834,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -5112,6 +5114,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that
Expand Down Expand Up @@ -5308,6 +5311,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -5766,6 +5770,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -6046,6 +6051,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -8638,6 +8644,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -8966,6 +8973,9 @@ paths:
- Query
/osmosis/superfluid/v1beta1/account_delegated_cl_positions/{delegator_address}:
get:
summary: >-
Returns all of a user's full range CL positions that are superfluid
staked.
operationId: UserConcentratedSuperfluidPositionsDelegated
responses:
'200':
Expand Down Expand Up @@ -35434,6 +35444,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35609,6 +35620,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35776,6 +35788,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35909,6 +35922,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36058,6 +36072,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36281,6 +36296,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36456,6 +36472,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36593,6 +36610,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand All @@ -36607,6 +36625,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -38079,6 +38098,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cmd/osmosisd/cmd/stargate-query.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ func GetStructAndFill(queryPath, module, structName string, structArguments ...s
v.BaseAssetDenom = structArguments[1]
v.QuoteAssetDenom = structArguments[2]
return v, nil
case "EstimateTradeBasedOnPriceImpactRequest":
return nil, fmt.Errorf("swap route parsing not supported yet")
Comment on lines +410 to +411
Copy link
Member

Choose a reason for hiding this comment

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

note: state breaking due to stargate query addition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I m not sure what this means, shall I remove this?

Copy link
Member

Choose a reason for hiding this comment

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

no, was a note to myself and other reviewers!

}
case "txfees":
switch structName {
Expand Down
58 changes: 57 additions & 1 deletion proto/osmosis/poolmanager/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ service Query {
option (google.api.http).get =
"/osmosis/poolmanager/v1beta1/pools/total_liquidity";
}

// EstimateTradeBasedOnPriceImpact returns an estimated trade based on price
// impact, if a trade cannot be estimated a 0 input and 0 output would be
// returned.
rpc EstimateTradeBasedOnPriceImpact(EstimateTradeBasedOnPriceImpactRequest)
returns (EstimateTradeBasedOnPriceImpactResponse) {
option (google.api.http).get =
"/osmosis/poolmanager/v1beta1/{pool_id}/estimate_trade";
}
}

//=============================== Params
Expand Down Expand Up @@ -250,4 +259,51 @@ message TotalLiquidityResponse {
(gogoproto.moretags) = "yaml:\"liquidity\"",
(gogoproto.nullable) = false
];
}
}

//=============================== EstimateTradeBasedOnPriceImpact

// EstimateTradeBasedOnPriceImpactRequest represents a request to estimate a
// trade for Balancer/StableSwap/Concentrated liquidity pool types based on the
// given parameters.
message EstimateTradeBasedOnPriceImpactRequest {
// from_coin is the total amount of tokens that the user wants to sell.
cosmos.base.v1beta1.Coin from_coin = 1 [ (gogoproto.nullable) = false ];

// to_coin_denom is the denom identifier of the token that the user wants to
// buy.
string to_coin_denom = 2;

// pool_id is the identifier of the liquidity pool that the trade will occur
// on.
uint64 pool_id = 3;

// max_price_impact is the maximum percentage that the user is willing
// to affect the price of the liquidity pool.
string max_price_impact = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// external_price is an optional external price that the user can enter.
// It adjusts the MaxPriceImpact as the SpotPrice of a pool can be changed at
// any time.
string external_price = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// EstimateTradeBasedOnPriceImpactResponse represents the response data
// for an estimated trade based on price impact. If a trade fails to be
// estimated the response would be 0,0 for input_coin and output_coin and will
// not error.
message EstimateTradeBasedOnPriceImpactResponse {
// input_coin is the actual input amount that would be tradeable
// under the specified price impact.
cosmos.base.v1beta1.Coin input_coin = 1 [ (gogoproto.nullable) = false ];

// output_coin is the amount of tokens of the ToCoinDenom type
// that will be received for the actual InputCoin trade.
cosmos.base.v1beta1.Coin output_coin = 2 [ (gogoproto.nullable) = false ];
}
6 changes: 6 additions & 0 deletions proto/osmosis/poolmanager/v1beta1/query.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ queries:
query_func: "k.TotalLiquidity"
cli:
cmd: "TotalLiquidity"
EstimateTradeBasedOnPriceImpact:
proto_wrapper:
query_func: "k.EstimateTradeBasedOnPriceImpact"
response: "*queryproto.EstimateTradeBasedOnPriceImpactResponse"
cli:
cmd: "EstimateTradeBasedOnPriceImpact"
Loading