Skip to content

Commit

Permalink
add improved supply queries (#809)
Browse files Browse the repository at this point in the history
* add improved supply queries

* lint

---------

Co-authored-by: Jacob Gadikian <[email protected]>
  • Loading branch information
Joe Bowman and faddat authored Dec 11, 2023
1 parent 5cdf155 commit d0f8f3e
Show file tree
Hide file tree
Showing 20 changed files with 1,183 additions and 125 deletions.
10 changes: 10 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import (
"github.com/quicksilver-zone/quicksilver/x/participationrewards"
participationrewardskeeper "github.com/quicksilver-zone/quicksilver/x/participationrewards/keeper"
participationrewardstypes "github.com/quicksilver-zone/quicksilver/x/participationrewards/types"
supplykeeper "github.com/quicksilver-zone/quicksilver/x/supply/keeper"
tokenfactorykeeper "github.com/quicksilver-zone/quicksilver/x/tokenfactory/keeper"
tokenfactorytypes "github.com/quicksilver-zone/quicksilver/x/tokenfactory/types"
)
Expand Down Expand Up @@ -118,6 +119,7 @@ type AppKeepers struct {
ParticipationRewardsKeeper *participationrewardskeeper.Keeper
AirdropKeeper *airdropkeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper
SupplyKeeper supplykeeper.Keeper

// IBC keepers
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
Expand Down Expand Up @@ -343,6 +345,14 @@ func (appKeepers *AppKeepers) InitKeepers(
scopedTransferKeeper,
)

appKeepers.SupplyKeeper = supplykeeper.NewKeeper(
appCodec,
appKeepers.keys[icacontrollertypes.StoreKey],
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.StakingKeeper,
utils.Keys[[]string](maccPerms),
)
appKeepers.PacketForwardKeeper.SetTransferKeeper(appKeepers.TransferKeeper)
appKeepers.TransferModule = transfer.NewAppModule(appKeepers.TransferKeeper)
appKeepers.PacketForwardModule = packetforward.NewAppModule(appKeepers.PacketForwardKeeper)
Expand Down
2 changes: 2 additions & 0 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
interchainstakingtypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types"
minttypes "github.com/quicksilver-zone/quicksilver/x/mint/types"
participationrewardstypes "github.com/quicksilver-zone/quicksilver/x/participationrewards/types"
supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types"
tokenfactorytypes "github.com/quicksilver-zone/quicksilver/x/tokenfactory/types"
)

Expand Down Expand Up @@ -66,6 +67,7 @@ func KVStoreKeys() []string {
airdroptypes.StoreKey,
wasm.StoreKey,
tokenfactorytypes.StoreKey,
supplytypes.StoreKey,
}
}

Expand Down
4 changes: 4 additions & 0 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import (
"github.com/quicksilver-zone/quicksilver/x/participationrewards"
participationrewardsclient "github.com/quicksilver-zone/quicksilver/x/participationrewards/client"
participationrewardstypes "github.com/quicksilver-zone/quicksilver/x/participationrewards/types"
supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types"
"github.com/quicksilver-zone/quicksilver/x/tokenfactory"
tokenfactorytypes "github.com/quicksilver-zone/quicksilver/x/tokenfactory/types"
)
Expand Down Expand Up @@ -262,6 +263,7 @@ func orderBeginBlockers() []string {
vestingtypes.ModuleName,
tokenfactorytypes.ModuleName,
wasm.ModuleName,
supplytypes.ModuleName,
}
}

Expand Down Expand Up @@ -305,6 +307,7 @@ func orderEndBlockers() []string {
airdroptypes.ModuleName,
tokenfactorytypes.ModuleName,
wasm.ModuleName,
supplytypes.ModuleName,
// currently no-op.
}
}
Expand Down Expand Up @@ -347,6 +350,7 @@ func orderInitBlockers() []string {
participationrewardstypes.ModuleName,
airdroptypes.ModuleName,
tokenfactorytypes.ModuleName,
supplytypes.ModuleName,
// wasmd
wasm.ModuleName,
// NOTE: crisis module must go at the end to check for invariants on each module
Expand Down
6 changes: 6 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/quicksilver-zone/quicksilver/app/upgrades"
supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types"
)

func (app *Quicksilver) setUpgradeHandlers() {
Expand Down Expand Up @@ -51,6 +52,11 @@ func (app *Quicksilver) setUpgradeStoreLoaders() {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{packetforwardtypes.ModuleName},
}

case upgrades.V010405rc0UpgradeName:
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{supplytypes.ModuleName},
}
default:
// no-op
}
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
V010404rc2UpgradeName = "v1.4.4-rc.2"
V010404rc3UpgradeName = "v1.4.4-rc.3"
V010404rc4UpgradeName = "v1.4.4-rc.4"
V010405rc0UpgradeName = "v1.4.5-rc0"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
20 changes: 16 additions & 4 deletions docs/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,10 @@ paths:
protobuf release, and it is not used for type URLs
beginning with
type.googleapis.com.
type.googleapis.com. As of May 2023, there are no widely
used type server
implementations and no plans to implement one.
Schemes other than `http`, `https` (or the empty scheme)
Expand Down Expand Up @@ -1692,6 +1695,10 @@ paths:
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Expand Down Expand Up @@ -1731,7 +1738,6 @@ paths:
name "y.z".
JSON
====
Expand Down Expand Up @@ -1958,7 +1964,10 @@ paths:
protobuf release, and it is not used for type URLs
beginning with
type.googleapis.com.
type.googleapis.com. As of May 2023, there are no widely
used type server
implementations and no plans to implement one.
Schemes other than `http`, `https` (or the empty scheme)
Expand Down Expand Up @@ -2003,6 +2012,10 @@ paths:
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Expand Down Expand Up @@ -2042,7 +2055,6 @@ paths:
name "y.z".
JSON
====
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
Expand Down
2 changes: 1 addition & 1 deletion proto/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM bufbuild/buf:latest as BUILDER
FROM 1.20.11-alpine
FROM golang:1.20.11-alpine

RUN apk add --no-cache \
nodejs \
Expand Down
20 changes: 20 additions & 0 deletions proto/quicksilver/supply/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";
package quicksilver.supply.v1;

import "google/api/annotations.proto";

option go_package = "github.com/ingenuity-build/quicksilver/x/supply/types";

// Query defines the gRPC querier service.
service Query {
// Supply provide running epochInfos
rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) {
option (google.api.http).get = "/quicksilver/supply/v1/supply";
}
}

message QuerySupplyRequest {}
message QuerySupplyResponse {
uint64 supply = 1;
uint64 circulating_supply = 2;
}
84 changes: 42 additions & 42 deletions x/airdrop/types/messages.pb.go

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

8 changes: 4 additions & 4 deletions x/interchainquery/types/messages.pb.go

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

Loading

0 comments on commit d0f8f3e

Please sign in to comment.