Skip to content

Commit

Permalink
BE-636 | Add remaining sort keys
Browse files Browse the repository at this point in the history
  • Loading branch information
deividaspetraitis committed Nov 13, 2024
1 parent 1d1c3b9 commit d0d766e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
38 changes: 36 additions & 2 deletions pools/usecase/pools_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,48 @@ func (p *poolsUseCase) GetPools(opts ...domain.PoolsOption) ([]sqsdomain.PoolI,
}
return a.GetId() > b.GetId()
})
case "liquidity_cap":

case "totalFiatValueLocked":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
if v.Direction == v1beta1.SortDirection_DESCENDING {
return a.GetLiquidityCap().LT(b.GetLiquidityCap())
}
return a.GetLiquidityCap().GT(b.GetLiquidityCap())
})
case "apr_data_total_apr_upper":

case "market.feesSpent7dUsd":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
if v.Direction == v1beta1.SortDirection_DESCENDING {
return a.GetFeesData().PoolFee.FeesSpent7d < b.GetFeesData().PoolFee.FeesSpent7d
}
return a.GetFeesData().PoolFee.FeesSpent7d > b.GetFeesData().PoolFee.FeesSpent7d
})

case "market.feesSpent24hUsd":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
if v.Direction == v1beta1.SortDirection_DESCENDING {
return a.GetFeesData().PoolFee.FeesSpent24h < b.GetFeesData().PoolFee.FeesSpent24h
}
return a.GetFeesData().PoolFee.FeesSpent24h > b.GetFeesData().PoolFee.FeesSpent24h
})

case "market.volume7dUsd":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
if v.Direction == v1beta1.SortDirection_DESCENDING {
return a.GetFeesData().PoolFee.Volume7d < b.GetFeesData().PoolFee.Volume7d
}
return a.GetFeesData().PoolFee.Volume7d > b.GetFeesData().PoolFee.Volume7d
})

case "market.volume24hUsd":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
if v.Direction == v1beta1.SortDirection_DESCENDING {
return a.GetFeesData().PoolFee.Volume24h < b.GetFeesData().PoolFee.Volume24h
}
return a.GetFeesData().PoolFee.Volume24h > b.GetFeesData().PoolFee.Volume24h
})

case "incentives.aprBreakdown.total.upper":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
if v.Direction == v1beta1.SortDirection_DESCENDING {
return a.GetAPRData().TotalAPR.Upper < b.GetAPRData().TotalAPR.Upper
Expand Down
2 changes: 1 addition & 1 deletion system/delivery/http/system_http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
echoSwagger "github.com/swaggo/echo-swagger"

"github.com/osmosis-labs/sqs/domain"
"github.com/osmosis-labs/sqs/client/docs"

Check failure on line 18 in system/delivery/http/system_http_handler.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/osmosis-labs/sqs/client/docs; to add it:
"github.com/osmosis-labs/sqs/domain"
"github.com/osmosis-labs/sqs/domain/mvc"
"github.com/osmosis-labs/sqs/log"
"github.com/osmosis-labs/sqs/sqsdomain/json"
Expand Down

0 comments on commit d0d766e

Please sign in to comment.