Skip to content

Commit

Permalink
fix: SuperfluidDelegationsByValidatorDenom does not return equivalent…
Browse files Browse the repository at this point in the history
… staked amount (backport #7857) (#7867)

* fix: SuperfluidDelegationsByValidatorDenom does not return equivalent staked amount (#7857)

* fix SuperfluidDelegationsByValidatorDenom query

* add changelog

(cherry picked from commit f3ff198)

# Conflicts:
#	CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Adam Tucker <[email protected]>
  • Loading branch information
mergify[bot] and czarcas7ic authored Mar 27, 2024
1 parent 54e31a8 commit a4446a8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#7689](https://github.com/osmosis-labs/osmosis/pull/7689) Make CL price estimations not cause state writes (speed and gas improvements)
* [#7745](https://github.com/osmosis-labs/osmosis/pull/7745) Add gauge id query to stargate whitelist
* [#7747](https://github.com/osmosis-labs/osmosis/pull/7747) Remove redundant call to incentive collection in CL position withdrawal logic
* [#7768](https://github.com/osmosis-labs/osmosis/pull/7768) Allow governance module account to transfer any CL position
* [#7746](https://github.com/osmosis-labs/osmosis/pull/7746) Make forfeited incentives redeposit into the pool instead of sending to community pool
* [#7785](https://github.com/osmosis-labs/osmosis/pull/7785) Remove reward claiming during position transfers
* [#7833](https://github.com/osmosis-labs/osmosis/pull/7883) Bump max gas wanted per tx to 6 mil
* [#7839](https://github.com/osmosis-labs/osmosis/pull/7839) Add ICA controller
* [#7527](https://github.com/osmosis-labs/osmosis/pull/7527) Add 30M gas limit to CW pool contract calls
* [#7857](https://github.com/osmosis-labs/osmosis/pull/7857) SuperfluidDelegationsByValidatorDenom query now returns equivalent staked amount

### SDK

* [#525](https://github.com/osmosis-labs/cosmos-sdk/pull/525) CacheKV speedups
* [#548](https://github.com/osmosis-labs/cosmos-sdk/pull/548) Implement v0.50 slashing bitmap logic
* [#543](https://github.com/osmosis-labs/cosmos-sdk/pull/543) Make slashing not write sign info every block
* [#513](https://github.com/osmosis-labs/cosmos-sdk/pull/513) Limit expired authz grant pruning to 200 per block
* [#514](https://github.com/osmosis-labs/cosmos-sdk/pull/514) Let gov hooks return an error
* [#580](https://github.com/osmosis-labs/cosmos-sdk/pull/580) Less time intensive slashing migration

## v23.0.8-iavl-v1 & v23.0.8

Expand Down
20 changes: 14 additions & 6 deletions x/superfluid/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,9 @@ func (q Querier) SuperfluidDelegationsByDelegator(goCtx context.Context, req *ty
if err != nil {
return nil, err
}

coin := sdk.NewCoin(appparams.BaseCoinUnit, equivalentAmount)

if err != nil {
return nil, err
}
res.SuperfluidDelegationRecords = append(res.SuperfluidDelegationRecords,
types.SuperfluidDelegationRecord{
DelegatorAddress: req.DelegatorAddress,
Expand Down Expand Up @@ -428,11 +426,21 @@ func (q Querier) SuperfluidDelegationsByValidatorDenom(goCtx context.Context, re

for _, lock := range periodLocks {
lockedCoins := sdk.NewCoin(req.Denom, lock.GetCoins().AmountOf(req.Denom))
baseDenom := lock.Coins.GetDenomByIndex(0)

equivalentAmount, err := q.Keeper.GetSuperfluidOSMOTokens(ctx, baseDenom, lockedCoins.Amount)
if err != nil {
return nil, err
}

coin := sdk.NewCoin(appparams.BaseCoinUnit, equivalentAmount)

res.SuperfluidDelegationRecords = append(res.SuperfluidDelegationRecords,
types.SuperfluidDelegationRecord{
DelegatorAddress: lock.GetOwner(),
ValidatorAddress: req.ValidatorAddress,
DelegationAmount: lockedCoins,
DelegatorAddress: lock.GetOwner(),
ValidatorAddress: req.ValidatorAddress,
DelegationAmount: lockedCoins,
EquivalentStakedAmount: &coin,
},
)
}
Expand Down

0 comments on commit a4446a8

Please sign in to comment.