Skip to content

Commit

Permalink
feat: leverageLp amm info (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptokage1996 authored Jun 27, 2024
1 parent 31064f5 commit 5fda96c
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 48 deletions.
1 change: 1 addition & 0 deletions proto/elys/amm/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ message EarnPool {
string swap_fee = 13 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
string fee_denom = 14;
bool use_oracle = 15;
bool is_leveragelp = 16;
}

message QueryEarnPoolResponse {
Expand Down
3 changes: 3 additions & 0 deletions x/amm/client/wasm/query_earn_mining_pool_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (oq *Querier) generateEarnPool(ctx sdk.Context, ammPool *types.Pool, filter
borrowApr := sdk.ZeroDec()
leverageLpPercent := sdk.ZeroDec()
perpetualPercent := sdk.ZeroDec()
isLeverageLpEnabled := false

poolInfo, found := oq.masterchefKeeper.GetPool(ctx, ammPool.PoolId)
if found {
Expand All @@ -82,6 +83,7 @@ func (oq *Querier) generateEarnPool(ctx sdk.Context, ammPool *types.Pool, filter

leverageLpPool, found := oq.leveragelpKeeper.GetPool(ctx, ammPool.PoolId)
if found {
isLeverageLpEnabled = true
leverageLpPercent = leverageLpPool.LeveragedLpAmount.ToLegacyDec().Quo(ammPool.TotalShares.Amount.ToLegacyDec()).Mul(sdk.NewDec(100))
}

Expand All @@ -106,6 +108,7 @@ func (oq *Querier) generateEarnPool(ctx sdk.Context, ammPool *types.Pool, filter
SwapFee: ammPool.PoolParams.SwapFee,
FeeDenom: ammPool.PoolParams.FeeDenom,
UseOracle: ammPool.PoolParams.UseOracle,
IsLeveragelp: isLeverageLpEnabled,
}
}

Expand Down
140 changes: 92 additions & 48 deletions x/amm/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5fda96c

Please sign in to comment.