diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c21438842..68199fb2eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,6 @@ jobs: - name: Compile stride run: make build - - uses: actions/upload-artifact@v4 with: name: strided ${{ matrix.targetos }} ${{ matrix.arch }} diff --git a/.gitmodules b/.gitmodules index e427bd1d66..c257531d76 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,7 +13,7 @@ path = deps/juno url = https://github.com/CosmosContracts/juno.git [submodule "deps/osmosis"] - # Commit: v20.5.0-no-fees + # Commit: v27.0.0-no-fees path = deps/osmosis url = https://github.com/Stride-Labs/osmosis.git [submodule "deps/stargaze"] diff --git a/app/app.go b/app/app.go index 7c11c8aab5..da24b2d843 100644 --- a/app/app.go +++ b/app/app.go @@ -129,6 +129,9 @@ import ( airdrop "github.com/Stride-Labs/stride/v25/x/airdrop" airdropkeeper "github.com/Stride-Labs/stride/v25/x/airdrop/keeper" airdroptypes "github.com/Stride-Labs/stride/v25/x/airdrop/types" + auction "github.com/Stride-Labs/stride/v25/x/auction" + auctionkeeper "github.com/Stride-Labs/stride/v25/x/auction/keeper" + auctiontypes "github.com/Stride-Labs/stride/v25/x/auction/types" "github.com/Stride-Labs/stride/v25/x/autopilot" autopilotkeeper "github.com/Stride-Labs/stride/v25/x/autopilot/keeper" autopilottypes "github.com/Stride-Labs/stride/v25/x/autopilot/types" @@ -146,6 +149,9 @@ import ( icaoracle "github.com/Stride-Labs/stride/v25/x/icaoracle" icaoraclekeeper "github.com/Stride-Labs/stride/v25/x/icaoracle/keeper" icaoracletypes "github.com/Stride-Labs/stride/v25/x/icaoracle/types" + icqoracle "github.com/Stride-Labs/stride/v25/x/icqoracle" + icqoraclekeeper "github.com/Stride-Labs/stride/v25/x/icqoracle/keeper" + icqoracletypes "github.com/Stride-Labs/stride/v25/x/icqoracle/types" "github.com/Stride-Labs/stride/v25/x/interchainquery" interchainquerykeeper "github.com/Stride-Labs/stride/v25/x/interchainquery/keeper" interchainquerytypes "github.com/Stride-Labs/stride/v25/x/interchainquery/types" @@ -165,6 +171,9 @@ import ( staketia "github.com/Stride-Labs/stride/v25/x/staketia" staketiakeeper "github.com/Stride-Labs/stride/v25/x/staketia/keeper" staketiatypes "github.com/Stride-Labs/stride/v25/x/staketia/types" + strdburner "github.com/Stride-Labs/stride/v25/x/strdburner" + strdburnerkeeper "github.com/Stride-Labs/stride/v25/x/strdburner/keeper" + strdburnertypes "github.com/Stride-Labs/stride/v25/x/strdburner/types" ) const ( @@ -236,6 +245,9 @@ var ( ibchooks.AppModuleBasic{}, ibcwasm.AppModuleBasic{}, airdrop.AppModuleBasic{}, + icqoracle.AppModuleBasic{}, + auction.AppModuleBasic{}, + strdburner.AppModuleBasic{}, ) // module account permissions @@ -260,6 +272,10 @@ var ( stakedymtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, stakedymtypes.FeeAddress: nil, wasmtypes.ModuleName: {authtypes.Burner}, + icqoracletypes.ModuleName: nil, + auctiontypes.ModuleName: nil, + // strdburner module needs burn access to burn STRD tokens that are sent to it + strdburnertypes.ModuleName: {authtypes.Burner}, } ) @@ -348,6 +364,9 @@ type StrideApp struct { StaketiaKeeper staketiakeeper.Keeper StakedymKeeper stakedymkeeper.Keeper AirdropKeeper airdropkeeper.Keeper + ICQOracleKeeper icqoraclekeeper.Keeper + AuctionKeeper auctionkeeper.Keeper + StrdBurnerKeeper strdburnerkeeper.Keeper mm *module.Manager sm *module.SimulationManager @@ -404,6 +423,9 @@ func NewStrideApp( ibchookstypes.StoreKey, ibcwasmtypes.StoreKey, airdroptypes.StoreKey, + icqoracletypes.StoreKey, + auctiontypes.StoreKey, + strdburnertypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -759,6 +781,31 @@ func NewStrideApp( app.AccountKeeper, app.BankKeeper, app.DistrKeeper, app.StakingKeeper, ) + app.ICQOracleKeeper = *icqoraclekeeper.NewKeeper( + appCodec, + keys[icqoracletypes.StoreKey], + &app.InterchainqueryKeeper, + app.TransferKeeper, + ) + icqOracleModule := icqoracle.NewAppModule(appCodec, app.ICQOracleKeeper) + + app.AuctionKeeper = *auctionkeeper.NewKeeper( + appCodec, + keys[auctiontypes.StoreKey], + app.AccountKeeper, + app.BankKeeper, + app.ICQOracleKeeper, + ) + auctionModule := auction.NewAppModule(appCodec, app.AuctionKeeper) + + app.StrdBurnerKeeper = *strdburnerkeeper.NewKeeper( + appCodec, + keys[strdburnertypes.StoreKey], + app.AccountKeeper, + app.BankKeeper, + ) + strdburnerModule := strdburner.NewAppModule(appCodec, app.StrdBurnerKeeper) + // Register Gov (must be registered after stakeibc) govRouter := govtypesv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler). @@ -780,6 +827,10 @@ func NewStrideApp( if err != nil { return nil } + err = app.InterchainqueryKeeper.SetCallbackHandler(icqoracletypes.ModuleName, app.ICQOracleKeeper.ICQCallbackHandler()) + if err != nil { + return nil + } app.EpochsKeeper = *epochsKeeper.SetHooks( epochsmoduletypes.NewMultiEpochHooks( @@ -935,6 +986,10 @@ func NewStrideApp( stakeTiaModule, stakeDymModule, airdropModule, + stakeTiaModule, + icqOracleModule, + auctionModule, + strdburnerModule, ) // During begin block slashing happens after distr.BeginBlocker so that @@ -980,6 +1035,9 @@ func NewStrideApp( ibchookstypes.ModuleName, ibcwasmtypes.ModuleName, airdroptypes.ModuleName, + icqoracletypes.ModuleName, + auctiontypes.ModuleName, + strdburnertypes.ModuleName, ) app.mm.SetOrderEndBlockers( @@ -1021,6 +1079,9 @@ func NewStrideApp( ibchookstypes.ModuleName, ibcwasmtypes.ModuleName, airdroptypes.ModuleName, + icqoracletypes.ModuleName, + auctiontypes.ModuleName, + strdburnertypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -1067,6 +1128,9 @@ func NewStrideApp( ibchookstypes.ModuleName, ibcwasmtypes.ModuleName, airdroptypes.ModuleName, + icqoracletypes.ModuleName, + auctiontypes.ModuleName, + strdburnertypes.ModuleName, ) app.mm.RegisterInvariants(app.CrisisKeeper) diff --git a/app/upgrades.go b/app/upgrades.go index fb56f58bb1..fbc1664c8c 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -35,6 +35,7 @@ import ( v23 "github.com/Stride-Labs/stride/v25/app/upgrades/v23" v24 "github.com/Stride-Labs/stride/v25/app/upgrades/v24" v25 "github.com/Stride-Labs/stride/v25/app/upgrades/v25" + v26 "github.com/Stride-Labs/stride/v25/app/upgrades/v26" v3 "github.com/Stride-Labs/stride/v25/app/upgrades/v3" v4 "github.com/Stride-Labs/stride/v25/app/upgrades/v4" v5 "github.com/Stride-Labs/stride/v25/app/upgrades/v5" @@ -43,14 +44,17 @@ import ( v8 "github.com/Stride-Labs/stride/v25/app/upgrades/v8" v9 "github.com/Stride-Labs/stride/v25/app/upgrades/v9" airdroptypes "github.com/Stride-Labs/stride/v25/x/airdrop/types" + auctiontypes "github.com/Stride-Labs/stride/v25/x/auction/types" autopilottypes "github.com/Stride-Labs/stride/v25/x/autopilot/types" claimtypes "github.com/Stride-Labs/stride/v25/x/claim/types" icacallbacktypes "github.com/Stride-Labs/stride/v25/x/icacallbacks/types" icaoracletypes "github.com/Stride-Labs/stride/v25/x/icaoracle/types" + icqoracletypes "github.com/Stride-Labs/stride/v25/x/icqoracle/types" recordtypes "github.com/Stride-Labs/stride/v25/x/records/types" stakedymtypes "github.com/Stride-Labs/stride/v25/x/stakedym/types" stakeibctypes "github.com/Stride-Labs/stride/v25/x/stakeibc/types" staketiatypes "github.com/Stride-Labs/stride/v25/x/staketia/types" + strdburnertypes "github.com/Stride-Labs/stride/v25/x/strdburner/types" ) func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) { @@ -338,6 +342,16 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) { ), ) + // v26 upgrade handler + app.UpgradeKeeper.SetUpgradeHandler( + v26.UpgradeName, + v26.CreateUpgradeHandler( + app.mm, + app.configurator, + app.ICQOracleKeeper, + ), + ) + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() if err != nil { panic(fmt.Errorf("Failed to read upgrade info from disk: %w", err)) @@ -399,6 +413,10 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) { storeUpgrades = &storetypes.StoreUpgrades{ Added: []string{ibcwasmtypes.ModuleName, airdroptypes.ModuleName}, } + case "v26": + storeUpgrades = &storetypes.StoreUpgrades{ + Added: []string{icqoracletypes.ModuleName, strdburnertypes.ModuleName, auctiontypes.ModuleName}, + } } if storeUpgrades != nil { diff --git a/app/upgrades/v26/upgrades.go b/app/upgrades/v26/upgrades.go new file mode 100644 index 0000000000..e15df41573 --- /dev/null +++ b/app/upgrades/v26/upgrades.go @@ -0,0 +1,41 @@ +package v26 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + icqoraclekeeper "github.com/Stride-Labs/stride/v25/x/icqoracle/keeper" + icqoracletypes "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +var ( + UpgradeName = "v26" + + OsmosisChainId = "osmosis-1" + OsmosisConnectionId = "connection-2" + + ICQOracleUpdateIntervalSec = uint64(5 * 60) // 5 min + ICQOraclePriceExpirationTimeoutSec = uint64(15 * 60) // 15 min +) + +// CreateUpgradeHandler creates an SDK upgrade handler for v23 +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + icqoracleKeeper icqoraclekeeper.Keeper, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("Starting upgrade v26...") + + icqoracleKeeper.SetParams(ctx, icqoracletypes.Params{ + OsmosisChainId: OsmosisChainId, + OsmosisConnectionId: OsmosisConnectionId, + UpdateIntervalSec: ICQOracleUpdateIntervalSec, + PriceExpirationTimeoutSec: ICQOraclePriceExpirationTimeoutSec, + }) + + ctx.Logger().Info("Running module migrations...") + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/app/upgrades/v26/upgrades_test.go b/app/upgrades/v26/upgrades_test.go new file mode 100644 index 0000000000..4258e8198b --- /dev/null +++ b/app/upgrades/v26/upgrades_test.go @@ -0,0 +1,34 @@ +package v26_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/Stride-Labs/stride/v25/app/apptesting" + v26 "github.com/Stride-Labs/stride/v25/app/upgrades/v26" +) + +type UpgradeTestSuite struct { + apptesting.AppTestHelper +} + +func (s *UpgradeTestSuite) SetupTest() { + s.Setup() +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} + +func (s *UpgradeTestSuite) TestUpgrade() { + upgradeHeight := int64(4) + + s.ConfirmUpgradeSucceededs(v26.UpgradeName, upgradeHeight) + + params := s.App.ICQOracleKeeper.GetParams(s.Ctx) + s.Require().Equal(v26.OsmosisChainId, params.OsmosisChainId, "Osmosis chain ID") + s.Require().Equal(v26.OsmosisConnectionId, params.OsmosisConnectionId, "Osmosis connection ID") + s.Require().Equal(v26.ICQOracleUpdateIntervalSec, params.UpdateIntervalSec, "Update interval") + s.Require().Equal(v26.ICQOraclePriceExpirationTimeoutSec, params.PriceExpirationTimeoutSec, "Timeout") +} diff --git a/dockernet/config.sh b/dockernet/config.sh index c5b09eff47..0f6ed5ece6 100755 --- a/dockernet/config.sh +++ b/dockernet/config.sh @@ -512,7 +512,7 @@ GET_VAL_ADDR() { val_index=$2 MAIN_CMD=$(GET_VAR_VALUE ${chain}_MAIN_CMD) - $MAIN_CMD q staking validators | grep ${chain}_${val_index} -A 6 | grep operator | awk '{print $2}' + $MAIN_CMD q staking validators 2>&1 | grep ${chain}_${val_index} -A 6 | grep operator | awk '{print $2}' } GET_ICA_ADDR() { diff --git a/dockernet/dockerfiles/Dockerfile.osmo b/dockernet/dockerfiles/Dockerfile.osmo index e8e0278b3b..caf8d5c980 100644 --- a/dockernet/dockerfiles/Dockerfile.osmo +++ b/dockernet/dockerfiles/Dockerfile.osmo @@ -1,10 +1,10 @@ -FROM golang:1.20-alpine3.16 AS builder +FROM golang:1.23-alpine3.21 AS builder WORKDIR /opt/ RUN set -eux; apk add --no-cache ca-certificates build-base; apk add git linux-headers -ENV COMMIT_HASH=v20.5.0-no-fees +ENV COMMIT_HASH=v27.0.0-no-fees RUN git clone https://github.com/Stride-Labs/osmosis.git \ && cd osmosis \ @@ -13,16 +13,16 @@ RUN git clone https://github.com/Stride-Labs/osmosis.git \ WORKDIR /opt/osmosis # Cosmwasm - download correct libwasmvm version and verify checksum -# Note: checksum not available for v1.2.3, otherwise command should be -# wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt -# && sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1) -RUN WASMVM_VERSION=v1.2.3 \ - && wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \ - -O /lib/libwasmvm_muslc.a +RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //') && \ + wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.a \ + -O /lib/libwasmvm_muslc.$ARCH.a && \ + # verify checksum + wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ + sha256sum /lib/libwasmvm_muslc.$ARCH.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1) RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build -FROM alpine:3.16 +FROM alpine:3.21 COPY --from=builder /opt/osmosis/build/osmosisd /usr/local/bin/ RUN apk add bash vim \ && addgroup -g 1000 osmosis \ diff --git a/dockernet/ts-tests/.npmrc b/dockernet/ts-tests/.npmrc deleted file mode 100644 index 0a60c47597..0000000000 --- a/dockernet/ts-tests/.npmrc +++ /dev/null @@ -1 +0,0 @@ -save-prefix='' \ No newline at end of file diff --git a/dockernet/ts-tests/.prettierrc.json b/dockernet/ts-tests/.prettierrc.json deleted file mode 100644 index e6d10890cb..0000000000 --- a/dockernet/ts-tests/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "trailingComma": "all", - "tabWidth": 2, - "useTabs": false, - "semi": true, - "singleQuote": false, - "printWidth": 80 -} diff --git a/dockernet/ts-tests/package.json b/dockernet/ts-tests/package.json deleted file mode 100644 index 0a96351a1d..0000000000 --- a/dockernet/ts-tests/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "stride-integration-tests", - "version": "1.0.0", - "description": "integration tests for stride chain", - "scripts": { - "test": "vitest run", - "test-watch": "vitest watch" - }, - "keywords": [ - "wow", - "much", - "liquidity" - ], - "author": "Stride Labs", - "license": "ISC", - "dependencies": { - "@cosmjs/amino": "0.32.4", - "@cosmjs/encoding": "0.32.4", - "@cosmjs/math": "0.32.4", - "@cosmjs/proto-signing": "0.32.4", - "@cosmjs/stargate": "0.32.4", - "@cosmjs/tendermint-rpc": "0.32.4", - "@cosmology/lcd": "0.13.4", - "@noble/hashes": "1.4.0", - "bech32": "2.0.0", - "jest": "29.7.0", - "prettier": "3.3.3", - "stridejs": "github:Stride-Labs/stridejs#e17c404f6451bad95ef0093f2b41244248bd7ebd", - "typescript": "5.5.3", - "vitest": "2.0.3" - }, - "packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a" -} diff --git a/dockernet/ts-tests/pnpm-lock.yaml b/dockernet/ts-tests/pnpm-lock.yaml deleted file mode 100644 index 6963e63875..0000000000 --- a/dockernet/ts-tests/pnpm-lock.yaml +++ /dev/null @@ -1,4082 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - dependencies: - '@cosmjs/amino': - specifier: 0.32.4 - version: 0.32.4 - '@cosmjs/encoding': - specifier: 0.32.4 - version: 0.32.4 - '@cosmjs/math': - specifier: 0.32.4 - version: 0.32.4 - '@cosmjs/proto-signing': - specifier: 0.32.4 - version: 0.32.4 - '@cosmjs/stargate': - specifier: 0.32.4 - version: 0.32.4 - '@cosmjs/tendermint-rpc': - specifier: 0.32.4 - version: 0.32.4 - '@cosmology/lcd': - specifier: 0.13.4 - version: 0.13.4 - '@noble/hashes': - specifier: 1.4.0 - version: 1.4.0 - bech32: - specifier: 2.0.0 - version: 2.0.0 - jest: - specifier: 29.7.0 - version: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - prettier: - specifier: 3.3.3 - version: 3.3.3 - stridejs: - specifier: github:Stride-Labs/stridejs#e17c404f6451bad95ef0093f2b41244248bd7ebd - version: https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e17c404f6451bad95ef0093f2b41244248bd7ebd - typescript: - specifier: 5.5.3 - version: 5.5.3 - vitest: - specifier: 2.0.3 - version: 2.0.3(@types/node@20.14.11)(terser@5.31.3) - -packages: - - '@ampproject/remapping@2.3.0': - resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} - engines: {node: '>=6.0.0'} - - '@babel/code-frame@7.24.7': - resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} - engines: {node: '>=6.9.0'} - - '@babel/compat-data@7.24.9': - resolution: {integrity: sha512-e701mcfApCJqMMueQI0Fb68Amflj83+dvAvHawoBpAz+GDjCIyGHzNwnefjsWJ3xiYAqqiQFoWbspGYBdb2/ng==} - engines: {node: '>=6.9.0'} - - '@babel/core@7.24.9': - resolution: {integrity: sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg==} - engines: {node: '>=6.9.0'} - - '@babel/generator@7.24.10': - resolution: {integrity: sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-compilation-targets@7.24.8': - resolution: {integrity: sha512-oU+UoqCHdp+nWVDkpldqIQL/i/bvAv53tRqLG/s+cOXxe66zOYLU7ar/Xs3LdmBihrUMEUhwu6dMZwbNOYDwvw==} - engines: {node: '>=6.9.0'} - - '@babel/helper-environment-visitor@7.24.7': - resolution: {integrity: sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-function-name@7.24.7': - resolution: {integrity: sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-hoist-variables@7.24.7': - resolution: {integrity: sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-imports@7.24.7': - resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-transforms@7.24.9': - resolution: {integrity: sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-plugin-utils@7.24.8': - resolution: {integrity: sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-simple-access@7.24.7': - resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-split-export-declaration@7.24.7': - resolution: {integrity: sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-string-parser@7.24.8': - resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-option@7.24.8': - resolution: {integrity: sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==} - engines: {node: '>=6.9.0'} - - '@babel/helpers@7.24.8': - resolution: {integrity: sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ==} - engines: {node: '>=6.9.0'} - - '@babel/highlight@7.24.7': - resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} - engines: {node: '>=6.9.0'} - - '@babel/parser@7.24.8': - resolution: {integrity: sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w==} - engines: {node: '>=6.0.0'} - hasBin: true - - '@babel/plugin-syntax-async-generators@7.8.4': - resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-bigint@7.8.3': - resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-properties@7.12.13': - resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-meta@7.10.4': - resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-json-strings@7.8.3': - resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-jsx@7.24.7': - resolution: {integrity: sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4': - resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': - resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-numeric-separator@7.10.4': - resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-object-rest-spread@7.8.3': - resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3': - resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-chaining@7.8.3': - resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-top-level-await@7.14.5': - resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-typescript@7.24.7': - resolution: {integrity: sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/runtime@7.24.8': - resolution: {integrity: sha512-5F7SDGs1T72ZczbRwbGO9lQi0NLjQxzl6i4lJxLxfW9U5UluCSyEJeniWvnhl3/euNiqQVbo8zruhsDfid0esA==} - engines: {node: '>=6.9.0'} - - '@babel/template@7.24.7': - resolution: {integrity: sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==} - engines: {node: '>=6.9.0'} - - '@babel/traverse@7.24.8': - resolution: {integrity: sha512-t0P1xxAPzEDcEPmjprAQq19NWum4K0EQPjMwZQZbHt+GiZqvjCHjj755Weq1YRPVzBI+3zSfvScfpnuIecVFJQ==} - engines: {node: '>=6.9.0'} - - '@babel/types@7.24.9': - resolution: {integrity: sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==} - engines: {node: '>=6.9.0'} - - '@bcoe/v8-coverage@0.2.3': - resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - - '@confio/ics23@0.6.8': - resolution: {integrity: sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w==} - - '@cosmjs/amino@0.32.4': - resolution: {integrity: sha512-zKYOt6hPy8obIFtLie/xtygCkH9ZROiQ12UHfKsOkWaZfPQUvVbtgmu6R4Kn1tFLI/SRkw7eqhaogmW/3NYu/Q==} - - '@cosmjs/crypto@0.32.4': - resolution: {integrity: sha512-zicjGU051LF1V9v7bp8p7ovq+VyC91xlaHdsFOTo2oVry3KQikp8L/81RkXmUIT8FxMwdx1T7DmFwVQikcSDIw==} - - '@cosmjs/encoding@0.32.4': - resolution: {integrity: sha512-tjvaEy6ZGxJchiizzTn7HVRiyTg1i4CObRRaTRPknm5EalE13SV+TCHq38gIDfyUeden4fCuaBVEdBR5+ti7Hw==} - - '@cosmjs/json-rpc@0.32.4': - resolution: {integrity: sha512-/jt4mBl7nYzfJ2J/VJ+r19c92mUKF0Lt0JxM3MXEJl7wlwW5haHAWtzRujHkyYMXOwIR+gBqT2S0vntXVBRyhQ==} - - '@cosmjs/math@0.32.4': - resolution: {integrity: sha512-++dqq2TJkoB8zsPVYCvrt88oJWsy1vMOuSOKcdlnXuOA/ASheTJuYy4+oZlTQ3Fr8eALDLGGPhJI02W2HyAQaw==} - - '@cosmjs/proto-signing@0.32.4': - resolution: {integrity: sha512-QdyQDbezvdRI4xxSlyM1rSVBO2st5sqtbEIl3IX03uJ7YiZIQHyv6vaHVf1V4mapusCqguiHJzm4N4gsFdLBbQ==} - - '@cosmjs/socket@0.32.4': - resolution: {integrity: sha512-davcyYziBhkzfXQTu1l5NrpDYv0K9GekZCC9apBRvL1dvMc9F/ygM7iemHjUA+z8tJkxKxrt/YPjJ6XNHzLrkw==} - - '@cosmjs/stargate@0.32.4': - resolution: {integrity: sha512-usj08LxBSsPRq9sbpCeVdyLx2guEcOHfJS9mHGCLCXpdAPEIEQEtWLDpEUc0LEhWOx6+k/ChXTc5NpFkdrtGUQ==} - - '@cosmjs/stream@0.32.4': - resolution: {integrity: sha512-Gih++NYHEiP+oyD4jNEUxU9antoC0pFSg+33Hpp0JlHwH0wXhtD3OOKnzSfDB7OIoEbrzLJUpEjOgpCp5Z+W3A==} - - '@cosmjs/tendermint-rpc@0.32.4': - resolution: {integrity: sha512-MWvUUno+4bCb/LmlMIErLypXxy7ckUuzEmpufYYYd9wgbdCXaTaO08SZzyFM5PI8UJ/0S2AmUrgWhldlbxO8mw==} - - '@cosmjs/utils@0.32.4': - resolution: {integrity: sha512-D1Yc+Zy8oL/hkUkFUL/bwxvuDBzRGpc4cF7/SkdhxX4iHpSLgdOuTt1mhCh9+kl6NQREy9t7SYZ6xeW5gFe60w==} - - '@cosmology/lcd@0.13.4': - resolution: {integrity: sha512-llClHHHjOCie9PxnXUOxvMcWi0aVjmzkRXM6IBBXluOczRFFog23rPPfrWZPeT30dIX1SGklp0Fek28O76BkvQ==} - - '@cspotcode/source-map-support@0.8.1': - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - - '@esbuild/aix-ppc64@0.21.5': - resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [aix] - - '@esbuild/android-arm64@0.21.5': - resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - - '@esbuild/android-arm@0.21.5': - resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - - '@esbuild/android-x64@0.21.5': - resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - - '@esbuild/darwin-arm64@0.21.5': - resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - - '@esbuild/darwin-x64@0.21.5': - resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - - '@esbuild/freebsd-arm64@0.21.5': - resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - - '@esbuild/freebsd-x64@0.21.5': - resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - - '@esbuild/linux-arm64@0.21.5': - resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - - '@esbuild/linux-arm@0.21.5': - resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - - '@esbuild/linux-ia32@0.21.5': - resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - - '@esbuild/linux-loong64@0.21.5': - resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - - '@esbuild/linux-mips64el@0.21.5': - resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - - '@esbuild/linux-ppc64@0.21.5': - resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - - '@esbuild/linux-riscv64@0.21.5': - resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - - '@esbuild/linux-s390x@0.21.5': - resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - - '@esbuild/linux-x64@0.21.5': - resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - - '@esbuild/netbsd-x64@0.21.5': - resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - - '@esbuild/openbsd-x64@0.21.5': - resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - - '@esbuild/sunos-x64@0.21.5': - resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - - '@esbuild/win32-arm64@0.21.5': - resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - - '@esbuild/win32-ia32@0.21.5': - resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - - '@esbuild/win32-x64@0.21.5': - resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - - '@istanbuljs/load-nyc-config@1.1.0': - resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} - engines: {node: '>=8'} - - '@istanbuljs/schema@0.1.3': - resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} - engines: {node: '>=8'} - - '@jest/console@29.7.0': - resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/core@29.7.0': - resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - '@jest/environment@29.7.0': - resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/expect-utils@29.7.0': - resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/expect@29.7.0': - resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/fake-timers@29.7.0': - resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/globals@29.7.0': - resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/reporters@29.7.0': - resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - '@jest/schemas@29.6.3': - resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/source-map@29.6.3': - resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/test-result@29.7.0': - resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/test-sequencer@29.7.0': - resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/transform@29.7.0': - resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/types@29.6.3': - resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jridgewell/gen-mapping@0.3.5': - resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} - engines: {node: '>=6.0.0'} - - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} - - '@jridgewell/set-array@1.2.1': - resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} - engines: {node: '>=6.0.0'} - - '@jridgewell/source-map@0.3.6': - resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} - - '@jridgewell/sourcemap-codec@1.5.0': - resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - - '@jridgewell/trace-mapping@0.3.25': - resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - - '@jridgewell/trace-mapping@0.3.9': - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - - '@noble/hashes@1.4.0': - resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} - engines: {node: '>= 16'} - - '@protobufjs/aspromise@1.1.2': - resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} - - '@protobufjs/base64@1.1.2': - resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} - - '@protobufjs/codegen@2.0.4': - resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} - - '@protobufjs/eventemitter@1.1.0': - resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} - - '@protobufjs/fetch@1.1.0': - resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} - - '@protobufjs/float@1.0.2': - resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} - - '@protobufjs/inquire@1.1.0': - resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} - - '@protobufjs/path@1.1.2': - resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} - - '@protobufjs/pool@1.1.0': - resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} - - '@protobufjs/utf8@1.1.0': - resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} - - '@rollup/rollup-android-arm-eabi@4.18.1': - resolution: {integrity: sha512-lncuC4aHicncmbORnx+dUaAgzee9cm/PbIqgWz1PpXuwc+sa1Ct83tnqUDy/GFKleLiN7ZIeytM6KJ4cAn1SxA==} - cpu: [arm] - os: [android] - - '@rollup/rollup-android-arm64@4.18.1': - resolution: {integrity: sha512-F/tkdw0WSs4ojqz5Ovrw5r9odqzFjb5LIgHdHZG65dFI1lWTWRVy32KDJLKRISHgJvqUeUhdIvy43fX41znyDg==} - cpu: [arm64] - os: [android] - - '@rollup/rollup-darwin-arm64@4.18.1': - resolution: {integrity: sha512-vk+ma8iC1ebje/ahpxpnrfVQJibTMyHdWpOGZ3JpQ7Mgn/3QNHmPq7YwjZbIE7km73dH5M1e6MRRsnEBW7v5CQ==} - cpu: [arm64] - os: [darwin] - - '@rollup/rollup-darwin-x64@4.18.1': - resolution: {integrity: sha512-IgpzXKauRe1Tafcej9STjSSuG0Ghu/xGYH+qG6JwsAUxXrnkvNHcq/NL6nz1+jzvWAnQkuAJ4uIwGB48K9OCGA==} - cpu: [x64] - os: [darwin] - - '@rollup/rollup-linux-arm-gnueabihf@4.18.1': - resolution: {integrity: sha512-P9bSiAUnSSM7EmyRK+e5wgpqai86QOSv8BwvkGjLwYuOpaeomiZWifEos517CwbG+aZl1T4clSE1YqqH2JRs+g==} - cpu: [arm] - os: [linux] - - '@rollup/rollup-linux-arm-musleabihf@4.18.1': - resolution: {integrity: sha512-5RnjpACoxtS+aWOI1dURKno11d7krfpGDEn19jI8BuWmSBbUC4ytIADfROM1FZrFhQPSoP+KEa3NlEScznBTyQ==} - cpu: [arm] - os: [linux] - - '@rollup/rollup-linux-arm64-gnu@4.18.1': - resolution: {integrity: sha512-8mwmGD668m8WaGbthrEYZ9CBmPug2QPGWxhJxh/vCgBjro5o96gL04WLlg5BA233OCWLqERy4YUzX3bJGXaJgQ==} - cpu: [arm64] - os: [linux] - - '@rollup/rollup-linux-arm64-musl@4.18.1': - resolution: {integrity: sha512-dJX9u4r4bqInMGOAQoGYdwDP8lQiisWb9et+T84l2WXk41yEej8v2iGKodmdKimT8cTAYt0jFb+UEBxnPkbXEQ==} - cpu: [arm64] - os: [linux] - - '@rollup/rollup-linux-powerpc64le-gnu@4.18.1': - resolution: {integrity: sha512-V72cXdTl4EI0x6FNmho4D502sy7ed+LuVW6Ym8aI6DRQ9hQZdp5sj0a2usYOlqvFBNKQnLQGwmYnujo2HvjCxQ==} - cpu: [ppc64] - os: [linux] - - '@rollup/rollup-linux-riscv64-gnu@4.18.1': - resolution: {integrity: sha512-f+pJih7sxoKmbjghrM2RkWo2WHUW8UbfxIQiWo5yeCaCM0TveMEuAzKJte4QskBp1TIinpnRcxkquY+4WuY/tg==} - cpu: [riscv64] - os: [linux] - - '@rollup/rollup-linux-s390x-gnu@4.18.1': - resolution: {integrity: sha512-qb1hMMT3Fr/Qz1OKovCuUM11MUNLUuHeBC2DPPAWUYYUAOFWaxInaTwTQmc7Fl5La7DShTEpmYwgdt2hG+4TEg==} - cpu: [s390x] - os: [linux] - - '@rollup/rollup-linux-x64-gnu@4.18.1': - resolution: {integrity: sha512-7O5u/p6oKUFYjRbZkL2FLbwsyoJAjyeXHCU3O4ndvzg2OFO2GinFPSJFGbiwFDaCFc+k7gs9CF243PwdPQFh5g==} - cpu: [x64] - os: [linux] - - '@rollup/rollup-linux-x64-musl@4.18.1': - resolution: {integrity: sha512-pDLkYITdYrH/9Cv/Vlj8HppDuLMDUBmgsM0+N+xLtFd18aXgM9Nyqupb/Uw+HeidhfYg2lD6CXvz6CjoVOaKjQ==} - cpu: [x64] - os: [linux] - - '@rollup/rollup-win32-arm64-msvc@4.18.1': - resolution: {integrity: sha512-W2ZNI323O/8pJdBGil1oCauuCzmVd9lDmWBBqxYZcOqWD6aWqJtVBQ1dFrF4dYpZPks6F+xCZHfzG5hYlSHZ6g==} - cpu: [arm64] - os: [win32] - - '@rollup/rollup-win32-ia32-msvc@4.18.1': - resolution: {integrity: sha512-ELfEX1/+eGZYMaCIbK4jqLxO1gyTSOIlZr6pbC4SRYFaSIDVKOnZNMdoZ+ON0mrFDp4+H5MhwNC1H/AhE3zQLg==} - cpu: [ia32] - os: [win32] - - '@rollup/rollup-win32-x64-msvc@4.18.1': - resolution: {integrity: sha512-yjk2MAkQmoaPYCSu35RLJ62+dz358nE83VfTePJRp8CG7aMg25mEJYpXFiD+NcevhX8LxD5OP5tktPXnXN7GDw==} - cpu: [x64] - os: [win32] - - '@sinclair/typebox@0.27.8': - resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} - - '@sinonjs/commons@3.0.1': - resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} - - '@sinonjs/fake-timers@10.3.0': - resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} - - '@tsconfig/node10@1.0.11': - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - - '@tsconfig/node12@1.0.11': - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - - '@tsconfig/node14@1.0.3': - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - - '@tsconfig/node16@1.0.4': - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - - '@types/babel__core@7.20.5': - resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} - - '@types/babel__generator@7.6.8': - resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==} - - '@types/babel__template@7.4.4': - resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} - - '@types/babel__traverse@7.20.6': - resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} - - '@types/estree@1.0.5': - resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - - '@types/graceful-fs@4.1.9': - resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} - - '@types/istanbul-lib-coverage@2.0.6': - resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} - - '@types/istanbul-lib-report@3.0.3': - resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} - - '@types/istanbul-reports@3.0.4': - resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} - - '@types/long@4.0.2': - resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==} - - '@types/node@20.14.11': - resolution: {integrity: sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==} - - '@types/stack-utils@2.0.3': - resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} - - '@types/yargs-parser@21.0.3': - resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} - - '@types/yargs@17.0.32': - resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==} - - '@vitest/expect@2.0.3': - resolution: {integrity: sha512-X6AepoOYePM0lDNUPsGXTxgXZAl3EXd0GYe/MZyVE4HzkUqyUVC6S3PrY5mClDJ6/7/7vALLMV3+xD/Ko60Hqg==} - - '@vitest/pretty-format@2.0.3': - resolution: {integrity: sha512-URM4GLsB2xD37nnTyvf6kfObFafxmycCL8un3OC9gaCs5cti2u+5rJdIflZ2fUJUen4NbvF6jCufwViAFLvz1g==} - - '@vitest/runner@2.0.3': - resolution: {integrity: sha512-EmSP4mcjYhAcuBWwqgpjR3FYVeiA4ROzRunqKltWjBfLNs1tnMLtF+qtgd5ClTwkDP6/DGlKJTNa6WxNK0bNYQ==} - - '@vitest/snapshot@2.0.3': - resolution: {integrity: sha512-6OyA6v65Oe3tTzoSuRPcU6kh9m+mPL1vQ2jDlPdn9IQoUxl8rXhBnfICNOC+vwxWY684Vt5UPgtcA2aPFBb6wg==} - - '@vitest/spy@2.0.3': - resolution: {integrity: sha512-sfqyAw/ypOXlaj4S+w8689qKM1OyPOqnonqOc9T91DsoHbfN5mU7FdifWWv3MtQFf0lEUstEwR9L/q/M390C+A==} - - '@vitest/utils@2.0.3': - resolution: {integrity: sha512-c/UdELMuHitQbbc/EVctlBaxoYAwQPQdSNwv7z/vHyBKy2edYZaFgptE27BRueZB7eW8po+cllotMNTDpL3HWg==} - - acorn-walk@8.3.3: - resolution: {integrity: sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==} - engines: {node: '>=0.4.0'} - - acorn@8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} - engines: {node: '>=0.4.0'} - hasBin: true - - ansi-escapes@4.3.2: - resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} - engines: {node: '>=8'} - - ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - - ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - - ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - - ansi-styles@5.2.0: - resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} - engines: {node: '>=10'} - - anymatch@3.1.3: - resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} - engines: {node: '>= 8'} - - arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - - argparse@1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - - assertion-error@2.0.1: - resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} - engines: {node: '>=12'} - - asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - - axios@1.6.0: - resolution: {integrity: sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==} - - babel-jest@29.7.0: - resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.8.0 - - babel-plugin-istanbul@6.1.1: - resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} - engines: {node: '>=8'} - - babel-plugin-jest-hoist@29.6.3: - resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - babel-preset-current-node-syntax@1.0.1: - resolution: {integrity: sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==} - peerDependencies: - '@babel/core': ^7.0.0 - - babel-preset-jest@29.6.3: - resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.0.0 - - balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - - base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - - bech32@1.1.4: - resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==} - - bech32@2.0.0: - resolution: {integrity: sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==} - - bn.js@4.12.0: - resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==} - - bn.js@5.2.1: - resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} - - brace-expansion@1.1.11: - resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - - brorand@1.1.0: - resolution: {integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==} - - browserslist@4.23.2: - resolution: {integrity: sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - - bser@2.1.1: - resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} - - buffer-from@1.1.2: - resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - - cac@6.7.14: - resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} - engines: {node: '>=8'} - - callsites@3.1.0: - resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} - engines: {node: '>=6'} - - camelcase@5.3.1: - resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} - engines: {node: '>=6'} - - camelcase@6.3.0: - resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} - engines: {node: '>=10'} - - caniuse-lite@1.0.30001642: - resolution: {integrity: sha512-3XQ0DoRgLijXJErLSl+bLnJ+Et4KqV1PY6JJBGAFlsNsz31zeAIncyeZfLCabHK/jtSh+671RM9YMldxjUPZtA==} - - chai@5.1.1: - resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} - engines: {node: '>=12'} - - chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - - chalk@4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - - char-regex@1.0.2: - resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} - engines: {node: '>=10'} - - check-error@2.1.1: - resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} - engines: {node: '>= 16'} - - ci-info@3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} - engines: {node: '>=8'} - - cjs-module-lexer@1.3.1: - resolution: {integrity: sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q==} - - cliui@8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - - co@4.6.0: - resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} - engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} - - collect-v8-coverage@1.0.2: - resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==} - - color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - - color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - - color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - - color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - - combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - - commander@2.20.3: - resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - - concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - - convert-source-map@2.0.0: - resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - - cosmjs-types@0.9.0: - resolution: {integrity: sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ==} - - create-jest@29.7.0: - resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - - create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} - engines: {node: '>= 8'} - - debug@4.3.5: - resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - - dedent@1.5.3: - resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} - peerDependencies: - babel-plugin-macros: ^3.1.0 - peerDependenciesMeta: - babel-plugin-macros: - optional: true - - deep-eql@5.0.2: - resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} - engines: {node: '>=6'} - - deepmerge@4.3.1: - resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} - engines: {node: '>=0.10.0'} - - define-data-property@1.1.4: - resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} - engines: {node: '>= 0.4'} - - define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - - delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - - detect-newline@3.1.0: - resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} - engines: {node: '>=8'} - - diff-sequences@29.6.3: - resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - - electron-to-chromium@1.4.829: - resolution: {integrity: sha512-5qp1N2POAfW0u1qGAxXEtz6P7bO1m6gpZr5hdf5ve6lxpLM7MpiM4jIPz7xcrNlClQMafbyUDDWjlIQZ1Mw0Rw==} - - elliptic@6.5.6: - resolution: {integrity: sha512-mpzdtpeCLuS3BmE3pO3Cpp5bbjlOPY2Q0PgoF+Od1XZrHLYI28Xe3ossCmYCQt11FQKEYd9+PF8jymTvtWJSHQ==} - - emittery@0.13.1: - resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} - engines: {node: '>=12'} - - emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - - error-ex@1.3.2: - resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} - - es-define-property@1.0.0: - resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} - engines: {node: '>= 0.4'} - - es-errors@1.3.0: - resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} - engines: {node: '>= 0.4'} - - esbuild@0.21.5: - resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} - engines: {node: '>=12'} - hasBin: true - - escalade@3.1.2: - resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} - engines: {node: '>=6'} - - escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - - escape-string-regexp@2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - - esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - - estree-walker@3.0.3: - resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} - - execa@5.1.1: - resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} - engines: {node: '>=10'} - - execa@8.0.1: - resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} - engines: {node: '>=16.17'} - - exit@0.1.2: - resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} - engines: {node: '>= 0.8.0'} - - expect@29.7.0: - resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - fast-json-stable-stringify@2.1.0: - resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - - fb-watchman@2.0.2: - resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} - - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - - find-up@4.1.0: - resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} - engines: {node: '>=8'} - - follow-redirects@1.15.6: - resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - - form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - - fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - - fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - - function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - - gensync@1.0.0-beta.2: - resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} - engines: {node: '>=6.9.0'} - - get-caller-file@2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - - get-func-name@2.0.2: - resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} - - get-intrinsic@1.2.4: - resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} - engines: {node: '>= 0.4'} - - get-package-type@0.1.0: - resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} - engines: {node: '>=8.0.0'} - - get-stream@6.0.1: - resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} - engines: {node: '>=10'} - - get-stream@8.0.1: - resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} - engines: {node: '>=16'} - - glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported - - globals@11.12.0: - resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} - engines: {node: '>=4'} - - globalthis@1.0.4: - resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} - engines: {node: '>= 0.4'} - - gopd@1.0.1: - resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - - has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - - has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - - has-property-descriptors@1.0.2: - resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} - - has-proto@1.0.3: - resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} - engines: {node: '>= 0.4'} - - has-symbols@1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - - hash.js@1.1.7: - resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} - - hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} - engines: {node: '>= 0.4'} - - hmac-drbg@1.0.1: - resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} - - html-escaper@2.0.2: - resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - - human-signals@2.1.0: - resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} - engines: {node: '>=10.17.0'} - - human-signals@5.0.0: - resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} - engines: {node: '>=16.17.0'} - - import-local@3.1.0: - resolution: {integrity: sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==} - engines: {node: '>=8'} - hasBin: true - - imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - - inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. - - inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - - is-arrayish@0.2.1: - resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} - - is-core-module@2.14.0: - resolution: {integrity: sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==} - engines: {node: '>= 0.4'} - - is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - - is-generator-fn@2.1.0: - resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} - engines: {node: '>=6'} - - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - - is-stream@2.0.1: - resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} - engines: {node: '>=8'} - - is-stream@3.0.0: - resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - - isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - - isomorphic-ws@4.0.1: - resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} - peerDependencies: - ws: '*' - - istanbul-lib-coverage@3.2.2: - resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} - engines: {node: '>=8'} - - istanbul-lib-instrument@5.2.1: - resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} - engines: {node: '>=8'} - - istanbul-lib-instrument@6.0.3: - resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==} - engines: {node: '>=10'} - - istanbul-lib-report@3.0.1: - resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} - engines: {node: '>=10'} - - istanbul-lib-source-maps@4.0.1: - resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} - engines: {node: '>=10'} - - istanbul-reports@3.1.7: - resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} - engines: {node: '>=8'} - - jest-changed-files@29.7.0: - resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-circus@29.7.0: - resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-cli@29.7.0: - resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - jest-config@29.7.0: - resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@types/node': '*' - ts-node: '>=9.0.0' - peerDependenciesMeta: - '@types/node': - optional: true - ts-node: - optional: true - - jest-diff@29.7.0: - resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-docblock@29.7.0: - resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-each@29.7.0: - resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-environment-node@29.7.0: - resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-get-type@29.6.3: - resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-haste-map@29.7.0: - resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-leak-detector@29.7.0: - resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-matcher-utils@29.7.0: - resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-message-util@29.7.0: - resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-mock@29.7.0: - resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-pnp-resolver@1.2.3: - resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} - engines: {node: '>=6'} - peerDependencies: - jest-resolve: '*' - peerDependenciesMeta: - jest-resolve: - optional: true - - jest-regex-util@29.6.3: - resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-resolve-dependencies@29.7.0: - resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-resolve@29.7.0: - resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-runner@29.7.0: - resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-runtime@29.7.0: - resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-snapshot@29.7.0: - resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-util@29.7.0: - resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-validate@29.7.0: - resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-watcher@29.7.0: - resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-worker@29.7.0: - resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest@29.7.0: - resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - - js-yaml@3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - - jsesc@2.5.2: - resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} - engines: {node: '>=4'} - hasBin: true - - json-parse-even-better-errors@2.3.1: - resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - - json5@2.2.3: - resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} - engines: {node: '>=6'} - hasBin: true - - kleur@3.0.3: - resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} - engines: {node: '>=6'} - - leven@3.1.0: - resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} - engines: {node: '>=6'} - - libsodium-sumo@0.7.14: - resolution: {integrity: sha512-2nDge6qlAjcwyslAhWfVumlkeSNK5+WCfKa2/VEq9prvlT5vP2FR0m0o5hmKaYqfsZ4TQVj5czQsimZvXDB1CQ==} - - libsodium-wrappers-sumo@0.7.14: - resolution: {integrity: sha512-0lm7ZwN5a95J2yUi8R1rgQeeaVDIWnvNzgVmXmZswis4mC+bQtbDrB+QpJlL4qklaKx3hVpJjoc6ubzJFiv64Q==} - - lines-and-columns@1.2.4: - resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - - locate-path@5.0.0: - resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} - engines: {node: '>=8'} - - long@4.0.0: - resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==} - - loupe@3.1.1: - resolution: {integrity: sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==} - - lru-cache@5.1.1: - resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - - magic-string@0.30.10: - resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==} - - make-dir@4.0.0: - resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} - engines: {node: '>=10'} - - make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - - makeerror@1.0.12: - resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} - - merge-stream@2.0.0: - resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} - - micromatch@4.0.7: - resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==} - engines: {node: '>=8.6'} - - mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - - mimic-fn@2.1.0: - resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} - engines: {node: '>=6'} - - mimic-fn@4.0.0: - resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} - engines: {node: '>=12'} - - minimalistic-assert@1.0.1: - resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} - - minimalistic-crypto-utils@1.0.1: - resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} - - minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - - ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - - nanoid@3.3.7: - resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - - natural-compare@1.4.0: - resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - - node-int64@0.4.0: - resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} - - node-releases@2.0.17: - resolution: {integrity: sha512-Ww6ZlOiEQfPfXM45v17oabk77Z7mg5bOt7AjDyzy7RjK9OrLrLC8dyZQoAPEOtFX9SaNf1Tdvr5gRJWdTJj7GA==} - - normalize-path@3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - - npm-run-path@4.0.1: - resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} - engines: {node: '>=8'} - - npm-run-path@5.3.0: - resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - - object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - - once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - - onetime@5.1.2: - resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} - engines: {node: '>=6'} - - onetime@6.0.0: - resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} - engines: {node: '>=12'} - - p-limit@2.3.0: - resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} - engines: {node: '>=6'} - - p-limit@3.1.0: - resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} - engines: {node: '>=10'} - - p-locate@4.1.0: - resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} - engines: {node: '>=8'} - - p-try@2.2.0: - resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} - engines: {node: '>=6'} - - parse-json@5.2.0: - resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} - engines: {node: '>=8'} - - path-exists@4.0.0: - resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} - engines: {node: '>=8'} - - path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - - path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - - path-key@4.0.0: - resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} - engines: {node: '>=12'} - - path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - - pathe@1.1.2: - resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} - - pathval@2.0.0: - resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} - engines: {node: '>= 14.16'} - - picocolors@1.0.1: - resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} - - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - - pirates@4.0.6: - resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} - engines: {node: '>= 6'} - - pkg-dir@4.2.0: - resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} - engines: {node: '>=8'} - - postcss@8.4.39: - resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} - engines: {node: ^10 || ^12 || >=14} - - prettier@3.3.3: - resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} - engines: {node: '>=14'} - hasBin: true - - pretty-format@29.7.0: - resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - prompts@2.4.2: - resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} - engines: {node: '>= 6'} - - protobufjs@6.11.4: - resolution: {integrity: sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==} - hasBin: true - - proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - - pure-rand@6.1.0: - resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} - - react-is@18.3.1: - resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} - - readonly-date@1.0.0: - resolution: {integrity: sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==} - - regenerator-runtime@0.14.1: - resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} - - require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - - resolve-cwd@3.0.0: - resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} - engines: {node: '>=8'} - - resolve-from@5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - - resolve.exports@2.0.2: - resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} - engines: {node: '>=10'} - - resolve@1.22.8: - resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} - hasBin: true - - rollup@4.18.1: - resolution: {integrity: sha512-Elx2UT8lzxxOXMpy5HWQGZqkrQOtrVDDa/bm9l10+U4rQnVzbL/LgZ4NOM1MPIDyHk69W4InuYDF5dzRh4Kw1A==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true - - semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - - semver@7.6.3: - resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} - engines: {node: '>=10'} - hasBin: true - - shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - - shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - - siginfo@2.0.0: - resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} - - signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - - signal-exit@4.1.0: - resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} - engines: {node: '>=14'} - - sisteransi@1.0.5: - resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} - - slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - - source-map-js@1.2.0: - resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} - engines: {node: '>=0.10.0'} - - source-map-support@0.5.13: - resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} - - source-map-support@0.5.21: - resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} - - source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - - sprintf-js@1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - - stack-utils@2.0.6: - resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} - engines: {node: '>=10'} - - stackback@0.0.2: - resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} - - std-env@3.7.0: - resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} - - stridejs@https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e17c404f6451bad95ef0093f2b41244248bd7ebd: - resolution: {tarball: https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e17c404f6451bad95ef0093f2b41244248bd7ebd} - version: 0.10.0-alpha - - string-length@4.0.2: - resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} - engines: {node: '>=10'} - - string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - - strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} - - strip-bom@4.0.0: - resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} - engines: {node: '>=8'} - - strip-final-newline@2.0.0: - resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} - engines: {node: '>=6'} - - strip-final-newline@3.0.0: - resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} - engines: {node: '>=12'} - - strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - - supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - - supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - - supports-color@8.1.1: - resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} - engines: {node: '>=10'} - - supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - - symbol-observable@2.0.3: - resolution: {integrity: sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==} - engines: {node: '>=0.10'} - - terser@5.31.3: - resolution: {integrity: sha512-pAfYn3NIZLyZpa83ZKigvj6Rn9c/vd5KfYGX7cN1mnzqgDcxWvrU5ZtAfIKhEXz9nRecw4z3LXkjaq96/qZqAA==} - engines: {node: '>=10'} - hasBin: true - - test-exclude@6.0.0: - resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} - engines: {node: '>=8'} - - tinybench@2.8.0: - resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} - - tinypool@1.0.0: - resolution: {integrity: sha512-KIKExllK7jp3uvrNtvRBYBWBOAXSX8ZvoaD8T+7KB/QHIuoJW3Pmr60zucywjAlMb5TeXUkcs/MWeWLu0qvuAQ==} - engines: {node: ^18.0.0 || >=20.0.0} - - tinyrainbow@1.2.0: - resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} - engines: {node: '>=14.0.0'} - - tinyspy@3.0.0: - resolution: {integrity: sha512-q5nmENpTHgiPVd1cJDDc9cVoYN5x4vCvwT3FMilvKPKneCBZAxn2YWQjDF0UMcE9k0Cay1gBiDfTMU0g+mPMQA==} - engines: {node: '>=14.0.0'} - - tmpl@1.0.5: - resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} - - to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - - ts-node@10.9.2: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - - type-detect@4.0.8: - resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} - engines: {node: '>=4'} - - type-fest@0.21.3: - resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} - engines: {node: '>=10'} - - typescript@5.5.3: - resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==} - engines: {node: '>=14.17'} - hasBin: true - - undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - - update-browserslist-db@1.1.0: - resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' - - v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - - v8-to-istanbul@9.3.0: - resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} - engines: {node: '>=10.12.0'} - - vite-node@2.0.3: - resolution: {integrity: sha512-14jzwMx7XTcMB+9BhGQyoEAmSl0eOr3nrnn+Z12WNERtOvLN+d2scbRUvyni05rT3997Bg+rZb47NyP4IQPKXg==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - - vite@5.3.4: - resolution: {integrity: sha512-Cw+7zL3ZG9/NZBB8C+8QbQZmR54GwqIz+WMI4b3JgdYJvX+ny9AjJXqkGQlDXSXRP9rP0B4tbciRMOVEKulVOA==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - - vitest@2.0.3: - resolution: {integrity: sha512-o3HRvU93q6qZK4rI2JrhKyZMMuxg/JRt30E6qeQs6ueaiz5hr1cPj+Sk2kATgQzMMqsa2DiNI0TIK++1ULx8Jw==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@edge-runtime/vm': '*' - '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.0.3 - '@vitest/ui': 2.0.3 - happy-dom: '*' - jsdom: '*' - peerDependenciesMeta: - '@edge-runtime/vm': - optional: true - '@types/node': - optional: true - '@vitest/browser': - optional: true - '@vitest/ui': - optional: true - happy-dom: - optional: true - jsdom: - optional: true - - walker@1.0.8: - resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} - - which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - - why-is-node-running@2.3.0: - resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} - engines: {node: '>=8'} - hasBin: true - - wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - - wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - - write-file-atomic@4.0.2: - resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} - engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} - - ws@7.5.10: - resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} - engines: {node: '>=8.3.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - xstream@11.14.0: - resolution: {integrity: sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==} - - y18n@5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - - yallist@3.1.1: - resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - - yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - - yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - - yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - - yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} - -snapshots: - - '@ampproject/remapping@2.3.0': - dependencies: - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - - '@babel/code-frame@7.24.7': - dependencies: - '@babel/highlight': 7.24.7 - picocolors: 1.0.1 - - '@babel/compat-data@7.24.9': {} - - '@babel/core@7.24.9': - dependencies: - '@ampproject/remapping': 2.3.0 - '@babel/code-frame': 7.24.7 - '@babel/generator': 7.24.10 - '@babel/helper-compilation-targets': 7.24.8 - '@babel/helper-module-transforms': 7.24.9(@babel/core@7.24.9) - '@babel/helpers': 7.24.8 - '@babel/parser': 7.24.8 - '@babel/template': 7.24.7 - '@babel/traverse': 7.24.8 - '@babel/types': 7.24.9 - convert-source-map: 2.0.0 - debug: 4.3.5 - gensync: 1.0.0-beta.2 - json5: 2.2.3 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - - '@babel/generator@7.24.10': - dependencies: - '@babel/types': 7.24.9 - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - jsesc: 2.5.2 - - '@babel/helper-compilation-targets@7.24.8': - dependencies: - '@babel/compat-data': 7.24.9 - '@babel/helper-validator-option': 7.24.8 - browserslist: 4.23.2 - lru-cache: 5.1.1 - semver: 6.3.1 - - '@babel/helper-environment-visitor@7.24.7': - dependencies: - '@babel/types': 7.24.9 - - '@babel/helper-function-name@7.24.7': - dependencies: - '@babel/template': 7.24.7 - '@babel/types': 7.24.9 - - '@babel/helper-hoist-variables@7.24.7': - dependencies: - '@babel/types': 7.24.9 - - '@babel/helper-module-imports@7.24.7': - dependencies: - '@babel/traverse': 7.24.8 - '@babel/types': 7.24.9 - transitivePeerDependencies: - - supports-color - - '@babel/helper-module-transforms@7.24.9(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-environment-visitor': 7.24.7 - '@babel/helper-module-imports': 7.24.7 - '@babel/helper-simple-access': 7.24.7 - '@babel/helper-split-export-declaration': 7.24.7 - '@babel/helper-validator-identifier': 7.24.7 - transitivePeerDependencies: - - supports-color - - '@babel/helper-plugin-utils@7.24.8': {} - - '@babel/helper-simple-access@7.24.7': - dependencies: - '@babel/traverse': 7.24.8 - '@babel/types': 7.24.9 - transitivePeerDependencies: - - supports-color - - '@babel/helper-split-export-declaration@7.24.7': - dependencies: - '@babel/types': 7.24.9 - - '@babel/helper-string-parser@7.24.8': {} - - '@babel/helper-validator-identifier@7.24.7': {} - - '@babel/helper-validator-option@7.24.8': {} - - '@babel/helpers@7.24.8': - dependencies: - '@babel/template': 7.24.7 - '@babel/types': 7.24.9 - - '@babel/highlight@7.24.7': - dependencies: - '@babel/helper-validator-identifier': 7.24.7 - chalk: 2.4.2 - js-tokens: 4.0.0 - picocolors: 1.0.1 - - '@babel/parser@7.24.8': - dependencies: - '@babel/types': 7.24.9 - - '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.24.9)': - dependencies: - '@babel/core': 7.24.9 - '@babel/helper-plugin-utils': 7.24.8 - - '@babel/runtime@7.24.8': - dependencies: - regenerator-runtime: 0.14.1 - - '@babel/template@7.24.7': - dependencies: - '@babel/code-frame': 7.24.7 - '@babel/parser': 7.24.8 - '@babel/types': 7.24.9 - - '@babel/traverse@7.24.8': - dependencies: - '@babel/code-frame': 7.24.7 - '@babel/generator': 7.24.10 - '@babel/helper-environment-visitor': 7.24.7 - '@babel/helper-function-name': 7.24.7 - '@babel/helper-hoist-variables': 7.24.7 - '@babel/helper-split-export-declaration': 7.24.7 - '@babel/parser': 7.24.8 - '@babel/types': 7.24.9 - debug: 4.3.5 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color - - '@babel/types@7.24.9': - dependencies: - '@babel/helper-string-parser': 7.24.8 - '@babel/helper-validator-identifier': 7.24.7 - to-fast-properties: 2.0.0 - - '@bcoe/v8-coverage@0.2.3': {} - - '@confio/ics23@0.6.8': - dependencies: - '@noble/hashes': 1.4.0 - protobufjs: 6.11.4 - - '@cosmjs/amino@0.32.4': - dependencies: - '@cosmjs/crypto': 0.32.4 - '@cosmjs/encoding': 0.32.4 - '@cosmjs/math': 0.32.4 - '@cosmjs/utils': 0.32.4 - - '@cosmjs/crypto@0.32.4': - dependencies: - '@cosmjs/encoding': 0.32.4 - '@cosmjs/math': 0.32.4 - '@cosmjs/utils': 0.32.4 - '@noble/hashes': 1.4.0 - bn.js: 5.2.1 - elliptic: 6.5.6 - libsodium-wrappers-sumo: 0.7.14 - - '@cosmjs/encoding@0.32.4': - dependencies: - base64-js: 1.5.1 - bech32: 1.1.4 - readonly-date: 1.0.0 - - '@cosmjs/json-rpc@0.32.4': - dependencies: - '@cosmjs/stream': 0.32.4 - xstream: 11.14.0 - - '@cosmjs/math@0.32.4': - dependencies: - bn.js: 5.2.1 - - '@cosmjs/proto-signing@0.32.4': - dependencies: - '@cosmjs/amino': 0.32.4 - '@cosmjs/crypto': 0.32.4 - '@cosmjs/encoding': 0.32.4 - '@cosmjs/math': 0.32.4 - '@cosmjs/utils': 0.32.4 - cosmjs-types: 0.9.0 - - '@cosmjs/socket@0.32.4': - dependencies: - '@cosmjs/stream': 0.32.4 - isomorphic-ws: 4.0.1(ws@7.5.10) - ws: 7.5.10 - xstream: 11.14.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - '@cosmjs/stargate@0.32.4': - dependencies: - '@confio/ics23': 0.6.8 - '@cosmjs/amino': 0.32.4 - '@cosmjs/encoding': 0.32.4 - '@cosmjs/math': 0.32.4 - '@cosmjs/proto-signing': 0.32.4 - '@cosmjs/stream': 0.32.4 - '@cosmjs/tendermint-rpc': 0.32.4 - '@cosmjs/utils': 0.32.4 - cosmjs-types: 0.9.0 - xstream: 11.14.0 - transitivePeerDependencies: - - bufferutil - - debug - - utf-8-validate - - '@cosmjs/stream@0.32.4': - dependencies: - xstream: 11.14.0 - - '@cosmjs/tendermint-rpc@0.32.4': - dependencies: - '@cosmjs/crypto': 0.32.4 - '@cosmjs/encoding': 0.32.4 - '@cosmjs/json-rpc': 0.32.4 - '@cosmjs/math': 0.32.4 - '@cosmjs/socket': 0.32.4 - '@cosmjs/stream': 0.32.4 - '@cosmjs/utils': 0.32.4 - axios: 1.6.0 - readonly-date: 1.0.0 - xstream: 11.14.0 - transitivePeerDependencies: - - bufferutil - - debug - - utf-8-validate - - '@cosmjs/utils@0.32.4': {} - - '@cosmology/lcd@0.13.4': - dependencies: - axios: 1.6.0 - transitivePeerDependencies: - - debug - - '@cspotcode/source-map-support@0.8.1': - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - optional: true - - '@esbuild/aix-ppc64@0.21.5': - optional: true - - '@esbuild/android-arm64@0.21.5': - optional: true - - '@esbuild/android-arm@0.21.5': - optional: true - - '@esbuild/android-x64@0.21.5': - optional: true - - '@esbuild/darwin-arm64@0.21.5': - optional: true - - '@esbuild/darwin-x64@0.21.5': - optional: true - - '@esbuild/freebsd-arm64@0.21.5': - optional: true - - '@esbuild/freebsd-x64@0.21.5': - optional: true - - '@esbuild/linux-arm64@0.21.5': - optional: true - - '@esbuild/linux-arm@0.21.5': - optional: true - - '@esbuild/linux-ia32@0.21.5': - optional: true - - '@esbuild/linux-loong64@0.21.5': - optional: true - - '@esbuild/linux-mips64el@0.21.5': - optional: true - - '@esbuild/linux-ppc64@0.21.5': - optional: true - - '@esbuild/linux-riscv64@0.21.5': - optional: true - - '@esbuild/linux-s390x@0.21.5': - optional: true - - '@esbuild/linux-x64@0.21.5': - optional: true - - '@esbuild/netbsd-x64@0.21.5': - optional: true - - '@esbuild/openbsd-x64@0.21.5': - optional: true - - '@esbuild/sunos-x64@0.21.5': - optional: true - - '@esbuild/win32-arm64@0.21.5': - optional: true - - '@esbuild/win32-ia32@0.21.5': - optional: true - - '@esbuild/win32-x64@0.21.5': - optional: true - - '@istanbuljs/load-nyc-config@1.1.0': - dependencies: - camelcase: 5.3.1 - find-up: 4.1.0 - get-package-type: 0.1.0 - js-yaml: 3.14.1 - resolve-from: 5.0.0 - - '@istanbuljs/schema@0.1.3': {} - - '@jest/console@29.7.0': - dependencies: - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - chalk: 4.1.2 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - slash: 3.0.0 - - '@jest/core@29.7.0(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3))': - dependencies: - '@jest/console': 29.7.0 - '@jest/reporters': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - ci-info: 3.9.0 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-resolve-dependencies: 29.7.0 - jest-runner: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - jest-watcher: 29.7.0 - micromatch: 4.0.7 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-ansi: 6.0.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - ts-node - - '@jest/environment@29.7.0': - dependencies: - '@jest/fake-timers': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - jest-mock: 29.7.0 - - '@jest/expect-utils@29.7.0': - dependencies: - jest-get-type: 29.6.3 - - '@jest/expect@29.7.0': - dependencies: - expect: 29.7.0 - jest-snapshot: 29.7.0 - transitivePeerDependencies: - - supports-color - - '@jest/fake-timers@29.7.0': - dependencies: - '@jest/types': 29.6.3 - '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.14.11 - jest-message-util: 29.7.0 - jest-mock: 29.7.0 - jest-util: 29.7.0 - - '@jest/globals@29.7.0': - dependencies: - '@jest/environment': 29.7.0 - '@jest/expect': 29.7.0 - '@jest/types': 29.6.3 - jest-mock: 29.7.0 - transitivePeerDependencies: - - supports-color - - '@jest/reporters@29.7.0': - dependencies: - '@bcoe/v8-coverage': 0.2.3 - '@jest/console': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 20.14.11 - chalk: 4.1.2 - collect-v8-coverage: 1.0.2 - exit: 0.1.2 - glob: 7.2.3 - graceful-fs: 4.2.11 - istanbul-lib-coverage: 3.2.2 - istanbul-lib-instrument: 6.0.3 - istanbul-lib-report: 3.0.1 - istanbul-lib-source-maps: 4.0.1 - istanbul-reports: 3.1.7 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - jest-worker: 29.7.0 - slash: 3.0.0 - string-length: 4.0.2 - strip-ansi: 6.0.1 - v8-to-istanbul: 9.3.0 - transitivePeerDependencies: - - supports-color - - '@jest/schemas@29.6.3': - dependencies: - '@sinclair/typebox': 0.27.8 - - '@jest/source-map@29.6.3': - dependencies: - '@jridgewell/trace-mapping': 0.3.25 - callsites: 3.1.0 - graceful-fs: 4.2.11 - - '@jest/test-result@29.7.0': - dependencies: - '@jest/console': 29.7.0 - '@jest/types': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.6 - collect-v8-coverage: 1.0.2 - - '@jest/test-sequencer@29.7.0': - dependencies: - '@jest/test-result': 29.7.0 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - slash: 3.0.0 - - '@jest/transform@29.7.0': - dependencies: - '@babel/core': 7.24.9 - '@jest/types': 29.6.3 - '@jridgewell/trace-mapping': 0.3.25 - babel-plugin-istanbul: 6.1.1 - chalk: 4.1.2 - convert-source-map: 2.0.0 - fast-json-stable-stringify: 2.1.0 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - jest-regex-util: 29.6.3 - jest-util: 29.7.0 - micromatch: 4.0.7 - pirates: 4.0.6 - slash: 3.0.0 - write-file-atomic: 4.0.2 - transitivePeerDependencies: - - supports-color - - '@jest/types@29.6.3': - dependencies: - '@jest/schemas': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.6 - '@types/istanbul-reports': 3.0.4 - '@types/node': 20.14.11 - '@types/yargs': 17.0.32 - chalk: 4.1.2 - - '@jridgewell/gen-mapping@0.3.5': - dependencies: - '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping': 0.3.25 - - '@jridgewell/resolve-uri@3.1.2': {} - - '@jridgewell/set-array@1.2.1': {} - - '@jridgewell/source-map@0.3.6': - dependencies: - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - optional: true - - '@jridgewell/sourcemap-codec@1.5.0': {} - - '@jridgewell/trace-mapping@0.3.25': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 - - '@jridgewell/trace-mapping@0.3.9': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 - optional: true - - '@noble/hashes@1.4.0': {} - - '@protobufjs/aspromise@1.1.2': {} - - '@protobufjs/base64@1.1.2': {} - - '@protobufjs/codegen@2.0.4': {} - - '@protobufjs/eventemitter@1.1.0': {} - - '@protobufjs/fetch@1.1.0': - dependencies: - '@protobufjs/aspromise': 1.1.2 - '@protobufjs/inquire': 1.1.0 - - '@protobufjs/float@1.0.2': {} - - '@protobufjs/inquire@1.1.0': {} - - '@protobufjs/path@1.1.2': {} - - '@protobufjs/pool@1.1.0': {} - - '@protobufjs/utf8@1.1.0': {} - - '@rollup/rollup-android-arm-eabi@4.18.1': - optional: true - - '@rollup/rollup-android-arm64@4.18.1': - optional: true - - '@rollup/rollup-darwin-arm64@4.18.1': - optional: true - - '@rollup/rollup-darwin-x64@4.18.1': - optional: true - - '@rollup/rollup-linux-arm-gnueabihf@4.18.1': - optional: true - - '@rollup/rollup-linux-arm-musleabihf@4.18.1': - optional: true - - '@rollup/rollup-linux-arm64-gnu@4.18.1': - optional: true - - '@rollup/rollup-linux-arm64-musl@4.18.1': - optional: true - - '@rollup/rollup-linux-powerpc64le-gnu@4.18.1': - optional: true - - '@rollup/rollup-linux-riscv64-gnu@4.18.1': - optional: true - - '@rollup/rollup-linux-s390x-gnu@4.18.1': - optional: true - - '@rollup/rollup-linux-x64-gnu@4.18.1': - optional: true - - '@rollup/rollup-linux-x64-musl@4.18.1': - optional: true - - '@rollup/rollup-win32-arm64-msvc@4.18.1': - optional: true - - '@rollup/rollup-win32-ia32-msvc@4.18.1': - optional: true - - '@rollup/rollup-win32-x64-msvc@4.18.1': - optional: true - - '@sinclair/typebox@0.27.8': {} - - '@sinonjs/commons@3.0.1': - dependencies: - type-detect: 4.0.8 - - '@sinonjs/fake-timers@10.3.0': - dependencies: - '@sinonjs/commons': 3.0.1 - - '@tsconfig/node10@1.0.11': - optional: true - - '@tsconfig/node12@1.0.11': - optional: true - - '@tsconfig/node14@1.0.3': - optional: true - - '@tsconfig/node16@1.0.4': - optional: true - - '@types/babel__core@7.20.5': - dependencies: - '@babel/parser': 7.24.8 - '@babel/types': 7.24.9 - '@types/babel__generator': 7.6.8 - '@types/babel__template': 7.4.4 - '@types/babel__traverse': 7.20.6 - - '@types/babel__generator@7.6.8': - dependencies: - '@babel/types': 7.24.9 - - '@types/babel__template@7.4.4': - dependencies: - '@babel/parser': 7.24.8 - '@babel/types': 7.24.9 - - '@types/babel__traverse@7.20.6': - dependencies: - '@babel/types': 7.24.9 - - '@types/estree@1.0.5': {} - - '@types/graceful-fs@4.1.9': - dependencies: - '@types/node': 20.14.11 - - '@types/istanbul-lib-coverage@2.0.6': {} - - '@types/istanbul-lib-report@3.0.3': - dependencies: - '@types/istanbul-lib-coverage': 2.0.6 - - '@types/istanbul-reports@3.0.4': - dependencies: - '@types/istanbul-lib-report': 3.0.3 - - '@types/long@4.0.2': {} - - '@types/node@20.14.11': - dependencies: - undici-types: 5.26.5 - - '@types/stack-utils@2.0.3': {} - - '@types/yargs-parser@21.0.3': {} - - '@types/yargs@17.0.32': - dependencies: - '@types/yargs-parser': 21.0.3 - - '@vitest/expect@2.0.3': - dependencies: - '@vitest/spy': 2.0.3 - '@vitest/utils': 2.0.3 - chai: 5.1.1 - tinyrainbow: 1.2.0 - - '@vitest/pretty-format@2.0.3': - dependencies: - tinyrainbow: 1.2.0 - - '@vitest/runner@2.0.3': - dependencies: - '@vitest/utils': 2.0.3 - pathe: 1.1.2 - - '@vitest/snapshot@2.0.3': - dependencies: - '@vitest/pretty-format': 2.0.3 - magic-string: 0.30.10 - pathe: 1.1.2 - - '@vitest/spy@2.0.3': - dependencies: - tinyspy: 3.0.0 - - '@vitest/utils@2.0.3': - dependencies: - '@vitest/pretty-format': 2.0.3 - estree-walker: 3.0.3 - loupe: 3.1.1 - tinyrainbow: 1.2.0 - - acorn-walk@8.3.3: - dependencies: - acorn: 8.12.1 - optional: true - - acorn@8.12.1: - optional: true - - ansi-escapes@4.3.2: - dependencies: - type-fest: 0.21.3 - - ansi-regex@5.0.1: {} - - ansi-styles@3.2.1: - dependencies: - color-convert: 1.9.3 - - ansi-styles@4.3.0: - dependencies: - color-convert: 2.0.1 - - ansi-styles@5.2.0: {} - - anymatch@3.1.3: - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - - arg@4.1.3: - optional: true - - argparse@1.0.10: - dependencies: - sprintf-js: 1.0.3 - - assertion-error@2.0.1: {} - - asynckit@0.4.0: {} - - axios@1.6.0: - dependencies: - follow-redirects: 1.15.6 - form-data: 4.0.0 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - - babel-jest@29.7.0(@babel/core@7.24.9): - dependencies: - '@babel/core': 7.24.9 - '@jest/transform': 29.7.0 - '@types/babel__core': 7.20.5 - babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 29.6.3(@babel/core@7.24.9) - chalk: 4.1.2 - graceful-fs: 4.2.11 - slash: 3.0.0 - transitivePeerDependencies: - - supports-color - - babel-plugin-istanbul@6.1.1: - dependencies: - '@babel/helper-plugin-utils': 7.24.8 - '@istanbuljs/load-nyc-config': 1.1.0 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-instrument: 5.2.1 - test-exclude: 6.0.0 - transitivePeerDependencies: - - supports-color - - babel-plugin-jest-hoist@29.6.3: - dependencies: - '@babel/template': 7.24.7 - '@babel/types': 7.24.9 - '@types/babel__core': 7.20.5 - '@types/babel__traverse': 7.20.6 - - babel-preset-current-node-syntax@1.0.1(@babel/core@7.24.9): - dependencies: - '@babel/core': 7.24.9 - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.9) - '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.24.9) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.9) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.9) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.9) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.9) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.24.9) - - babel-preset-jest@29.6.3(@babel/core@7.24.9): - dependencies: - '@babel/core': 7.24.9 - babel-plugin-jest-hoist: 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.24.9) - - balanced-match@1.0.2: {} - - base64-js@1.5.1: {} - - bech32@1.1.4: {} - - bech32@2.0.0: {} - - bn.js@4.12.0: {} - - bn.js@5.2.1: {} - - brace-expansion@1.1.11: - dependencies: - balanced-match: 1.0.2 - concat-map: 0.0.1 - - braces@3.0.3: - dependencies: - fill-range: 7.1.1 - - brorand@1.1.0: {} - - browserslist@4.23.2: - dependencies: - caniuse-lite: 1.0.30001642 - electron-to-chromium: 1.4.829 - node-releases: 2.0.17 - update-browserslist-db: 1.1.0(browserslist@4.23.2) - - bser@2.1.1: - dependencies: - node-int64: 0.4.0 - - buffer-from@1.1.2: {} - - cac@6.7.14: {} - - callsites@3.1.0: {} - - camelcase@5.3.1: {} - - camelcase@6.3.0: {} - - caniuse-lite@1.0.30001642: {} - - chai@5.1.1: - dependencies: - assertion-error: 2.0.1 - check-error: 2.1.1 - deep-eql: 5.0.2 - loupe: 3.1.1 - pathval: 2.0.0 - - chalk@2.4.2: - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - - chalk@4.1.2: - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - - char-regex@1.0.2: {} - - check-error@2.1.1: {} - - ci-info@3.9.0: {} - - cjs-module-lexer@1.3.1: {} - - cliui@8.0.1: - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - - co@4.6.0: {} - - collect-v8-coverage@1.0.2: {} - - color-convert@1.9.3: - dependencies: - color-name: 1.1.3 - - color-convert@2.0.1: - dependencies: - color-name: 1.1.4 - - color-name@1.1.3: {} - - color-name@1.1.4: {} - - combined-stream@1.0.8: - dependencies: - delayed-stream: 1.0.0 - - commander@2.20.3: - optional: true - - concat-map@0.0.1: {} - - convert-source-map@2.0.0: {} - - cosmjs-types@0.9.0: {} - - create-jest@29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)): - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - jest-util: 29.7.0 - prompts: 2.4.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - create-require@1.1.1: - optional: true - - cross-spawn@7.0.3: - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - - debug@4.3.5: - dependencies: - ms: 2.1.2 - - dedent@1.5.3: {} - - deep-eql@5.0.2: {} - - deepmerge@4.3.1: {} - - define-data-property@1.1.4: - dependencies: - es-define-property: 1.0.0 - es-errors: 1.3.0 - gopd: 1.0.1 - - define-properties@1.2.1: - dependencies: - define-data-property: 1.1.4 - has-property-descriptors: 1.0.2 - object-keys: 1.1.1 - - delayed-stream@1.0.0: {} - - detect-newline@3.1.0: {} - - diff-sequences@29.6.3: {} - - diff@4.0.2: - optional: true - - electron-to-chromium@1.4.829: {} - - elliptic@6.5.6: - dependencies: - bn.js: 4.12.0 - brorand: 1.1.0 - hash.js: 1.1.7 - hmac-drbg: 1.0.1 - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - minimalistic-crypto-utils: 1.0.1 - - emittery@0.13.1: {} - - emoji-regex@8.0.0: {} - - error-ex@1.3.2: - dependencies: - is-arrayish: 0.2.1 - - es-define-property@1.0.0: - dependencies: - get-intrinsic: 1.2.4 - - es-errors@1.3.0: {} - - esbuild@0.21.5: - optionalDependencies: - '@esbuild/aix-ppc64': 0.21.5 - '@esbuild/android-arm': 0.21.5 - '@esbuild/android-arm64': 0.21.5 - '@esbuild/android-x64': 0.21.5 - '@esbuild/darwin-arm64': 0.21.5 - '@esbuild/darwin-x64': 0.21.5 - '@esbuild/freebsd-arm64': 0.21.5 - '@esbuild/freebsd-x64': 0.21.5 - '@esbuild/linux-arm': 0.21.5 - '@esbuild/linux-arm64': 0.21.5 - '@esbuild/linux-ia32': 0.21.5 - '@esbuild/linux-loong64': 0.21.5 - '@esbuild/linux-mips64el': 0.21.5 - '@esbuild/linux-ppc64': 0.21.5 - '@esbuild/linux-riscv64': 0.21.5 - '@esbuild/linux-s390x': 0.21.5 - '@esbuild/linux-x64': 0.21.5 - '@esbuild/netbsd-x64': 0.21.5 - '@esbuild/openbsd-x64': 0.21.5 - '@esbuild/sunos-x64': 0.21.5 - '@esbuild/win32-arm64': 0.21.5 - '@esbuild/win32-ia32': 0.21.5 - '@esbuild/win32-x64': 0.21.5 - - escalade@3.1.2: {} - - escape-string-regexp@1.0.5: {} - - escape-string-regexp@2.0.0: {} - - esprima@4.0.1: {} - - estree-walker@3.0.3: - dependencies: - '@types/estree': 1.0.5 - - execa@5.1.1: - dependencies: - cross-spawn: 7.0.3 - get-stream: 6.0.1 - human-signals: 2.1.0 - is-stream: 2.0.1 - merge-stream: 2.0.0 - npm-run-path: 4.0.1 - onetime: 5.1.2 - signal-exit: 3.0.7 - strip-final-newline: 2.0.0 - - execa@8.0.1: - dependencies: - cross-spawn: 7.0.3 - get-stream: 8.0.1 - human-signals: 5.0.0 - is-stream: 3.0.0 - merge-stream: 2.0.0 - npm-run-path: 5.3.0 - onetime: 6.0.0 - signal-exit: 4.1.0 - strip-final-newline: 3.0.0 - - exit@0.1.2: {} - - expect@29.7.0: - dependencies: - '@jest/expect-utils': 29.7.0 - jest-get-type: 29.6.3 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - - fast-json-stable-stringify@2.1.0: {} - - fb-watchman@2.0.2: - dependencies: - bser: 2.1.1 - - fill-range@7.1.1: - dependencies: - to-regex-range: 5.0.1 - - find-up@4.1.0: - dependencies: - locate-path: 5.0.0 - path-exists: 4.0.0 - - follow-redirects@1.15.6: {} - - form-data@4.0.0: - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - - fs.realpath@1.0.0: {} - - fsevents@2.3.3: - optional: true - - function-bind@1.1.2: {} - - gensync@1.0.0-beta.2: {} - - get-caller-file@2.0.5: {} - - get-func-name@2.0.2: {} - - get-intrinsic@1.2.4: - dependencies: - es-errors: 1.3.0 - function-bind: 1.1.2 - has-proto: 1.0.3 - has-symbols: 1.0.3 - hasown: 2.0.2 - - get-package-type@0.1.0: {} - - get-stream@6.0.1: {} - - get-stream@8.0.1: {} - - glob@7.2.3: - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - - globals@11.12.0: {} - - globalthis@1.0.4: - dependencies: - define-properties: 1.2.1 - gopd: 1.0.1 - - gopd@1.0.1: - dependencies: - get-intrinsic: 1.2.4 - - graceful-fs@4.2.11: {} - - has-flag@3.0.0: {} - - has-flag@4.0.0: {} - - has-property-descriptors@1.0.2: - dependencies: - es-define-property: 1.0.0 - - has-proto@1.0.3: {} - - has-symbols@1.0.3: {} - - hash.js@1.1.7: - dependencies: - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - - hasown@2.0.2: - dependencies: - function-bind: 1.1.2 - - hmac-drbg@1.0.1: - dependencies: - hash.js: 1.1.7 - minimalistic-assert: 1.0.1 - minimalistic-crypto-utils: 1.0.1 - - html-escaper@2.0.2: {} - - human-signals@2.1.0: {} - - human-signals@5.0.0: {} - - import-local@3.1.0: - dependencies: - pkg-dir: 4.2.0 - resolve-cwd: 3.0.0 - - imurmurhash@0.1.4: {} - - inflight@1.0.6: - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - - inherits@2.0.4: {} - - is-arrayish@0.2.1: {} - - is-core-module@2.14.0: - dependencies: - hasown: 2.0.2 - - is-fullwidth-code-point@3.0.0: {} - - is-generator-fn@2.1.0: {} - - is-number@7.0.0: {} - - is-stream@2.0.1: {} - - is-stream@3.0.0: {} - - isexe@2.0.0: {} - - isomorphic-ws@4.0.1(ws@7.5.10): - dependencies: - ws: 7.5.10 - - istanbul-lib-coverage@3.2.2: {} - - istanbul-lib-instrument@5.2.1: - dependencies: - '@babel/core': 7.24.9 - '@babel/parser': 7.24.8 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.2 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - - istanbul-lib-instrument@6.0.3: - dependencies: - '@babel/core': 7.24.9 - '@babel/parser': 7.24.8 - '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.2 - semver: 7.6.3 - transitivePeerDependencies: - - supports-color - - istanbul-lib-report@3.0.1: - dependencies: - istanbul-lib-coverage: 3.2.2 - make-dir: 4.0.0 - supports-color: 7.2.0 - - istanbul-lib-source-maps@4.0.1: - dependencies: - debug: 4.3.5 - istanbul-lib-coverage: 3.2.2 - source-map: 0.6.1 - transitivePeerDependencies: - - supports-color - - istanbul-reports@3.1.7: - dependencies: - html-escaper: 2.0.2 - istanbul-lib-report: 3.0.1 - - jest-changed-files@29.7.0: - dependencies: - execa: 5.1.1 - jest-util: 29.7.0 - p-limit: 3.1.0 - - jest-circus@29.7.0: - dependencies: - '@jest/environment': 29.7.0 - '@jest/expect': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - chalk: 4.1.2 - co: 4.6.0 - dedent: 1.5.3 - is-generator-fn: 2.1.0 - jest-each: 29.7.0 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - p-limit: 3.1.0 - pretty-format: 29.7.0 - pure-rand: 6.1.0 - slash: 3.0.0 - stack-utils: 2.0.6 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - jest-cli@29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)): - dependencies: - '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - exit: 0.1.2 - import-local: 3.1.0 - jest-config: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - jest-util: 29.7.0 - jest-validate: 29.7.0 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - jest-config@29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)): - dependencies: - '@babel/core': 7.24.9 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.24.9) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0 - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.7 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 20.14.11 - ts-node: 10.9.2(@types/node@20.14.11)(typescript@5.5.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - jest-diff@29.7.0: - dependencies: - chalk: 4.1.2 - diff-sequences: 29.6.3 - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - - jest-docblock@29.7.0: - dependencies: - detect-newline: 3.1.0 - - jest-each@29.7.0: - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - jest-get-type: 29.6.3 - jest-util: 29.7.0 - pretty-format: 29.7.0 - - jest-environment-node@29.7.0: - dependencies: - '@jest/environment': 29.7.0 - '@jest/fake-timers': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - jest-mock: 29.7.0 - jest-util: 29.7.0 - - jest-get-type@29.6.3: {} - - jest-haste-map@29.7.0: - dependencies: - '@jest/types': 29.6.3 - '@types/graceful-fs': 4.1.9 - '@types/node': 20.14.11 - anymatch: 3.1.3 - fb-watchman: 2.0.2 - graceful-fs: 4.2.11 - jest-regex-util: 29.6.3 - jest-util: 29.7.0 - jest-worker: 29.7.0 - micromatch: 4.0.7 - walker: 1.0.8 - optionalDependencies: - fsevents: 2.3.3 - - jest-leak-detector@29.7.0: - dependencies: - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - - jest-matcher-utils@29.7.0: - dependencies: - chalk: 4.1.2 - jest-diff: 29.7.0 - jest-get-type: 29.6.3 - pretty-format: 29.7.0 - - jest-message-util@29.7.0: - dependencies: - '@babel/code-frame': 7.24.7 - '@jest/types': 29.6.3 - '@types/stack-utils': 2.0.3 - chalk: 4.1.2 - graceful-fs: 4.2.11 - micromatch: 4.0.7 - pretty-format: 29.7.0 - slash: 3.0.0 - stack-utils: 2.0.6 - - jest-mock@29.7.0: - dependencies: - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - jest-util: 29.7.0 - - jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): - optionalDependencies: - jest-resolve: 29.7.0 - - jest-regex-util@29.6.3: {} - - jest-resolve-dependencies@29.7.0: - dependencies: - jest-regex-util: 29.6.3 - jest-snapshot: 29.7.0 - transitivePeerDependencies: - - supports-color - - jest-resolve@29.7.0: - dependencies: - chalk: 4.1.2 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - jest-pnp-resolver: 1.2.3(jest-resolve@29.7.0) - jest-util: 29.7.0 - jest-validate: 29.7.0 - resolve: 1.22.8 - resolve.exports: 2.0.2 - slash: 3.0.0 - - jest-runner@29.7.0: - dependencies: - '@jest/console': 29.7.0 - '@jest/environment': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - chalk: 4.1.2 - emittery: 0.13.1 - graceful-fs: 4.2.11 - jest-docblock: 29.7.0 - jest-environment-node: 29.7.0 - jest-haste-map: 29.7.0 - jest-leak-detector: 29.7.0 - jest-message-util: 29.7.0 - jest-resolve: 29.7.0 - jest-runtime: 29.7.0 - jest-util: 29.7.0 - jest-watcher: 29.7.0 - jest-worker: 29.7.0 - p-limit: 3.1.0 - source-map-support: 0.5.13 - transitivePeerDependencies: - - supports-color - - jest-runtime@29.7.0: - dependencies: - '@jest/environment': 29.7.0 - '@jest/fake-timers': 29.7.0 - '@jest/globals': 29.7.0 - '@jest/source-map': 29.6.3 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - chalk: 4.1.2 - cjs-module-lexer: 1.3.1 - collect-v8-coverage: 1.0.2 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-mock: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - slash: 3.0.0 - strip-bom: 4.0.0 - transitivePeerDependencies: - - supports-color - - jest-snapshot@29.7.0: - dependencies: - '@babel/core': 7.24.9 - '@babel/generator': 7.24.10 - '@babel/plugin-syntax-jsx': 7.24.7(@babel/core@7.24.9) - '@babel/plugin-syntax-typescript': 7.24.7(@babel/core@7.24.9) - '@babel/types': 7.24.9 - '@jest/expect-utils': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.24.9) - chalk: 4.1.2 - expect: 29.7.0 - graceful-fs: 4.2.11 - jest-diff: 29.7.0 - jest-get-type: 29.6.3 - jest-matcher-utils: 29.7.0 - jest-message-util: 29.7.0 - jest-util: 29.7.0 - natural-compare: 1.4.0 - pretty-format: 29.7.0 - semver: 7.6.3 - transitivePeerDependencies: - - supports-color - - jest-util@29.7.0: - dependencies: - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - chalk: 4.1.2 - ci-info: 3.9.0 - graceful-fs: 4.2.11 - picomatch: 2.3.1 - - jest-validate@29.7.0: - dependencies: - '@jest/types': 29.6.3 - camelcase: 6.3.0 - chalk: 4.1.2 - jest-get-type: 29.6.3 - leven: 3.1.0 - pretty-format: 29.7.0 - - jest-watcher@29.7.0: - dependencies: - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.14.11 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - emittery: 0.13.1 - jest-util: 29.7.0 - string-length: 4.0.2 - - jest-worker@29.7.0: - dependencies: - '@types/node': 20.14.11 - jest-util: 29.7.0 - merge-stream: 2.0.0 - supports-color: 8.1.1 - - jest@29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)): - dependencies: - '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - '@jest/types': 29.6.3 - import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@20.14.11)(ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3)) - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - js-tokens@4.0.0: {} - - js-yaml@3.14.1: - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - - jsesc@2.5.2: {} - - json-parse-even-better-errors@2.3.1: {} - - json5@2.2.3: {} - - kleur@3.0.3: {} - - leven@3.1.0: {} - - libsodium-sumo@0.7.14: {} - - libsodium-wrappers-sumo@0.7.14: - dependencies: - libsodium-sumo: 0.7.14 - - lines-and-columns@1.2.4: {} - - locate-path@5.0.0: - dependencies: - p-locate: 4.1.0 - - long@4.0.0: {} - - loupe@3.1.1: - dependencies: - get-func-name: 2.0.2 - - lru-cache@5.1.1: - dependencies: - yallist: 3.1.1 - - magic-string@0.30.10: - dependencies: - '@jridgewell/sourcemap-codec': 1.5.0 - - make-dir@4.0.0: - dependencies: - semver: 7.6.3 - - make-error@1.3.6: - optional: true - - makeerror@1.0.12: - dependencies: - tmpl: 1.0.5 - - merge-stream@2.0.0: {} - - micromatch@4.0.7: - dependencies: - braces: 3.0.3 - picomatch: 2.3.1 - - mime-db@1.52.0: {} - - mime-types@2.1.35: - dependencies: - mime-db: 1.52.0 - - mimic-fn@2.1.0: {} - - mimic-fn@4.0.0: {} - - minimalistic-assert@1.0.1: {} - - minimalistic-crypto-utils@1.0.1: {} - - minimatch@3.1.2: - dependencies: - brace-expansion: 1.1.11 - - ms@2.1.2: {} - - nanoid@3.3.7: {} - - natural-compare@1.4.0: {} - - node-int64@0.4.0: {} - - node-releases@2.0.17: {} - - normalize-path@3.0.0: {} - - npm-run-path@4.0.1: - dependencies: - path-key: 3.1.1 - - npm-run-path@5.3.0: - dependencies: - path-key: 4.0.0 - - object-keys@1.1.1: {} - - once@1.4.0: - dependencies: - wrappy: 1.0.2 - - onetime@5.1.2: - dependencies: - mimic-fn: 2.1.0 - - onetime@6.0.0: - dependencies: - mimic-fn: 4.0.0 - - p-limit@2.3.0: - dependencies: - p-try: 2.2.0 - - p-limit@3.1.0: - dependencies: - yocto-queue: 0.1.0 - - p-locate@4.1.0: - dependencies: - p-limit: 2.3.0 - - p-try@2.2.0: {} - - parse-json@5.2.0: - dependencies: - '@babel/code-frame': 7.24.7 - error-ex: 1.3.2 - json-parse-even-better-errors: 2.3.1 - lines-and-columns: 1.2.4 - - path-exists@4.0.0: {} - - path-is-absolute@1.0.1: {} - - path-key@3.1.1: {} - - path-key@4.0.0: {} - - path-parse@1.0.7: {} - - pathe@1.1.2: {} - - pathval@2.0.0: {} - - picocolors@1.0.1: {} - - picomatch@2.3.1: {} - - pirates@4.0.6: {} - - pkg-dir@4.2.0: - dependencies: - find-up: 4.1.0 - - postcss@8.4.39: - dependencies: - nanoid: 3.3.7 - picocolors: 1.0.1 - source-map-js: 1.2.0 - - prettier@3.3.3: {} - - pretty-format@29.7.0: - dependencies: - '@jest/schemas': 29.6.3 - ansi-styles: 5.2.0 - react-is: 18.3.1 - - prompts@2.4.2: - dependencies: - kleur: 3.0.3 - sisteransi: 1.0.5 - - protobufjs@6.11.4: - dependencies: - '@protobufjs/aspromise': 1.1.2 - '@protobufjs/base64': 1.1.2 - '@protobufjs/codegen': 2.0.4 - '@protobufjs/eventemitter': 1.1.0 - '@protobufjs/fetch': 1.1.0 - '@protobufjs/float': 1.0.2 - '@protobufjs/inquire': 1.1.0 - '@protobufjs/path': 1.1.2 - '@protobufjs/pool': 1.1.0 - '@protobufjs/utf8': 1.1.0 - '@types/long': 4.0.2 - '@types/node': 20.14.11 - long: 4.0.0 - - proxy-from-env@1.1.0: {} - - pure-rand@6.1.0: {} - - react-is@18.3.1: {} - - readonly-date@1.0.0: {} - - regenerator-runtime@0.14.1: {} - - require-directory@2.1.1: {} - - resolve-cwd@3.0.0: - dependencies: - resolve-from: 5.0.0 - - resolve-from@5.0.0: {} - - resolve.exports@2.0.2: {} - - resolve@1.22.8: - dependencies: - is-core-module: 2.14.0 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - - rollup@4.18.1: - dependencies: - '@types/estree': 1.0.5 - optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.18.1 - '@rollup/rollup-android-arm64': 4.18.1 - '@rollup/rollup-darwin-arm64': 4.18.1 - '@rollup/rollup-darwin-x64': 4.18.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.18.1 - '@rollup/rollup-linux-arm-musleabihf': 4.18.1 - '@rollup/rollup-linux-arm64-gnu': 4.18.1 - '@rollup/rollup-linux-arm64-musl': 4.18.1 - '@rollup/rollup-linux-powerpc64le-gnu': 4.18.1 - '@rollup/rollup-linux-riscv64-gnu': 4.18.1 - '@rollup/rollup-linux-s390x-gnu': 4.18.1 - '@rollup/rollup-linux-x64-gnu': 4.18.1 - '@rollup/rollup-linux-x64-musl': 4.18.1 - '@rollup/rollup-win32-arm64-msvc': 4.18.1 - '@rollup/rollup-win32-ia32-msvc': 4.18.1 - '@rollup/rollup-win32-x64-msvc': 4.18.1 - fsevents: 2.3.3 - - semver@6.3.1: {} - - semver@7.6.3: {} - - shebang-command@2.0.0: - dependencies: - shebang-regex: 3.0.0 - - shebang-regex@3.0.0: {} - - siginfo@2.0.0: {} - - signal-exit@3.0.7: {} - - signal-exit@4.1.0: {} - - sisteransi@1.0.5: {} - - slash@3.0.0: {} - - source-map-js@1.2.0: {} - - source-map-support@0.5.13: - dependencies: - buffer-from: 1.1.2 - source-map: 0.6.1 - - source-map-support@0.5.21: - dependencies: - buffer-from: 1.1.2 - source-map: 0.6.1 - optional: true - - source-map@0.6.1: {} - - sprintf-js@1.0.3: {} - - stack-utils@2.0.6: - dependencies: - escape-string-regexp: 2.0.0 - - stackback@0.0.2: {} - - std-env@3.7.0: {} - - stridejs@https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e17c404f6451bad95ef0093f2b41244248bd7ebd: - dependencies: - '@babel/runtime': 7.24.8 - '@cosmjs/amino': 0.32.4 - '@cosmjs/encoding': 0.32.4 - '@cosmjs/math': 0.32.4 - '@cosmjs/proto-signing': 0.32.4 - '@cosmjs/stargate': 0.32.4 - '@cosmjs/tendermint-rpc': 0.32.4 - '@cosmjs/utils': 0.32.4 - '@cosmology/lcd': 0.13.4 - '@noble/hashes': 1.4.0 - bech32: 2.0.0 - cosmjs-types: 0.9.0 - transitivePeerDependencies: - - bufferutil - - debug - - utf-8-validate - - string-length@4.0.2: - dependencies: - char-regex: 1.0.2 - strip-ansi: 6.0.1 - - string-width@4.2.3: - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.1 - - strip-ansi@6.0.1: - dependencies: - ansi-regex: 5.0.1 - - strip-bom@4.0.0: {} - - strip-final-newline@2.0.0: {} - - strip-final-newline@3.0.0: {} - - strip-json-comments@3.1.1: {} - - supports-color@5.5.0: - dependencies: - has-flag: 3.0.0 - - supports-color@7.2.0: - dependencies: - has-flag: 4.0.0 - - supports-color@8.1.1: - dependencies: - has-flag: 4.0.0 - - supports-preserve-symlinks-flag@1.0.0: {} - - symbol-observable@2.0.3: {} - - terser@5.31.3: - dependencies: - '@jridgewell/source-map': 0.3.6 - acorn: 8.12.1 - commander: 2.20.3 - source-map-support: 0.5.21 - optional: true - - test-exclude@6.0.0: - dependencies: - '@istanbuljs/schema': 0.1.3 - glob: 7.2.3 - minimatch: 3.1.2 - - tinybench@2.8.0: {} - - tinypool@1.0.0: {} - - tinyrainbow@1.2.0: {} - - tinyspy@3.0.0: {} - - tmpl@1.0.5: {} - - to-fast-properties@2.0.0: {} - - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 - - ts-node@10.9.2(@types/node@20.14.11)(typescript@5.5.3): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 20.14.11 - acorn: 8.12.1 - acorn-walk: 8.3.3 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.5.3 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - optional: true - - type-detect@4.0.8: {} - - type-fest@0.21.3: {} - - typescript@5.5.3: {} - - undici-types@5.26.5: {} - - update-browserslist-db@1.1.0(browserslist@4.23.2): - dependencies: - browserslist: 4.23.2 - escalade: 3.1.2 - picocolors: 1.0.1 - - v8-compile-cache-lib@3.0.1: - optional: true - - v8-to-istanbul@9.3.0: - dependencies: - '@jridgewell/trace-mapping': 0.3.25 - '@types/istanbul-lib-coverage': 2.0.6 - convert-source-map: 2.0.0 - - vite-node@2.0.3(@types/node@20.14.11)(terser@5.31.3): - dependencies: - cac: 6.7.14 - debug: 4.3.5 - pathe: 1.1.2 - tinyrainbow: 1.2.0 - vite: 5.3.4(@types/node@20.14.11)(terser@5.31.3) - transitivePeerDependencies: - - '@types/node' - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - - vite@5.3.4(@types/node@20.14.11)(terser@5.31.3): - dependencies: - esbuild: 0.21.5 - postcss: 8.4.39 - rollup: 4.18.1 - optionalDependencies: - '@types/node': 20.14.11 - fsevents: 2.3.3 - terser: 5.31.3 - - vitest@2.0.3(@types/node@20.14.11)(terser@5.31.3): - dependencies: - '@ampproject/remapping': 2.3.0 - '@vitest/expect': 2.0.3 - '@vitest/pretty-format': 2.0.3 - '@vitest/runner': 2.0.3 - '@vitest/snapshot': 2.0.3 - '@vitest/spy': 2.0.3 - '@vitest/utils': 2.0.3 - chai: 5.1.1 - debug: 4.3.5 - execa: 8.0.1 - magic-string: 0.30.10 - pathe: 1.1.2 - std-env: 3.7.0 - tinybench: 2.8.0 - tinypool: 1.0.0 - tinyrainbow: 1.2.0 - vite: 5.3.4(@types/node@20.14.11)(terser@5.31.3) - vite-node: 2.0.3(@types/node@20.14.11)(terser@5.31.3) - why-is-node-running: 2.3.0 - optionalDependencies: - '@types/node': 20.14.11 - transitivePeerDependencies: - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - - walker@1.0.8: - dependencies: - makeerror: 1.0.12 - - which@2.0.2: - dependencies: - isexe: 2.0.0 - - why-is-node-running@2.3.0: - dependencies: - siginfo: 2.0.0 - stackback: 0.0.2 - - wrap-ansi@7.0.0: - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - - wrappy@1.0.2: {} - - write-file-atomic@4.0.2: - dependencies: - imurmurhash: 0.1.4 - signal-exit: 3.0.7 - - ws@7.5.10: {} - - xstream@11.14.0: - dependencies: - globalthis: 1.0.4 - symbol-observable: 2.0.3 - - y18n@5.0.8: {} - - yallist@3.1.1: {} - - yargs-parser@21.1.1: {} - - yargs@17.7.2: - dependencies: - cliui: 8.0.1 - escalade: 3.1.2 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 21.1.1 - - yn@3.1.1: - optional: true - - yocto-queue@0.1.0: {} diff --git a/dockernet/ts-tests/test/main.test.ts b/dockernet/ts-tests/test/main.test.ts deleted file mode 100644 index 8bc47e4ea5..0000000000 --- a/dockernet/ts-tests/test/main.test.ts +++ /dev/null @@ -1,267 +0,0 @@ -import { Secp256k1HdWallet } from "@cosmjs/amino"; -import { GasPrice } from "@cosmjs/stargate"; -import { fromSeconds } from "@cosmjs/tendermint-rpc"; -import { - coinFromString, - convertBech32Prefix, - decToString, - StrideClient, -} from "stridejs"; -import { beforeAll, describe, expect, test } from "vitest"; -import { waitForChain } from "./utils"; - -const RPC_ENDPOINT = "http://localhost:26657"; -const HUB_RPC_ENDPOINT = "http://localhost:26557"; - -let accounts: { - user: StrideClient; // a normal account loaded with 100 STRD - admin: StrideClient; // the stride admin account loaded with 1000 STRD - val1: StrideClient; - val2: StrideClient; - val3: StrideClient; -}; - -let gaiaAccounts: { - user: StrideClient; // a normal account loaded with 100 ATOM -}; - -// init accounts and wait for chain to start -beforeAll(async () => { - console.log("setting up accounts..."); - - const mnemonics: { - name: "user" | "admin" | "val1" | "val2" | "val3"; - mnemonic: string; - }[] = [ - { - name: "user", - mnemonic: - "brief play describe burden half aim soccer carbon hope wait output play vacuum joke energy crucial output mimic cruise brother document rail anger leaf", - }, - { - name: "admin", - mnemonic: - "tone cause tribe this switch near host damage idle fragile antique tail soda alien depth write wool they rapid unfold body scan pledge soft", - }, - { - name: "val1", - mnemonic: - "close soup mirror crew erode defy knock trigger gather eyebrow tent farm gym gloom base lemon sleep weekend rich forget diagram hurt prize fly", - }, - { - name: "val2", - mnemonic: - "turkey miss hurry unable embark hospital kangaroo nuclear outside term toy fall buffalo book opinion such moral meadow wing olive camp sad metal banner", - }, - { - name: "val3", - mnemonic: - "tenant neck ask season exist hill churn rice convince shock modify evidence armor track army street stay light program harvest now settle feed wheat", - }, - ]; - - // @ts-expect-error - // init accounts as an empty object, then add the accounts in the loop - accounts = {}; - for (const { name, mnemonic } of mnemonics) { - // setup signer - // - // IMPORTANT: we're using Secp256k1HdWallet from @cosmjs/amino because sending amino txs tests both amino and direct. - // that's because the tx contains the direct encoding anyway, and also attaches a signature on the amino encoding. - // the mempool then converts from direct to amino to verify the signature. - // therefore if the signature verification passes, we can be sure that both amino and direct are supported. - const signer = await Secp256k1HdWallet.fromMnemonic(mnemonic, { - prefix: "stride", - }); - - // get signer address - const [{ address }] = await signer.getAccounts(); - - accounts[name] = await StrideClient.create(RPC_ENDPOINT, signer, address, { - gasPrice: GasPrice.fromString("0.025ustrd"), - broadcastPollIntervalMs: 50, - resolveIbcResponsesCheckIntervalMs: 50, - }); - - if (name === "user") { - const signer = await Secp256k1HdWallet.fromMnemonic(mnemonic); - - // get signer address - const [{ address }] = await signer.getAccounts(); - - gaiaAccounts = { - user: await StrideClient.create(HUB_RPC_ENDPOINT, signer, address, { - gasPrice: GasPrice.fromString("0.025uatom"), - broadcastPollIntervalMs: 50, - resolveIbcResponsesCheckIntervalMs: 50, - }), - }; - } - } - console.log("waiting for stride to start..."); - await waitForChain(accounts.user, "ustrd"); - - console.log("waiting for gaia to start..."); - await waitForChain(gaiaAccounts.user, "uatom"); -}); - -// time variables in seconds -const now = () => Math.floor(Date.now() / 1000); -const minute = 60; -const hour = 60 * minute; -const day = 24 * hour; - -describe("x/airdrop", () => { - test("MsgCreateAirdrop", async () => { - const stridejs = accounts.admin; - - const nowSec = now(); - const airdropId = String(nowSec); - - const msg = - stridejs.types.stride.airdrop.MessageComposer.withTypeUrl.createAirdrop({ - admin: stridejs.address, - airdropId: airdropId, - rewardDenom: "ustrd", - distributionStartDate: fromSeconds(now()), - distributionEndDate: fromSeconds(nowSec + 3 * day), - clawbackDate: fromSeconds(nowSec + 4 * day), - claimTypeDeadlineDate: fromSeconds(nowSec + 2 * day), - earlyClaimPenalty: decToString(0.5), - allocatorAddress: stridejs.address, - distributorAddress: stridejs.address, - linkerAddress: stridejs.address, - }); - - const tx = await stridejs.signAndBroadcast([msg], 2); - - if (tx.code !== 0) { - console.error(tx.rawLog); - } - expect(tx.code).toBe(0); - - const { airdrop } = await stridejs.query.stride.airdrop.airdrop({ - id: airdropId, - }); - - expect(airdrop!.id).toBe(airdropId); - expect(airdrop!.earlyClaimPenalty).toBe("0.5"); - }); -}); - -describe("ibc", () => { - test("MsgTransfer", async () => { - const stridejs = accounts.user; - - const msg = - stridejs.types.ibc.applications.transfer.v1.MessageComposer.withTypeUrl.transfer( - { - sourcePort: "transfer", - sourceChannel: "channel-0", - token: coinFromString("1ustrd"), - sender: stridejs.address, - receiver: convertBech32Prefix(stridejs.address, "cosmos"), - timeoutHeight: { - revisionNumber: 0n, - revisionHeight: 0n, - }, - timeoutTimestamp: BigInt( - `${Math.floor(Date.now() / 1000) + 3 * 60}000000000`, // 3 minutes - ), - memo: "", - }, - ); - - const tx = await stridejs.signAndBroadcast([msg], 2); - if (tx.code !== 0) { - console.error(tx.rawLog); - } - expect(tx.code).toBe(0); - - const ibcAck = await tx.ibcResponses[0]; - expect(ibcAck.type).toBe("ack"); - expect(ibcAck.tx.code).toBe(0); - }, 30_000); -}); - -describe("x/stakeibc", () => { - test("batch undelegation happy path", async () => { - const strideClient = accounts.user; - const gaiaClient = gaiaAccounts.user; - - // get stATOM balance before - let { balances } = await strideClient.query.cosmos.bank.v1beta1.allBalances( - { - address: strideClient.address, - }, - ); - - const stAtomBalanceBefore = balances.find( - (coin) => coin.denom === "stuatom", - )?.amount; - - // get Gaia redemption rate - const { - hostZone: { redemptionRate }, - } = await strideClient.query.stride.stakeibc.hostZone({ - chainId: "GAIA", - }); - - // on Gaia, send ATOM to Stride and use autopilot to liquid stake - const amount = 1_000_000; - - let msg = - gaiaClient.types.ibc.applications.transfer.v1.MessageComposer.withTypeUrl.transfer( - { - sourcePort: "transfer", - sourceChannel: "channel-0", - token: coinFromString(`${amount}uatom`), - sender: gaiaClient.address, - receiver: JSON.stringify({ - autopilot: { - stakeibc: { - stride_address: strideClient.address, - action: "LiquidStake", - }, - receiver: strideClient.address, - }, - }), - timeoutHeight: { - revisionNumber: 0n, - revisionHeight: 0n, - }, - timeoutTimestamp: BigInt( - `${Math.floor(Date.now() / 1000) + 3 * 60}000000000`, // 3 minutes - ), - memo: "", - }, - ); - - let tx = await gaiaClient.signAndBroadcast([msg], 2); - if (tx.code !== 0) { - console.error(tx.rawLog); - } - expect(tx.code).toBe(0); - - // on Gaia, wait for the ibc ack - const ibcAck = await tx.ibcResponses[0]; - expect(ibcAck.type).toBe("ack"); - expect(ibcAck.tx.code).toBe(0); - - // get stATOM balance after - ({ balances } = await strideClient.query.cosmos.bank.v1beta1.allBalances({ - address: strideClient.address, - })); - - const stAtomBalanceAfter = balances.find( - (coin) => coin.denom === "stuatom", - )?.amount; - - // check expected stAtom balance using expectedStAtomAfter and redemptionRate - const expectedStAtomAfter = - Number(stAtomBalanceBefore ?? 0) + - Math.floor(amount / Number(redemptionRate)); // https://github.com/Stride-Labs/stride/blob/0cb59a10d/x/stakeibc/keeper/msg_server.go#L256 - - expect(Number(stAtomBalanceAfter ?? 0)).toBe(expectedStAtomAfter); - }, 120_000); -}); diff --git a/dockernet/ts-tests/test/utils.ts b/dockernet/ts-tests/test/utils.ts deleted file mode 100644 index 72cffdc598..0000000000 --- a/dockernet/ts-tests/test/utils.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { coinsFromString, StrideClient } from "stridejs"; - -/** - * Waits for the chain to start by continuously sending transactions until . - * - * @param {StrideClient} client The Stride client instance. - * @param {string} denom The denomination of the coins to send. - */ -export async function waitForChain( - client: StrideClient, - denom: string, -): Promise { - // the best way to ensure a chain is up is to successfully send a tx - - while (true) { - try { - const msg = - client.types.cosmos.bank.v1beta1.MessageComposer.withTypeUrl.send({ - fromAddress: client.address, - toAddress: client.address, - amount: coinsFromString(`1${denom}`), - }); - - const tx = await client.signAndBroadcast([msg], 2); - - if (tx.code == 0) { - break; - } - } catch (e) { - // signAndBroadcast might throw if the RPC is not up yet - } - } -} diff --git a/go.mod b/go.mod index 443270cb48..9393ec3113 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( github.com/stretchr/testify v1.10.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 + google.golang.org/protobuf v1.36.1 gopkg.in/yaml.v2 v2.4.0 ) @@ -189,7 +190,6 @@ require ( google.golang.org/api v0.171.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/protobuf v1.36.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect diff --git a/integration-tests/Makefile b/integration-tests/Makefile index 83dbbcf83e..336168ccce 100644 --- a/integration-tests/Makefile +++ b/integration-tests/Makefile @@ -51,11 +51,11 @@ build-api: build-stride: @bash network/scripts/build.sh stride -build-cosmos: - $(call build_and_push_docker,cosmos,.,chains/cosmoshub:v18.1.0) +build-cosmoshub: + $(call build_and_push_docker,cosmoshub,.,chains/cosmoshub:v18.1.0) build-osmosis: - $(call build_and_push_docker,osmosis,.,chains/osmosis:v27.0.0) + $(call build_and_push_docker,osmosis,.,chains/osmosis:v28.0.0) build-relayer: $(call build_and_push_docker,relayer,.,relayer:v2.5.2) diff --git a/dockernet/ts-tests/README.md b/integration-tests/client/README.md similarity index 89% rename from dockernet/ts-tests/README.md rename to integration-tests/client/README.md index d04d6a260a..011fc0faf8 100644 --- a/dockernet/ts-tests/README.md +++ b/integration-tests/client/README.md @@ -1,8 +1,8 @@ ### running the tests ```bash -# build stride locally and run dokcernet -(cd ../.. && make sync && make start-docker build=sgr) +# Start the network in k8s +(cd .. && make start) # install deps pnpm i @@ -23,9 +23,11 @@ IMPORTANT: `@cosmjs/*` dependencies must match the versions used by stridejs. To ### test new protobufs - go to https://github.com/Stride-Labs/stridejs + - remove `/dist` from `.gitignore` - update the config in `scripts/clone_repos.ts` to point to the new `stride/cosmos-sdk/ibc-go` version - run `pnpm i` - run `pnpm codegen` + - run `pnpm build` - run `git commit...` - run `git push` - get the current `stridejs` commit using `git rev-parse HEAD` diff --git a/integration-tests/client/package.json b/integration-tests/client/package.json index 3dfef7a28a..1be5379972 100644 --- a/integration-tests/client/package.json +++ b/integration-tests/client/package.json @@ -26,7 +26,7 @@ "bech32": "2.0.0", "jest": "29.7.0", "prettier": "3.3.3", - "stridejs": "github:Stride-Labs/stridejs#e949e35", + "stridejs": "github:Stride-Labs/stridejs#f60d3e2d6c3b0ddbbb5522ccb57a8ae33ee67bfc", "typescript": "5.5.3", "vitest": "2.0.3" }, diff --git a/integration-tests/client/pnpm-lock.yaml b/integration-tests/client/pnpm-lock.yaml index 79354fd853..bfc0093577 100644 --- a/integration-tests/client/pnpm-lock.yaml +++ b/integration-tests/client/pnpm-lock.yaml @@ -42,8 +42,8 @@ importers: specifier: 3.3.3 version: 3.3.3 stridejs: - specifier: github:Stride-Labs/stridejs#e949e35 - version: https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e949e35 + specifier: github:Stride-Labs/stridejs#f60d3e2d6c3b0ddbbb5522ccb57a8ae33ee67bfc + version: https://codeload.github.com/Stride-Labs/stridejs/tar.gz/f60d3e2d6c3b0ddbbb5522ccb57a8ae33ee67bfc typescript: specifier: 5.5.3 version: 5.5.3 @@ -1669,8 +1669,8 @@ packages: std-env@3.7.0: resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} - stridejs@https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e949e35: - resolution: {tarball: https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e949e35} + stridejs@https://codeload.github.com/Stride-Labs/stridejs/tar.gz/f60d3e2d6c3b0ddbbb5522ccb57a8ae33ee67bfc: + resolution: {tarball: https://codeload.github.com/Stride-Labs/stridejs/tar.gz/f60d3e2d6c3b0ddbbb5522ccb57a8ae33ee67bfc} version: 0.11.4 string-length@4.0.2: @@ -3825,7 +3825,7 @@ snapshots: std-env@3.7.0: {} - stridejs@https://codeload.github.com/Stride-Labs/stridejs/tar.gz/e949e35: + stridejs@https://codeload.github.com/Stride-Labs/stridejs/tar.gz/f60d3e2d6c3b0ddbbb5522ccb57a8ae33ee67bfc: dependencies: '@cosmjs/amino': 0.32.4 '@cosmjs/encoding': 0.32.4 diff --git a/integration-tests/client/test/core.test.ts b/integration-tests/client/test/core.test.ts index f6723dc2ae..8351d66d5a 100644 --- a/integration-tests/client/test/core.test.ts +++ b/integration-tests/client/test/core.test.ts @@ -77,7 +77,7 @@ beforeAll(async () => { await waitForChain(accounts.user, "ustrd"); }); -describe("x/stakeibc", () => { +describe.skip("x/stakeibc", () => { test("Registration", async () => { const stridejs = accounts.admin; diff --git a/integration-tests/client/test/main.test.ts b/integration-tests/client/test/main.test.ts index 56e81cf2a3..6a8877ac71 100644 --- a/integration-tests/client/test/main.test.ts +++ b/integration-tests/client/test/main.test.ts @@ -1,17 +1,24 @@ -import { Secp256k1HdWallet } from "@cosmjs/amino"; -import { GasPrice } from "@cosmjs/stargate"; +import { OfflineAminoSigner, Secp256k1HdWallet } from "@cosmjs/amino"; +import { GasPrice, SigningStargateClient } from "@cosmjs/stargate"; import { fromSeconds } from "@cosmjs/tendermint-rpc"; import { coinFromString, convertBech32Prefix, decToString, - sleep, StrideClient, } from "stridejs"; import { beforeAll, describe, expect, test } from "vitest"; import { waitForChain } from "./utils"; -const RPC_ENDPOINT = "http://stride-rpc.internal.stridenet.co"; +const STRIDE_RPC_ENDPOINT = "http://stride-rpc.internal.stridenet.co"; +const GAIA_RPC_ENDPOINT = "http://cosmoshub-rpc.internal.stridenet.co"; +const OSMO_RPC_ENDPOINT = "http://osmosis-rpc.internal.stridenet.co"; + +const TRANSFER_CHANNEL = { + STRIDE: { GAIA: "channel-0", OSMO: "channel-1" }, + GAIA: { STRIDE: "channel-0" }, + OSMO: { STRIDE: "channel-0" }, +}; let accounts: { user: StrideClient; // a normal account loaded with 100 STRD @@ -21,51 +28,69 @@ let accounts: { val3: StrideClient; }; +export type GaiaClient = { + signer: OfflineAminoSigner; + client: SigningStargateClient; +}; + +export function isGaiaClient(client: any): client is GaiaClient { + return ( + "signer" in client && + "getAccounts" in client.signer && + "signAmino" in client.signer && + "client" in client && + client.client instanceof SigningStargateClient + ); +} + +let gaiaAccounts: { + user: GaiaClient; // a normal account loaded with 100 ATOM +}; + +const mnemonics: { + name: "user" | "admin" | "val1" | "val2" | "val3"; + mnemonic: string; +}[] = [ + { + name: "user", + mnemonic: + "brief play describe burden half aim soccer carbon hope wait output play vacuum joke energy crucial output mimic cruise brother document rail anger leaf", + }, + { + name: "admin", + mnemonic: + "tone cause tribe this switch near host damage idle fragile antique tail soda alien depth write wool they rapid unfold body scan pledge soft", + }, + { + name: "val1", + mnemonic: + "close soup mirror crew erode defy knock trigger gather eyebrow tent farm gym gloom base lemon sleep weekend rich forget diagram hurt prize fly", + }, + { + name: "val2", + mnemonic: + "turkey miss hurry unable embark hospital kangaroo nuclear outside term toy fall buffalo book opinion such moral meadow wing olive camp sad metal banner", + }, + { + name: "val3", + mnemonic: + "tenant neck ask season exist hill churn rice convince shock modify evidence armor track army street stay light program harvest now settle feed wheat", + }, +]; + // init accounts and wait for chain to start beforeAll(async () => { console.log("setting up accounts..."); - - const mnemonics: { - name: "user" | "admin" | "val1" | "val2" | "val3"; - mnemonic: string; - }[] = [ - { - name: "user", - mnemonic: - "brief play describe burden half aim soccer carbon hope wait output play vacuum joke energy crucial output mimic cruise brother document rail anger leaf", - }, - { - name: "admin", - mnemonic: - "tone cause tribe this switch near host damage idle fragile antique tail soda alien depth write wool they rapid unfold body scan pledge soft", - }, - { - name: "val1", - mnemonic: - "close soup mirror crew erode defy knock trigger gather eyebrow tent farm gym gloom base lemon sleep weekend rich forget diagram hurt prize fly", - }, - { - name: "val2", - mnemonic: - "turkey miss hurry unable embark hospital kangaroo nuclear outside term toy fall buffalo book opinion such moral meadow wing olive camp sad metal banner", - }, - { - name: "val3", - mnemonic: - "tenant neck ask season exist hill churn rice convince shock modify evidence armor track army street stay light program harvest now settle feed wheat", - }, - ]; - // @ts-expect-error // init accounts as an empty object, then add the accounts in the loop accounts = {}; for (const { name, mnemonic } of mnemonics) { // setup signer // - // IMPORTANT: we're using Secp256k1HdWallet from @cosmjs/amino because sending amino txs tests both amino and direct. - // that's because the tx contains the direct encoding anyway, and also attaches a signature on the amino encoding. - // the mempool then converts from direct to amino to verify the signature. - // therefore if the signature verification passes, we can be sure that both amino and direct are supported. + // IMPORTANT: We're using Secp256k1HdWallet from @cosmjs/amino because sending amino txs tests both amino and direct. + // That's because the tx contains the direct encoding anyway, and also attaches a signature on the amino encoding. + // The mempool then converts from direct to amino to verify the signature. + // Therefore if the signature verification passes, we can be sure that both amino and direct are working properly. const signer = await Secp256k1HdWallet.fromMnemonic(mnemonic, { prefix: "stride", }); @@ -73,15 +98,45 @@ beforeAll(async () => { // get signer address const [{ address }] = await signer.getAccounts(); - accounts[name] = await StrideClient.create(RPC_ENDPOINT, signer, address, { - gasPrice: GasPrice.fromString("0.025ustrd"), - broadcastPollIntervalMs: 50, - resolveIbcResponsesCheckIntervalMs: 50, - }); - } + accounts[name] = await StrideClient.create( + STRIDE_RPC_ENDPOINT, + signer, + address, + { + gasPrice: GasPrice.fromString("0.025ustrd"), + broadcastPollIntervalMs: 50, + resolveIbcResponsesCheckIntervalMs: 50, + }, + ); + + if (name === "user") { + const signer = await Secp256k1HdWallet.fromMnemonic(mnemonic); + // get signer address + const [{ address }] = await signer.getAccounts(); + + gaiaAccounts = { + user: { + signer, + client: await SigningStargateClient.connectWithSigner( + GAIA_RPC_ENDPOINT, + signer, + { + gasPrice: GasPrice.fromString("1.0uatom"), + broadcastPollIntervalMs: 50, + }, + ), + }, + }; + + // TODO osmosisAccount + } + } console.log("waiting for stride to start..."); await waitForChain(accounts.user, "ustrd"); + + console.log("waiting for gaia to start..."); + await waitForChain(gaiaAccounts.user, "uatom"); }); // time variables in seconds @@ -137,7 +192,7 @@ describe("ibc", () => { stridejs.types.ibc.applications.transfer.v1.MessageComposer.withTypeUrl.transfer( { sourcePort: "transfer", - sourceChannel: "channel-0", + sourceChannel: TRANSFER_CHANNEL["STRIDE"]["GAIA"], token: coinFromString("1ustrd"), sender: stridejs.address, receiver: convertBech32Prefix(stridejs.address, "cosmos"), @@ -163,3 +218,92 @@ describe("ibc", () => { expect(ibcAck.tx.code).toBe(0); }, 30_000); }); + +describe("x/icqoracle", () => { + test.only("happy path", async () => { + // - Transfer STRD to Osmosis + // - Transfer ATOM to Osmosis + // - Create STRD/OSMO pool + // - Create ATOM/OSMO pool + // - Add TokenPrice(base=STRD, quote=OSMO) + // - Add TokenPrice(base=ATOM, quote=OSMO) + // - Query for price of ATOM in STRD + + // Transfer STRD to Osmosis + const stridejs = accounts.user; + + const strideTx = await stridejs.signAndBroadcast([ + stridejs.types.ibc.applications.transfer.v1.MessageComposer.withTypeUrl.transfer( + { + sourcePort: "transfer", + sourceChannel: TRANSFER_CHANNEL["STRIDE"]["OSMO"], + token: coinFromString("1000000ustrd"), + sender: stridejs.address, + receiver: convertBech32Prefix(stridejs.address, "osmo"), + timeoutHeight: { + revisionNumber: 0n, + revisionHeight: 0n, + }, + timeoutTimestamp: BigInt( + `${Math.floor(Date.now() / 1000) + 3 * 60}000000000`, // 3 minutes + ), + memo: "", + }, + ), + ]); + if (strideTx.code !== 0) { + console.error(strideTx.rawLog); + } + expect(strideTx.code).toBe(0); + + const ibcAck = await strideTx.ibcResponses[0]; + expect(ibcAck.type).toBe("ack"); + expect(ibcAck.tx.code).toBe(0); + + // Transfer ATOM to Osmosis + const gaiajs = gaiaAccounts.user; + + const [{ address: gaiaAddress }] = await gaiajs.signer.getAccounts(); + + const gaiaTx = await gaiajs.client.signAndBroadcast( + gaiaAddress, + [ + { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: { + sourcePort: "transfer", + sourceChannel: TRANSFER_CHANNEL["GAIA"]["STRIDE"], + token: coinFromString("1000000uatom"), + sender: gaiaAddress, + receiver: convertBech32Prefix(gaiaAddress, "stride"), // needs to be valid but ignored by pfm + timeoutHeight: { + revisionNumber: 0n, + revisionHeight: 0n, + }, + timeoutTimestamp: BigInt( + `${Math.floor(Date.now() / 1000) + 3 * 60}000000000`, // 3 minutes + ), + memo: JSON.stringify({ + forward: { + receiver: convertBech32Prefix(gaiaAddress, "osmo"), + port: "transfer", + channel: TRANSFER_CHANNEL["STRIDE"]["OSMO"], + }, + }), + }, + }, + ], + "auto", + ); + + if (gaiaTx.code !== 0) { + console.error(gaiaTx.rawLog); + } + expect(gaiaTx.code).toBe(0); + + // // packet forward should resolve only after the final destination is acked + // ibcAck = await tx.ibcResponses[0]; + // expect(ibcAck.type).toBe("ack"); + // expect(ibcAck.tx.code).toBe(0); + }, 120_000); +}); diff --git a/integration-tests/client/test/utils.ts b/integration-tests/client/test/utils.ts index af7608e827..80761c7914 100644 --- a/integration-tests/client/test/utils.ts +++ b/integration-tests/client/test/utils.ts @@ -1,5 +1,7 @@ +import { SigningStargateClient } from "@cosmjs/stargate"; import { coinsFromString, EncodeObject, StrideClient } from "stridejs"; import { expect } from "vitest"; +import { GaiaClient, isGaiaClient } from "./main.test"; /** * Waits for the chain to start by continuously sending transactions until . @@ -8,27 +10,43 @@ import { expect } from "vitest"; * @param {string} denom The denomination of the coins to send. */ export async function waitForChain( - client: StrideClient, + client: StrideClient | GaiaClient, denom: string, ): Promise { // the best way to ensure a chain is up is to successfully send a tx while (true) { try { - const msg = - client.types.cosmos.bank.v1beta1.MessageComposer.withTypeUrl.send({ - fromAddress: client.address, - toAddress: client.address, - amount: coinsFromString(`1${denom}`), - }); + if (client instanceof StrideClient) { + const msg = + client.types.cosmos.bank.v1beta1.MessageComposer.withTypeUrl.send({ + fromAddress: client.address, + toAddress: client.address, + amount: coinsFromString(`1${denom}`), + }); - const tx = await client.signAndBroadcast([msg], 2); + const tx = await client.signAndBroadcast([msg], 2); - if (tx.code == 0) { - break; + if (tx.code === 0) { + break; + } + } else if (isGaiaClient(client)) { + const [{ address }] = await client.signer.getAccounts(); + + const tx = await client.client.sendTokens( + address, + address, + coinsFromString(`1${denom}`), + 2, + ); + + if (tx.code === 0) { + break; + } } } catch (e) { // signAndBroadcast might throw if the RPC is not up yet + // console.log(e); } } } diff --git a/integration-tests/dockerfiles/Dockerfile.cosmos b/integration-tests/dockerfiles/Dockerfile.cosmoshub similarity index 100% rename from integration-tests/dockerfiles/Dockerfile.cosmos rename to integration-tests/dockerfiles/Dockerfile.cosmoshub diff --git a/integration-tests/dockerfiles/Dockerfile.osmosis b/integration-tests/dockerfiles/Dockerfile.osmosis index d2a48946a9..154ecc74b8 100644 --- a/integration-tests/dockerfiles/Dockerfile.osmosis +++ b/integration-tests/dockerfiles/Dockerfile.osmosis @@ -5,13 +5,12 @@ WORKDIR /opt RUN apk add --update curl make git libc-dev bash gcc linux-headers eudev-dev ca-certificates build-base git ENV REPO=https://github.com/osmosis-labs/osmosis -ENV COMMIT_HASH=v27.0.0 +ENV COMMIT_HASH=v28.0.0 ENV BINARY=osmosisd RUN git clone ${REPO} chain \ && cd chain \ && git checkout $COMMIT_HASH - WORKDIR /opt/chain RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //') && \ @@ -29,4 +28,4 @@ RUN apk add bash vim sudo dasel jq curl \ USER 1000 WORKDIR /home/validator -EXPOSE 26657 26656 1317 9090 \ No newline at end of file +EXPOSE 26657 26656 1317 9090 diff --git a/integration-tests/network/values.yaml b/integration-tests/network/values.yaml index ef830a23bf..cc137d56f8 100644 --- a/integration-tests/network/values.yaml +++ b/integration-tests/network/values.yaml @@ -26,7 +26,7 @@ chains: - name: osmosis binary: osmosisd - version: v27.0.0 + version: v28.0.0 numValidators: 1 home: .osmosisd denom: uosmo @@ -42,4 +42,4 @@ relayers: - name: stride-osmosis type: hermes chainA: stride - chainB: osmosis \ No newline at end of file + chainB: osmosis diff --git a/proto/stride/auction/auction.proto b/proto/stride/auction/auction.proto new file mode 100644 index 0000000000..b697f73b8c --- /dev/null +++ b/proto/stride/auction/auction.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; +package stride.auction; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/auction/types"; + +enum AuctionType { + // Default value - should not be used + AUCTION_TYPE_UNSPECIFIED = 0; + // First-Come First-Served auction + AUCTION_TYPE_FCFS = 1; +} +message Params {} + +message Auction { + // Auction type + AuctionType type = 1; + + // A unique auction name + string name = 2; + + // Token denom being sold in the auction + string selling_denom = 3; + + // Token denom used to place bids + string payment_denom = 4; + + // Whether auction is active + bool enabled = 5; + + // Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price) + // bids_floor_price = oracle_price * min_price_multiplier + string min_price_multiplier = 6 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Minimum payment token bid amount + string min_bid_amount = 7 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + + // Address to send the auction proceeds to + string beneficiary = 8 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Total amount of payment token received + string total_payment_token_received = 9 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + + // Total amount of selling token sold + string total_selling_token_sold = 10 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/stride/auction/genesis.proto b/proto/stride/auction/genesis.proto new file mode 100644 index 0000000000..d3e6856a7d --- /dev/null +++ b/proto/stride/auction/genesis.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package stride.auction; + +import "gogoproto/gogo.proto"; +import "stride/auction/auction.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/auction/types"; + +// GenesisState defines the auction module's genesis state +message GenesisState { + // Module parameters + Params params = 1 [ (gogoproto.nullable) = false ]; + + // List of token auctions + repeated Auction auctions = 2 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/stride/auction/query.proto b/proto/stride/auction/query.proto new file mode 100644 index 0000000000..26d2d8c9a3 --- /dev/null +++ b/proto/stride/auction/query.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; +package stride.auction; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "stride/auction/auction.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/auction/types"; + +// Query defines the gRPC querier service. +service Query { + // Auction queries the auction info for a specific token + rpc Auction(QueryAuctionRequest) returns (QueryAuctionResponse) { + option (google.api.http).get = "/stride/auction/{name}"; + } + + // Auctions queries the auction info for a specific token + rpc Auctions(QueryAuctionsRequest) returns (QueryAuctionsResponse) { + option (google.api.http).get = "/stride/auction/auctions"; + } +} + +// QueryAuctionRequest is the request type for the Query/Auction RPC +// method +message QueryAuctionRequest { string name = 1; } + +// QueryAuctionResponse is the response type for the Query/Auction RPC +// method +message QueryAuctionResponse { + Auction auction = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryAuctionsRequest is the request type for the +// Query/Auctions RPC method +message QueryAuctionsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAuctionsResponse is the response type for the +// Query/Auctions RPC method +message QueryAuctionsResponse { + repeated Auction auctions = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/stride/auction/tx.proto b/proto/stride/auction/tx.proto new file mode 100644 index 0000000000..31572b9a60 --- /dev/null +++ b/proto/stride/auction/tx.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; +package stride.auction; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "stride/auction/auction.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/auction/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // User messages + + // PlaceBid places a bid to buy a token off an auction + rpc PlaceBid(MsgPlaceBid) returns (MsgPlaceBidResponse); + + // Admin messages + + // CreateAuction creates a new auction + rpc CreateAuction(MsgCreateAuction) returns (MsgCreateAuctionResponse); + // CreateAuction updates an existing auction + rpc UpdateAuction(MsgUpdateAuction) returns (MsgUpdateAuctionResponse); +} + +// MsgPlaceBid defines the message for bidding in a token auction +message MsgPlaceBid { + option (cosmos.msg.v1.signer) = "bidder"; + option (amino.name) = "auction/MsgPlaceBid"; + + // Bidder's address + string bidder = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Token being bid on + string auction_name = 2; + + // Amount of tokens requested in base units (utoken) + string selling_token_amount = 3 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + + // Amount of tokens being paid in base units (utoken) + string payment_token_amount = 4 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +message MsgPlaceBidResponse {} + +// MsgCreateAuction defines the message for adding a token auction +message MsgCreateAuction { + option (cosmos.msg.v1.signer) = "admin"; + option (amino.name) = "auction/MsgCreateAuction"; + + // Admin's address + string admin = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // A unique auction name + string auction_name = 2; + + // Auction type + AuctionType auction_type = 3; + + // Denom on Stride of the token being auctioned off (e.g. "ibc/...") + string selling_denom = 4; + + // Denom on Stride of the token being used to place bids (e.g. "ustrd") + string payment_denom = 5; + + // Whether auction is active + bool enabled = 6; + + // Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price) + // bids_floor_price = oracle_price * min_price_multiplier + string min_price_multiplier = 7 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Minimum payment token bid amount + string min_bid_amount = 8 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + + string beneficiary = 9 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +message MsgCreateAuctionResponse {} + +// MsgUpdateAuction defines the message for adding a token auction +message MsgUpdateAuction { + option (cosmos.msg.v1.signer) = "admin"; + option (amino.name) = "auction/MsgUpdateAuction"; + + // Admin's address + string admin = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // A unique auction name + string auction_name = 2; + + // Auction type + AuctionType auction_type = 3; + + // Whether auction is active + bool enabled = 4; + + // Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price) + // bids_floor_price = oracle_price * min_price_multiplier + string min_price_multiplier = 5 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Minimum payment token bid amount + string min_bid_amount = 6 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + + string beneficiary = 7 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +message MsgUpdateAuctionResponse {} diff --git a/proto/stride/icqoracle/genesis.proto b/proto/stride/icqoracle/genesis.proto new file mode 100644 index 0000000000..0ad21481d4 --- /dev/null +++ b/proto/stride/icqoracle/genesis.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package stride.icqoracle; + +import "gogoproto/gogo.proto"; +import "stride/icqoracle/icqoracle.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/icqoracle/types"; + +// GenesisState defines the icqoracle module's genesis state +message GenesisState { + // Module parameters + Params params = 1 [ (gogoproto.nullable) = false ]; + + // List of token prices + repeated TokenPrice token_prices = 2 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/stride/icqoracle/icqoracle.proto b/proto/stride/icqoracle/icqoracle.proto new file mode 100644 index 0000000000..27a9a9cc7b --- /dev/null +++ b/proto/stride/icqoracle/icqoracle.proto @@ -0,0 +1,70 @@ +syntax = "proto3"; +package stride.icqoracle; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/icqoracle/types"; + +// TokenPrice stores latest price data for a token +message TokenPrice { + // Base denom on Stride + string base_denom = 1; + // Quote denom on Stride + string quote_denom = 2; + // Decimals of base token, used for normalizing price feed from Osmosis + int64 base_denom_decimals = 3; + // Decimals of quote token, used for normalizing price feed from Osmosis + int64 quote_denom_decimals = 4; + // Base denom on Osmosis + string osmosis_base_denom = 5; + // Quote denom on Osmosis + string osmosis_quote_denom = 6; + // Pool ID on Osmosis + uint64 osmosis_pool_id = 7; + + // Spot price of base_denom denominated in quote_denom + string spot_price = 8 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Last time a query request was submitted + google.protobuf.Timestamp last_request_time = 9 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + + // Last time a query response was received + google.protobuf.Timestamp last_response_time = 10 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + + // Whether there is a spot price query currently in progress + bool query_in_progress = 11; +} + +// OracleParams stores global oracle parameters +message Params { + // Osmosis chain identifier + string osmosis_chain_id = 1 [ + (gogoproto.moretags) = "yaml:\"osmosis_chain_id\"", + (gogoproto.jsontag) = "osmosis_chain_id" + ]; + + // Osmosis IBC connection identifier + string osmosis_connection_id = 2 [ + (gogoproto.moretags) = "yaml:\"osmosis_connection_id\"", + (gogoproto.jsontag) = "osmosis_connection_id" + ]; + + // Time between price updates + // Also used to timeout icq requests + uint64 update_interval_sec = 3 [ + (gogoproto.moretags) = "yaml:\"update_interval_sec\"", + (gogoproto.jsontag) = "update_interval_sec" + ]; + + // Max time before price is considered stale/expired + uint64 price_expiration_timeout_sec = 4 [ + (gogoproto.moretags) = "yaml:\"price_expiration_timeout_sec\"", + (gogoproto.jsontag) = "price_expiration_timeout_sec" + ]; +} diff --git a/proto/stride/icqoracle/query.proto b/proto/stride/icqoracle/query.proto new file mode 100644 index 0000000000..1313f64aed --- /dev/null +++ b/proto/stride/icqoracle/query.proto @@ -0,0 +1,124 @@ +syntax = "proto3"; +package stride.icqoracle; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "stride/icqoracle/icqoracle.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/icqoracle/types"; + +// Query defines the gRPC querier service. +service Query { + // TokenPrice queries the current price for a specific token + rpc TokenPrice(QueryTokenPriceRequest) returns (QueryTokenPriceResponse) { + option (google.api.http).get = "/stride/icqoracle/price"; + } + + // TokenPrices queries all token prices + rpc TokenPrices(QueryTokenPricesRequest) returns (QueryTokenPricesResponse) { + option (google.api.http).get = "/stride/icqoracle/prices"; + } + + // Params queries the oracle parameters + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/stride/icqoracle/params"; + } + + // TokenPriceForQuoteDenom queries the exchange rate between two tokens + rpc TokenPriceForQuoteDenom(QueryTokenPriceForQuoteDenomRequest) + returns (QueryTokenPriceForQuoteDenomResponse) { + option (google.api.http).get = "/stride/icqoracle/quote_price"; + } +} + +// QueryTokenPriceRequest is the request type for the Query/TokenPrice RPC +// method +message QueryTokenPriceRequest { + string base_denom = 1; + string quote_denom = 2; + uint64 pool_id = 3; +} + +// QueryTokenPriceResponse is the response type for the Query/TokenPrice RPC +// method +message QueryTokenPriceResponse { + TokenPriceResponse token_price = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryTokenPricesRequest is the request type for the Query/TokenPrices RPC +// method +message QueryTokenPricesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryTokenPricesResponse is the response type for the Query/TokenPrices RPC +// method +message QueryTokenPricesResponse { + repeated TokenPriceResponse token_prices = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryParamsRequest is the request type for the Query/Params RPC method +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method +message QueryParamsResponse { + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryTokenPriceForQuoteDenomRequest is the request type for the +// Query/TokenPriceForQuoteDenom RPC method +message QueryTokenPriceForQuoteDenomRequest { + string base_denom = 1; + string quote_denom = 2; +} + +// QueryTokenPriceForQuoteDenomResponse is the response type for the +// Query/TokenPriceForQuoteDenom RPC method +message QueryTokenPriceForQuoteDenomResponse { + string price = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// TokenPriceResponse adds human readable info on to of TokenPrice +message TokenPriceResponse { + // If IBC token, base denom unwrapped (e.g. ibc/... -> uatom) + string base_denom_unwrapped = 1; + // If IBC token, Quote denom unwrapped (e.g. ibc/... -> uatom) + string quote_denom_unwrapped = 2; + // Base denom on Stride, can be IBC denom + string base_denom = 3; + // Quote denom on Stride, can be IBC denom + string quote_denom = 4; + // Decimals of base token, used for normalizing price feed from Osmosis + int64 base_denom_decimals = 5; + // Decimals of quote token, used for normalizing price feed from Osmosis + int64 quote_denom_decimals = 6; + // Base denom on Osmosis + string osmosis_base_denom = 7; + // Quote denom on Osmosis + string osmosis_quote_denom = 8; + // Pool ID on Osmosis + uint64 osmosis_pool_id = 9; + + // Spot price of base_denom denominated in quote_denom + string spot_price = 10 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // Last time a query request was submitted + google.protobuf.Timestamp last_request_time = 11 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + + // Last time a query response was received + google.protobuf.Timestamp last_response_time = 12 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + + // Whether there is a spot price query currently in progress + bool query_in_progress = 13; +} \ No newline at end of file diff --git a/proto/stride/icqoracle/tx.proto b/proto/stride/icqoracle/tx.proto new file mode 100644 index 0000000000..1ee23107e1 --- /dev/null +++ b/proto/stride/icqoracle/tx.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; +package stride.icqoracle; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/icqoracle/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // RegisterTokenPriceQuery registers a new token to track prices for + rpc RegisterTokenPriceQuery(MsgRegisterTokenPriceQuery) + returns (MsgRegisterTokenPriceQueryResponse); + + // RemoveTokenPriceQuery removes a token from price tracking + rpc RemoveTokenPriceQuery(MsgRemoveTokenPriceQuery) + returns (MsgRemoveTokenPriceQueryResponse); +} + +// MsgRegisterTokenPriceQuery defines the message for adding a new token to +// track prices +message MsgRegisterTokenPriceQuery { + option (cosmos.msg.v1.signer) = "admin"; + option (amino.name) = "icqoracle/MsgRegisterTokenPriceQuery"; + + string admin = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Token denom on Stride + string base_denom = 2; + // Quote denom on Stride + string quote_denom = 3; + // Decimals of base token, used for normalizing price feed from Osmosis + int64 base_denom_decimals = 4; + // Decimals of quote token, used for normalizing price feed from Osmosis + int64 quote_denom_decimals = 5; + // Token denom on Osmosis + string osmosis_base_denom = 6; + // Quote denom on Osmosis + string osmosis_quote_denom = 7; + // Pool ID on Osmosis + uint64 osmosis_pool_id = 8; +} + +message MsgRegisterTokenPriceQueryResponse {} + +// MsgRemoveTokenPriceQuery defines the message for removing a token from price +// tracking +message MsgRemoveTokenPriceQuery { + option (cosmos.msg.v1.signer) = "admin"; + option (amino.name) = "icqoracle/MsgRemoveTokenPriceQuery"; + + string admin = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Token denom on Stride + string base_denom = 2; + // Quote denom on Stride + string quote_denom = 3; + // Pool ID on Osmosis + uint64 osmosis_pool_id = 4; +} + +message MsgRemoveTokenPriceQueryResponse {} \ No newline at end of file diff --git a/proto/stride/strdburner/genesis.proto b/proto/stride/strdburner/genesis.proto new file mode 100644 index 0000000000..b1a0cb110e --- /dev/null +++ b/proto/stride/strdburner/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package stride.strdburner; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/strdburner/types"; + +// GenesisState defines the strdburner module's genesis state +message GenesisState { + // Total amount of ustrd burned + string total_ustrd_burned = 9 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/stride/strdburner/query.proto b/proto/stride/strdburner/query.proto new file mode 100644 index 0000000000..26152eca88 --- /dev/null +++ b/proto/stride/strdburner/query.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package stride.strdburner; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/Stride-Labs/stride/v25/x/strdburner/types"; + +// Query defines the gRPC querier service. +service Query { + // StrdBurnerAddress queries the address of the strdburner module + rpc StrdBurnerAddress(QueryStrdBurnerAddressRequest) + returns (QueryStrdBurnerAddressResponse) { + option (google.api.http).get = "/stride/strdburner/address"; + } + + // StrdBurnerAddress queries the address of the strdburner module + rpc TotalStrdBurned(QueryTotalStrdBurnedRequest) + returns (QueryTotalStrdBurnedResponse) { + option (google.api.http).get = "/stride/strdburner/total_burned"; + } +} + +// QueryStrdBurnerAddressRequest is the request type for the Query/strdburner +// RPC method +message QueryStrdBurnerAddressRequest {} + +// QueryStrdBurnerAddressResponse is the response type for the Query/strdburner +// RPC method +message QueryStrdBurnerAddressResponse { + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// QueryTotalStrdBurnedRequest is the request type for the Query/strdburner +// RPC method +message QueryTotalStrdBurnedRequest {} + +// QueryTotalStrdBurnedResponse is the response type for the Query/strdburner +// RPC method +message QueryTotalStrdBurnedResponse { + string total_burned = 1 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/utils/utils.go b/utils/utils.go index 95158be4a4..993adecc5f 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -252,6 +252,26 @@ func LogWithHostZone(chainId string, s string, a ...any) string { return fmt.Sprintf("| %-13s | %s", strings.ToUpper(chainId), msg) } +// Returns a log string with a base denom, quote denom and tab as the prefix +// Ex: +// +// | uosmo/ustrd | string +func LogWithTokenPriceQuery(baseDenom, quoteDenom string, osmosisPoolId uint64, s string, a ...any, +) string { + msg := fmt.Sprintf(s, a...) + return fmt.Sprintf("| %s/%s/%d | %s", baseDenom, quoteDenom, osmosisPoolId, msg) +} + +// Returns a log string with a chain Id and callback as a prefix +// callbackType is either ICACALLBACK or ICQCALLBACK +// Format: +// +// | uosmo/ustrd | {CALLBACK_ID} {CALLBACK_TYPE} | string +func logCallbackWithTokenPriceQuery(baseDenom, quoteDenom string, osmosisPoolId uint64, callbackId string, callbackType string, s string, a ...any) string { + msg := fmt.Sprintf(s, a...) + return fmt.Sprintf("| %s/%s/%d | %s %s | %s", baseDenom, quoteDenom, osmosisPoolId, strings.ToUpper(callbackId), callbackType, msg) +} + // Returns a log string with a chain Id and callback as a prefix // callbackType is either ICACALLBACK or ICQCALLBACK // Format: @@ -295,6 +315,14 @@ func LogICQCallbackWithHostZone(chainId string, callbackId string, s string, a . return logCallbackWithHostZone(chainId, callbackId, "ICQCALLBACK", s, a...) } +// Returns a log string with a chain Id and icqcallback as a prefix +// Ex: +// +// | COSMOSHUB-4 | WITHDRAWALHOSTBALANCE ICQCALLBACK | string +func LogICQCallbackWithTokenPriceQuery(baseDenom, quoteDenom string, osmosisPoolId uint64, callbackId string, s string, a ...any) string { + return logCallbackWithTokenPriceQuery(baseDenom, quoteDenom, osmosisPoolId, callbackId, "ICQCALLBACK", s, a...) +} + // Returns a log header string with a dash padding on either side // Ex: // diff --git a/x/auction/client/cli/query.go b/x/auction/client/cli/query.go new file mode 100644 index 0000000000..c6b7d5c886 --- /dev/null +++ b/x/auction/client/cli/query.go @@ -0,0 +1,78 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdQueryAuction(), + CmdQueryAuctions(), + ) + + return cmd +} + +func CmdQueryAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "auction [name]", + Short: "Query the auction info for a specific auction", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryAuctionRequest{ + Name: args[0], + } + res, err := queryClient.Auction(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + return cmd +} + +func CmdQueryAuctions() *cobra.Command { + cmd := &cobra.Command{ + Use: "auctions", + Short: "Get all auctions", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryAuctionsRequest{} + res, err := queryClient.Auctions(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + return cmd +} diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go new file mode 100644 index 0000000000..fc6f4091c6 --- /dev/null +++ b/x/auction/client/cli/tx.go @@ -0,0 +1,183 @@ +package cli + +import ( + "fmt" + "strconv" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdPlaceBid(), + CmdCreateAuction(), + CmdUpdateAuction(), + ) + + return cmd +} + +func CmdPlaceBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "place-bid [auction-name] [selling-token-amount] [payment-token-amount]", + Short: "Place a bid on an auction", + Long: strings.TrimSpace( + fmt.Sprintf(`Place a bid on an auction for a specific token. + +Example: + $ %[1]s tx %[2]s place-bid auctionName 123 1000000 --from mykey +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + sellingTokenAmount, err := strconv.ParseUint(args[1], 10, 64) + if err != nil { + return fmt.Errorf("cannot parse sellingTokenAmount as uint64 from '%s': %w", args[1], err) + } + + paymentTokenAmount, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return fmt.Errorf("cannot parse paymentTokenAmount as uint64 from '%s': %w", args[2], err) + } + + msg := types.NewMsgPlaceBid( + clientCtx.GetFromAddress().String(), + args[0], + sellingTokenAmount, + paymentTokenAmount, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdCreateAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-auction [name] [selling-denom] [payment-denom] [enabled] [min-price-multiplier] [min-bid-amount] [beneficiary]", + Short: "Create a new auction", + Long: strings.TrimSpace( + fmt.Sprintf(`Create a new auction for a specific token. + +Example: + $ %[1]s tx %[2]s create-auction my-auction ibc/DEADBEEF true 0.95 1000000 --from admin +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(7), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + enabled := args[3] == "true" + + minBidAmount, err := strconv.ParseUint(args[3], 10, 64) + if err != nil { + return fmt.Errorf("cannot parse minBidAmount as uint64 from '%s': %w", args[3], err) + } + + msg := types.NewMsgCreateAuction( + clientCtx.GetFromAddress().String(), + args[0], + types.AuctionType_AUCTION_TYPE_FCFS, + args[1], + args[2], + enabled, + args[4], + minBidAmount, + args[6], + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdUpdateAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-auction [name] [enabled] [min-price-multiplier] [min-bid-amount] [beneficiary]", + Short: "Update an existing auction", + Long: strings.TrimSpace( + fmt.Sprintf(`Update an existing auction's parameters. + +Example: + $ %[1]s tx %[2]s update-auction auctionName true 0.97 500000 --from admin +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + enabled, err := strconv.ParseBool(args[1]) + if err != nil { + return fmt.Errorf("cannot parse enabled as bool from '%s': %w", args[1], err) + } + + minBidAmount, err := strconv.ParseUint(args[3], 10, 64) + if err != nil { + return fmt.Errorf("cannot parse minBidAmount as uint64 from '%s': %w", args[3], err) + } + + msg := types.NewMsgUpdateAuction( + clientCtx.GetFromAddress().String(), + args[0], + types.AuctionType_AUCTION_TYPE_FCFS, + enabled, + args[2], + minBidAmount, + args[4], + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/auction/keeper/auction.go b/x/auction/keeper/auction.go new file mode 100644 index 0000000000..00663b256c --- /dev/null +++ b/x/auction/keeper/auction.go @@ -0,0 +1,71 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// SetAuction stores auction info for a token +func (k Keeper) SetAuction(ctx sdk.Context, auction *types.Auction) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionPrefix) + key := []byte(auction.Name) + bz := k.cdc.MustMarshal(auction) + store.Set(key, bz) +} + +// GetAuction retrieves auction info for a token +func (k Keeper) GetAuction(ctx sdk.Context, name string) (*types.Auction, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionPrefix) + key := []byte(name) + + bz := store.Get(key) + if bz == nil { + return &types.Auction{}, fmt.Errorf("auction not found for denom '%s'", name) + } + + var auction types.Auction + if err := k.cdc.Unmarshal(bz, &auction); err != nil { + return &types.Auction{}, fmt.Errorf("error retrieving auction for denom '%s': %w", auction.SellingDenom, err) + } + + return &auction, nil +} + +// GetAllAuctions retrieves all stored auctions +func (k Keeper) GetAllAuctions(ctx sdk.Context) []types.Auction { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionPrefix) + iterator := store.Iterator(nil, nil) + defer iterator.Close() + + auctions := []types.Auction{} + for ; iterator.Valid(); iterator.Next() { + var auction types.Auction + k.cdc.MustUnmarshal(iterator.Value(), &auction) + auctions = append(auctions, auction) + } + + return auctions +} + +// PlaceBid places an auction bid and executes it based on the auction type +func (k Keeper) PlaceBid(ctx sdk.Context, bid *types.MsgPlaceBid) error { + // Get auction + auction, err := k.GetAuction(ctx, bid.AuctionName) + if err != nil { + return fmt.Errorf("cannot get auction for name='%s': %w", bid.AuctionName, err) + } + + // Get the appropriate auctionBidHandler for the auction type + auctionBidHandler, exists := bidHandlers[auction.Type] + if !exists { + return fmt.Errorf("unsupported auction type: %s", auction.Type) + } + + // Call the handler + return auctionBidHandler(ctx, k, auction, bid) +} diff --git a/x/auction/keeper/auction_test.go b/x/auction/keeper/auction_test.go new file mode 100644 index 0000000000..39c78e87ef --- /dev/null +++ b/x/auction/keeper/auction_test.go @@ -0,0 +1,58 @@ +package keeper_test + +import ( + "fmt" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// Helper function to create 5 auction objects with various attributes +func (s *KeeperTestSuite) createAuctions() []types.Auction { + auctions := []types.Auction{} + for i := int64(1); i <= 5; i++ { + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: fmt.Sprintf("auction-%d", i), + SellingDenom: fmt.Sprintf("selling-%d", i), + PaymentDenom: fmt.Sprintf("payment-%d", i), + Enabled: true, + MinPriceMultiplier: sdk.ZeroDec(), + MinBidAmount: sdkmath.NewInt(i), + TotalPaymentTokenReceived: sdkmath.NewInt(i), + TotalSellingTokenSold: sdkmath.NewInt(i), + } + + auctions = append(auctions, auction) + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + } + return auctions +} + +// Tests Get/Set Auction +func (s *KeeperTestSuite) TestGetAuction() { + auctions := s.createAuctions() + + for _, expected := range auctions { + actual, err := s.App.AuctionKeeper.GetAuction(s.Ctx, expected.Name) + s.Require().NoError(err, "auction %s should have been found", expected.Name) + s.Require().Equal(expected, *actual, "auction %s", expected.Name) + } + + _, err := s.App.AuctionKeeper.GetAuction(s.Ctx, "non-existent") + s.Require().ErrorContains(err, "auction not found") +} + +// Tests getting all auctions +func (s *KeeperTestSuite) TestGetAllAuctions() { + expectedAuctions := s.createAuctions() + + actualAuctions := s.App.AuctionKeeper.GetAllAuctions(s.Ctx) + s.Require().Equal(len(actualAuctions), len(expectedAuctions), "number of auctions") + + for i, expectedAuction := range expectedAuctions { + s.Require().Equal(expectedAuction, actualAuctions[i], "auction %s", expectedAuction.Name) + } +} diff --git a/x/auction/keeper/genesis.go b/x/auction/keeper/genesis.go new file mode 100644 index 0000000000..f3debfc26d --- /dev/null +++ b/x/auction/keeper/genesis.go @@ -0,0 +1,25 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// Loads module state from genesis +func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + + for _, auction := range genState.Auctions { + k.SetAuction(ctx, &auction) + } +} + +// Export's module state into genesis file +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + params := k.GetParams(ctx) + genesis := types.DefaultGenesis() + genesis.Params = params + genesis.Auctions = k.GetAllAuctions(ctx) + return genesis +} diff --git a/x/auction/keeper/handlers.go b/x/auction/keeper/handlers.go new file mode 100644 index 0000000000..8f2e11299e --- /dev/null +++ b/x/auction/keeper/handlers.go @@ -0,0 +1,115 @@ +package keeper + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// Define a type for bid handler functions +type AuctionBidHandler func(ctx sdk.Context, k Keeper, auction *types.Auction, bid *types.MsgPlaceBid) error + +// Map of auction types to their handlers +var bidHandlers = map[types.AuctionType]AuctionBidHandler{ + types.AuctionType_AUCTION_TYPE_FCFS: fcfsBidHandler, +} + +// fcfsBidHandler handles bids for First Come First Serve auctions +func fcfsBidHandler(ctx sdk.Context, k Keeper, auction *types.Auction, bid *types.MsgPlaceBid) error { + // Get token amount being auctioned off + moduleAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) + balance := k.bankKeeper.GetBalance(ctx, moduleAddr, auction.SellingDenom) + sellingAmountAvailable := balance.Amount + + // Verify auction has enough selling tokens to service the bid + if bid.SellingTokenAmount.GT(sellingAmountAvailable) { + return fmt.Errorf("bid wants to buy %s%s but auction only has %s%s", + bid.SellingTokenAmount.String(), + auction.SellingDenom, + sellingAmountAvailable.String(), + auction.SellingDenom, + ) + } + + // Note: price converts SellingToken to PaymentToken + // Any calculation down the road makes sense only if price is multiplied by a derivative of SellingToken + price, err := k.icqoracleKeeper.GetTokenPriceForQuoteDenom(ctx, auction.SellingDenom, auction.PaymentDenom) + if err != nil { + return errorsmod.Wrapf(err, "error getting price for baseDenom='%s' quoteDenom='%s'", auction.SellingDenom, auction.PaymentDenom) + } + + // Apply MinPriceMultiplier + bidsFloorPrice := price.Mul(auction.MinPriceMultiplier) + minPaymentRequired := bid.SellingTokenAmount.ToLegacyDec().Mul(bidsFloorPrice) + + // if paymentAmount < sellingAmount * bidsFloorPrice + if bid.PaymentTokenAmount.ToLegacyDec().LT(minPaymentRequired) { + return fmt.Errorf("bid price too low: offered %s%s for %s%s, bids floor price is %s%s (price=%s %s/%s)", + bid.PaymentTokenAmount.String(), + auction.PaymentDenom, + bid.SellingTokenAmount.String(), + auction.SellingDenom, + minPaymentRequired.String(), + auction.PaymentDenom, + bidsFloorPrice.String(), + auction.PaymentDenom, + auction.SellingDenom, + ) + } + + // Safe to use MustAccAddressFromBech32 because bid.Bidder passed ValidateBasic + bidder := sdk.MustAccAddressFromBech32(bid.Bidder) + + // Send paymentToken to beneficiary + err = k.bankKeeper.SendCoins( + ctx, + bidder, + sdk.MustAccAddressFromBech32(auction.Beneficiary), + sdk.NewCoins(sdk.NewCoin(auction.PaymentDenom, bid.PaymentTokenAmount)), + ) + if err != nil { + return fmt.Errorf("failed to send payment tokens from bidder '%s' to beneficiary '%s': %w", + bid.Bidder, + auction.Beneficiary, + err, + ) + } + + // Send sellingToken to bidder + err = k.bankKeeper.SendCoinsFromModuleToAccount( + ctx, + types.ModuleName, + bidder, + sdk.NewCoins(sdk.NewCoin(auction.SellingDenom, bid.SellingTokenAmount)), + ) + if err != nil { + return fmt.Errorf("failed to send auction tokens from module '%s' to bidder '%s': %w", + types.ModuleName, + bid.Bidder, + err, + ) + } + + auction.TotalSellingTokenSold = auction.TotalSellingTokenSold.Add(bid.SellingTokenAmount) + auction.TotalPaymentTokenReceived = auction.TotalPaymentTokenReceived.Add(bid.PaymentTokenAmount) + + k.SetAuction(ctx, auction) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeBidAccepted, + sdk.NewAttribute(types.AttributeKeyAuctionName, auction.Name), + sdk.NewAttribute(types.AttributeKeyBidder, bid.Bidder), + sdk.NewAttribute(types.AttributeKeyPaymentAmount, bid.PaymentTokenAmount.String()), + sdk.NewAttribute(types.AttributeKeyPaymentDenom, auction.PaymentDenom), + sdk.NewAttribute(types.AttributeKeySellingAmount, bid.SellingTokenAmount.String()), + sdk.NewAttribute(types.AttributeKeySellingDenom, auction.SellingDenom), + sdk.NewAttribute(types.AttributeKeyPrice, bidsFloorPrice.String()), + ), + ) + + return nil +} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go new file mode 100644 index 0000000000..c669515ed7 --- /dev/null +++ b/x/auction/keeper/keeper.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +type Keeper struct { + cdc codec.Codec + storeKey storetypes.StoreKey + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + icqoracleKeeper types.IcqOracleKeeper +} + +func NewKeeper( + cdc codec.Codec, + storeKey storetypes.StoreKey, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + icqoracleKeeper types.IcqOracleKeeper, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + icqoracleKeeper: icqoracleKeeper, + } +} diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go new file mode 100644 index 0000000000..777c74b2b6 --- /dev/null +++ b/x/auction/keeper/keeper_test.go @@ -0,0 +1,47 @@ +package keeper_test + +import ( + "bytes" + "testing" + + "github.com/cometbft/cometbft/libs/log" + "github.com/stretchr/testify/suite" + + "github.com/Stride-Labs/stride/v25/app/apptesting" + "github.com/Stride-Labs/stride/v25/x/auction/keeper" + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +type KeeperTestSuite struct { + apptesting.AppTestHelper + logBuffer bytes.Buffer +} + +// Modify SetupTest to include mock setup +func (s *KeeperTestSuite) SetupTest() { + s.Setup() + + // Create a logger with accessible output + logger := log.NewTMLogger(&s.logBuffer) + s.Ctx = s.Ctx.WithLogger(logger) +} + +// Dynamically gets the MsgServer for this module's keeper +// this function must be used so that the MsgServer is always created with the most updated App context +// +// which can change depending on the type of test +// (e.g. tests with only one Stride chain vs tests with multiple chains and IBC support) +func (s *KeeperTestSuite) GetMsgServer() types.MsgServer { + return keeper.NewMsgServerImpl(s.App.AuctionKeeper) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +// Helper function to get a auction and confirm there's no error +func (s *KeeperTestSuite) MustGetAuction(name string) types.Auction { + auction, err := s.App.AuctionKeeper.GetAuction(s.Ctx, name) + s.Require().NoError(err, "no error expected when getting auction") + return *auction +} diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go new file mode 100644 index 0000000000..fe889da21d --- /dev/null +++ b/x/auction/keeper/msg_server.go @@ -0,0 +1,79 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// PlaceBid places a bid to buy a token off an auction +func (ms msgServer) PlaceBid(goCtx context.Context, msg *types.MsgPlaceBid) (*types.MsgPlaceBidResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + err := ms.Keeper.PlaceBid(ctx, msg) + if err != nil { + return nil, err + } + + return &types.MsgPlaceBidResponse{}, nil +} + +// CreateAuction creates a new auction +func (ms msgServer) CreateAuction(goCtx context.Context, msg *types.MsgCreateAuction) (*types.MsgCreateAuctionResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + _, err := ms.Keeper.GetAuction(ctx, msg.AuctionName) + if err == nil { + return nil, types.ErrAuctionAlreadyExists.Wrapf("auction with name '%s' already exists", msg.AuctionName) + } + + auction := types.Auction{ + Type: msg.AuctionType, + Name: msg.AuctionName, + SellingDenom: msg.SellingDenom, + PaymentDenom: msg.PaymentDenom, + Enabled: msg.Enabled, + MinPriceMultiplier: msg.MinPriceMultiplier, + MinBidAmount: msg.MinBidAmount, + Beneficiary: msg.Beneficiary, + TotalPaymentTokenReceived: math.ZeroInt(), + TotalSellingTokenSold: math.ZeroInt(), + } + ms.Keeper.SetAuction(ctx, &auction) + + return &types.MsgCreateAuctionResponse{}, nil +} + +// CreateAuction updates an existing auction +func (ms msgServer) UpdateAuction(goCtx context.Context, msg *types.MsgUpdateAuction) (*types.MsgUpdateAuctionResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + auction, err := ms.Keeper.GetAuction(ctx, msg.AuctionName) + if err != nil { + return nil, types.ErrAuctionDoesntExist.Wrapf("cannot find auction with name '%s'", msg.AuctionName) + } + + auction.Type = msg.AuctionType + auction.Enabled = msg.Enabled + auction.MinBidAmount = msg.MinBidAmount + auction.MinPriceMultiplier = msg.MinPriceMultiplier + auction.Beneficiary = msg.Beneficiary + ms.Keeper.SetAuction(ctx, auction) + + return &types.MsgUpdateAuctionResponse{}, nil +} diff --git a/x/auction/keeper/msg_server_test.go b/x/auction/keeper/msg_server_test.go new file mode 100644 index 0000000000..f0dd3de897 --- /dev/null +++ b/x/auction/keeper/msg_server_test.go @@ -0,0 +1,400 @@ +package keeper_test + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" + icqoracletypes "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +func (s *KeeperTestSuite) TestCreateAuction() { + // Create a new auction + msg := types.MsgCreateAuction{ + AuctionName: "test-auction", + AuctionType: types.AuctionType_AUCTION_TYPE_FCFS, + SellingDenom: "ustrd", + PaymentDenom: "uatom", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyMustNewDecFromStr("0.95"), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: "beneficiary-address", + } + _, err := s.GetMsgServer().CreateAuction(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().NoError(err, "no error expected when creating auction") + + // Confirm the auction was created + auction := s.MustGetAuction(msg.AuctionName) + + s.Require().Equal(msg.AuctionType, auction.Type, "auction type") + s.Require().Equal(msg.AuctionName, auction.Name, "auction name") + s.Require().Equal(msg.SellingDenom, auction.SellingDenom, "selling denom") + s.Require().Equal(msg.PaymentDenom, auction.PaymentDenom, "payment denom") + s.Require().Equal(msg.Enabled, auction.Enabled, "enabled") + s.Require().Equal(msg.MinPriceMultiplier, auction.MinPriceMultiplier, "min price multiplier") + s.Require().Equal(msg.MinBidAmount, auction.MinBidAmount, "min bid amount") + s.Require().Equal(msg.Beneficiary, auction.Beneficiary, "beneficiary") + s.Require().Equal(sdkmath.ZeroInt(), auction.TotalPaymentTokenReceived, "total payment token received") + s.Require().Equal(sdkmath.ZeroInt(), auction.TotalSellingTokenSold, "total selling token sold") + + // Attempt to create it again, it should fail + _, err = s.GetMsgServer().CreateAuction(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorIs(err, types.ErrAuctionAlreadyExists) +} + +func (s *KeeperTestSuite) TestUpdateAuction() { + // Create an auction first + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "ustrd", + PaymentDenom: "uatom", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: "beneficiary-address", + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Update the auction + msg := types.MsgUpdateAuction{ + AuctionName: auction.Name, + AuctionType: types.AuctionType_AUCTION_TYPE_FCFS, + Enabled: false, + MinPriceMultiplier: sdkmath.LegacyNewDec(2), + MinBidAmount: sdkmath.NewInt(2000), + Beneficiary: "new-beneficiary-address", + } + _, err := s.GetMsgServer().UpdateAuction(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().NoError(err, "no error expected when updating auction") + + // Confirm the auction was updated + updatedAuction := s.MustGetAuction(msg.AuctionName) + s.Require().Equal(msg.AuctionType, updatedAuction.Type, "auction type") + s.Require().Equal(msg.Enabled, updatedAuction.Enabled, "enabled") + s.Require().Equal(msg.MinPriceMultiplier, updatedAuction.MinPriceMultiplier, "min price multiplier") + s.Require().Equal(msg.MinBidAmount, updatedAuction.MinBidAmount, "min bid amount") + s.Require().Equal(msg.Beneficiary, updatedAuction.Beneficiary, "beneficiary") + + // Try to update non-existent auction, it should fail + msg.AuctionName = "non-existent-auction" + _, err = s.GetMsgServer().UpdateAuction(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorIs(err, types.ErrAuctionDoesntExist) +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidHappyPath() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Create a price + tokenPrice := icqoracletypes.TokenPrice{ + BaseDenom: auction.SellingDenom, + QuoteDenom: auction.PaymentDenom, + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1), + LastRequestTime: s.Ctx.BlockTime(), + QueryInProgress: false, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Mint enough selling coins to auction module to sell + s.FundModuleAccount(types.ModuleName, sdk.NewCoin(auction.SellingDenom, msg.SellingTokenAmount)) + + // Mint enough payment coins to bidder to pay + s.FundAccount(bidder, sdk.NewCoin(auction.PaymentDenom, msg.PaymentTokenAmount)) + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().NoError(err, "no error expected when placing bid") + + // Check payment token to beneficiary + s.Require().Contains(s.Ctx.EventManager().Events(), + sdk.NewEvent( + banktypes.EventTypeTransfer, + sdk.NewAttribute(banktypes.AttributeKeyRecipient, s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String()), + sdk.NewAttribute(banktypes.AttributeKeySender, msg.Bidder), + sdk.NewAttribute(sdk.AttributeKeyAmount, sdk.NewCoins(sdk.NewCoin(auction.PaymentDenom, msg.PaymentTokenAmount)).String()), + ), + ) + + // Check selling token to bidder + s.Require().Contains(s.Ctx.EventManager().Events(), + sdk.NewEvent( + banktypes.EventTypeTransfer, + sdk.NewAttribute(banktypes.AttributeKeyRecipient, msg.Bidder), + sdk.NewAttribute(banktypes.AttributeKeySender, s.App.AccountKeeper.GetModuleAddress(types.ModuleName).String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, sdk.NewCoins(sdk.NewCoin(auction.SellingDenom, msg.SellingTokenAmount)).String()), + ), + ) + + // Check PlaceBid events + s.Require().Contains(s.Ctx.EventManager().Events(), + sdk.NewEvent( + types.EventTypeBidAccepted, + sdk.NewAttribute(types.AttributeKeyAuctionName, auction.Name), + sdk.NewAttribute(types.AttributeKeyBidder, msg.Bidder), + sdk.NewAttribute(types.AttributeKeyPaymentAmount, msg.PaymentTokenAmount.String()), + sdk.NewAttribute(types.AttributeKeyPaymentDenom, auction.PaymentDenom), + sdk.NewAttribute(types.AttributeKeySellingAmount, msg.SellingTokenAmount.String()), + sdk.NewAttribute(types.AttributeKeySellingDenom, auction.SellingDenom), + sdk.NewAttribute(types.AttributeKeyPrice, sdkmath.LegacyNewDec(1).String()), + ), + ) +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidUnsupportedAuctionType() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_UNSPECIFIED, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "unsupported auction type") +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidAuctionNoFound() { + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: "banana", + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "cannot get auction for name='banana'") +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidNotEnoughSellingTokens() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "bid wants to buy 1000uosmo but auction only has 0uosmo") +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidNoPriceForSellingDenom() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Mint enough selling coins to auction module to sell + s.FundModuleAccount(types.ModuleName, sdk.NewCoin(auction.SellingDenom, msg.SellingTokenAmount)) + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "error getting price for baseDenom='uosmo' quoteDenom='ustrd': no price for baseDenom 'uosmo'") +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidNoPriceForPaymentDenom() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Create a price only for SellingDenom + tokenPrice := icqoracletypes.TokenPrice{ + BaseDenom: auction.SellingDenom, + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1), + LastRequestTime: s.Ctx.BlockTime(), + QueryInProgress: false, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Mint enough selling coins to auction module to sell + s.FundModuleAccount(types.ModuleName, sdk.NewCoin(auction.SellingDenom, msg.SellingTokenAmount)) + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "error getting price for baseDenom='uosmo' quoteDenom='ustrd': no price for quoteDenom 'ustrd'") +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidTooLowPrice() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: "beneficiary-address", + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Create a price + tokenPrice := icqoracletypes.TokenPrice{ + BaseDenom: auction.SellingDenom, + QuoteDenom: auction.PaymentDenom, + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1), + LastRequestTime: s.Ctx.BlockTime(), + QueryInProgress: false, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Prepare bid with a price that's too low + // With spot price = 1 and multiplier = 1, minimum accepted price should be 1 + // Setting bid with price < 1 + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + // Make the effective price 0.5, which is below floor of 1 + SellingTokenAmount: sdkmath.NewInt(2000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Mint enough selling coins to auction module to sell + s.FundModuleAccount(types.ModuleName, sdk.NewCoin(auction.SellingDenom, msg.SellingTokenAmount)) + + // Mint enough payment coins to bidder to pay + s.FundAccount(bidder, sdk.NewCoin(auction.PaymentDenom, msg.PaymentTokenAmount)) + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "bid price too low") +} + +func (s *KeeperTestSuite) TestFcfsPlaceBidNotEnoughPaymentTokens() { + // Create an auction + auction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "uosmo", + PaymentDenom: "ustrd", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + + // Create a price + tokenPrice := icqoracletypes.TokenPrice{ + BaseDenom: auction.SellingDenom, + QuoteDenom: auction.PaymentDenom, + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1), + LastRequestTime: s.Ctx.BlockTime(), + QueryInProgress: false, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Prepare bid + bidder := s.TestAccs[0] + msg := types.MsgPlaceBid{ + AuctionName: auction.Name, + Bidder: bidder.String(), + SellingTokenAmount: sdkmath.NewInt(1000), + PaymentTokenAmount: sdkmath.NewInt(1000), + } + + // Mint enough selling coins to auction module to sell + s.FundModuleAccount(types.ModuleName, sdk.NewCoin(auction.SellingDenom, msg.SellingTokenAmount)) + + // DON'T fund the bidder with payment tokens + + // Place Bid + _, err := s.GetMsgServer().PlaceBid(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorContains(err, "failed to send payment tokens from bidder") +} diff --git a/x/auction/keeper/params.go b/x/auction/keeper/params.go new file mode 100644 index 0000000000..5cd2a38329 --- /dev/null +++ b/x/auction/keeper/params.go @@ -0,0 +1,22 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +// GetParams get params +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) +} diff --git a/x/auction/keeper/params_test.go b/x/auction/keeper/params_test.go new file mode 100644 index 0000000000..833f4a350d --- /dev/null +++ b/x/auction/keeper/params_test.go @@ -0,0 +1,11 @@ +package keeper_test + +import "github.com/Stride-Labs/stride/v25/x/auction/types" + +func (s *KeeperTestSuite) TestParams() { + expectedParams := types.Params{} + s.App.AuctionKeeper.SetParams(s.Ctx, expectedParams) + + actualParams := s.App.AuctionKeeper.GetParams(s.Ctx) + s.Require().Equal(expectedParams, actualParams, "params") +} diff --git a/x/auction/keeper/query.go b/x/auction/keeper/query.go new file mode 100644 index 0000000000..32afbfe1bc --- /dev/null +++ b/x/auction/keeper/query.go @@ -0,0 +1,49 @@ +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +var _ types.QueryServer = Keeper{} + +// Auction queries the auction info for a specific token +func (k Keeper) Auction(goCtx context.Context, req *types.QueryAuctionRequest) (*types.QueryAuctionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + auction, err := k.GetAuction(ctx, req.Name) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryAuctionResponse{ + Auction: *auction, + }, nil +} + +// Auctions queries the auction info for a specific token +func (k Keeper) Auctions(goCtx context.Context, req *types.QueryAuctionsRequest) (*types.QueryAuctionsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + auctions := k.GetAllAuctions(ctx) + + // TODO impl paging + + return &types.QueryAuctionsResponse{ + Auctions: auctions, + }, nil +} diff --git a/x/auction/keeper/query_test.go b/x/auction/keeper/query_test.go new file mode 100644 index 0000000000..9fe7f6e6a4 --- /dev/null +++ b/x/auction/keeper/query_test.go @@ -0,0 +1,89 @@ +package keeper_test + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +func (s *KeeperTestSuite) TestQueryAuction() { + // Create an auction + expectedAuction := types.Auction{ + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction", + SellingDenom: "ustrd", + PaymentDenom: "uatom", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: "beneficiary-address", + TotalSellingTokenSold: sdkmath.ZeroInt(), + TotalPaymentTokenReceived: sdkmath.ZeroInt(), + } + s.App.AuctionKeeper.SetAuction(s.Ctx, &expectedAuction) + + // Query for the auction + req := &types.QueryAuctionRequest{ + Name: expectedAuction.Name, + } + resp, err := s.App.AuctionKeeper.Auction(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying auction") + s.Require().Equal(expectedAuction, resp.Auction, "auction") + + // Query with invalid request + _, err = s.App.AuctionKeeper.Auction(sdk.WrapSDKContext(s.Ctx), nil) + s.Require().Error(err, "error expected when querying with nil request") + + // Query with non-existent auction + reqNonExistent := &types.QueryAuctionRequest{ + Name: "non-existent-auction", + } + _, err = s.App.AuctionKeeper.Auction(sdk.WrapSDKContext(s.Ctx), reqNonExistent) + s.Require().Error(err, "error expected when querying non-existent auction") + s.Require().Contains(err.Error(), "auction not found") +} + +func (s *KeeperTestSuite) TestQueryAuctions() { + // Create multiple auctions + expectedAuctions := []types.Auction{ + { + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction-1", + SellingDenom: "ustrd", + PaymentDenom: "uatom", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(1), + MinBidAmount: sdkmath.NewInt(1000), + Beneficiary: "beneficiary-address-1", + TotalSellingTokenSold: sdkmath.ZeroInt(), + TotalPaymentTokenReceived: sdkmath.ZeroInt(), + }, + { + Type: types.AuctionType_AUCTION_TYPE_FCFS, + Name: "test-auction-2", + SellingDenom: "ustrd", + PaymentDenom: "uosmo", + Enabled: true, + MinPriceMultiplier: sdkmath.LegacyNewDec(2), + MinBidAmount: sdkmath.NewInt(2000), + Beneficiary: "beneficiary-address-2", + TotalSellingTokenSold: sdkmath.ZeroInt(), + TotalPaymentTokenReceived: sdkmath.ZeroInt(), + }, + } + + for _, auction := range expectedAuctions { + s.App.AuctionKeeper.SetAuction(s.Ctx, &auction) + } + + // Query all auctions + req := &types.QueryAuctionsRequest{} + resp, err := s.App.AuctionKeeper.Auctions(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying all auctions") + s.Require().Equal(expectedAuctions, resp.Auctions, "auctions") + + // Query with invalid request + _, err = s.App.AuctionKeeper.Auctions(sdk.WrapSDKContext(s.Ctx), nil) + s.Require().Error(err, "error expected when querying with nil request") +} diff --git a/x/auction/module.go b/x/auction/module.go new file mode 100644 index 0000000000..14b114c10a --- /dev/null +++ b/x/auction/module.go @@ -0,0 +1,156 @@ +package auction + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/Stride-Labs/stride/v25/x/auction/client/cli" + "github.com/Stride-Labs/stride/v25/x/auction/keeper" + "github.com/Stride-Labs/stride/v25/x/auction/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + am.keeper.InitGenesis(ctx, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/auction/types/auction.pb.go b/x/auction/types/auction.pb.go new file mode 100644 index 0000000000..9dea9d522a --- /dev/null +++ b/x/auction/types/auction.pb.go @@ -0,0 +1,915 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/auction/auction.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type AuctionType int32 + +const ( + // Default value - should not be used + AuctionType_AUCTION_TYPE_UNSPECIFIED AuctionType = 0 + // First-Come First-Served auction + AuctionType_AUCTION_TYPE_FCFS AuctionType = 1 +) + +var AuctionType_name = map[int32]string{ + 0: "AUCTION_TYPE_UNSPECIFIED", + 1: "AUCTION_TYPE_FCFS", +} + +var AuctionType_value = map[string]int32{ + "AUCTION_TYPE_UNSPECIFIED": 0, + "AUCTION_TYPE_FCFS": 1, +} + +func (x AuctionType) String() string { + return proto.EnumName(AuctionType_name, int32(x)) +} + +func (AuctionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_739480caccbf7be9, []int{0} +} + +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_739480caccbf7be9, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +type Auction struct { + // Auction type + Type AuctionType `protobuf:"varint,1,opt,name=type,proto3,enum=stride.auction.AuctionType" json:"type,omitempty"` + // A unique auction name + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Token denom being sold in the auction + SellingDenom string `protobuf:"bytes,3,opt,name=selling_denom,json=sellingDenom,proto3" json:"selling_denom,omitempty"` + // Token denom used to place bids + PaymentDenom string `protobuf:"bytes,4,opt,name=payment_denom,json=paymentDenom,proto3" json:"payment_denom,omitempty"` + // Whether auction is active + Enabled bool `protobuf:"varint,5,opt,name=enabled,proto3" json:"enabled,omitempty"` + // Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price) + // bids_floor_price = oracle_price * min_price_multiplier + MinPriceMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=min_price_multiplier,json=minPriceMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_price_multiplier"` + // Minimum payment token bid amount + MinBidAmount cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=min_bid_amount,json=minBidAmount,proto3,customtype=cosmossdk.io/math.Int" json:"min_bid_amount"` + // Address to send the auction proceeds to + Beneficiary string `protobuf:"bytes,8,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"` + // Total amount of payment token received + TotalPaymentTokenReceived cosmossdk_io_math.Int `protobuf:"bytes,9,opt,name=total_payment_token_received,json=totalPaymentTokenReceived,proto3,customtype=cosmossdk.io/math.Int" json:"total_payment_token_received"` + // Total amount of selling token sold + TotalSellingTokenSold cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=total_selling_token_sold,json=totalSellingTokenSold,proto3,customtype=cosmossdk.io/math.Int" json:"total_selling_token_sold"` +} + +func (m *Auction) Reset() { *m = Auction{} } +func (m *Auction) String() string { return proto.CompactTextString(m) } +func (*Auction) ProtoMessage() {} +func (*Auction) Descriptor() ([]byte, []int) { + return fileDescriptor_739480caccbf7be9, []int{1} +} +func (m *Auction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Auction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auction.Merge(m, src) +} +func (m *Auction) XXX_Size() int { + return m.Size() +} +func (m *Auction) XXX_DiscardUnknown() { + xxx_messageInfo_Auction.DiscardUnknown(m) +} + +var xxx_messageInfo_Auction proto.InternalMessageInfo + +func (m *Auction) GetType() AuctionType { + if m != nil { + return m.Type + } + return AuctionType_AUCTION_TYPE_UNSPECIFIED +} + +func (m *Auction) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Auction) GetSellingDenom() string { + if m != nil { + return m.SellingDenom + } + return "" +} + +func (m *Auction) GetPaymentDenom() string { + if m != nil { + return m.PaymentDenom + } + return "" +} + +func (m *Auction) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *Auction) GetBeneficiary() string { + if m != nil { + return m.Beneficiary + } + return "" +} + +func init() { + proto.RegisterEnum("stride.auction.AuctionType", AuctionType_name, AuctionType_value) + proto.RegisterType((*Params)(nil), "stride.auction.Params") + proto.RegisterType((*Auction)(nil), "stride.auction.Auction") +} + +func init() { proto.RegisterFile("stride/auction/auction.proto", fileDescriptor_739480caccbf7be9) } + +var fileDescriptor_739480caccbf7be9 = []byte{ + // 525 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6b, 0xdb, 0x3e, + 0x18, 0xc7, 0xe3, 0xdf, 0x2f, 0x6b, 0x53, 0xb5, 0x0b, 0x9d, 0x48, 0x40, 0x6d, 0x33, 0x37, 0xb4, + 0x97, 0x30, 0xa8, 0xcd, 0x3a, 0x76, 0xd9, 0x2d, 0x7f, 0x21, 0xac, 0xeb, 0x82, 0x9d, 0x0c, 0xb6, + 0xc3, 0x8c, 0x6c, 0x6b, 0xae, 0xa8, 0x25, 0x19, 0x4b, 0x29, 0xcb, 0xbb, 0xd8, 0x8b, 0xd9, 0x2b, + 0xd8, 0xa9, 0xc7, 0xb2, 0xd3, 0xd8, 0xa1, 0x8c, 0xe4, 0x8d, 0x0c, 0x4b, 0x4e, 0x69, 0xd9, 0xa5, + 0x27, 0x4b, 0xdf, 0xe7, 0xfb, 0xfd, 0x58, 0x48, 0xcf, 0x03, 0x5a, 0x52, 0xe5, 0x34, 0x26, 0x2e, + 0x9e, 0x47, 0x8a, 0x0a, 0xbe, 0xfe, 0x3a, 0x59, 0x2e, 0x94, 0x80, 0x75, 0x53, 0x75, 0x4a, 0x75, + 0x7f, 0x2f, 0x12, 0x92, 0x09, 0x19, 0xe8, 0xaa, 0x6b, 0x36, 0xc6, 0xba, 0xdf, 0x48, 0x44, 0x22, + 0x8c, 0x5e, 0xac, 0x8c, 0x7a, 0x54, 0x03, 0x1b, 0x13, 0x9c, 0x63, 0x26, 0x8f, 0x7e, 0x54, 0xc1, + 0x66, 0xd7, 0x60, 0xa0, 0x0b, 0xaa, 0x6a, 0x91, 0x11, 0x64, 0xb5, 0xad, 0x4e, 0xfd, 0xf4, 0xc0, + 0x79, 0xf8, 0x17, 0xa7, 0xb4, 0x4d, 0x17, 0x19, 0xf1, 0xb4, 0x11, 0x42, 0x50, 0xe5, 0x98, 0x11, + 0xf4, 0x5f, 0xdb, 0xea, 0x6c, 0x79, 0x7a, 0x0d, 0x8f, 0xc1, 0x53, 0x49, 0xd2, 0x94, 0xf2, 0x24, + 0x88, 0x09, 0x17, 0x0c, 0xfd, 0xaf, 0x8b, 0x3b, 0xa5, 0x38, 0x28, 0xb4, 0xc2, 0x94, 0xe1, 0x05, + 0x23, 0x5c, 0x95, 0xa6, 0xaa, 0x31, 0x95, 0xa2, 0x31, 0x21, 0xb0, 0x49, 0x38, 0x0e, 0x53, 0x12, + 0xa3, 0x27, 0x6d, 0xab, 0x53, 0xf3, 0xd6, 0x5b, 0x38, 0x03, 0x0d, 0x46, 0x79, 0x90, 0xe5, 0x34, + 0x22, 0x01, 0x9b, 0xa7, 0x8a, 0x66, 0x29, 0x25, 0x39, 0xda, 0x28, 0x28, 0xbd, 0xe3, 0xeb, 0xdb, + 0xc3, 0xca, 0xef, 0xdb, 0xc3, 0x03, 0x73, 0x11, 0x32, 0xbe, 0x74, 0xa8, 0x70, 0x19, 0x56, 0x17, + 0xce, 0x19, 0x49, 0x70, 0xb4, 0x18, 0x90, 0xc8, 0x83, 0x8c, 0xf2, 0x49, 0x91, 0x7f, 0x77, 0x17, + 0x87, 0x7d, 0x50, 0x2f, 0xb0, 0x21, 0x8d, 0x03, 0xcc, 0xc4, 0x9c, 0x2b, 0xb4, 0xa9, 0x81, 0xcf, + 0x4b, 0x60, 0xf3, 0x5f, 0xe0, 0x98, 0x2b, 0x6f, 0x87, 0x51, 0xde, 0xa3, 0x71, 0x57, 0x47, 0xe0, + 0x1b, 0xb0, 0x1d, 0x12, 0x4e, 0xbe, 0xd0, 0x88, 0xe2, 0x7c, 0x81, 0x6a, 0x9a, 0x80, 0x7e, 0x7e, + 0x3f, 0x69, 0x94, 0xef, 0xd2, 0x8d, 0xe3, 0x9c, 0x48, 0xe9, 0xab, 0x9c, 0xf2, 0xc4, 0xbb, 0x6f, + 0x86, 0x9f, 0x41, 0x4b, 0x09, 0x85, 0xd3, 0x60, 0x7d, 0x39, 0x4a, 0x5c, 0x12, 0x1e, 0xe4, 0x24, + 0x22, 0xf4, 0x8a, 0xc4, 0x68, 0xeb, 0x31, 0xc7, 0xd9, 0xd3, 0x88, 0x89, 0x21, 0x4c, 0x0b, 0x80, + 0x57, 0xe6, 0xe1, 0x07, 0x80, 0x0c, 0x7f, 0xfd, 0x42, 0x86, 0x2f, 0x45, 0x1a, 0x23, 0xf0, 0x18, + 0x76, 0x53, 0xc7, 0x7d, 0x93, 0xd6, 0x6c, 0x5f, 0xa4, 0xf1, 0x8b, 0x1e, 0xd8, 0xbe, 0xd7, 0x1c, + 0xb0, 0x05, 0x50, 0x77, 0xd6, 0x9f, 0x8e, 0xdf, 0x9f, 0x07, 0xd3, 0x8f, 0x93, 0x61, 0x30, 0x3b, + 0xf7, 0x27, 0xc3, 0xfe, 0x78, 0x34, 0x1e, 0x0e, 0x76, 0x2b, 0xb0, 0x09, 0x9e, 0x3d, 0xa8, 0x8e, + 0xfa, 0x23, 0x7f, 0xd7, 0xea, 0xbd, 0xbd, 0x5e, 0xda, 0xd6, 0xcd, 0xd2, 0xb6, 0xfe, 0x2c, 0x6d, + 0xeb, 0xdb, 0xca, 0xae, 0xdc, 0xac, 0xec, 0xca, 0xaf, 0x95, 0x5d, 0xf9, 0xf4, 0x32, 0xa1, 0xea, + 0x62, 0x1e, 0x3a, 0x91, 0x60, 0xae, 0xaf, 0x5b, 0xf2, 0xe4, 0x0c, 0x87, 0xd2, 0x2d, 0x47, 0xe4, + 0xea, 0xf4, 0xb5, 0xfb, 0xf5, 0x6e, 0x50, 0x8a, 0xbe, 0x94, 0xe1, 0x86, 0x6e, 0xf3, 0x57, 0x7f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x67, 0xed, 0x43, 0x15, 0x47, 0x03, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *Auction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Auction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TotalSellingTokenSold.Size() + i -= size + if _, err := m.TotalSellingTokenSold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size := m.TotalPaymentTokenReceived.Size() + i -= size + if _, err := m.TotalPaymentTokenReceived.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if len(m.Beneficiary) > 0 { + i -= len(m.Beneficiary) + copy(dAtA[i:], m.Beneficiary) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Beneficiary))) + i-- + dAtA[i] = 0x42 + } + { + size := m.MinBidAmount.Size() + i -= size + if _, err := m.MinBidAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.MinPriceMultiplier.Size() + i -= size + if _, err := m.MinPriceMultiplier.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAuction(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(m.PaymentDenom) > 0 { + i -= len(m.PaymentDenom) + copy(dAtA[i:], m.PaymentDenom) + i = encodeVarintAuction(dAtA, i, uint64(len(m.PaymentDenom))) + i-- + dAtA[i] = 0x22 + } + if len(m.SellingDenom) > 0 { + i -= len(m.SellingDenom) + copy(dAtA[i:], m.SellingDenom) + i = encodeVarintAuction(dAtA, i, uint64(len(m.SellingDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintAuction(dAtA []byte, offset int, v uint64) int { + offset -= sovAuction(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *Auction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovAuction(uint64(m.Type)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = len(m.SellingDenom) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = len(m.PaymentDenom) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + if m.Enabled { + n += 2 + } + l = m.MinPriceMultiplier.Size() + n += 1 + l + sovAuction(uint64(l)) + l = m.MinBidAmount.Size() + n += 1 + l + sovAuction(uint64(l)) + l = len(m.Beneficiary) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = m.TotalPaymentTokenReceived.Size() + n += 1 + l + sovAuction(uint64(l)) + l = m.TotalSellingTokenSold.Size() + n += 1 + l + sovAuction(uint64(l)) + return n +} + +func sovAuction(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAuction(x uint64) (n int) { + return sovAuction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Auction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Auction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= AuctionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellingDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SellingDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PaymentDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PaymentDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPriceMultiplier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinPriceMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBidAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinBidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beneficiary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPaymentTokenReceived", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalPaymentTokenReceived.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalSellingTokenSold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalSellingTokenSold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAuction(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthAuction + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAuction + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAuction + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAuction = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAuction = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAuction = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/codec.go b/x/auction/types/codec.go new file mode 100644 index 0000000000..171d9f1dab --- /dev/null +++ b/x/auction/types/codec.go @@ -0,0 +1,42 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgPlaceBid{}, "auction/MsgPlaceBid") + legacy.RegisterAminoMsg(cdc, &MsgCreateAuction{}, "auction/MsgCreateAuction") + legacy.RegisterAminoMsg(cdc, &MsgUpdateAuction{}, "auction/MsgUpdateAuction") +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgPlaceBid{}, + &MsgCreateAuction{}, + &MsgUpdateAuction{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgSubmitProposal instances + RegisterLegacyAminoCodec(govcodec.Amino) +} diff --git a/x/auction/types/errors.go b/x/auction/types/errors.go new file mode 100644 index 0000000000..9d35039f96 --- /dev/null +++ b/x/auction/types/errors.go @@ -0,0 +1,13 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/auction module sentinel errors +var ( + ErrAuctionAlreadyExists = sdkerrors.Register(ModuleName, 7001, "auction already exists") + ErrAuctionDoesntExist = sdkerrors.Register(ModuleName, 7002, "auction doesn't exists") +) diff --git a/x/auction/types/events.go b/x/auction/types/events.go new file mode 100644 index 0000000000..49e8dbc64a --- /dev/null +++ b/x/auction/types/events.go @@ -0,0 +1,15 @@ +package types + +// Event types and attribute keys for auction module +const ( + EventTypeBidPlaced = "bid_placed" + EventTypeBidAccepted = "bid_accepted" + + AttributeKeyAuctionName = "auction_name" + AttributeKeyBidder = "bidder" + AttributeKeyPaymentAmount = "payment_amount" + AttributeKeyPaymentDenom = "payment_denom" + AttributeKeySellingAmount = "selling_amount" + AttributeKeySellingDenom = "selling_denom" + AttributeKeyPrice = "discounted_price" +) diff --git a/x/auction/types/expected_keepers.go b/x/auction/types/expected_keepers.go new file mode 100644 index 0000000000..91e2160752 --- /dev/null +++ b/x/auction/types/expected_keepers.go @@ -0,0 +1,23 @@ +package types + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Required AccountKeeper functions +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} + +// Required BankKeeper functions +type BankKeeper interface { + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoins(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +// Required IcqOracleKeeper functions +type IcqOracleKeeper interface { + GetTokenPriceForQuoteDenom(ctx sdk.Context, baseDenom string, quoteDenom string) (price math.LegacyDec, err error) +} diff --git a/x/auction/types/genesis.go b/x/auction/types/genesis.go new file mode 100644 index 0000000000..981feb11b9 --- /dev/null +++ b/x/auction/types/genesis.go @@ -0,0 +1,30 @@ +package types + +import ( + "fmt" +) + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{} +} + +// Performs basic genesis state validation by iterating through all auctions and validating +// using ValidateCreateAuctionParams() +func (gs GenesisState) Validate() error { + for i, auction := range gs.Auctions { + err := ValidateCreateAuctionParams( + auction.Name, + auction.Type, + auction.SellingDenom, + auction.PaymentDenom, + auction.MinPriceMultiplier, + auction.MinBidAmount, + auction.Beneficiary, + ) + if err != nil { + return fmt.Errorf("invalid genesis auction at index %d: %w", i, err) + } + } + return nil +} diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go new file mode 100644 index 0000000000..c35aa20653 --- /dev/null +++ b/x/auction/types/genesis.pb.go @@ -0,0 +1,386 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/auction/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the auction module's genesis state +type GenesisState struct { + // Module parameters + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // List of token auctions + Auctions []Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_94bb6618fc080329, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetAuctions() []Auction { + if m != nil { + return m.Auctions + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "stride.auction.GenesisState") +} + +func init() { proto.RegisterFile("stride/auction/genesis.proto", fileDescriptor_94bb6618fc080329) } + +var fileDescriptor_94bb6618fc080329 = []byte{ + // 220 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x2e, 0x29, 0xca, + 0x4c, 0x49, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, + 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xc8, 0xea, 0x41, 0x65, 0xa5, + 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x14, 0xba, 0x19, 0x50, + 0x1a, 0x22, 0xab, 0x54, 0xcf, 0xc5, 0xe3, 0x0e, 0x31, 0x34, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, + 0x84, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, + 0x4c, 0x0f, 0xd5, 0x12, 0xbd, 0x00, 0xb0, 0xac, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, + 0xb5, 0x42, 0x96, 0x5c, 0x1c, 0x50, 0xf9, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x71, + 0x74, 0x7d, 0x8e, 0x10, 0x1a, 0xaa, 0x11, 0xae, 0xdc, 0xc9, 0xfb, 0xc4, 0x23, 0x39, 0xc6, 0x0b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, + 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, + 0xf5, 0x83, 0xc1, 0x86, 0xe9, 0xfa, 0x24, 0x26, 0x15, 0xeb, 0x43, 0xfd, 0x53, 0x66, 0x64, 0xaa, + 0x5f, 0x01, 0xf7, 0x55, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x53, 0xc6, 0x80, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x15, 0x2c, 0x17, 0xd9, 0x38, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/keys.go b/x/auction/types/keys.go new file mode 100644 index 0000000000..ea08ff65d7 --- /dev/null +++ b/x/auction/types/keys.go @@ -0,0 +1,16 @@ +package types + +const ( + ModuleName = "auction" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the routing key + RouterKey = ModuleName +) + +var ( + ParamsKey = []byte("params") + AuctionPrefix = []byte("auction") +) diff --git a/x/auction/types/msgs.go b/x/auction/types/msgs.go new file mode 100644 index 0000000000..2677149fd8 --- /dev/null +++ b/x/auction/types/msgs.go @@ -0,0 +1,230 @@ +package types + +import ( + "errors" + "fmt" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + + "github.com/Stride-Labs/stride/v25/utils" +) + +const ( + TypeMsgPlaceBid = "place_bid" + TypeMsgCreateAuction = "create_auction" + TypeMsgUpdateAuction = "update_auction" +) + +var ( + _ sdk.Msg = &MsgPlaceBid{} + _ sdk.Msg = &MsgCreateAuction{} + _ sdk.Msg = &MsgUpdateAuction{} + + // Implement legacy interface for ledger support + _ legacytx.LegacyMsg = &MsgPlaceBid{} + _ legacytx.LegacyMsg = &MsgCreateAuction{} + _ legacytx.LegacyMsg = &MsgUpdateAuction{} +) + +// ---------------------------------------------- +// MsgPlaceBid +// ---------------------------------------------- + +func NewMsgPlaceBid( + bidder string, + AuctionName string, + sellingTokenAmount uint64, + paymentTokenAmount uint64, +) *MsgPlaceBid { + return &MsgPlaceBid{ + Bidder: bidder, + AuctionName: AuctionName, + SellingTokenAmount: math.NewIntFromUint64(sellingTokenAmount), + PaymentTokenAmount: math.NewIntFromUint64(paymentTokenAmount), + } +} + +func (msg MsgPlaceBid) Type() string { + return TypeMsgPlaceBid +} + +func (msg MsgPlaceBid) Route() string { + return RouterKey +} + +func (msg *MsgPlaceBid) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Bidder) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgPlaceBid) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgPlaceBid) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Bidder); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address (%s)", err) + } + if msg.AuctionName == "" { + return errors.New("auction-name must be specified") + } + if msg.SellingTokenAmount.IsZero() { + return errors.New("selling-token-amount cannot be 0") + } + if msg.PaymentTokenAmount.IsZero() { + return errors.New("payment-token-amount cannot be 0") + } + + return nil +} + +// ---------------------------------------------- +// MsgCreateAuction +// ---------------------------------------------- + +func NewMsgCreateAuction( + admin string, + auctionName string, + auctionType AuctionType, + sellingDenom string, + paymentDenom string, + enabled bool, + minPriceMultiplier string, + minBidAmount uint64, + beneficiary string, +) *MsgCreateAuction { + minPriceMultiplierDec, err := math.LegacyNewDecFromStr(minPriceMultiplier) + if err != nil { + panic(fmt.Sprintf("cannot parse LegacyDecimal from minPriceMultiplier '%s'", minPriceMultiplier)) + } + + return &MsgCreateAuction{ + Admin: admin, + AuctionName: auctionName, + AuctionType: auctionType, + SellingDenom: sellingDenom, + PaymentDenom: paymentDenom, + Enabled: enabled, + MinPriceMultiplier: minPriceMultiplierDec, + MinBidAmount: math.NewIntFromUint64(minBidAmount), + Beneficiary: beneficiary, + } +} + +func (msg MsgCreateAuction) Type() string { + return TypeMsgCreateAuction +} + +func (msg MsgCreateAuction) Route() string { + return RouterKey +} + +func (msg *MsgCreateAuction) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Admin) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgCreateAuction) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgCreateAuction) ValidateBasic() error { + if err := utils.ValidateAdminAddress(msg.Admin); err != nil { + return err + } + + return ValidateCreateAuctionParams( + msg.AuctionName, + msg.AuctionType, + msg.SellingDenom, + msg.PaymentDenom, + msg.MinPriceMultiplier, + msg.MinBidAmount, + msg.Beneficiary, + ) +} + +// ---------------------------------------------- +// MsgUpdateAuction +// ---------------------------------------------- + +func NewMsgUpdateAuction( + admin string, + auctionName string, + auctionType AuctionType, + enabled bool, + minPriceMultiplier string, + minBidAmount uint64, + beneficiary string, +) *MsgUpdateAuction { + minPriceMultiplierDec, err := math.LegacyNewDecFromStr(minPriceMultiplier) + if err != nil { + panic(fmt.Sprintf("cannot parse LegacyDecimal from minPriceMultiplier '%s'", minPriceMultiplier)) + } + + return &MsgUpdateAuction{ + Admin: admin, + AuctionName: auctionName, + AuctionType: auctionType, + Enabled: enabled, + MinPriceMultiplier: minPriceMultiplierDec, + MinBidAmount: math.NewIntFromUint64(minBidAmount), + Beneficiary: beneficiary, + } +} + +func (msg MsgUpdateAuction) Type() string { + return TypeMsgUpdateAuction +} + +func (msg MsgUpdateAuction) Route() string { + return RouterKey +} + +func (msg *MsgUpdateAuction) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Admin) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgUpdateAuction) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateAuction) ValidateBasic() error { + if err := utils.ValidateAdminAddress(msg.Admin); err != nil { + return err + } + if msg.AuctionName == "" { + return errors.New("auction-name must be specified") + } + if _, ok := AuctionType_name[int32(msg.AuctionType)]; !ok { + return errors.New("auction-type is invalid") + } + if msg.MinPriceMultiplier.IsZero() { + return errors.New("min-price-multiplier cannot be 0") + } + if msg.MinBidAmount.LT(math.ZeroInt()) { + return errors.New("min-bid-amount must be at least 0") + } + if _, err := sdk.AccAddressFromBech32(msg.Beneficiary); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address (%s)", err) + } + + return nil +} diff --git a/x/auction/types/params.go b/x/auction/types/params.go new file mode 100644 index 0000000000..874012a4b8 --- /dev/null +++ b/x/auction/types/params.go @@ -0,0 +1,16 @@ +package types + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go new file mode 100644 index 0000000000..7ab7a3aea6 --- /dev/null +++ b/x/auction/types/query.pb.go @@ -0,0 +1,1059 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/auction/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryAuctionRequest is the request type for the Query/Auction RPC +// method +type QueryAuctionRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *QueryAuctionRequest) Reset() { *m = QueryAuctionRequest{} } +func (m *QueryAuctionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAuctionRequest) ProtoMessage() {} +func (*QueryAuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_8113674a9412675c, []int{0} +} +func (m *QueryAuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuctionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuctionRequest.Merge(m, src) +} +func (m *QueryAuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuctionRequest proto.InternalMessageInfo + +func (m *QueryAuctionRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// QueryAuctionResponse is the response type for the Query/Auction RPC +// method +type QueryAuctionResponse struct { + Auction Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction"` +} + +func (m *QueryAuctionResponse) Reset() { *m = QueryAuctionResponse{} } +func (m *QueryAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAuctionResponse) ProtoMessage() {} +func (*QueryAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8113674a9412675c, []int{1} +} +func (m *QueryAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuctionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuctionResponse.Merge(m, src) +} +func (m *QueryAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuctionResponse proto.InternalMessageInfo + +func (m *QueryAuctionResponse) GetAuction() Auction { + if m != nil { + return m.Auction + } + return Auction{} +} + +// QueryAuctionsRequest is the request type for the +// Query/Auctions RPC method +type QueryAuctionsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAuctionsRequest) Reset() { *m = QueryAuctionsRequest{} } +func (m *QueryAuctionsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAuctionsRequest) ProtoMessage() {} +func (*QueryAuctionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_8113674a9412675c, []int{2} +} +func (m *QueryAuctionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuctionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuctionsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAuctionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuctionsRequest.Merge(m, src) +} +func (m *QueryAuctionsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAuctionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuctionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuctionsRequest proto.InternalMessageInfo + +func (m *QueryAuctionsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAuctionsResponse is the response type for the +// Query/Auctions RPC method +type QueryAuctionsResponse struct { + Auctions []Auction `protobuf:"bytes,1,rep,name=auctions,proto3" json:"auctions"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAuctionsResponse) Reset() { *m = QueryAuctionsResponse{} } +func (m *QueryAuctionsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAuctionsResponse) ProtoMessage() {} +func (*QueryAuctionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8113674a9412675c, []int{3} +} +func (m *QueryAuctionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuctionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuctionsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAuctionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuctionsResponse.Merge(m, src) +} +func (m *QueryAuctionsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAuctionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuctionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuctionsResponse proto.InternalMessageInfo + +func (m *QueryAuctionsResponse) GetAuctions() []Auction { + if m != nil { + return m.Auctions + } + return nil +} + +func (m *QueryAuctionsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryAuctionRequest)(nil), "stride.auction.QueryAuctionRequest") + proto.RegisterType((*QueryAuctionResponse)(nil), "stride.auction.QueryAuctionResponse") + proto.RegisterType((*QueryAuctionsRequest)(nil), "stride.auction.QueryAuctionsRequest") + proto.RegisterType((*QueryAuctionsResponse)(nil), "stride.auction.QueryAuctionsResponse") +} + +func init() { proto.RegisterFile("stride/auction/query.proto", fileDescriptor_8113674a9412675c) } + +var fileDescriptor_8113674a9412675c = []byte{ + // 422 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x4f, 0x6b, 0xdb, 0x30, + 0x14, 0xb7, 0xb2, 0x6c, 0xc9, 0x34, 0xd8, 0x41, 0xcb, 0x36, 0x63, 0x86, 0x17, 0xbc, 0xff, 0x83, + 0x49, 0x24, 0x63, 0x8c, 0x1d, 0x97, 0xc3, 0x76, 0x68, 0xa1, 0xad, 0x7b, 0xeb, 0xa1, 0x20, 0xa7, + 0xc2, 0x35, 0x34, 0x96, 0x13, 0xc9, 0xa1, 0xa1, 0xf4, 0xd2, 0x4f, 0x50, 0xe8, 0xb1, 0x5f, 0x28, + 0xc7, 0x40, 0x2f, 0x3d, 0x95, 0x92, 0xf4, 0x43, 0xf4, 0x58, 0x2c, 0xc9, 0x69, 0x6c, 0x42, 0x72, + 0xf2, 0xc3, 0xef, 0xf7, 0x4f, 0xef, 0x3d, 0xe8, 0x08, 0x39, 0x88, 0x0e, 0x18, 0xa1, 0x69, 0x57, + 0x46, 0x3c, 0x26, 0xfd, 0x94, 0x0d, 0x46, 0x38, 0x19, 0x70, 0xc9, 0xd1, 0x4b, 0xdd, 0xc3, 0xa6, + 0xe7, 0x7c, 0xef, 0x72, 0xd1, 0xe3, 0x82, 0x04, 0x54, 0x30, 0x0d, 0x24, 0xc3, 0x56, 0xc0, 0x24, + 0x6d, 0x91, 0x84, 0x86, 0x51, 0x4c, 0x33, 0x94, 0xe6, 0x3a, 0x8d, 0x90, 0x87, 0x5c, 0x95, 0x24, + 0xab, 0xcc, 0xdf, 0x77, 0x21, 0xe7, 0xe1, 0x11, 0x23, 0x34, 0x89, 0x08, 0x8d, 0x63, 0x2e, 0x15, + 0x45, 0xe4, 0xdd, 0x52, 0x16, 0xf3, 0xd5, 0x5d, 0xef, 0x1b, 0x7c, 0xb5, 0x93, 0x79, 0xfe, 0xd5, + 0x7f, 0x7d, 0xd6, 0x4f, 0x99, 0x90, 0x08, 0xc1, 0x6a, 0x4c, 0x7b, 0xcc, 0x06, 0x4d, 0xf0, 0xf5, + 0xb9, 0xaf, 0x6a, 0x6f, 0x0b, 0x36, 0x8a, 0x50, 0x91, 0xf0, 0x58, 0x30, 0xf4, 0x1b, 0xd6, 0x8c, + 0xa6, 0x82, 0xbf, 0x68, 0xbf, 0xc5, 0xc5, 0x27, 0x62, 0xc3, 0xe8, 0x54, 0xc7, 0x37, 0xef, 0x2d, + 0x3f, 0x47, 0x7b, 0xfb, 0x45, 0x41, 0x91, 0x9b, 0xff, 0x83, 0xf0, 0xf1, 0xe5, 0x46, 0xf3, 0x33, + 0xd6, 0x63, 0xc2, 0xd9, 0x98, 0xb0, 0x9e, 0xa7, 0x19, 0x13, 0xde, 0xa6, 0x21, 0x33, 0x5c, 0x7f, + 0x81, 0xe9, 0x5d, 0x02, 0xf8, 0xba, 0x64, 0x60, 0x22, 0xff, 0x81, 0x75, 0x13, 0x42, 0xd8, 0xa0, + 0xf9, 0x64, 0x7d, 0xe6, 0x39, 0x1c, 0xfd, 0x2f, 0x84, 0xab, 0xa8, 0x70, 0x5f, 0xd6, 0x86, 0xd3, + 0xbe, 0x8b, 0xe9, 0xda, 0xf7, 0x00, 0x3e, 0x55, 0xe9, 0x90, 0x84, 0x35, 0xe3, 0x86, 0x3e, 0x94, + 0x63, 0x2c, 0x59, 0x8e, 0xf3, 0x71, 0x35, 0x48, 0x7b, 0x79, 0xee, 0xd9, 0xd5, 0xdd, 0x45, 0xc5, + 0x46, 0x6f, 0x48, 0xe9, 0x00, 0x4e, 0xb2, 0x6d, 0x9e, 0xa2, 0x11, 0xac, 0xe7, 0x73, 0x41, 0x2b, + 0x15, 0xf3, 0xbd, 0x38, 0x9f, 0xd6, 0xa0, 0x8c, 0x71, 0x53, 0x19, 0x3b, 0xc8, 0x26, 0xcb, 0x2f, + 0x4f, 0x74, 0x36, 0xc6, 0x53, 0x17, 0x4c, 0xa6, 0x2e, 0xb8, 0x9d, 0xba, 0xe0, 0x7c, 0xe6, 0x5a, + 0x93, 0x99, 0x6b, 0x5d, 0xcf, 0x5c, 0x6b, 0xaf, 0x15, 0x46, 0xf2, 0x30, 0x0d, 0x70, 0x97, 0xf7, + 0xc8, 0xae, 0x62, 0xff, 0xd8, 0xa4, 0x81, 0xc8, 0x95, 0x86, 0xed, 0x5f, 0xe4, 0x78, 0xae, 0x27, + 0x47, 0x09, 0x13, 0xc1, 0x33, 0x75, 0xc8, 0x3f, 0x1f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xc4, + 0x87, 0xa1, 0x74, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Auction queries the auction info for a specific token + Auction(ctx context.Context, in *QueryAuctionRequest, opts ...grpc.CallOption) (*QueryAuctionResponse, error) + // Auctions queries the auction info for a specific token + Auctions(ctx context.Context, in *QueryAuctionsRequest, opts ...grpc.CallOption) (*QueryAuctionsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Auction(ctx context.Context, in *QueryAuctionRequest, opts ...grpc.CallOption) (*QueryAuctionResponse, error) { + out := new(QueryAuctionResponse) + err := c.cc.Invoke(ctx, "/stride.auction.Query/Auction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Auctions(ctx context.Context, in *QueryAuctionsRequest, opts ...grpc.CallOption) (*QueryAuctionsResponse, error) { + out := new(QueryAuctionsResponse) + err := c.cc.Invoke(ctx, "/stride.auction.Query/Auctions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Auction queries the auction info for a specific token + Auction(context.Context, *QueryAuctionRequest) (*QueryAuctionResponse, error) + // Auctions queries the auction info for a specific token + Auctions(context.Context, *QueryAuctionsRequest) (*QueryAuctionsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Auction(ctx context.Context, req *QueryAuctionRequest) (*QueryAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Auction not implemented") +} +func (*UnimplementedQueryServer) Auctions(ctx context.Context, req *QueryAuctionsRequest) (*QueryAuctionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Auctions not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Auction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Auction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.auction.Query/Auction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Auction(ctx, req.(*QueryAuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Auctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuctionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Auctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.auction.Query/Auctions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Auctions(ctx, req.(*QueryAuctionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stride.auction.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Auction", + Handler: _Query_Auction_Handler, + }, + { + MethodName: "Auctions", + Handler: _Query_Auctions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stride/auction/query.proto", +} + +func (m *QueryAuctionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAuctionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAuctionsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuctionsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuctionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAuctionsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuctionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuctionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryAuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Auction.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAuctionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuctionsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryAuctionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuctionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Auction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuctionsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAuctionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuctionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuctionsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAuctionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuctionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/query.pb.gw.go b/x/auction/types/query.pb.gw.go new file mode 100644 index 0000000000..6ae3c71981 --- /dev/null +++ b/x/auction/types/query.pb.gw.go @@ -0,0 +1,272 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stride/auction/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Auction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.Auction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Auction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.Auction(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Auctions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuctionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Auctions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Auctions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuctionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Auctions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Auctions(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Auction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Auction_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Auctions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Auctions_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auctions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Auction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Auction_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Auctions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Auctions_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auctions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Auction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"stride", "auction", "name"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Auctions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "auction", "auctions"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Auction_0 = runtime.ForwardResponseMessage + + forward_Query_Auctions_0 = runtime.ForwardResponseMessage +) diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go new file mode 100644 index 0000000000..a133ea8746 --- /dev/null +++ b/x/auction/types/tx.pb.go @@ -0,0 +1,2026 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/auction/tx.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgPlaceBid defines the message for bidding in a token auction +type MsgPlaceBid struct { + // Bidder's address + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + // Token being bid on + AuctionName string `protobuf:"bytes,2,opt,name=auction_name,json=auctionName,proto3" json:"auction_name,omitempty"` + // Amount of tokens requested in base units (utoken) + SellingTokenAmount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=selling_token_amount,json=sellingTokenAmount,proto3,customtype=cosmossdk.io/math.Int" json:"selling_token_amount"` + // Amount of tokens being paid in base units (utoken) + PaymentTokenAmount cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=payment_token_amount,json=paymentTokenAmount,proto3,customtype=cosmossdk.io/math.Int" json:"payment_token_amount"` +} + +func (m *MsgPlaceBid) Reset() { *m = MsgPlaceBid{} } +func (m *MsgPlaceBid) String() string { return proto.CompactTextString(m) } +func (*MsgPlaceBid) ProtoMessage() {} +func (*MsgPlaceBid) Descriptor() ([]byte, []int) { + return fileDescriptor_07b888fb549a7ca8, []int{0} +} +func (m *MsgPlaceBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPlaceBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPlaceBid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgPlaceBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPlaceBid.Merge(m, src) +} +func (m *MsgPlaceBid) XXX_Size() int { + return m.Size() +} +func (m *MsgPlaceBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPlaceBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPlaceBid proto.InternalMessageInfo + +func (m *MsgPlaceBid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *MsgPlaceBid) GetAuctionName() string { + if m != nil { + return m.AuctionName + } + return "" +} + +type MsgPlaceBidResponse struct { +} + +func (m *MsgPlaceBidResponse) Reset() { *m = MsgPlaceBidResponse{} } +func (m *MsgPlaceBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPlaceBidResponse) ProtoMessage() {} +func (*MsgPlaceBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07b888fb549a7ca8, []int{1} +} +func (m *MsgPlaceBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPlaceBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPlaceBidResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgPlaceBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPlaceBidResponse.Merge(m, src) +} +func (m *MsgPlaceBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPlaceBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPlaceBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPlaceBidResponse proto.InternalMessageInfo + +// MsgCreateAuction defines the message for adding a token auction +type MsgCreateAuction struct { + // Admin's address + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` + // A unique auction name + AuctionName string `protobuf:"bytes,2,opt,name=auction_name,json=auctionName,proto3" json:"auction_name,omitempty"` + // Auction type + AuctionType AuctionType `protobuf:"varint,3,opt,name=auction_type,json=auctionType,proto3,enum=stride.auction.AuctionType" json:"auction_type,omitempty"` + // Denom on Stride of the token being auctioned off (e.g. "ibc/...") + SellingDenom string `protobuf:"bytes,4,opt,name=selling_denom,json=sellingDenom,proto3" json:"selling_denom,omitempty"` + // Denom on Stride of the token being used to place bids (e.g. "ustrd") + PaymentDenom string `protobuf:"bytes,5,opt,name=payment_denom,json=paymentDenom,proto3" json:"payment_denom,omitempty"` + // Whether auction is active + Enabled bool `protobuf:"varint,6,opt,name=enabled,proto3" json:"enabled,omitempty"` + // Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price) + // bids_floor_price = oracle_price * min_price_multiplier + MinPriceMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=min_price_multiplier,json=minPriceMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_price_multiplier"` + // Minimum payment token bid amount + MinBidAmount cosmossdk_io_math.Int `protobuf:"bytes,8,opt,name=min_bid_amount,json=minBidAmount,proto3,customtype=cosmossdk.io/math.Int" json:"min_bid_amount"` + Beneficiary string `protobuf:"bytes,9,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"` +} + +func (m *MsgCreateAuction) Reset() { *m = MsgCreateAuction{} } +func (m *MsgCreateAuction) String() string { return proto.CompactTextString(m) } +func (*MsgCreateAuction) ProtoMessage() {} +func (*MsgCreateAuction) Descriptor() ([]byte, []int) { + return fileDescriptor_07b888fb549a7ca8, []int{2} +} +func (m *MsgCreateAuction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateAuction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateAuction) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateAuction.Merge(m, src) +} +func (m *MsgCreateAuction) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateAuction) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateAuction.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateAuction proto.InternalMessageInfo + +func (m *MsgCreateAuction) GetAdmin() string { + if m != nil { + return m.Admin + } + return "" +} + +func (m *MsgCreateAuction) GetAuctionName() string { + if m != nil { + return m.AuctionName + } + return "" +} + +func (m *MsgCreateAuction) GetAuctionType() AuctionType { + if m != nil { + return m.AuctionType + } + return AuctionType_AUCTION_TYPE_UNSPECIFIED +} + +func (m *MsgCreateAuction) GetSellingDenom() string { + if m != nil { + return m.SellingDenom + } + return "" +} + +func (m *MsgCreateAuction) GetPaymentDenom() string { + if m != nil { + return m.PaymentDenom + } + return "" +} + +func (m *MsgCreateAuction) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *MsgCreateAuction) GetBeneficiary() string { + if m != nil { + return m.Beneficiary + } + return "" +} + +type MsgCreateAuctionResponse struct { +} + +func (m *MsgCreateAuctionResponse) Reset() { *m = MsgCreateAuctionResponse{} } +func (m *MsgCreateAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateAuctionResponse) ProtoMessage() {} +func (*MsgCreateAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07b888fb549a7ca8, []int{3} +} +func (m *MsgCreateAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateAuctionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateAuctionResponse.Merge(m, src) +} +func (m *MsgCreateAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateAuctionResponse proto.InternalMessageInfo + +// MsgUpdateAuction defines the message for adding a token auction +type MsgUpdateAuction struct { + // Admin's address + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` + // A unique auction name + AuctionName string `protobuf:"bytes,2,opt,name=auction_name,json=auctionName,proto3" json:"auction_name,omitempty"` + // Auction type + AuctionType AuctionType `protobuf:"varint,3,opt,name=auction_type,json=auctionType,proto3,enum=stride.auction.AuctionType" json:"auction_type,omitempty"` + // Whether auction is active + Enabled bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"` + // Minimum price multiplier (e.g. 0.95 for 5% discount off the oracle price) + // bids_floor_price = oracle_price * min_price_multiplier + MinPriceMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=min_price_multiplier,json=minPriceMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_price_multiplier"` + // Minimum payment token bid amount + MinBidAmount cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=min_bid_amount,json=minBidAmount,proto3,customtype=cosmossdk.io/math.Int" json:"min_bid_amount"` + Beneficiary string `protobuf:"bytes,7,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"` +} + +func (m *MsgUpdateAuction) Reset() { *m = MsgUpdateAuction{} } +func (m *MsgUpdateAuction) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateAuction) ProtoMessage() {} +func (*MsgUpdateAuction) Descriptor() ([]byte, []int) { + return fileDescriptor_07b888fb549a7ca8, []int{4} +} +func (m *MsgUpdateAuction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateAuction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateAuction) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateAuction.Merge(m, src) +} +func (m *MsgUpdateAuction) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateAuction) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateAuction.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateAuction proto.InternalMessageInfo + +func (m *MsgUpdateAuction) GetAdmin() string { + if m != nil { + return m.Admin + } + return "" +} + +func (m *MsgUpdateAuction) GetAuctionName() string { + if m != nil { + return m.AuctionName + } + return "" +} + +func (m *MsgUpdateAuction) GetAuctionType() AuctionType { + if m != nil { + return m.AuctionType + } + return AuctionType_AUCTION_TYPE_UNSPECIFIED +} + +func (m *MsgUpdateAuction) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *MsgUpdateAuction) GetBeneficiary() string { + if m != nil { + return m.Beneficiary + } + return "" +} + +type MsgUpdateAuctionResponse struct { +} + +func (m *MsgUpdateAuctionResponse) Reset() { *m = MsgUpdateAuctionResponse{} } +func (m *MsgUpdateAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateAuctionResponse) ProtoMessage() {} +func (*MsgUpdateAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07b888fb549a7ca8, []int{5} +} +func (m *MsgUpdateAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateAuctionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateAuctionResponse.Merge(m, src) +} +func (m *MsgUpdateAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateAuctionResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgPlaceBid)(nil), "stride.auction.MsgPlaceBid") + proto.RegisterType((*MsgPlaceBidResponse)(nil), "stride.auction.MsgPlaceBidResponse") + proto.RegisterType((*MsgCreateAuction)(nil), "stride.auction.MsgCreateAuction") + proto.RegisterType((*MsgCreateAuctionResponse)(nil), "stride.auction.MsgCreateAuctionResponse") + proto.RegisterType((*MsgUpdateAuction)(nil), "stride.auction.MsgUpdateAuction") + proto.RegisterType((*MsgUpdateAuctionResponse)(nil), "stride.auction.MsgUpdateAuctionResponse") +} + +func init() { proto.RegisterFile("stride/auction/tx.proto", fileDescriptor_07b888fb549a7ca8) } + +var fileDescriptor_07b888fb549a7ca8 = []byte{ + // 688 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x3d, 0x4f, 0xdc, 0x4a, + 0x14, 0x5d, 0x03, 0xbb, 0xc0, 0xf0, 0xa1, 0xf7, 0xcc, 0x22, 0xfc, 0x96, 0xf7, 0x16, 0xde, 0x6e, + 0x11, 0x84, 0x84, 0x1d, 0x88, 0xd2, 0x50, 0x44, 0x62, 0xa1, 0x89, 0xc2, 0x26, 0xc8, 0x40, 0x93, + 0x14, 0xab, 0xb1, 0x67, 0x62, 0x46, 0xec, 0xcc, 0x58, 0x9e, 0x59, 0xc4, 0x76, 0x51, 0x4a, 0xaa, + 0x14, 0xf9, 0x13, 0xe9, 0x28, 0xf2, 0x03, 0x52, 0x52, 0xa2, 0x54, 0x51, 0x0a, 0x14, 0x41, 0xc1, + 0xdf, 0x88, 0xec, 0x19, 0x2f, 0x36, 0xac, 0xc2, 0x4a, 0xa1, 0x48, 0x83, 0xb9, 0xf7, 0x9e, 0x73, + 0xec, 0x3d, 0xe7, 0x6a, 0x06, 0xcc, 0x09, 0x19, 0x11, 0x84, 0x1d, 0xd8, 0xf1, 0x25, 0xe1, 0xcc, + 0x91, 0xc7, 0x76, 0x18, 0x71, 0xc9, 0xcd, 0x69, 0x35, 0xb0, 0xf5, 0xa0, 0xf2, 0x37, 0xa4, 0x84, + 0x71, 0x27, 0xf9, 0xab, 0x20, 0x95, 0x7f, 0x7c, 0x2e, 0x28, 0x17, 0xad, 0xa4, 0x72, 0x54, 0xa1, + 0x47, 0x73, 0xaa, 0x72, 0xa8, 0x08, 0x9c, 0xa3, 0xd5, 0xf8, 0xa1, 0x07, 0xe5, 0x80, 0x07, 0x5c, + 0x11, 0xe2, 0xff, 0x74, 0xf7, 0xdf, 0x5b, 0x5f, 0xa1, 0x9f, 0x6a, 0x5a, 0xfb, 0x34, 0x04, 0x26, + 0x9a, 0x22, 0xd8, 0x69, 0x43, 0x1f, 0x37, 0x08, 0x32, 0x1f, 0x83, 0x92, 0x47, 0x10, 0xc2, 0x91, + 0x65, 0x2c, 0x1a, 0x4b, 0xe3, 0x0d, 0xeb, 0xeb, 0xe7, 0x95, 0xb2, 0x7e, 0xfd, 0x06, 0x42, 0x11, + 0x16, 0x62, 0x57, 0x46, 0x84, 0x05, 0xae, 0xc6, 0x99, 0xff, 0x83, 0x49, 0x2d, 0xd9, 0x62, 0x90, + 0x62, 0x6b, 0x28, 0xe6, 0xb9, 0x13, 0xba, 0xf7, 0x12, 0x52, 0x6c, 0xbe, 0x02, 0x65, 0x81, 0xdb, + 0x6d, 0xc2, 0x82, 0x96, 0xe4, 0x87, 0x98, 0xb5, 0x20, 0xe5, 0x1d, 0x26, 0xad, 0xe1, 0xe4, 0x15, + 0xff, 0x9d, 0x5d, 0x2c, 0x14, 0xbe, 0x5f, 0x2c, 0xcc, 0xaa, 0xd7, 0x08, 0x74, 0x68, 0x13, 0xee, + 0x50, 0x28, 0x0f, 0xec, 0xe7, 0x4c, 0xba, 0xa6, 0xa6, 0xee, 0xc5, 0xcc, 0x8d, 0x84, 0x18, 0x0b, + 0x86, 0xb0, 0x4b, 0x31, 0x93, 0x79, 0xc1, 0x91, 0x81, 0x04, 0x35, 0x35, 0x23, 0xb8, 0x5e, 0x7f, + 0x7f, 0x7d, 0xba, 0xac, 0x7f, 0xd1, 0xc9, 0xf5, 0xe9, 0xf2, 0x4c, 0xea, 0x56, 0xc6, 0x9b, 0xda, + 0x2c, 0x98, 0xc9, 0x94, 0x2e, 0x16, 0x21, 0x67, 0x02, 0xd7, 0x4e, 0x46, 0xc0, 0x5f, 0x4d, 0x11, + 0x6c, 0x46, 0x18, 0x4a, 0xbc, 0xa1, 0x78, 0xa6, 0x0d, 0x8a, 0x10, 0x51, 0xc2, 0xee, 0xb5, 0x51, + 0xc1, 0x06, 0x71, 0xf1, 0xd9, 0x0d, 0x44, 0x76, 0x43, 0x9c, 0xb8, 0x37, 0xbd, 0x36, 0x6f, 0xe7, + 0x97, 0xc9, 0xd6, 0x5f, 0xb0, 0xd7, 0x0d, 0x71, 0x8f, 0x1f, 0x17, 0x66, 0x1d, 0x4c, 0xa5, 0x29, + 0x20, 0xcc, 0x38, 0x55, 0x6e, 0xb9, 0x93, 0xba, 0xb9, 0x15, 0xf7, 0x62, 0x50, 0xea, 0xac, 0x02, + 0x15, 0x15, 0x48, 0x37, 0x15, 0xc8, 0x02, 0xa3, 0x98, 0x41, 0xaf, 0x8d, 0x91, 0x55, 0x5a, 0x34, + 0x96, 0xc6, 0xdc, 0xb4, 0x34, 0xf7, 0x41, 0x99, 0x12, 0xd6, 0x0a, 0x23, 0xe2, 0xe3, 0x16, 0xed, + 0xb4, 0x25, 0x09, 0xdb, 0x04, 0x47, 0xd6, 0x68, 0xe2, 0x42, 0x5d, 0x07, 0x33, 0x7f, 0x37, 0x98, + 0x6d, 0x1c, 0x40, 0xbf, 0xbb, 0x85, 0x7d, 0xd7, 0xa4, 0x84, 0xed, 0xc4, 0xfc, 0x66, 0x8f, 0x6e, + 0x6e, 0x82, 0xe9, 0x58, 0xd6, 0x23, 0x28, 0x4d, 0x7a, 0x6c, 0x90, 0xa4, 0x27, 0x29, 0x61, 0x0d, + 0x82, 0xf4, 0xd2, 0xac, 0x83, 0x09, 0x0f, 0x33, 0xfc, 0x96, 0xf8, 0x04, 0x46, 0x5d, 0x6b, 0xfc, + 0x9e, 0x60, 0xb2, 0xe0, 0xf5, 0x47, 0xf1, 0x7e, 0xa8, 0xa8, 0xe2, 0xf5, 0xb0, 0x32, 0xeb, 0x91, + 0xcb, 0xbd, 0x56, 0x01, 0xd6, 0xed, 0x5e, 0x6f, 0x51, 0xbe, 0x0c, 0x27, 0x8b, 0xb2, 0x1f, 0xa2, + 0x3f, 0x7b, 0x51, 0x32, 0xf1, 0x8e, 0x0c, 0x16, 0x6f, 0xf1, 0xa1, 0xe3, 0x2d, 0xfd, 0x76, 0xbc, + 0xa3, 0x0f, 0x14, 0x6f, 0x2e, 0x2d, 0x1d, 0x6f, 0xae, 0x97, 0xc6, 0xbb, 0xf6, 0x71, 0x08, 0x0c, + 0x37, 0x45, 0x60, 0x6e, 0x83, 0xb1, 0xde, 0x71, 0x7a, 0xc7, 0xf4, 0xcc, 0x01, 0x52, 0xa9, 0xff, + 0x62, 0x98, 0xaa, 0x9a, 0x6f, 0xc0, 0x54, 0xfe, 0x64, 0x59, 0xec, 0xc3, 0xca, 0x21, 0x2a, 0x4b, + 0xf7, 0x21, 0xb2, 0xe2, 0xf9, 0x6d, 0xec, 0x27, 0x9e, 0x43, 0xf4, 0x15, 0xef, 0xeb, 0x47, 0xa5, + 0xf8, 0xee, 0xfa, 0x74, 0xd9, 0x68, 0xbc, 0x38, 0xbb, 0xac, 0x1a, 0xe7, 0x97, 0x55, 0xe3, 0xc7, + 0x65, 0xd5, 0xf8, 0x70, 0x55, 0x2d, 0x9c, 0x5f, 0x55, 0x0b, 0xdf, 0xae, 0xaa, 0x85, 0xd7, 0xab, + 0x01, 0x91, 0x07, 0x1d, 0xcf, 0xf6, 0x39, 0x75, 0x76, 0x13, 0xd1, 0x95, 0x6d, 0xe8, 0x09, 0x47, + 0x5f, 0x58, 0x47, 0x6b, 0x4f, 0x9d, 0xe3, 0x9b, 0xcb, 0xb3, 0x1b, 0x62, 0xe1, 0x95, 0x92, 0x5b, + 0xeb, 0xc9, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x4b, 0x61, 0x3e, 0x5b, 0x07, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // PlaceBid places a bid to buy a token off an auction + PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) + // CreateAuction creates a new auction + CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) + // CreateAuction updates an existing auction + UpdateAuction(ctx context.Context, in *MsgUpdateAuction, opts ...grpc.CallOption) (*MsgUpdateAuctionResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) { + out := new(MsgPlaceBidResponse) + err := c.cc.Invoke(ctx, "/stride.auction.Msg/PlaceBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) { + out := new(MsgCreateAuctionResponse) + err := c.cc.Invoke(ctx, "/stride.auction.Msg/CreateAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateAuction(ctx context.Context, in *MsgUpdateAuction, opts ...grpc.CallOption) (*MsgUpdateAuctionResponse, error) { + out := new(MsgUpdateAuctionResponse) + err := c.cc.Invoke(ctx, "/stride.auction.Msg/UpdateAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // PlaceBid places a bid to buy a token off an auction + PlaceBid(context.Context, *MsgPlaceBid) (*MsgPlaceBidResponse, error) + // CreateAuction creates a new auction + CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error) + // CreateAuction updates an existing auction + UpdateAuction(context.Context, *MsgUpdateAuction) (*MsgUpdateAuctionResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) PlaceBid(ctx context.Context, req *MsgPlaceBid) (*MsgPlaceBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlaceBid not implemented") +} +func (*UnimplementedMsgServer) CreateAuction(ctx context.Context, req *MsgCreateAuction) (*MsgCreateAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAuction not implemented") +} +func (*UnimplementedMsgServer) UpdateAuction(ctx context.Context, req *MsgUpdateAuction) (*MsgUpdateAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateAuction not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_PlaceBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPlaceBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PlaceBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.auction.Msg/PlaceBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PlaceBid(ctx, req.(*MsgPlaceBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CreateAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateAuction) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.auction.Msg/CreateAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateAuction(ctx, req.(*MsgCreateAuction)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateAuction) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.auction.Msg/UpdateAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateAuction(ctx, req.(*MsgUpdateAuction)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stride.auction.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PlaceBid", + Handler: _Msg_PlaceBid_Handler, + }, + { + MethodName: "CreateAuction", + Handler: _Msg_CreateAuction_Handler, + }, + { + MethodName: "UpdateAuction", + Handler: _Msg_UpdateAuction_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stride/auction/tx.proto", +} + +func (m *MsgPlaceBid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgPlaceBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.PaymentTokenAmount.Size() + i -= size + if _, err := m.PaymentTokenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.SellingTokenAmount.Size() + i -= size + if _, err := m.SellingTokenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.AuctionName) > 0 { + i -= len(m.AuctionName) + copy(dAtA[i:], m.AuctionName) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPlaceBidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgPlaceBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPlaceBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCreateAuction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateAuction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Beneficiary) > 0 { + i -= len(m.Beneficiary) + copy(dAtA[i:], m.Beneficiary) + i = encodeVarintTx(dAtA, i, uint64(len(m.Beneficiary))) + i-- + dAtA[i] = 0x4a + } + { + size := m.MinBidAmount.Size() + i -= size + if _, err := m.MinBidAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size := m.MinPriceMultiplier.Size() + i -= size + if _, err := m.MinPriceMultiplier.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.PaymentDenom) > 0 { + i -= len(m.PaymentDenom) + copy(dAtA[i:], m.PaymentDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.PaymentDenom))) + i-- + dAtA[i] = 0x2a + } + if len(m.SellingDenom) > 0 { + i -= len(m.SellingDenom) + copy(dAtA[i:], m.SellingDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.SellingDenom))) + i-- + dAtA[i] = 0x22 + } + if m.AuctionType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AuctionType)) + i-- + dAtA[i] = 0x18 + } + if len(m.AuctionName) > 0 { + i -= len(m.AuctionName) + copy(dAtA[i:], m.AuctionName) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateAuctionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateAuction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateAuction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Beneficiary) > 0 { + i -= len(m.Beneficiary) + copy(dAtA[i:], m.Beneficiary) + i = encodeVarintTx(dAtA, i, uint64(len(m.Beneficiary))) + i-- + dAtA[i] = 0x3a + } + { + size := m.MinBidAmount.Size() + i -= size + if _, err := m.MinBidAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.MinPriceMultiplier.Size() + i -= size + if _, err := m.MinPriceMultiplier.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.AuctionType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AuctionType)) + i-- + dAtA[i] = 0x18 + } + if len(m.AuctionName) > 0 { + i -= len(m.AuctionName) + copy(dAtA[i:], m.AuctionName) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateAuctionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgPlaceBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AuctionName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.SellingTokenAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.PaymentTokenAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgPlaceBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateAuction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AuctionName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AuctionType != 0 { + n += 1 + sovTx(uint64(m.AuctionType)) + } + l = len(m.SellingDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PaymentDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Enabled { + n += 2 + } + l = m.MinPriceMultiplier.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinBidAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Beneficiary) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateAuction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AuctionName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AuctionType != 0 { + n += 1 + sovTx(uint64(m.AuctionType)) + } + if m.Enabled { + n += 2 + } + l = m.MinPriceMultiplier.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinBidAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Beneficiary) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPlaceBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPlaceBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellingTokenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SellingTokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PaymentTokenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PaymentTokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPlaceBidResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPlaceBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPlaceBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateAuction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateAuction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionType", wireType) + } + m.AuctionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionType |= AuctionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellingDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SellingDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PaymentDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PaymentDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPriceMultiplier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinPriceMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBidAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinBidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beneficiary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateAuctionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateAuction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateAuction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateAuction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionType", wireType) + } + m.AuctionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionType |= AuctionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPriceMultiplier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinPriceMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBidAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinBidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beneficiary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateAuctionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/validate.go b/x/auction/types/validate.go new file mode 100644 index 0000000000..b5404425f1 --- /dev/null +++ b/x/auction/types/validate.go @@ -0,0 +1,45 @@ +package types + +import ( + "errors" + fmt "fmt" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +func ValidateCreateAuctionParams( + auctionName string, + auctionType AuctionType, + sellingDenom string, + paymentDenom string, + minPriceMultiplier math.LegacyDec, + minBidAmount math.Int, + beneficiary string, +) error { + if auctionName == "" { + return errors.New("auction-name must be specified") + } + if _, ok := AuctionType_name[int32(auctionType)]; !ok { + return fmt.Errorf("auction-type %d is invalid", auctionType) + } + if sellingDenom == "" { + return errors.New("selling-denom must be specified") + } + if paymentDenom == "" { + return errors.New("payment-denom must be specified") + } + if !(minPriceMultiplier.GT(math.LegacyZeroDec()) && minPriceMultiplier.LTE(math.LegacyOneDec())) { + return errors.New("min-price-multiplier must be > 0 and <= 1 (0 > minPriceMultiplier >= 1)") + } + if minBidAmount.LT(math.ZeroInt()) { + return errors.New("min-bid-amount must be >= 0") + } + if _, err := sdk.AccAddressFromBech32(beneficiary); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid beneficiary address (%s)", err) + } + + return nil +} diff --git a/x/icqoracle/client/cli/query.go b/x/icqoracle/client/cli/query.go new file mode 100644 index 0000000000..cbffd94629 --- /dev/null +++ b/x/icqoracle/client/cli/query.go @@ -0,0 +1,110 @@ +package cli + +import ( + "context" + "fmt" + "strconv" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdQueryTokenPrice(), + CmdQueryTokenPrices(), + CmdQueryParams(), + ) + + return cmd +} + +func CmdQueryTokenPrice() *cobra.Command { + cmd := &cobra.Command{ + Use: "token-price [base-denom] [quote-denom] [pool-id]", + Short: "Query the current price for a specific token", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + baseDenom := args[0] + quoteDenom := args[1] + poolId, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return fmt.Errorf("Error parsing osmosis pool ID as uint64: %w", err) + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryTokenPriceRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + PoolId: poolId, + } + res, err := queryClient.TokenPrice(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + return cmd +} + +func CmdQueryTokenPrices() *cobra.Command { + cmd := &cobra.Command{ + Use: "token-prices", + Short: "Query all token prices", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + req := &types.QueryTokenPricesRequest{} + res, err := queryClient.TokenPrices(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + return cmd +} + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Get the parameters", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + req := &types.QueryParamsRequest{} + res, err := queryClient.Params(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + return cmd +} diff --git a/x/icqoracle/client/cli/tx.go b/x/icqoracle/client/cli/tx.go new file mode 100644 index 0000000000..ff49d0308b --- /dev/null +++ b/x/icqoracle/client/cli/tx.go @@ -0,0 +1,133 @@ +package cli + +import ( + "fmt" + "strconv" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdAddTokenPrice(), + CmdRemoveTokenPrice(), + ) + + return cmd +} + +func CmdAddTokenPrice() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-token-price [base-denom] [quote-denom] [base-denom-decimals] [quote-denom-decimals] [osmosis-pool-id] [osmosis-base-denom] [osmosis-quote-denom]", + Short: "Add a token to price tracking", + Long: strings.TrimSpace( + fmt.Sprintf(`Add a token to price tracking. + +Example: + $ %[1]s tx %[2]s add-token-price uosmo uatom 6 6 123 uosmo ibc/... --from admin +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + baseDenomDecimls, err := strconv.ParseInt(args[2], 10, 64) + if err != nil { + return fmt.Errorf("Error parsing baseDenomDecmnals as int64: %w", err) + } + + quoteDenomDecimls, err := strconv.ParseInt(args[3], 10, 64) + if err != nil { + return fmt.Errorf("Error parsing quoteDenomDecmnals as int64: %w", err) + } + + osmosisPoolId, err := strconv.ParseUint(args[4], 10, 64) + if err != nil { + return fmt.Errorf("Error parsing osmosis pool ID as uint64: %w", err) + } + + msg := types.NewMsgRegisterTokenPriceQuery( + clientCtx.GetFromAddress().String(), + args[0], + args[1], + baseDenomDecimls, + quoteDenomDecimls, + osmosisPoolId, + args[5], + args[6], + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdRemoveTokenPrice() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-token-price [base-denom] [quote-denom] [osmosis-pool-id]", + Short: "Remove a token from price tracking", + Long: strings.TrimSpace( + fmt.Sprintf(`Remove a token from price tracking. + +Example: + $ %[1]s tx %[2]s remove-token-price uatom uosmo 123 --from admin +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + osmosisPoolId, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return fmt.Errorf("Error parsing osmosis pool ID as uint64: %w", err) + } + + msg := types.NewMsgRemoveTokenPriceQuery( + clientCtx.GetFromAddress().String(), + args[0], + args[1], + osmosisPoolId, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/icqoracle/deps/osmomath/decimal.go b/x/icqoracle/deps/osmomath/decimal.go new file mode 100644 index 0000000000..2515e1e2eb --- /dev/null +++ b/x/icqoracle/deps/osmomath/decimal.go @@ -0,0 +1,1287 @@ +// Forked from https://github.com/osmosis-labs/osmosis/blob/v27.0.0/osmomath/decimal.go under the Apache v2.0 License +package osmomath + +import ( + "encoding/json" + "errors" + "fmt" + "math/big" + "strconv" + "strings" + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NOTE: never use new(BigDec) or else we will panic unmarshalling into the +// nil embedded big.Int +type BigDec struct { + i *big.Int +} + +const ( + // number of decimal places + BigDecPrecision = 36 + + // bytes required to represent the above precision + // Ceiling[Log2[10**Precision - 1]] + BigDecimalPrecisionBits = 120 + + maxDecBitLen = maxBitLen + BigDecimalPrecisionBits + + // max number of iterations in ApproxRoot function + maxApproxRootIterations = 100 + + // max number of iterations in Log2 function + maxLog2Iterations = 300 +) + +var ( + defaultBigDecPrecisionReuse = new(big.Int).Exp(big.NewInt(10), big.NewInt(BigDecPrecision), nil) + precisionReuseSDKDec = new(big.Int).Exp(big.NewInt(10), big.NewInt(DecPrecision), nil) + + //nolint:unused + bigDecDecPrecision = new(big.Int).Mul(defaultBigDecPrecisionReuse, precisionReuseSDKDec) + squaredPrecisionReuse = new(big.Int).Mul(defaultBigDecPrecisionReuse, defaultBigDecPrecisionReuse) + bigDecDecPrecisionFactorDiff = new(big.Int).Exp(big.NewInt(10), big.NewInt(BigDecPrecision-DecPrecision), nil) + + //nolint:unused + tenTimesPrecision = new(big.Int).Exp(big.NewInt(10), big.NewInt(BigDecPrecision+1), nil) + fivePrecision = new(big.Int).Quo(defaultBigDecPrecisionReuse, big.NewInt(2)) + fivePrecisionSDKDec = new(big.Int).Quo(precisionReuseSDKDec, big.NewInt(2)) + + precisionMultipliers []*big.Int + zeroInt = big.NewInt(0) + oneInt = big.NewInt(1) + //nolint:unused + fiveInt = big.NewInt(5) + tenInt = big.NewInt(10) + + // log_2(e) + // From: https://www.wolframalpha.com/input?i=log_2%28e%29+with+37+digits + logOfEbase2 = MustNewBigDecFromStr("1.442695040888963407359924681001892137") + + // log_2(1.0001) + // From: https://www.wolframalpha.com/input?i=log_2%281.0001%29+to+33+digits + tickLogOf2 = MustNewBigDecFromStr("0.000144262291094554178391070900057480") + // initialized in init() since requires + // precision to be defined. + twoBigDec BigDec = MustNewBigDecFromStr("2") + + // precisionFactors are used to adjust the scale of big.Int values to match the desired precision + precisionFactors = make(map[uint64]*big.Int) + + zeroBigDec BigDec = ZeroBigDec() + oneBigDec BigDec = OneBigDec() + oneHalfBigDec BigDec = oneBigDec.Quo(twoBigDec) + negOneBigDec BigDec = oneBigDec.Neg() +) + +// Decimal errors +var ( + ErrEmptyDecimalStr = errors.New("decimal string cannot be empty") + ErrInvalidDecimalLength = errors.New("invalid decimal length") + ErrInvalidDecimalStr = errors.New("invalid decimal string") +) + +// Set precision multipliers +func init() { + precisionMultipliers = make([]*big.Int, BigDecPrecision+1) + for i := 0; i <= BigDecPrecision; i++ { + precisionMultipliers[i] = calcPrecisionMultiplier(int64(i)) + } + + for precision := uint64(0); precision <= BigDecPrecision; precision++ { + precisionFactor := new(big.Int).Exp(big.NewInt(10), big.NewInt(BigDecPrecision-int64(precision)), nil) + precisionFactors[precision] = precisionFactor + } +} + +func precisionInt() *big.Int { + return new(big.Int).Set(defaultBigDecPrecisionReuse) +} + +func ZeroBigDec() BigDec { return BigDec{new(big.Int).Set(zeroInt)} } +func OneBigDec() BigDec { return BigDec{precisionInt()} } +func SmallestBigDec() BigDec { return BigDec{new(big.Int).Set(oneInt)} } + +// calculate the precision multiplier +func calcPrecisionMultiplier(prec int64) *big.Int { + if prec > BigDecPrecision { + panic(fmt.Sprintf("too much precision, maximum %v, provided %v", BigDecPrecision, prec)) + } + zerosToAdd := BigDecPrecision - prec + multiplier := new(big.Int).Exp(tenInt, big.NewInt(zerosToAdd), nil) + return multiplier +} + +// get the precision multiplier, do not mutate result +func precisionMultiplier(prec int64) *big.Int { + if prec > BigDecPrecision { + panic(fmt.Sprintf("too much precision, maximum %v, provided %v", BigDecPrecision, prec)) + } + return precisionMultipliers[prec] +} + +// create a new NewBigDec from integer assuming whole number +func NewBigDec(i int64) BigDec { + return NewBigDecWithPrec(i, 0) +} + +// create a new BigDec from integer with decimal place at prec +// CONTRACT: prec <= BigDecPrecision +func NewBigDecWithPrec(i, prec int64) BigDec { + bi := big.NewInt(i) + return BigDec{ + bi.Mul(bi, precisionMultiplier(prec)), + } +} + +// create a new BigDec from big integer assuming whole numbers +// CONTRACT: prec <= BigDecPrecision +func NewBigDecFromBigInt(i *big.Int) BigDec { + return NewBigDecFromBigIntWithPrec(i, 0) +} + +func NewBigDecFromBigIntMut(i *big.Int) BigDec { + return NewBigDecFromBigIntMutWithPrec(i, 0) +} + +// create a new BigDec from big integer assuming whole numbers +// CONTRACT: prec <= BigDecPrecision +func NewBigDecFromBigIntWithPrec(i *big.Int, prec int64) BigDec { + return BigDec{ + new(big.Int).Mul(i, precisionMultiplier(prec)), + } +} + +// returns a BigDec, built using a mutated copy of the passed in bigint. +// CONTRACT: prec <= BigDecPrecision +func NewBigDecFromBigIntMutWithPrec(i *big.Int, prec int64) BigDec { + return BigDec{ + i.Mul(i, precisionMultiplier(prec)), + } +} + +// create a new BigDec from big integer assuming whole numbers +// CONTRACT: prec <= BigDecPrecision +func NewBigDecFromInt(i BigInt) BigDec { + return NewBigDecFromIntWithPrec(i, 0) +} + +// create a new BigDec from big integer with decimal place at prec +// CONTRACT: prec <= BigDecPrecision +func NewBigDecFromIntWithPrec(i BigInt, prec int64) BigDec { + return BigDec{ + new(big.Int).Mul(i.BigInt(), precisionMultiplier(prec)), + } +} + +func NewBigDecFromDecMulDec(a, b Dec) BigDec { + newBi := new(big.Int).Mul(a.BigIntMut(), b.BigIntMut()) + return BigDec{newBi} +} + +// create a decimal from an input decimal string. +// valid must come in the form: +// +// (-) whole integers (.) decimal integers +// +// examples of acceptable input include: +// +// -123.456 +// 456.7890 +// 345 +// -456789 +// +// NOTE - An error will return if more decimal places +// are provided in the string than the constant Precision. +// +// CONTRACT - This function does not mutate the input str. +func NewBigDecFromStr(str string) (BigDec, error) { + if len(str) == 0 { + return BigDec{}, ErrEmptyDecimalStr + } + + // first extract any negative symbol + neg := false + if str[0] == '-' { + neg = true + str = str[1:] + } + + if len(str) == 0 { + return BigDec{}, ErrEmptyDecimalStr + } + + strs := strings.Split(str, ".") + lenDecs := 0 + combinedStr := strs[0] + + if len(strs) == 2 { // has a decimal place + lenDecs = len(strs[1]) + if lenDecs == 0 || len(combinedStr) == 0 { + return BigDec{}, ErrInvalidDecimalLength + } + combinedStr += strs[1] + } else if len(strs) > 2 { + return BigDec{}, ErrInvalidDecimalStr + } + + if lenDecs > BigDecPrecision { + return BigDec{}, fmt.Errorf("invalid precision; max: %d, got: %d", BigDecPrecision, lenDecs) + } + + // add some extra zero's to correct to the Precision factor + zerosToAdd := BigDecPrecision - lenDecs + zeros := fmt.Sprintf(`%0`+strconv.Itoa(zerosToAdd)+`s`, "") + combinedStr += zeros + + combined, ok := new(big.Int).SetString(combinedStr, 10) // base 10 + if !ok { + return BigDec{}, fmt.Errorf("failed to set decimal string: %s", combinedStr) + } + if combined.BitLen() > maxBitLen { + return BigDec{}, fmt.Errorf("decimal out of range; bitLen: got %d, max %d", combined.BitLen(), maxBitLen) + } + if neg { + combined = new(big.Int).Neg(combined) + } + + return BigDec{combined}, nil +} + +// Decimal from string, panic on error +func MustNewBigDecFromStr(s string) BigDec { + dec, err := NewBigDecFromStr(s) + if err != nil { + panic(err) + } + return dec +} + +func (d BigDec) IsNil() bool { return d.i == nil } // is decimal nil +func (d BigDec) IsZero() bool { return (d.i).Sign() == 0 } // is equal to zero +func (d BigDec) IsNegative() bool { return (d.i).Sign() == -1 } // is negative +func (d BigDec) IsPositive() bool { return (d.i).Sign() == 1 } // is positive +func (d BigDec) Equal(d2 BigDec) bool { return (d.i).Cmp(d2.i) == 0 } // equal decimals +func (d BigDec) GT(d2 BigDec) bool { return (d.i).Cmp(d2.i) > 0 } // greater than +func (d BigDec) GTE(d2 BigDec) bool { return (d.i).Cmp(d2.i) >= 0 } // greater than or equal +func (d BigDec) LT(d2 BigDec) bool { return (d.i).Cmp(d2.i) < 0 } // less than +func (d BigDec) LTE(d2 BigDec) bool { return (d.i).Cmp(d2.i) <= 0 } // less than or equal +func (d BigDec) Neg() BigDec { return BigDec{new(big.Int).Neg(d.i)} } // reverse the decimal sign +// nolint: stylecheck +func (d BigDec) Abs() BigDec { return BigDec{new(big.Int).Abs(d.i)} } // absolute value +func (d BigDec) AbsMut() BigDec { d.i.Abs(d.i); return d } // absolute value + +// BigInt returns a copy of the underlying big.Int. +func (d BigDec) BigInt() *big.Int { + if d.IsNil() { + return nil + } + + cp := new(big.Int) + return cp.Set(d.i) +} + +// BigIntMut returns the pointer of the underlying big.Int. +func (d BigDec) BigIntMut() *big.Int { + if d.IsNil() { + return nil + } + + return d.i +} + +// addition +func (d BigDec) Add(d2 BigDec) BigDec { + copy := d.Clone() + copy.AddMut(d2) + return copy +} + +// mutative addition +func (d BigDec) AddMut(d2 BigDec) BigDec { + d.i.Add(d.i, d2.i) + + assertMaxBitLen(d.i) + + return d +} + +// subtraction +func (d BigDec) Sub(d2 BigDec) BigDec { + copy := d.Clone() + copy.SubMut(d2) + return copy +} + +func (d BigDec) SubMut(d2 BigDec) BigDec { + res := d.i.Sub(d.i, d2.i) + assertMaxBitLen(res) + return BigDec{res} +} + +func (d BigDec) NegMut() BigDec { + d.i.Neg(d.i) + return d +} // reverse the decimal sign + +// Clone performs a deep copy of the receiver +// and returns the new result. +func (d BigDec) Clone() BigDec { + copy := BigDec{new(big.Int)} + copy.i.Set(d.i) + return copy +} + +// Mut performs non-mutative multiplication. +// The receiver is not modifier but the result is. +func (d BigDec) Mul(d2 BigDec) BigDec { + copy := d.Clone() + copy.MulMut(d2) + return copy +} + +// Mut performs non-mutative multiplication. +// The receiver is not modifier but the result is. +func (d BigDec) MulMut(d2 BigDec) BigDec { + d.i.Mul(d.i, d2.i) + d.i = chopPrecisionAndRound(d.i) + + assertMaxBitLen(d.i) + return BigDec{d.i} +} + +func (d BigDec) MulDec(d2 Dec) BigDec { + copy := d.Clone() + copy.MulDecMut(d2) + return copy +} + +func (d BigDec) MulDecMut(d2 Dec) BigDec { + d.i.Mul(d.i, d2.BigIntMut()) + d.i = chopPrecisionAndRoundSdkDec(d.i) + + assertMaxBitLen(d.i) + return BigDec{d.i} +} + +// multiplication truncate +func (d BigDec) MulTruncate(d2 BigDec) BigDec { + mul := new(big.Int).Mul(d.i, d2.i) + chopped := chopPrecisionAndTruncateMut(mul, defaultBigDecPrecisionReuse) + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +func (d BigDec) MulTruncateDec(d2 Dec) BigDec { + mul := new(big.Int).Mul(d.i, d2.BigIntMut()) + chopped := chopPrecisionAndTruncateMut(mul, precisionReuseSDKDec) + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +// multiplication round up +func (d BigDec) MulRoundUp(d2 BigDec) BigDec { + mul := new(big.Int).Mul(d.i, d2.i) + chopped := chopPrecisionAndRoundUpMut(mul, defaultBigDecPrecisionReuse) + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +// multiplication round up by Dec +func (d BigDec) MulRoundUpDec(d2 Dec) BigDec { + mul := new(big.Int).Mul(d.i, d2.BigIntMut()) + chopped := chopPrecisionAndRoundUpMut(mul, precisionReuseSDKDec) + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +// multiplication +func (d BigDec) MulInt(i BigInt) BigDec { + mul := new(big.Int).Mul(d.i, i.i) + assertMaxBitLen(mul) + return BigDec{mul} +} + +// MulInt64 - multiplication with int64 +func (d BigDec) MulInt64(i int64) BigDec { + bi := big.NewInt(i) + mul := bi.Mul(d.i, bi) + assertMaxBitLen(mul) + return BigDec{mul} +} + +// quotient +func (d BigDec) Quo(d2 BigDec) BigDec { + copy := d.Clone() + copy.QuoMut(d2) + return copy +} + +// mutative quotient +func (d BigDec) QuoMut(d2 BigDec) BigDec { + // multiply precision twice + // TODO: Use lower overhead thing here + d.i.Mul(d.i, squaredPrecisionReuse) + + d.i.Quo(d.i, d2.i) + chopPrecisionAndRound(d.i) + + assertMaxBitLen(d.i) + return d +} + +func (d BigDec) QuoRaw(d2 int64) BigDec { + // multiply precision, so we can chop it later + // TODO: There is certainly more efficient ways to do this, come back later + mul := new(big.Int).Mul(d.i, defaultBigDecPrecisionReuse) + + quo := mul.Quo(mul, big.NewInt(d2)) + chopped := chopPrecisionAndRound(quo) + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +// quotient truncate +func (d BigDec) QuoTruncate(d2 BigDec) BigDec { + mul := new(big.Int).Mul(d.i, defaultBigDecPrecisionReuse) + quo := mul.Quo(mul, d2.i) + assertMaxBitLen(quo) + return BigDec{quo} +} + +// quotient truncate (mutative) +func (d BigDec) QuoTruncateMut(d2 BigDec) BigDec { + // multiply bigDec precision + d.i.Mul(d.i, defaultBigDecPrecisionReuse) + d.i.Quo(d.i, d2.i) + assertMaxBitLen(d.i) + return d +} + +// quotient truncate +func (d BigDec) QuoTruncateDec(d2 Dec) BigDec { + // multiply Dec Precision + mul := new(big.Int).Mul(d.i, precisionReuseSDKDec) + quo := mul.Quo(mul, d2.BigIntMut()) + assertMaxBitLen(quo) + return BigDec{quo} +} + +// quotient truncate (mutative) +func (d BigDec) QuoTruncateDecMut(d2 Dec) BigDec { + // multiply Dec Precision + d.i.Mul(d.i, precisionReuseSDKDec) + d.i.Quo(d.i, d2.BigIntMut()) + + assertMaxBitLen(d.i) + return d +} + +// quotient, round up +func (d BigDec) QuoRoundUp(d2 BigDec) BigDec { + mul := new(big.Int).Mul(d.i, defaultBigDecPrecisionReuse) + + chopped, rem := mul.QuoRem(mul, d2.i, new(big.Int)) + if rem.Sign() > 0 { + chopped.Add(chopped, oneInt) + } + + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +// quotient, round up +func (d BigDec) QuoByDecRoundUp(d2 Dec) BigDec { + mul := new(big.Int).Mul(d.i, precisionReuseSDKDec) + + chopped, rem := mul.QuoRem(mul, d2.BigIntMut(), new(big.Int)) + if rem.Sign() > 0 { + chopped.Add(chopped, oneInt) + } + + assertMaxBitLen(chopped) + return BigDec{chopped} +} + +// quotient, round up (mutative) +func (d BigDec) QuoRoundUpMut(d2 BigDec) BigDec { + d.i.Mul(d.i, defaultBigDecPrecisionReuse) + _, rem := d.i.QuoRem(d.i, d2.i, new(big.Int)) + + d.i = incBasedOnRem(rem, d.i) + assertMaxBitLen(d.i) + return BigDec{d.i} +} + +// quotient, round up to next integer (mutative) +func (d BigDec) QuoRoundUpNextIntMut(d2 BigDec) BigDec { + _, rem := d.i.QuoRem(d.i, d2.i, new(big.Int)) + + d.i = incBasedOnRem(rem, d.i) + d.i.Mul(d.i, defaultBigDecPrecisionReuse) + assertMaxBitLen(d.i) + return BigDec{d.i} +} + +// quotient +func (d BigDec) QuoInt(i BigInt) BigDec { + mul := new(big.Int).Quo(d.i, i.i) + return BigDec{mul} +} + +// QuoInt64 - quotient with int64 +func (d BigDec) QuoInt64(i int64) BigDec { + mul := new(big.Int).Quo(d.i, big.NewInt(i)) + return BigDec{mul} +} + +// ApproxRoot returns an approximate estimation of a Dec's positive real nth root +// using Newton's method (where n is positive). The algorithm starts with some guess and +// computes the sequence of improved guesses until an answer converges to an +// approximate answer. It returns `|d|.ApproxRoot() * -1` if input is negative. +// A maximum number of 100 iterations is used a backup boundary condition for +// cases where the answer never converges enough to satisfy the main condition. +func (d BigDec) ApproxRoot(root uint64) (guess BigDec, err error) { + defer func() { + if r := recover(); r != nil { + var ok bool + err, ok = r.(error) + if !ok { + err = errors.New("out of bounds") + } + } + }() + + if d.IsNegative() { + absRoot, err := d.MulInt64(-1).ApproxRoot(root) + return absRoot.MulInt64(-1), err + } + + if root == 1 || d.IsZero() || d.Equal(oneBigDec) { + return d, nil + } + + if root == 0 { + return OneBigDec(), nil + } + + rootInt := NewBigIntFromUint64(root) + guess, delta := OneBigDec(), OneBigDec() + + for iter := 0; delta.Abs().GT(SmallestBigDec()) && iter < maxApproxRootIterations; iter++ { + prev := guess.PowerInteger(root - 1) + if prev.IsZero() { + prev = SmallestBigDec() + } + delta = d.Quo(prev) + delta.SubMut(guess) + delta = delta.QuoInt(rootInt) + + guess = guess.Add(delta) + } + + return guess, nil +} + +func assertMaxBitLen(i *big.Int) { + if i.BitLen() > maxDecBitLen { + panic("Int overflow") + } +} + +// ApproxSqrt is a wrapper around ApproxRoot for the common special case +// of finding the square root of a number. It returns -(sqrt(abs(d)) if input is negative. +// TODO: Optimize this to be faster just using native big int sqrt. +func (d BigDec) ApproxSqrt() (BigDec, error) { + return d.ApproxRoot(2) +} + +// is integer, e.g. decimals are zero +func (d BigDec) IsInteger() bool { + return new(big.Int).Rem(d.i, defaultBigDecPrecisionReuse).Sign() == 0 +} + +// format decimal state +func (d BigDec) Format(s fmt.State, verb rune) { + _, err := s.Write([]byte(d.String())) + if err != nil { + panic(err) + } +} + +// String returns a BigDec as a string. +func (d BigDec) String() string { + if d.i == nil { + return d.i.String() + } + + isNeg := d.IsNegative() + + if isNeg { + d = d.Neg() + } + + bzInt, err := d.i.MarshalText() + if err != nil { + return "" + } + inputSize := len(bzInt) + + var bzStr []byte + + // TODO: Remove trailing zeros + // case 1, purely decimal + if inputSize <= BigDecPrecision { + bzStr = make([]byte, BigDecPrecision+2) + + // 0. prefix + bzStr[0] = byte('0') + bzStr[1] = byte('.') + + // set relevant digits to 0 + for i := 0; i < BigDecPrecision-inputSize; i++ { + bzStr[i+2] = byte('0') + } + + // set final digits + copy(bzStr[2+(BigDecPrecision-inputSize):], bzInt) + } else { + // inputSize + 1 to account for the decimal point that is being added + bzStr = make([]byte, inputSize+1) + decPointPlace := inputSize - BigDecPrecision + + copy(bzStr, bzInt[:decPointPlace]) // pre-decimal digits + bzStr[decPointPlace] = byte('.') // decimal point + copy(bzStr[decPointPlace+1:], bzInt[decPointPlace:]) // post-decimal digits + } + + if isNeg { + return "-" + string(bzStr) + } + + return string(bzStr) +} + +// Float64 returns the float64 representation of a BigDec. +// Will return the error if the conversion failed. +func (d BigDec) Float64() (float64, error) { + return strconv.ParseFloat(d.String(), 64) +} + +// MustFloat64 returns the float64 representation of a BigDec. +// Would panic if the conversion failed. +func (d BigDec) MustFloat64() float64 { + if value, err := strconv.ParseFloat(d.String(), 64); err != nil { + panic(err) + } else { + return value + } +} + +// Dec returns the osmomath.Dec representation of a BigDec. +// Values in any additional decimal places are truncated. +func (d BigDec) Dec() Dec { + dec := math.LegacyNewDec(0) + decBi := dec.BigIntMut() + decBi.Quo(d.i, bigDecDecPrecisionFactorDiff) + return dec +} + +// DecWithPrecision converts BigDec to Dec with desired precision +// Example: +// BigDec: 1.010100000000153000000000000000000000 +// precision: 4 +// Output Dec: 1.010100000000000000 +// Panics if precision exceeds DecPrecision +func (d BigDec) DecWithPrecision(precision uint64) Dec { + var precisionFactor *big.Int + if precision > DecPrecision { + panic(fmt.Sprintf("maximum Dec precision is (%v), provided (%v)", DecPrecision, precision)) + } else { + precisionFactor = precisionFactors[precision] + } + + // Truncate any additional decimal values that exist due to BigDec's additional precision + // This relies on big.Int's Quo function doing floor division + intRepresentation := new(big.Int).Quo(d.BigIntMut(), precisionFactor) + + // convert int representation back to SDK Dec precision + truncatedDec := NewDecFromBigIntWithPrec(intRepresentation, int64(precision)) + + return truncatedDec +} + +// ChopPrecisionMut truncates all decimals after precision numbers after decimal point. Mutative +// CONTRACT: precision <= BigDecPrecision +// Panics if precision exceeds BigDecPrecision +func (d *BigDec) ChopPrecisionMut(precision uint64) BigDec { + if precision > BigDecPrecision { + panic(fmt.Sprintf("maximum BigDec precision is (%v), provided (%v)", DecPrecision, precision)) + } + + precisionFactor := precisionFactors[precision] + // big.Quo truncates numbers that would have been after decimal point + d.i.Quo(d.i, precisionFactor) + d.i.Mul(d.i, precisionFactor) + return BigDec{d.i} +} + +// ChopPrecision truncates all decimals after precision numbers after decimal point +// CONTRACT: precision <= BigDecPrecision +// Panics if precision exceeds BigDecPrecision +func (d *BigDec) ChopPrecision(precision uint64) BigDec { + copy := d.Clone() + return copy.ChopPrecisionMut(precision) +} + +// DecRoundUp returns the osmomath.Dec representation of a BigDec. +// Round up at precision end. +// Values in any additional decimal places are truncated. +func (d BigDec) DecRoundUp() Dec { + dec := math.LegacyZeroDec() + decBi := dec.BigIntMut() + decBi, rem := decBi.QuoRem(d.i, bigDecDecPrecisionFactorDiff, big.NewInt(0)) + incBasedOnRem(rem, decBi) + return dec +} + +// BigDecFromDec returns the BigDec representation of an Dec. +// Values in any additional decimal places are truncated. +func BigDecFromDec(d Dec) BigDec { + return NewBigDecFromBigIntMutWithPrec(d.BigInt(), DecPrecision) +} + +// BigDecFromDec returns the BigDec representation of an Dec. +// Values in any additional decimal places are truncated. +func BigDecFromDecMut(d Dec) BigDec { + return NewBigDecFromBigIntMutWithPrec(d.BigIntMut(), DecPrecision) +} + +// BigDecFromSDKInt returns the BigDec representation of an sdkInt. +// Values in any additional decimal places are truncated. +func BigDecFromSDKInt(i Int) BigDec { + return NewBigDecFromBigIntWithPrec(i.BigIntMut(), 0) +} + +// BigDecFromDecSlice returns the []BigDec representation of an []Dec. +// Values in any additional decimal places are truncated. +func BigDecFromDecSlice(ds []Dec) []BigDec { + result := make([]BigDec, len(ds)) + for i, d := range ds { + result[i] = NewBigDecFromBigIntMutWithPrec(d.BigInt(), DecPrecision) + } + return result +} + +// BigDecFromDecSlice returns the []BigDec representation of an []Dec. +// Values in any additional decimal places are truncated. +func BigDecFromDecCoinSlice(ds []sdk.DecCoin) []BigDec { + result := make([]BigDec, len(ds)) + for i, d := range ds { + result[i] = NewBigDecFromBigIntMutWithPrec(d.Amount.BigInt(), DecPrecision) + } + return result +} + +// ____ +// __| |__ "chop 'em +// ` \ round!" +// ___|| ~ _ -bankers +// | | __ +// | | | __|__|__ +// |_____: / | $$$ | +// |________| + +// Remove a Precision amount of rightmost digits and perform bankers rounding +// on the remainder (gaussian rounding) on the digits which have been removed. +// +// Mutates the input. Use the non-mutative version if that is undesired +func chopPrecisionAndRound(d *big.Int) *big.Int { + // remove the negative and add it back when returning + if d.Sign() == -1 { + // make d positive, compute chopped value, and then un-mutate d + d = d.Neg(d) + d = chopPrecisionAndRound(d) + d = d.Neg(d) + return d + } + + // get the truncated quotient and remainder + quo, rem := d, big.NewInt(0) + quo, rem = quo.QuoRem(d, defaultBigDecPrecisionReuse, rem) + + if rem.Sign() == 0 { // remainder is zero + return quo + } + + switch rem.Cmp(fivePrecision) { + case -1: + return quo + case 1: + return quo.Add(quo, oneInt) + default: // bankers rounding must take place + // always round to an even number + if quo.Bit(0) == 0 { + return quo + } + return quo.Add(quo, oneInt) + } +} + +// TODO: Abstract code +func chopPrecisionAndRoundSdkDec(d *big.Int) *big.Int { + // remove the negative and add it back when returning + if d.Sign() == -1 { + // make d positive, compute chopped value, and then un-mutate d + d = d.Neg(d) + d = chopPrecisionAndRoundSdkDec(d) + d = d.Neg(d) + return d + } + + // get the truncated quotient and remainder + quo, rem := d, big.NewInt(0) + quo, rem = quo.QuoRem(d, precisionReuseSDKDec, rem) + + if rem.Sign() == 0 { // remainder is zero + return quo + } + + switch rem.Cmp(fivePrecisionSDKDec) { + case -1: + return quo + case 1: + return quo.Add(quo, oneInt) + default: // bankers rounding must take place + // always round to an even number + if quo.Bit(0) == 0 { + return quo + } + return quo.Add(quo, oneInt) + } +} + +// chopPrecisionAndRoundUpDec removes DecPrecision amount of rightmost digits and rounds up. +// Non-mutative. +// +//nolint:unused +func chopPrecisionAndRoundUpDec(d *big.Int) *big.Int { + copy := new(big.Int).Set(d) + return chopPrecisionAndRoundUpMut(copy, precisionReuseSDKDec) +} + +func incBasedOnRem(rem *big.Int, d *big.Int) *big.Int { + if rem.Sign() == 0 { + return d + } + return d.Add(d, oneInt) +} + +// chopPrecisionAndRoundUp removes a Precision amount of rightmost digits and rounds up. +// Mutates input d. +// Mutations occur: +// - By calling chopPrecisionAndTruncateMut. +// - Using input d directly in QuoRem. +func chopPrecisionAndRoundUpMut(d *big.Int, precisionReuse *big.Int) *big.Int { + // remove the negative and add it back when returning + if d.Sign() == -1 { + // make d positive, compute chopped value, and then un-mutate d + d = d.Neg(d) + // truncate since d is negative... + d = chopPrecisionAndTruncateMut(d, precisionReuse) + d = d.Neg(d) + return d + } + + // get the truncated quotient and remainder + _, rem := d.QuoRem(d, precisionReuse, big.NewInt(0)) + return incBasedOnRem(rem, d) +} + +func chopPrecisionAndRoundNonMutative(d *big.Int) *big.Int { + tmp := new(big.Int).Set(d) + return chopPrecisionAndRound(tmp) +} + +// RoundInt64 rounds the decimal using bankers rounding +func (d BigDec) RoundInt64() int64 { + chopped := chopPrecisionAndRoundNonMutative(d.i) + if !chopped.IsInt64() { + panic("Int64() out of bound") + } + return chopped.Int64() +} + +// RoundInt round the decimal using bankers rounding +func (d BigDec) RoundInt() BigInt { + return NewBigIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i)) +} + +// chopPrecisionAndTruncate is similar to chopPrecisionAndRound, +// but always rounds down. It does not mutate the input. +func chopPrecisionAndTruncate(d *big.Int, precisionReuse *big.Int) *big.Int { + return new(big.Int).Quo(d, precisionReuse) +} + +// chopPrecisionAndTruncate is similar to chopPrecisionAndRound, +// but always rounds down. It mutates the input. +func chopPrecisionAndTruncateMut(d, precisionReuse *big.Int) *big.Int { + return d.Quo(d, precisionReuse) +} + +// TruncateInt64 truncates the decimals from the number and returns an int64 +func (d BigDec) TruncateInt64() int64 { + chopped := chopPrecisionAndTruncate(d.i, defaultBigDecPrecisionReuse) + if !chopped.IsInt64() { + panic("Int64() out of bound") + } + return chopped.Int64() +} + +// TruncateInt truncates the decimals from the number and returns an Int +func (d BigDec) TruncateInt() BigInt { + return NewBigIntFromBigInt(chopPrecisionAndTruncate(d.i, defaultBigDecPrecisionReuse)) +} + +// TruncateDec truncates the decimals from the number and returns a Dec +func (d BigDec) TruncateDec() BigDec { + return NewBigDecFromBigInt(chopPrecisionAndTruncate(d.i, defaultBigDecPrecisionReuse)) +} + +// Ceil returns the smallest integer value (as a decimal) that is greater than +// or equal to the given decimal. +func (d BigDec) Ceil() BigDec { + tmp := new(big.Int).Set(d.i) + return BigDec{i: tmp}.CeilMut() +} + +func (d BigDec) CeilMut() BigDec { + quo, rem := d.i, big.NewInt(0) + quo, rem = quo.QuoRem(quo, defaultBigDecPrecisionReuse, rem) + + // no need to round with a zero remainder regardless of sign + if rem.Sign() <= 0 { + return NewBigDecFromBigIntMut(quo) + } + + return NewBigDecFromBigIntMut(quo.Add(quo, oneInt)) +} + +// reuse nil values +var nilJSON []byte + +func init() { + empty := new(big.Int) + bz, _ := empty.MarshalText() + nilJSON, _ = json.Marshal(string(bz)) +} + +// MarshalJSON marshals the decimal +func (d BigDec) MarshalJSON() ([]byte, error) { + if d.i == nil { + return nilJSON, nil + } + return json.Marshal(d.String()) +} + +// UnmarshalJSON defines custom decoding scheme +func (d *BigDec) UnmarshalJSON(bz []byte) error { + if d.i == nil { + d.i = new(big.Int) + } + + var text string + err := json.Unmarshal(bz, &text) + if err != nil { + return err + } + + // TODO: Reuse dec allocation + newDec, err := NewBigDecFromStr(text) + if err != nil { + return err + } + + d.i = newDec.i + return nil +} + +// MarshalYAML returns the YAML representation. +func (d BigDec) MarshalYAML() (interface{}, error) { + return d.String(), nil +} + +// Marshal implements the gogo proto custom type interface. +func (d BigDec) Marshal() ([]byte, error) { + if d.i == nil { + d.i = new(big.Int) + } + return d.i.MarshalText() +} + +// MarshalTo implements the gogo proto custom type interface. +func (d *BigDec) MarshalTo(data []byte) (n int, err error) { + if d.i == nil { + d.i = new(big.Int) + } + + if d.i.Sign() == 0 { + copy(data, []byte{0x30}) + return 1, nil + } + + bz, err := d.Marshal() + if err != nil { + return 0, err + } + + copy(data, bz) + return len(bz), nil +} + +// Unmarshal implements the gogo proto custom type interface. +func (d *BigDec) Unmarshal(data []byte) error { + if len(data) == 0 { + d = nil + return nil + } + + if d.i == nil { + d.i = new(big.Int) + } + + if err := d.i.UnmarshalText(data); err != nil { + return err + } + + if d.i.BitLen() > maxBitLen { + return fmt.Errorf("decimal out of range; got: %d, max: %d", d.i.BitLen(), maxBitLen) + } + + return nil +} + +// Size implements the gogo proto custom type interface. +func (d *BigDec) Size() int { + bz, _ := d.Marshal() + return len(bz) +} + +// Override Amino binary serialization by proxying to protobuf. +func (d BigDec) MarshalAmino() ([]byte, error) { return d.Marshal() } +func (d *BigDec) UnmarshalAmino(bz []byte) error { return d.Unmarshal(bz) } + +// helpers + +// DecsEqual tests if two decimal arrays are equal +func DecsEqual(d1s, d2s []BigDec) bool { + if len(d1s) != len(d2s) { + return false + } + + for i, d1 := range d1s { + if !d1.Equal(d2s[i]) { + return false + } + } + return true +} + +// MinBigDec gets minimum decimal between two +func MinBigDec(d1, d2 BigDec) BigDec { + if d1.LT(d2) { + return d1 + } + return d2 +} + +// MaxBigDec gets maximum decimal between two +func MaxBigDec(d1, d2 BigDec) BigDec { + if d1.LT(d2) { + return d2 + } + return d1 +} + +// DecEq returns true if two given decimals are equal. +// Intended to be used with require/assert: require.True(t, DecEq(...)) +// +//nolint:thelper +func DecEq(t *testing.T, exp, got BigDec) (*testing.T, bool, string, string, string) { + return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() +} + +// DecApproxEq returns true if the differences between two given decimals are smaller than the tolerance range. +// Intended to be used with require/assert: require.True(t, DecEq(...)) +// +//nolint:thelper +func DecApproxEq(t *testing.T, d1 BigDec, d2 BigDec, tol BigDec) (*testing.T, bool, string, string, string) { + diff := d1.Sub(d2).Abs() + return t, diff.LTE(tol), "expected |d1 - d2| <:\t%v\ngot |d1 - d2| = \t\t%v", tol.String(), diff.String() +} + +// LogBase2 returns log_2 {x}. +// Rounds down by truncations during division and right shifting. +// Accurate up to 32 precision digits. +// Implementation is based on: +// https://stm32duinoforum.com/forum/dsp/BinaryLogarithm.pdf +func (x BigDec) LogBase2() BigDec { + // create a new decimal to avoid mutating + // the receiver's int buffer. + xCopy := BigDec{} + xCopy.i = new(big.Int).Set(x.i) + if xCopy.LTE(zeroBigDec) { + panic(fmt.Sprintf("log is not defined at <= 0, given (%s)", xCopy)) + } + + // Normalize x to be 1 <= x < 2. + + // y is the exponent that results in a whole multiple of 2. + y := ZeroBigDec() + + // repeat until: x >= 1. + for xCopy.LT(oneBigDec) { + xCopy.i.Lsh(xCopy.i, 1) + y.AddMut(negOneBigDec) + } + + // repeat until: x < 2. + for xCopy.GTE(twoBigDec) { + xCopy.i.Rsh(xCopy.i, 1) + y.AddMut(oneBigDec) + } + + b := oneHalfBigDec.Clone() + + // N.B. At this point x is a positive real number representing + // mantissa of the log. We estimate it using the following + // algorithm: + // https://stm32duinoforum.com/forum/dsp/BinaryLogarithm.pdf + // This has shown precision of 32 digits relative + // to Wolfram Alpha in tests. + for i := 0; i < maxLog2Iterations; i++ { + xCopy.MulMut(xCopy) + if xCopy.GTE(twoBigDec) { + xCopy.i.Rsh(xCopy.i, 1) + y.AddMut(b) + } + b.i.Rsh(b.i, 1) + } + + return y +} + +// Natural logarithm of x. +// Formula: ln(x) = log_2(x) / log_2(e) +func (x BigDec) Ln() BigDec { + log2x := x.LogBase2() + + y := log2x.Quo(logOfEbase2) + + return y +} + +// log_1.0001(x) "tick" base logarithm +// Formula: log_1.0001(b) = log_2(b) / log_2(1.0001) +func (x BigDec) TickLog() BigDec { + log2x := x.LogBase2() + + y := log2x.Quo(tickLogOf2) + + return y +} + +// log_a(x) custom base logarithm +// Formula: log_a(b) = log_2(b) / log_2(a) +func (x BigDec) CustomBaseLog(base BigDec) BigDec { + if base.LTE(ZeroBigDec()) || base.Equal(OneBigDec()) { + panic(fmt.Sprintf("log is not defined at base <= 0 or base == 1, base given (%s)", base)) + } + + log2x_argument := x.LogBase2() + log2x_base := base.LogBase2() + + y := log2x_argument.Quo(log2x_base) + + return y +} + +// PowerInteger takes a given decimal to an integer power +// and returns the result. Non-mutative. Uses square and multiply +// algorithm for performing the calculation. +func (d BigDec) PowerInteger(power uint64) BigDec { + clone := d.Clone() + return clone.PowerIntegerMut(power) +} + +// PowerIntegerMut takes a given decimal to an integer power +// and returns the result. Mutative. Uses square and multiply +// algorithm for performing the calculation. +func (d BigDec) PowerIntegerMut(power uint64) BigDec { + if power == 0 { + return OneBigDec() + } else if power == 1 { + return d + } else if power == 2 { + // save a oneBigDec allocation + return d.MulMut(d) + } + tmp := OneBigDec() + + for i := power; i > 1; { + if i%2 != 0 { + tmp = tmp.MulMut(d) + } + i /= 2 + d = d.MulMut(d) + } + + return d.MulMut(tmp) +} + +// Power returns a result of raising the given big dec to +// a positive decimal power. Panics if the power is negative. +// Panics if the base is negative. Does not mutate the receiver. +// The max supported exponent is defined by the global maxSupportedExponent. +// If a greater exponent is given, the function panics. +// The error is not bounded but expected to be around 10^-18, use with care. +// See the underlying Exp2, LogBase2 and Mul for the details of their bounds. +// WARNING: This function is broken for base < 1. The reason is that logarithm function is +// negative between zero and 1, and the Exp2(k) is undefined for negative k. +// As a result, this function panics if called for d < 1. +func (d BigDec) Power(power BigDec) BigDec { + if d.IsNegative() { + panic(fmt.Sprintf("negative base is not supported for Power(), base was (%s)", d)) + } + if power.IsNegative() { + panic(fmt.Sprintf("negative power is not supported for Power(), power was (%s)", power)) + } + if power.Abs().GT(maxSupportedExponent) { + panic(fmt.Sprintf("integer exponent %s is too large, max (%s)", power, maxSupportedExponent)) + } + // TODO: Potentially expensive?? + if power.IsInteger() { + return d.PowerInteger(power.TruncateInt().Uint64()) + } + if power.IsZero() { + return OneBigDec() + } + if d.IsZero() { + return ZeroBigDec() + } + if d.LT(oneBigDec) { + panic(fmt.Sprintf("Power() is not supported for base < 1, base was (%s)", d)) + } + if d.Equal(twoBigDec) { + return Exp2(power) + } + + // d^power = exp2(power * log_2{base}) + result := Exp2(d.LogBase2().Mul(power)) + + return result +} diff --git a/x/icqoracle/deps/osmomath/exp2.go b/x/icqoracle/deps/osmomath/exp2.go new file mode 100644 index 0000000000..d9b43313f2 --- /dev/null +++ b/x/icqoracle/deps/osmomath/exp2.go @@ -0,0 +1,102 @@ +// Forked from https://github.com/osmosis-labs/osmosis/blob/v27.0.0/osmomath/exp2.go under the Apache v2.0 License +package osmomath + +import "fmt" + +var ( + // Truncated at precision end. + // See scripts/approximations/main.py exponent_approximation_choice function for details. + numeratorCoefficients13Param = []BigDec{ + MustNewBigDecFromStr("1.000000000000000000000044212244679434"), + MustNewBigDecFromStr("0.352032455817400196452603772766844426"), + MustNewBigDecFromStr("0.056507868883666405413116800969512484"), + MustNewBigDecFromStr("0.005343900728213034434757419480319916"), + MustNewBigDecFromStr("0.000317708814342353603087543715930732"), + MustNewBigDecFromStr("0.000011429747507407623028722262874632"), + MustNewBigDecFromStr("0.000000198381965651614980168744540366"), + } + + // Rounded up at precision end. + // See scripts/approximations/main.py exponent_approximation_choice function for details. + denominatorCoefficients13Param = []BigDec{ + OneBigDec(), + MustNewBigDecFromStr("0.341114724742545112949699755780593311").Neg(), + MustNewBigDecFromStr("0.052724071627342653404436933178482287"), + MustNewBigDecFromStr("0.004760950735524957576233524801866342").Neg(), + MustNewBigDecFromStr("0.000267168475410566529819971616894193"), + MustNewBigDecFromStr("0.000008923715368802211181557353097439").Neg(), + MustNewBigDecFromStr("0.000000140277233177373698516010555916"), + } + + // maxSupportedExponent = 2^10. The value is chosen by benchmarking + // when the underlying internal functions overflow. + // If needed in the future, Exp2 can be reimplemented to allow for greater exponents. + maxSupportedExponent = MustNewBigDecFromStr("2").PowerInteger(9) +) + +// Exp2 takes 2 to the power of a given non-negative decimal exponent +// and returns the result. +// The computation is performed by using th following property: +// 2^decimal_exp = 2^{integer_exp + fractional_exp} = 2^integer_exp * 2^fractional_exp +// The max supported exponent is defined by the global maxSupportedExponent. +// If a greater exponent is given, the function panics. +// Panics if the exponent is negative. +// The answer is correct up to a factor of 10^-18. +// Meaning, result = result * k for k in [1 - 10^(-18), 1 + 10^(-18)] +// Note: our Python script plots show accuracy up to a factor of 10^22. +// However, in Go tests we only test up to 10^18. Therefore, this is the guarantee. +func Exp2(exponent BigDec) BigDec { + if exponent.IsNegative() { + panic(fmt.Sprintf("negative exponent %s is not supported", exponent)) + } + if exponent.Abs().GT(maxSupportedExponent) { + panic(fmt.Sprintf("integer exponent %s is too large, max (%s)", exponent, maxSupportedExponent)) + } + + integerExponent := exponent.TruncateDec() + + fractionalExponent := exponent.Sub(integerExponent) + fractionalResult := exp2ChebyshevRationalApprox(fractionalExponent) + + // Left bit shift is equivalent to multiplying by 2^integerExponent. + fractionalResult.i = fractionalResult.i.Lsh(fractionalResult.i, uint(integerExponent.TruncateInt().Uint64())) + + return fractionalResult +} + +// exp2ChebyshevRationalApprox takes 2 to the power of a given decimal exponent. +// The result is approximated by a 13 parameter Chebyshev rational approximation. +// f(x) = h(x) / p(x) (7, 7) terms. We set the first term of p(x) to 1. +// As a result, this ends up being 7 + 6 = 13 parameters. +// The numerator coefficients are truncated at precision end. The denominator +// coefficients are rounded up at precision end. +// See scripts/approximations/README.md for details of the scripts used +// to compute the coefficients. +// CONTRACT: exponent must be in the range [0, 1], panics if not. +// The answer is correct up to a factor of 10^-18. +// Meaning, result = result * k for k in [1 - 10^(-18), 1 + 10^(-18)] +// Note: our Python script plots show accuracy up to a factor of 10^22. +// However, in Go tests we only test up to 10^18. Therefore, this is the guarantee. +func exp2ChebyshevRationalApprox(x BigDec) BigDec { + if x.LT(ZeroBigDec()) || x.GT(OneBigDec()) { + panic(fmt.Sprintf("exponent must be in the range [0, 1], got %s", x)) + } + if x.IsZero() { + return OneBigDec() + } + if x.Equal(OneBigDec()) { + return twoBigDec + } + + h_x := numeratorCoefficients13Param[0].Clone() + p_x := denominatorCoefficients13Param[0].Clone() + x_exp_i := OneBigDec() + for i := 1; i < len(numeratorCoefficients13Param); i++ { + x_exp_i.MulMut(x) + + h_x.AddMut(numeratorCoefficients13Param[i].Mul(x_exp_i)) + p_x.AddMut(denominatorCoefficients13Param[i].Mul(x_exp_i)) + } + + return h_x.QuoMut(p_x) +} diff --git a/x/icqoracle/deps/osmomath/int.go b/x/icqoracle/deps/osmomath/int.go new file mode 100644 index 0000000000..93e0c6ab5c --- /dev/null +++ b/x/icqoracle/deps/osmomath/int.go @@ -0,0 +1,441 @@ +// Forked from https://github.com/osmosis-labs/osmosis/blob/v27.0.0/osmomath/int.go under the Apache v2.0 License +package osmomath + +import ( + "encoding" + "encoding/json" + "fmt" + "math/big" + "testing" +) + +const maxBitLen = 1024 + +func newIntegerFromString(s string) (*big.Int, bool) { + return new(big.Int).SetString(s, 0) +} + +func equal(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == 0 } + +// Greater than +func gt(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == 1 } + +// Greater than or equal to +func gte(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) >= 0 } + +// Less than +func lt(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == -1 } + +// Less than or equal to +func lte(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) <= 0 } + +func add(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Add(i, i2) } + +func sub(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Sub(i, i2) } + +func mul(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Mul(i, i2) } + +func div(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Quo(i, i2) } + +func mod(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Mod(i, i2) } + +func neg(i *big.Int) *big.Int { return new(big.Int).Neg(i) } + +func abs(i *big.Int) *big.Int { return new(big.Int).Abs(i) } + +func min(i *big.Int, i2 *big.Int) *big.Int { + if i.Cmp(i2) == 1 { + return new(big.Int).Set(i2) + } + + return new(big.Int).Set(i) +} + +func max(i *big.Int, i2 *big.Int) *big.Int { + if i.Cmp(i2) == -1 { + return new(big.Int).Set(i2) + } + + return new(big.Int).Set(i) +} + +func unmarshalText(i *big.Int, text string) error { + if err := i.UnmarshalText([]byte(text)); err != nil { + return err + } + + if i.BitLen() > maxBitLen { + return fmt.Errorf("integer out of range: %s", text) + } + + return nil +} + +// Int wraps big.Int with a 257 bit range bound +// Checks overflow, underflow and division by zero +// Exists in range from -(2^256 - 1) to 2^256 - 1 +type BigInt struct { + i *big.Int +} + +// BigInt converts Int to big.Int +func (i BigInt) BigInt() *big.Int { + if i.IsNil() { + return nil + } + return new(big.Int).Set(i.i) +} + +// IsNil returns true if Int is uninitialized +func (i BigInt) IsNil() bool { + return i.i == nil +} + +// NewBigInt constructs Int from int64 +func NewBigInt(n int64) BigInt { + return BigInt{big.NewInt(n)} +} + +// NewBigIntFromUint64 constructs an Int from a uint64. +func NewBigIntFromUint64(n uint64) BigInt { + b := big.NewInt(0) + b.SetUint64(n) + return BigInt{b} +} + +// NewBigIntFromBigInt constructs Int from big.Int. If the provided big.Int is nil, +// it returns an empty instance. This function panics if the bit length is > 256. +func NewBigIntFromBigInt(i *big.Int) BigInt { + if i == nil { + return BigInt{} + } + + if i.BitLen() > maxBitLen { + panic("NewIntFromBigInt() out of bound") + } + return BigInt{i} +} + +// NewBigIntFromString constructs Int from string +func NewBigIntFromString(s string) (res BigInt, ok bool) { + i, ok := newIntegerFromString(s) + if !ok { + return + } + // Check overflow + if i.BitLen() > maxBitLen { + ok = false + return + } + return BigInt{i}, true +} + +// NewBigIntWithDecimal constructs Int with decimal +// Result value is n*10^dec +func NewBigIntWithDecimal(n int64, dec int) BigInt { + if dec < 0 { + panic("NewIntWithDecimal() decimal is negative") + } + exp := new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(dec)), nil) + i := new(big.Int) + i.Mul(big.NewInt(n), exp) + + // Check overflow + if i.BitLen() > maxBitLen { + panic("NewIntWithDecimal() out of bound") + } + return BigInt{i} +} + +// ZeroBigInt returns Int value with zero +func ZeroBigInt() BigInt { return BigInt{big.NewInt(0)} } + +// OneBigInt returns Int value with one +func OneBigInt() BigInt { return BigInt{big.NewInt(1)} } + +// ToDec converts Int to Dec +func (i BigInt) ToDec() BigDec { + return NewBigDecFromInt(i) +} + +// Int64 converts Int to int64 +// Panics if the value is out of range +func (i BigInt) Int64() int64 { + if !i.i.IsInt64() { + panic("Int64() out of bound") + } + return i.i.Int64() +} + +// IsInt64 returns true if Int64() not panics +func (i BigInt) IsInt64() bool { + return i.i.IsInt64() +} + +// Uint64 converts Int to uint64 +// Panics if the value is out of range +func (i BigInt) Uint64() uint64 { + if !i.i.IsUint64() { + panic("Uint64() out of bounds") + } + return i.i.Uint64() +} + +// IsUint64 returns true if Uint64() not panics +func (i BigInt) IsUint64() bool { + return i.i.IsUint64() +} + +// IsZero returns true if Int is zero +func (i BigInt) IsZero() bool { + return i.i.Sign() == 0 +} + +// IsNegative returns true if Int is negative +func (i BigInt) IsNegative() bool { + return i.i.Sign() == -1 +} + +// IsPositive returns true if Int is positive +func (i BigInt) IsPositive() bool { + return i.i.Sign() == 1 +} + +// Sign returns sign of Int +func (i BigInt) Sign() int { + return i.i.Sign() +} + +// Equal compares two Ints +func (i BigInt) Equal(i2 BigInt) bool { + return equal(i.i, i2.i) +} + +// GT returns true if first Int is greater than second +func (i BigInt) GT(i2 BigInt) bool { + return gt(i.i, i2.i) +} + +// GTE returns true if receiver Int is greater than or equal to the parameter +// Int. +func (i BigInt) GTE(i2 BigInt) bool { + return gte(i.i, i2.i) +} + +// LT returns true if first Int is lesser than second +func (i BigInt) LT(i2 BigInt) bool { + return lt(i.i, i2.i) +} + +// LTE returns true if first Int is less than or equal to second +func (i BigInt) LTE(i2 BigInt) bool { + return lte(i.i, i2.i) +} + +// Add adds Int from another +func (i BigInt) Add(i2 BigInt) (res BigInt) { + res = BigInt{add(i.i, i2.i)} + // Check overflow + if res.i.BitLen() > maxBitLen { + panic("Int overflow") + } + return +} + +// AddRaw adds int64 to Int +func (i BigInt) AddRaw(i2 int64) BigInt { + return i.Add(NewBigInt(i2)) +} + +// Sub subtracts Int from another +func (i BigInt) Sub(i2 BigInt) (res BigInt) { + res = BigInt{sub(i.i, i2.i)} + // Check overflow + if res.i.BitLen() > maxBitLen { + panic("Int overflow") + } + return +} + +// SubRaw subtracts int64 from Int +func (i BigInt) SubRaw(i2 int64) BigInt { + return i.Sub(NewBigInt(i2)) +} + +// Mul multiples two Ints +func (i BigInt) Mul(i2 BigInt) (res BigInt) { + // Check overflow + if i.i.BitLen()+i2.i.BitLen()-1 > maxBitLen { + panic("Int overflow") + } + res = BigInt{mul(i.i, i2.i)} + // Check overflow if sign of both are same + if res.i.BitLen() > maxBitLen { + panic("Int overflow") + } + return +} + +// MulRaw multiplies Int and int64 +func (i BigInt) MulRaw(i2 int64) BigInt { + return i.Mul(NewBigInt(i2)) +} + +// Quo divides Int with Int +func (i BigInt) Quo(i2 BigInt) (res BigInt) { + // Check division-by-zero + if i2.i.Sign() == 0 { + panic("Division by zero") + } + return BigInt{div(i.i, i2.i)} +} + +// QuoRaw divides Int with int64 +func (i BigInt) QuoRaw(i2 int64) BigInt { + return i.Quo(NewBigInt(i2)) +} + +// Mod returns remainder after dividing with Int +func (i BigInt) Mod(i2 BigInt) BigInt { + if i2.Sign() == 0 { + panic("division-by-zero") + } + return BigInt{mod(i.i, i2.i)} +} + +// ModRaw returns remainder after dividing with int64 +func (i BigInt) ModRaw(i2 int64) BigInt { + return i.Mod(NewBigInt(i2)) +} + +// Neg negates Int +func (i BigInt) Neg() (res BigInt) { + return BigInt{neg(i.i)} +} + +// Abs returns the absolute value of Int. +func (i BigInt) Abs() BigInt { + return BigInt{abs(i.i)} +} + +// return the minimum of the ints +func MinBigInt(i1, i2 BigInt) BigInt { + return BigInt{min(i1.BigInt(), i2.BigInt())} +} + +// MaxBigInt returns the maximum between two integers. +func MaxBigInt(i, i2 BigInt) BigInt { + return BigInt{max(i.BigInt(), i2.BigInt())} +} + +// Human readable string +func (i BigInt) String() string { + return i.i.String() +} + +// MarshalJSON defines custom encoding scheme +func (i BigInt) MarshalJSON() ([]byte, error) { + if i.i == nil { // Necessary since default Uint initialization has i.i as nil + i.i = new(big.Int) + } + return marshalJSON(i.i) +} + +// UnmarshalJSON defines custom decoding scheme +func (i *BigInt) UnmarshalJSON(bz []byte) error { + if i.i == nil { // Necessary since default Int initialization has i.i as nil + i.i = new(big.Int) + } + return unmarshalJSON(i.i, bz) +} + +// MarshalJSON for custom encoding scheme +// Must be encoded as a string for JSON precision +func marshalJSON(i encoding.TextMarshaler) ([]byte, error) { + text, err := i.MarshalText() + if err != nil { + return nil, err + } + + return json.Marshal(string(text)) +} + +// UnmarshalJSON for custom decoding scheme +// Must be encoded as a string for JSON precision +func unmarshalJSON(i *big.Int, bz []byte) error { + var text string + if err := json.Unmarshal(bz, &text); err != nil { + return err + } + + return unmarshalText(i, text) +} + +// MarshalYAML returns the YAML representation. +func (i BigInt) MarshalYAML() (interface{}, error) { + return i.String(), nil +} + +// Marshal implements the gogo proto custom type interface. +func (i BigInt) Marshal() ([]byte, error) { + if i.i == nil { + i.i = new(big.Int) + } + return i.i.MarshalText() +} + +// MarshalTo implements the gogo proto custom type interface. +func (i *BigInt) MarshalTo(data []byte) (n int, err error) { + if i.i == nil { + i.i = new(big.Int) + } + if i.i.BitLen() == 0 { // The value 0 + copy(data, []byte{0x30}) + return 1, nil + } + + bz, err := i.Marshal() + if err != nil { + return 0, err + } + + copy(data, bz) + return len(bz), nil +} + +// Unmarshal implements the gogo proto custom type interface. +func (i *BigInt) Unmarshal(data []byte) error { + if len(data) == 0 { + i = nil + return nil + } + + if i.i == nil { + i.i = new(big.Int) + } + + if err := i.i.UnmarshalText(data); err != nil { + return err + } + + if i.i.BitLen() > maxBitLen { + return fmt.Errorf("integer out of range; got: %d, max: %d", i.i.BitLen(), maxBitLen) + } + + return nil +} + +// Size implements the gogo proto custom type interface. +func (i *BigInt) Size() int { + bz, _ := i.Marshal() + return len(bz) +} + +// Override Amino binary serialization by proxying to protobuf. +func (i BigInt) MarshalAmino() ([]byte, error) { return i.Marshal() } +func (i *BigInt) UnmarshalAmino(bz []byte) error { return i.Unmarshal(bz) } + +// intended to be used with require/assert: require.True(IntEq(...)) +func BigIntEq(t *testing.T, exp, got BigInt) (*testing.T, bool, string, string, string) { + return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() +} diff --git a/x/icqoracle/deps/osmomath/sdk_math_alias.go b/x/icqoracle/deps/osmomath/sdk_math_alias.go new file mode 100644 index 0000000000..accf9ec891 --- /dev/null +++ b/x/icqoracle/deps/osmomath/sdk_math_alias.go @@ -0,0 +1,56 @@ +// Forked from https://github.com/osmosis-labs/osmosis/blob/v27.0.0/osmomath/sdk_math_alias.go under the Apache v2.0 License +// This file creates type and function aliases the sdkmath.LegacyDec +// This is done for reducing verbosity and improving readability. +// +// For consistency, we also alias Int and Uint so that sdkmath does not have +// to be directly imported in files where both decimal and integer types are used. +package osmomath + +import ( + sdkmath "cosmossdk.io/math" +) + +type ( + Dec = sdkmath.LegacyDec + Int = sdkmath.Int + Uint = sdkmath.Uint +) + +const ( + DecPrecision = sdkmath.LegacyPrecision + DecimalPrecisionBits = sdkmath.LegacyDecimalPrecisionBits +) + +var ( + // Dec + NewDec = sdkmath.LegacyNewDec + NewDecWithPrec = sdkmath.LegacyNewDecWithPrec + NewDecFromBigInt = sdkmath.LegacyNewDecFromBigInt + NewDecFromBigIntWithPrec = sdkmath.LegacyNewDecFromBigIntWithPrec + NewDecFromInt = sdkmath.LegacyNewDecFromInt + NewDecFromIntWithPrec = sdkmath.LegacyNewDecFromIntWithPrec + NewDecFromStr = sdkmath.LegacyNewDecFromStr + MustNewDecFromStr = sdkmath.LegacyMustNewDecFromStr + ZeroDec = sdkmath.LegacyZeroDec + OneDec = sdkmath.LegacyOneDec + SmallestDec = sdkmath.LegacySmallestDec + + // Int + NewInt = sdkmath.NewInt + NewIntFromUint64 = sdkmath.NewIntFromUint64 + NewIntFromBigInt = sdkmath.NewIntFromBigInt + NewIntFromString = sdkmath.NewIntFromString + NewIntWithDecimal = sdkmath.NewIntWithDecimal + ZeroInt = sdkmath.ZeroInt + OneInt = sdkmath.OneInt + IntEq = sdkmath.IntEq + MinInt = sdkmath.MinInt + MaxInt = sdkmath.MaxInt + + // Uint + NewUint = sdkmath.NewUint + NewUintFromString = sdkmath.NewUintFromString + + MinDec = sdkmath.LegacyMinDec + MaxDec = sdkmath.LegacyMaxDec +) diff --git a/x/icqoracle/deps/types/osmosis_concentrated_liquidity_pool.go b/x/icqoracle/deps/types/osmosis_concentrated_liquidity_pool.go new file mode 100644 index 0000000000..032fa3de3d --- /dev/null +++ b/x/icqoracle/deps/types/osmosis_concentrated_liquidity_pool.go @@ -0,0 +1,39 @@ +package types + +import ( + fmt "fmt" + + "cosmossdk.io/math" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/deps/osmomath" +) + +// SpotPrice returns the spot price of the pool. +// If base asset is the Token0 of the pool, we use the current sqrt price of the pool. +// If not, we calculate the inverse of the current sqrt price of the pool. +// +// Forked from https://github.com/osmosis-labs/osmosis/blob/v27.0.0/x/concentrated-liquidity/model/pool.go#L108-L129 under the Apache v2.0 License. +// Modified to return math.LegacyDec instead of osmomath.BigDec. +// Removed unused ctx param. +func (p OsmosisConcentratedLiquidityPool) SpotPrice(quoteAssetDenom string, baseAssetDenom string) (math.LegacyDec, error) { + // validate base asset is in pool + if baseAssetDenom != p.Token0 && baseAssetDenom != p.Token1 { + return math.LegacyDec{}, fmt.Errorf("base asset denom (%s) is not in pool with (%s, %s) pair", baseAssetDenom, p.Token0, p.Token1) + } + // validate quote asset is in pool + if quoteAssetDenom != p.Token0 && quoteAssetDenom != p.Token1 { + return math.LegacyDec{}, fmt.Errorf("quote asset denom (%s) is not in pool with (%s, %s) pair", quoteAssetDenom, p.Token0, p.Token1) + } + if p.CurrentSqrtPrice.IsZero() { + return math.LegacyDec{}, fmt.Errorf("zero sqrt price would result in either a zero spot price or division by zero when calculating the inverse price") + } + + priceSquared := p.CurrentSqrtPrice.PowerInteger(2) + // The reason why we convert the result to Dec and then back to BigDec is to temporarily + // maintain backwards compatibility with the original implementation. + // TODO: remove before https://github.com/osmosis-labs/osmosis/issues/5726 is complete + if baseAssetDenom == p.Token0 { + return priceSquared.Dec(), nil + } + return osmomath.OneBigDec().QuoMut(priceSquared).Dec(), nil +} diff --git a/x/icqoracle/deps/types/osmosis_concentrated_liquidity_pool.pb.go b/x/icqoracle/deps/types/osmosis_concentrated_liquidity_pool.pb.go new file mode 100644 index 0000000000..5dbd217a97 --- /dev/null +++ b/x/icqoracle/deps/types/osmosis_concentrated_liquidity_pool.pb.go @@ -0,0 +1,842 @@ +// Forked from https://github.com/osmosis-labs/osmosis/blob/3941926d1ace180a689951f66b01a0ecc0603d93/x/concentrated-liquidity/model/pool.pb.go under the Apache v2.0 License +// Changes made: +// 1. Pointed import path of osmomath to Stride's forked version +// 2. Implemented `func (m *Pool) String() string` (difference in gogoproto version between Osmosis and Stride) +// 3. Renamed Pool -> OsmosisConcentratedLiquidityPool + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/concentratedliquidity/v1beta1/pool.proto + +// This is a legacy package that requires additional migration logic +// in order to use the correct package. Decision made to use legacy package path +// until clear steps for migration logic and the unknowns for state breaking are +// investigated for changing proto package. + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + "github.com/Stride-Labs/stride/v25/x/icqoracle/deps/osmomath" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type OsmosisConcentratedLiquidityPool struct { + // pool's address holding all liquidity tokens. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` + // address holding the incentives liquidity. + IncentivesAddress string `protobuf:"bytes,2,opt,name=incentives_address,json=incentivesAddress,proto3" json:"incentives_address,omitempty" yaml:"incentives_address"` + // address holding spread rewards from swaps. + SpreadRewardsAddress string `protobuf:"bytes,3,opt,name=spread_rewards_address,json=spreadRewardsAddress,proto3" json:"spread_rewards_address,omitempty" yaml:"spread_rewards_address"` + Id uint64 `protobuf:"varint,4,opt,name=id,proto3" json:"id,omitempty"` + // Amount of total liquidity + CurrentTickLiquidity cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=current_tick_liquidity,json=currentTickLiquidity,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"current_tick_liquidity" yaml:"current_tick_liquidity"` + Token0 string `protobuf:"bytes,6,opt,name=token0,proto3" json:"token0,omitempty"` + Token1 string `protobuf:"bytes,7,opt,name=token1,proto3" json:"token1,omitempty"` + CurrentSqrtPrice osmomath.BigDec `protobuf:"bytes,8,opt,name=current_sqrt_price,json=currentSqrtPrice,proto3,customtype=github.com/osmosis-labs/osmosis/osmomath.BigDec" json:"current_sqrt_price" yaml:"spot_price"` + CurrentTick int64 `protobuf:"varint,9,opt,name=current_tick,json=currentTick,proto3" json:"current_tick,omitempty" yaml:"current_tick"` + // tick_spacing must be one of the authorized_tick_spacing values set in the + // concentrated-liquidity parameters + TickSpacing uint64 `protobuf:"varint,10,opt,name=tick_spacing,json=tickSpacing,proto3" json:"tick_spacing,omitempty" yaml:"tick_spacing"` + ExponentAtPriceOne int64 `protobuf:"varint,11,opt,name=exponent_at_price_one,json=exponentAtPriceOne,proto3" json:"exponent_at_price_one,omitempty" yaml:"exponent_at_price_one"` + // spread_factor is the ratio that is charged on the amount of token in. + SpreadFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,12,opt,name=spread_factor,json=spreadFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"spread_factor" yaml:"spread_factor"` + // last_liquidity_update is the last time either the pool liquidity or the + // active tick changed + LastLiquidityUpdate time.Time `protobuf:"bytes,13,opt,name=last_liquidity_update,json=lastLiquidityUpdate,proto3,stdtime" json:"last_liquidity_update" yaml:"last_liquidity_update"` +} + +func (m *OsmosisConcentratedLiquidityPool) Reset() { *m = OsmosisConcentratedLiquidityPool{} } +func (m *OsmosisConcentratedLiquidityPool) String() string { return proto.CompactTextString(m) } +func (*OsmosisConcentratedLiquidityPool) ProtoMessage() {} +func (*OsmosisConcentratedLiquidityPool) Descriptor() ([]byte, []int) { + return fileDescriptor_8b899353e6a19a1a, []int{0} +} +func (m *OsmosisConcentratedLiquidityPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OsmosisConcentratedLiquidityPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OsmosisConcentratedLiquidityPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} +func (m *OsmosisConcentratedLiquidityPool) XXX_Size() int { + return m.Size() +} +func (m *OsmosisConcentratedLiquidityPool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +func init() { + proto.RegisterType((*OsmosisConcentratedLiquidityPool)(nil), "osmosis.concentratedliquidity.v1beta1.Pool") +} + +func init() { + proto.RegisterFile("osmosis/concentratedliquidity/v1beta1/pool.proto", fileDescriptor_8b899353e6a19a1a) +} + +var fileDescriptor_8b899353e6a19a1a = []byte{ + // 661 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x4e, 0xdb, 0x40, + 0x10, 0x8e, 0xf9, 0x2d, 0x1b, 0x40, 0x65, 0x09, 0xd4, 0xd0, 0x12, 0xa7, 0x96, 0x2a, 0xe5, 0x50, + 0x6c, 0x42, 0x0f, 0x95, 0xe8, 0x89, 0x08, 0x55, 0xaa, 0x14, 0xa9, 0x68, 0xa1, 0xaa, 0x54, 0x55, + 0x72, 0x37, 0xf6, 0x62, 0x56, 0x71, 0xbc, 0xc6, 0xbb, 0xa1, 0xc0, 0x13, 0xf4, 0xc8, 0xb1, 0x47, + 0x1e, 0xa2, 0x0f, 0x81, 0x7a, 0x29, 0xc7, 0xaa, 0x07, 0xb7, 0x82, 0x37, 0xc8, 0x13, 0x54, 0xde, + 0x5d, 0x93, 0x20, 0x22, 0xb5, 0xa7, 0x64, 0xbe, 0x99, 0xef, 0xdb, 0x6f, 0xc6, 0xb3, 0x0b, 0x36, + 0x18, 0xef, 0x32, 0x4e, 0xb9, 0xeb, 0xb3, 0xd8, 0x27, 0xb1, 0x48, 0xb1, 0x20, 0x41, 0x44, 0x8f, + 0x7a, 0x34, 0xa0, 0xe2, 0xd4, 0x3d, 0x6e, 0xb4, 0x89, 0xc0, 0x0d, 0x37, 0x61, 0x2c, 0x72, 0x92, + 0x94, 0x09, 0x06, 0x9f, 0x69, 0x86, 0x33, 0x92, 0xe1, 0x68, 0xc6, 0xea, 0x8a, 0x2f, 0xeb, 0x3c, + 0x49, 0x72, 0x55, 0xa0, 0x14, 0x56, 0x2b, 0x21, 0x0b, 0x99, 0xc2, 0xf3, 0x7f, 0x1a, 0xb5, 0x42, + 0xc6, 0xc2, 0x88, 0xb8, 0x32, 0x6a, 0xf7, 0x0e, 0x5c, 0x41, 0xbb, 0x84, 0x0b, 0xdc, 0x4d, 0x54, + 0x81, 0xfd, 0x63, 0x1a, 0x4c, 0xec, 0x32, 0x16, 0xc1, 0xe7, 0x60, 0x1a, 0x07, 0x41, 0x4a, 0x38, + 0x37, 0x8d, 0x9a, 0x51, 0x9f, 0x69, 0xc2, 0x7e, 0x66, 0xcd, 0x9f, 0xe2, 0x6e, 0xb4, 0x65, 0xeb, + 0x84, 0x8d, 0x8a, 0x12, 0xd8, 0x02, 0x90, 0x4a, 0xa3, 0xf4, 0x98, 0x70, 0xaf, 0x20, 0x8e, 0x49, + 0xe2, 0x5a, 0x3f, 0xb3, 0x56, 0x14, 0xf1, 0x7e, 0x8d, 0x8d, 0x16, 0x06, 0xe0, 0xb6, 0x56, 0x7b, + 0x0f, 0x96, 0x79, 0x92, 0x12, 0x1c, 0x78, 0x29, 0xf9, 0x8c, 0xd3, 0x60, 0xa0, 0x38, 0x2e, 0x15, + 0x9f, 0xf6, 0x33, 0x6b, 0x4d, 0x29, 0x8e, 0xae, 0xb3, 0x51, 0x45, 0x25, 0x90, 0xc2, 0x0b, 0xe1, + 0x79, 0x30, 0x46, 0x03, 0x73, 0xa2, 0x66, 0xd4, 0x27, 0xd0, 0x18, 0x0d, 0xe0, 0x19, 0x58, 0xf6, + 0x7b, 0x69, 0x4a, 0x62, 0xe1, 0x09, 0xea, 0x77, 0xbc, 0xdb, 0x09, 0x9b, 0x93, 0xf2, 0xa0, 0x9d, + 0xcb, 0xcc, 0x2a, 0xfd, 0xca, 0xac, 0xc7, 0x6a, 0xb4, 0x3c, 0xe8, 0x38, 0x94, 0xb9, 0x5d, 0x2c, + 0x0e, 0x9d, 0x16, 0x09, 0xb1, 0x7f, 0xba, 0x43, 0xfc, 0x81, 0x97, 0xd1, 0x52, 0x36, 0xaa, 0xe8, + 0xc4, 0x3e, 0xf5, 0x3b, 0xad, 0x02, 0x86, 0xcb, 0x60, 0x4a, 0xb0, 0x0e, 0x89, 0x37, 0xcc, 0xa9, + 0xfc, 0x2c, 0xa4, 0xa3, 0x5b, 0xbc, 0x61, 0x4e, 0x0f, 0xe1, 0x0d, 0x78, 0x06, 0x60, 0x71, 0x00, + 0x3f, 0x4a, 0x85, 0x97, 0xa4, 0xd4, 0x27, 0xe6, 0x03, 0xe9, 0xb3, 0xa5, 0x7d, 0xba, 0x21, 0x15, + 0x87, 0xbd, 0xb6, 0xe3, 0xb3, 0xae, 0xab, 0x37, 0x68, 0x3d, 0xc2, 0x6d, 0x5e, 0x04, 0xf2, 0x57, + 0xda, 0x6f, 0xd2, 0x50, 0x79, 0x5f, 0x28, 0xe6, 0xc8, 0xb4, 0xa4, 0x8d, 0x1e, 0xea, 0x73, 0xf6, + 0x8e, 0x52, 0xb1, 0x9b, 0x43, 0x70, 0x0b, 0xcc, 0x0e, 0x37, 0x67, 0xce, 0xd4, 0x8c, 0xfa, 0x78, + 0xf3, 0x51, 0x3f, 0xb3, 0x16, 0xef, 0xb7, 0x6e, 0xa3, 0xf2, 0x50, 0xc3, 0x39, 0x57, 0x0e, 0x84, + 0x27, 0xd8, 0xa7, 0x71, 0x68, 0x82, 0x7c, 0xfa, 0xc3, 0xdc, 0xe1, 0xac, 0x8d, 0xca, 0x79, 0xb8, + 0xa7, 0x22, 0xb8, 0x07, 0x96, 0xc8, 0x49, 0xc2, 0xe2, 0x5c, 0x1a, 0x6b, 0x7f, 0x1e, 0x8b, 0x89, + 0x59, 0x96, 0x06, 0x6a, 0xfd, 0xcc, 0x7a, 0xa2, 0x44, 0x46, 0x96, 0xd9, 0x08, 0x16, 0xf8, 0xb6, + 0xea, 0xe4, 0x6d, 0x4c, 0xe0, 0x27, 0x30, 0xa7, 0xb7, 0xe6, 0x00, 0xfb, 0x82, 0xa5, 0xe6, 0xac, + 0x9c, 0xe1, 0xab, 0xff, 0xfb, 0xd6, 0x95, 0x3b, 0x7b, 0xa7, 0x14, 0x6c, 0x34, 0xab, 0xe2, 0xd7, + 0x32, 0x84, 0x27, 0x60, 0x29, 0xc2, 0x5c, 0x0c, 0x76, 0xc0, 0xeb, 0x25, 0x01, 0x16, 0xc4, 0x9c, + 0xab, 0x19, 0xf5, 0xf2, 0xe6, 0xaa, 0xa3, 0x6e, 0xa1, 0x53, 0xdc, 0x42, 0x67, 0xbf, 0xb8, 0x85, + 0xcd, 0x7a, 0xee, 0x62, 0xd0, 0xd6, 0x48, 0x19, 0xfb, 0xfc, 0xb7, 0x65, 0xa0, 0xc5, 0x3c, 0x77, + 0xbb, 0x4e, 0xef, 0x64, 0x66, 0x6b, 0xe1, 0xcb, 0x85, 0x55, 0xfa, 0x7a, 0x61, 0x95, 0xbe, 0x7f, + 0x5b, 0x9f, 0xcc, 0xef, 0xf1, 0x9b, 0xe6, 0xc7, 0xcb, 0xeb, 0xaa, 0x71, 0x75, 0x5d, 0x35, 0xfe, + 0x5c, 0x57, 0x8d, 0xf3, 0x9b, 0x6a, 0xe9, 0xea, 0xa6, 0x5a, 0xfa, 0x79, 0x53, 0x2d, 0x7d, 0x68, + 0xfe, 0x6b, 0x5b, 0x8e, 0x37, 0x5f, 0xba, 0x27, 0x77, 0x1e, 0xad, 0xf5, 0xc1, 0xab, 0xd5, 0x65, + 0x01, 0x89, 0xda, 0x53, 0xb2, 0x87, 0x17, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd4, 0xe2, 0x15, + 0xf7, 0xe3, 0x04, 0x00, 0x00, +} + +func (m *OsmosisConcentratedLiquidityPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OsmosisConcentratedLiquidityPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OsmosisConcentratedLiquidityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastLiquidityUpdate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastLiquidityUpdate):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintPool(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x6a + { + size := m.SpreadFactor.Size() + i -= size + if _, err := m.SpreadFactor.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + if m.ExponentAtPriceOne != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.ExponentAtPriceOne)) + i-- + dAtA[i] = 0x58 + } + if m.TickSpacing != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.TickSpacing)) + i-- + dAtA[i] = 0x50 + } + if m.CurrentTick != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentTick)) + i-- + dAtA[i] = 0x48 + } + { + size := m.CurrentSqrtPrice.Size() + i -= size + if _, err := m.CurrentSqrtPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if len(m.Token1) > 0 { + i -= len(m.Token1) + copy(dAtA[i:], m.Token1) + i = encodeVarintPool(dAtA, i, uint64(len(m.Token1))) + i-- + dAtA[i] = 0x3a + } + if len(m.Token0) > 0 { + i -= len(m.Token0) + copy(dAtA[i:], m.Token0) + i = encodeVarintPool(dAtA, i, uint64(len(m.Token0))) + i-- + dAtA[i] = 0x32 + } + { + size := m.CurrentTickLiquidity.Size() + i -= size + if _, err := m.CurrentTickLiquidity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Id != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x20 + } + if len(m.SpreadRewardsAddress) > 0 { + i -= len(m.SpreadRewardsAddress) + copy(dAtA[i:], m.SpreadRewardsAddress) + i = encodeVarintPool(dAtA, i, uint64(len(m.SpreadRewardsAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.IncentivesAddress) > 0 { + i -= len(m.IncentivesAddress) + copy(dAtA[i:], m.IncentivesAddress) + i = encodeVarintPool(dAtA, i, uint64(len(m.IncentivesAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintPool(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintPool(dAtA []byte, offset int, v uint64) int { + offset -= sovPool(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *OsmosisConcentratedLiquidityPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.IncentivesAddress) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.SpreadRewardsAddress) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.Id != 0 { + n += 1 + sovPool(uint64(m.Id)) + } + l = m.CurrentTickLiquidity.Size() + n += 1 + l + sovPool(uint64(l)) + l = len(m.Token0) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Token1) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = m.CurrentSqrtPrice.Size() + n += 1 + l + sovPool(uint64(l)) + if m.CurrentTick != 0 { + n += 1 + sovPool(uint64(m.CurrentTick)) + } + if m.TickSpacing != 0 { + n += 1 + sovPool(uint64(m.TickSpacing)) + } + if m.ExponentAtPriceOne != 0 { + n += 1 + sovPool(uint64(m.ExponentAtPriceOne)) + } + l = m.SpreadFactor.Size() + n += 1 + l + sovPool(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastLiquidityUpdate) + n += 1 + l + sovPool(uint64(l)) + return n +} + +func sovPool(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPool(x uint64) (n int) { + return sovPool(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *OsmosisConcentratedLiquidityPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IncentivesAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IncentivesAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpreadRewardsAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpreadRewardsAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentTickLiquidity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CurrentTickLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token0", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Token0 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Token1 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentSqrtPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CurrentSqrtPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentTick", wireType) + } + m.CurrentTick = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentTick |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TickSpacing", wireType) + } + m.TickSpacing = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TickSpacing |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExponentAtPriceOne", wireType) + } + m.ExponentAtPriceOne = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExponentAtPriceOne |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpreadFactor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SpreadFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastLiquidityUpdate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastLiquidityUpdate, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPool(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPool + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPool + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPool + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPool + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPool + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPool + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPool = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPool = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPool = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/icqoracle/keeper/abci.go b/x/icqoracle/keeper/abci.go new file mode 100644 index 0000000000..273f1ed59d --- /dev/null +++ b/x/icqoracle/keeper/abci.go @@ -0,0 +1,49 @@ +package keeper + +import ( + "fmt" + "time" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +func (k Keeper) BeginBlocker(ctx sdk.Context) { + params := k.GetParams(ctx) + + for _, tokenPrice := range k.GetAllTokenPrices(ctx) { + if err := k.RefreshTokenPrice(ctx, tokenPrice, params.UpdateIntervalSec); err != nil { + ctx.Logger().Error(fmt.Sprintf("failed to refresh token price: %s", err.Error())) + continue + } + } +} + +// Refreshes the price of a token (if applicable) +func (k Keeper) RefreshTokenPrice(ctx sdk.Context, tokenPrice types.TokenPrice, updateIntervalSec uint64) error { + // Get last update time for this token + currentTime := ctx.BlockTime() + lastUpdate := tokenPrice.LastRequestTime + isNewToken := lastUpdate.IsZero() + updateIntervalPassed := currentTime.Sub(lastUpdate) >= time.Second*time.Duration(updateIntervalSec) + + // If the update interval has not passed, don't update + if !isNewToken && !updateIntervalPassed { + return nil + } + + // If never updated or update interval has passed, submit a new query for the price + // If a query was already in progress, it will be replaced with a new one that will + // have the same query ID + if err := k.SubmitOsmosisClPoolICQ(ctx, tokenPrice); err != nil { + return errorsmod.Wrapf(err, + "failed to submit Osmosis CL pool ICQ baseToken='%s' quoteToken='%s' poolId='%d'", + tokenPrice.BaseDenom, + tokenPrice.QuoteDenom, + tokenPrice.OsmosisPoolId) + } + + return nil +} diff --git a/x/icqoracle/keeper/abci_test.go b/x/icqoracle/keeper/abci_test.go new file mode 100644 index 0000000000..491d89b000 --- /dev/null +++ b/x/icqoracle/keeper/abci_test.go @@ -0,0 +1,220 @@ +package keeper_test + +import ( + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" + icqtypes "github.com/Stride-Labs/stride/v25/x/interchainquery/types" +) + +func (s *KeeperTestSuite) TestBeginBlockerSubmitICQ() { + var submitICQCalled bool + + // Mock ICQ keeper to capture submitted queries + mockICQKeeper := MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + submitICQCalled = true + return nil + }, + } + + params := types.Params{ + UpdateIntervalSec: 60, // 1 minute interval + } + + now := time.Now().UTC() + staleTime := now.Add(-2 * time.Minute) // Older than update interval + freshTime := now.Add(-30 * time.Second) // More recent than update interval + + testCases := []struct { + name string + tokenPrice types.TokenPrice + expectedICQSubmit bool + }{ + { + name: "never updated token price", + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + LastRequestTime: time.Time{}, // Zero time + }, + expectedICQSubmit: true, + }, + { + name: "stale token price", + tokenPrice: types.TokenPrice{ + BaseDenom: "uosmo", + QuoteDenom: "uusdc", + OsmosisPoolId: 2, + LastRequestTime: staleTime, + }, + expectedICQSubmit: true, + }, + { + name: "fresh token price", + tokenPrice: types.TokenPrice{ + BaseDenom: "ustrd", + QuoteDenom: "uusdc", + OsmosisPoolId: 3, + LastRequestTime: freshTime, + }, + expectedICQSubmit: false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + // Reset test state + s.SetupTest() + + // Setup params + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Reset mock IcqKeeper + s.App.ICQOracleKeeper.IcqKeeper = mockICQKeeper + submitICQCalled = false + + // Store token price + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tc.tokenPrice) + + // Set block time to now + s.Ctx = s.Ctx.WithBlockTime(now) + + // Run BeginBlocker + s.App.ICQOracleKeeper.BeginBlocker(s.Ctx) + + // Verify if ICQ was submitted as expected + s.Require().Equal(tc.expectedICQSubmit, submitICQCalled, + "ICQ submission status does not match expected for case: %s", tc.name) + + // If ICQ was expected to be submitted, verify the token price query in progress flag + if tc.expectedICQSubmit { + updatedPrice := s.MustGetTokenPrice( + tc.tokenPrice.BaseDenom, + tc.tokenPrice.QuoteDenom, + tc.tokenPrice.OsmosisPoolId, + ) + s.Require().True(updatedPrice.QueryInProgress, + "query in progress should be true after BeginBlocker for case: %s", tc.name) + } + }) + } +} + +func (s *KeeperTestSuite) TestBeginBlockerICQErrors() { + // Setup mock ICQ keeper that returns an error + s.mockICQKeeper = MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + return fmt.Errorf("icq submit failed") + }, + } + s.App.ICQOracleKeeper.IcqKeeper = s.mockICQKeeper + + // Create token price that needs updating + updateIntervalSec := uint64(60) + tokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + LastRequestTime: time.Time{}, // Zero time to trigger update + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Run BeginBlocker - should log error but continue + err := s.App.ICQOracleKeeper.RefreshTokenPrice(s.Ctx, tokenPrice, updateIntervalSec) + s.Require().ErrorContains(err, "failed to submit Osmosis CL pool ICQ") + + // Verify token price query was not submitted + updatedPrice := s.MustGetTokenPrice( + tokenPrice.BaseDenom, + tokenPrice.QuoteDenom, + tokenPrice.OsmosisPoolId, + ) + s.Require().False(updatedPrice.QueryInProgress, + "query in progress should remain false when ICQ submission fails") +} + +func (s *KeeperTestSuite) TestBeginBlockerMultipleTokens() { + var submittedQueries int + + // Setup mock ICQ keeper to count submitted queries + mockICQKeeper := MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + submittedQueries++ + return nil + }, + } + s.App.ICQOracleKeeper.IcqKeeper = mockICQKeeper + + // Set params + params := types.Params{ + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + now := time.Now().UTC() + staleTime := now.Add(-2 * time.Minute) + + // Create multiple token prices + tokenPrices := []types.TokenPrice{ + { + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + LastRequestTime: staleTime, + QueryInProgress: false, + }, + { + BaseDenom: "uosmo", + QuoteDenom: "uusdc", + OsmosisPoolId: 2, + LastRequestTime: staleTime, + QueryInProgress: false, + }, + { + BaseDenom: "ustrd", + QuoteDenom: "uusdc", + OsmosisPoolId: 3, + LastRequestTime: s.Ctx.BlockTime(), // Should skip this one + QueryInProgress: true, + }, + { + BaseDenom: "ustrd", + QuoteDenom: "uusdc", + OsmosisPoolId: 4, + LastRequestTime: s.Ctx.BlockTime(), // Should skip this one + QueryInProgress: false, + }, + } + + // Store all token prices + for _, tp := range tokenPrices { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tp) + } + + // Set block time + s.Ctx = s.Ctx.WithBlockTime(now) + + // Run BeginBlocker + s.App.ICQOracleKeeper.BeginBlocker(s.Ctx) + + // Verify number of submitted queries + s.Require().Equal(2, submittedQueries, + "expected 2 ICQ queries to be submitted (skipping the one in progress)") + + // Verify query in progress flags + for _, tp := range tokenPrices[:2] { + updatedPrice := s.MustGetTokenPrice(tp.BaseDenom, tp.QuoteDenom, tp.OsmosisPoolId) + s.Require().True(updatedPrice.QueryInProgress, + "query in progress should be set to true for tokens that are updating") + } + for _, tp := range tokenPrices[2:] { + updatedPrice := s.MustGetTokenPrice(tp.BaseDenom, tp.QuoteDenom, tp.OsmosisPoolId) + s.Require().Equal(tp.QueryInProgress, updatedPrice.QueryInProgress, + "query in progress should not change for tokens that are not updating") + } +} diff --git a/x/icqoracle/keeper/genesis.go b/x/icqoracle/keeper/genesis.go new file mode 100644 index 0000000000..5e6025cc0e --- /dev/null +++ b/x/icqoracle/keeper/genesis.go @@ -0,0 +1,25 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +// Loads module state from genesis +func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + + for _, tokenPrice := range genState.TokenPrices { + k.SetTokenPrice(ctx, tokenPrice) + } +} + +// Export's module state into genesis file +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + params := k.GetParams(ctx) + genesis := types.DefaultGenesis() + genesis.Params = params + genesis.TokenPrices = k.GetAllTokenPrices(ctx) + return genesis +} diff --git a/x/icqoracle/keeper/icq.go b/x/icqoracle/keeper/icq.go new file mode 100644 index 0000000000..9d8d9c2224 --- /dev/null +++ b/x/icqoracle/keeper/icq.go @@ -0,0 +1,167 @@ +package keeper + +import ( + "encoding/hex" + "fmt" + "time" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + proto "github.com/cosmos/gogoproto/proto" + + "github.com/Stride-Labs/stride/v25/utils" + deps "github.com/Stride-Labs/stride/v25/x/icqoracle/deps/types" + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" + icqtypes "github.com/Stride-Labs/stride/v25/x/interchainquery/types" +) + +const ( + ICQCallbackID_OsmosisClPool = "osmosisclpool" +) + +// ICQCallbacks wrapper struct for stakeibc keeper +type ICQCallback func(Keeper, sdk.Context, []byte, icqtypes.Query) error + +type ICQCallbacks struct { + k Keeper + callbacks map[string]ICQCallback +} + +var _ icqtypes.QueryCallbacks = ICQCallbacks{} + +func (k Keeper) ICQCallbackHandler() ICQCallbacks { + return ICQCallbacks{k, make(map[string]ICQCallback)} +} + +func (c ICQCallbacks) CallICQCallback(ctx sdk.Context, id string, args []byte, query icqtypes.Query) error { + return c.callbacks[id](c.k, ctx, args, query) +} + +func (c ICQCallbacks) HasICQCallback(id string) bool { + _, found := c.callbacks[id] + return found +} + +func (c ICQCallbacks) AddICQCallback(id string, fn interface{}) icqtypes.QueryCallbacks { + c.callbacks[id] = fn.(ICQCallback) + return c +} + +func (c ICQCallbacks) RegisterICQCallbacks() icqtypes.QueryCallbacks { + return c. + AddICQCallback(ICQCallbackID_OsmosisClPool, ICQCallback(OsmosisClPoolCallback)) +} + +// Submits an ICQ to get a concentrated liquidity pool from Osmosis' store +func (k Keeper) SubmitOsmosisClPoolICQ( + ctx sdk.Context, + tokenPrice types.TokenPrice, +) error { + k.Logger(ctx).Info(utils.LogWithTokenPriceQuery(tokenPrice.BaseDenom, tokenPrice.QuoteDenom, tokenPrice.OsmosisPoolId, "Submitting OsmosisClPool ICQ")) + + params := k.GetParams(ctx) + + tokenPriceBz, err := k.cdc.Marshal(&tokenPrice) + if err != nil { + return errorsmod.Wrapf(err, "Error serializing tokenPrice '%+v' to bytes", tokenPrice) + } + + query := icqtypes.Query{ + ChainId: params.OsmosisChainId, + ConnectionId: params.OsmosisConnectionId, + QueryType: icqtypes.CONCENTRATEDLIQUIDITY_STORE_QUERY_WITH_PROOF, + RequestData: icqtypes.FormatOsmosisKeyPool(tokenPrice.OsmosisPoolId), + CallbackModule: types.ModuleName, + CallbackId: ICQCallbackID_OsmosisClPool, + CallbackData: tokenPriceBz, + TimeoutDuration: time.Duration(params.UpdateIntervalSec) * time.Second, + TimeoutPolicy: icqtypes.TimeoutPolicy_REJECT_QUERY_RESPONSE, + } + + if err := k.IcqKeeper.SubmitICQRequest(ctx, query, false); err != nil { + return errorsmod.Wrap(err, "Error submitting OsmosisClPool ICQ") + } + + if err := k.SetQueryInProgress(ctx, tokenPrice.BaseDenom, tokenPrice.QuoteDenom, tokenPrice.OsmosisPoolId); err != nil { + return errorsmod.Wrap(err, "Error updating token price query to in progress") + } + + return nil +} + +// Callback from Osmosis spot price query +func OsmosisClPoolCallback(k Keeper, ctx sdk.Context, args []byte, query icqtypes.Query) error { + var tokenPrice types.TokenPrice + if err := k.cdc.Unmarshal(query.CallbackData, &tokenPrice); err != nil { + return fmt.Errorf("Error deserializing query.CallbackData '%s' as TokenPrice", hex.EncodeToString(query.CallbackData)) + } + + k.Logger(ctx).Info(utils.LogICQCallbackWithTokenPriceQuery(tokenPrice.BaseDenom, tokenPrice.QuoteDenom, tokenPrice.OsmosisPoolId, "OsmosisClPool", + "Starting OsmosisClPool ICQ callback, QueryId: %vs, QueryType: %s, Connection: %s", query.Id, query.QueryType, query.ConnectionId)) + + tokenPrice, err := k.GetTokenPrice(ctx, tokenPrice.BaseDenom, tokenPrice.QuoteDenom, tokenPrice.OsmosisPoolId) + if err != nil { + return errorsmod.Wrap(err, "Error getting current spot price") + } + + // TODO review this + // this should never happen + if !tokenPrice.QueryInProgress { + return nil + } + + // Unmarshal the query response args to determine the prices + newSpotPrice, err := UnmarshalSpotPriceFromOsmosisClPool(tokenPrice, args) + if err != nil { + return errorsmod.Wrap(err, "Error determining spot price from query response") + } + + k.SetQueryComplete(ctx, tokenPrice, newSpotPrice) + + return nil +} + +func UnmarshalSpotPriceFromOsmosisClPool(tokenPrice types.TokenPrice, queryResponseBz []byte) (price math.LegacyDec, err error) { + var pool deps.OsmosisConcentratedLiquidityPool + if err := proto.Unmarshal(queryResponseBz, &pool); err != nil { + return math.LegacyZeroDec(), err + } + + rawSpotPrice, err := pool.SpotPrice(tokenPrice.OsmosisQuoteDenom, tokenPrice.OsmosisBaseDenom) + if err != nil { + return math.LegacyZeroDec(), err + } + + return AdjustSpotPriceForDecimals( + rawSpotPrice, + tokenPrice.BaseDenomDecimals, + tokenPrice.QuoteDenomDecimals, + ), nil +} + +// AdjustSpotPriceForDecimals corrects the spot price to account for different decimal places between tokens +// Example: For BTC (8 decimals) / USDC (6 decimals): +// - If raw price is 1,000 USDC/BTC, we multiply by 10^(8-6) to get 100,000 USDC/BTC +func AdjustSpotPriceForDecimals(rawPrice math.LegacyDec, baseDecimals, quoteDecimals int64) math.LegacyDec { + decimalsDiff := baseDecimals - quoteDecimals + if decimalsDiff == 0 { + return rawPrice + } + + decimalAdjustmentExp := abs(decimalsDiff) + decimalAdjustment := math.LegacyNewDec(10).Power(decimalAdjustmentExp) + + if decimalsDiff > 0 { + return rawPrice.Mul(decimalAdjustment) + } else { + return rawPrice.Quo(decimalAdjustment) + } +} + +func abs(num int64) uint64 { + if num < 0 { + return uint64(-num) + } + return uint64(num) +} diff --git a/x/icqoracle/keeper/icq_test.go b/x/icqoracle/keeper/icq_test.go new file mode 100644 index 0000000000..0817e41ccf --- /dev/null +++ b/x/icqoracle/keeper/icq_test.go @@ -0,0 +1,835 @@ +package keeper_test + +import ( + "fmt" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + proto "github.com/cosmos/gogoproto/proto" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/deps/osmomath" + deps "github.com/Stride-Labs/stride/v25/x/icqoracle/deps/types" + "github.com/Stride-Labs/stride/v25/x/icqoracle/keeper" + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" + icqtypes "github.com/Stride-Labs/stride/v25/x/interchainquery/types" +) + +// Mock ICQ Keeper struct +type MockICQKeeper struct { + SubmitICQRequestFn func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error +} + +func (m MockICQKeeper) SubmitICQRequest(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + if m.SubmitICQRequestFn != nil { + return m.SubmitICQRequestFn(ctx, query, forceUnique) + } + return nil +} + +func (s *KeeperTestSuite) TestSubmitOsmosisClPoolICQUnknownPrice() { + // Set up test parameters + tokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + } + + params := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-0", + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Submit ICQ request + err := s.App.ICQOracleKeeper.SubmitOsmosisClPoolICQ(s.Ctx, tokenPrice) + s.Require().ErrorContains(err, "price not found") +} + +func (s *KeeperTestSuite) TestHappyPathOsmosisClPoolICQ() { + var submittedQuery icqtypes.Query + + // Setup mock ICQ keeper with custom behavior + s.mockICQKeeper = MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + submittedQuery = query + return nil + }, + } + s.App.ICQOracleKeeper.IcqKeeper = s.mockICQKeeper + + // Set up test parameters + tokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + } + + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + params := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-0", + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Verify tokenPrice.QueryInProgress before + s.Require().False(tokenPrice.QueryInProgress) + + // Submit ICQ request + err := s.App.ICQOracleKeeper.SubmitOsmosisClPoolICQ(s.Ctx, tokenPrice) + s.Require().NoError(err) + + // Verify the submitted query + s.Require().Equal(params.OsmosisChainId, submittedQuery.ChainId) + s.Require().Equal(params.OsmosisConnectionId, submittedQuery.ConnectionId) + s.Require().Equal(icqtypes.CONCENTRATEDLIQUIDITY_STORE_QUERY_WITH_PROOF, submittedQuery.QueryType) + + // Verify tokenPrice.QueryInProgress after + tokenPriceAfter, err := s.App.ICQOracleKeeper.GetTokenPrice(s.Ctx, tokenPrice.BaseDenom, tokenPrice.QuoteDenom, tokenPrice.OsmosisPoolId) + s.Require().NoError(err) + + s.Require().True(tokenPriceAfter.QueryInProgress, "query in progress") + s.Require().Equal(tokenPriceAfter.LastRequestTime, s.Ctx.BlockTime(), "query request time") +} + +func (s *KeeperTestSuite) TestSubmitOsmosisClPoolICQBranches() { + testCases := []struct { + name string + setup func() + tokenPrice types.TokenPrice + expectedError string + }{ + { + name: "error submitting ICQ request", + setup: func() { + params := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-0", + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Mock ICQ keeper to return error + s.mockICQKeeper = MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + return fmt.Errorf("mock ICQ submit error") + }, + } + s.App.ICQOracleKeeper.IcqKeeper = s.mockICQKeeper + }, + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + }, + expectedError: "Error submitting OsmosisClPool ICQ", + }, + { + name: "error setting query in progress", + setup: func() { + params := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-0", + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Setup mock ICQ keeper with success response + s.mockICQKeeper = MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + // Remove token price so set query in progress will fail to get it after SubmitICQRequest returns + s.App.ICQOracleKeeper.RemoveTokenPrice(ctx, "uatom", "uusdc", 1) + return nil + }, + } + s.App.ICQOracleKeeper.IcqKeeper = s.mockICQKeeper + + // Don't set the token price first, which will cause SetTokenPriceQueryInProgress to fail + }, + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + }, + expectedError: "Error updating token price query to in progress", + }, + { + name: "successful submission", + setup: func() { + params := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-0", + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Setup mock ICQ keeper with success response + s.mockICQKeeper = MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + return nil + }, + } + s.App.ICQOracleKeeper.IcqKeeper = s.mockICQKeeper + }, + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + }, + expectedError: "", + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + // Reset context for each test case + s.SetupTest() + + // Run test case setup + tc.setup() + + // If this is not an error case testing query in progress, + // set the token price first + if tc.expectedError != "token price not found" { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tc.tokenPrice) + + } + + // Execute + err := s.App.ICQOracleKeeper.SubmitOsmosisClPoolICQ(s.Ctx, tc.tokenPrice) + + // Verify results + if tc.expectedError != "" { + s.Require().ErrorContains(err, tc.expectedError) + } else { + s.Require().NoError(err) + + // For successful case, verify query in progress was set + tokenPriceAfter, err := s.App.ICQOracleKeeper.GetTokenPrice( + s.Ctx, + tc.tokenPrice.BaseDenom, + tc.tokenPrice.QuoteDenom, + tc.tokenPrice.OsmosisPoolId, + ) + s.Require().NoError(err) + s.Require().True(tokenPriceAfter.QueryInProgress) + } + }) + } +} + +func (s *KeeperTestSuite) TestSubmitOsmosisClPoolICQQueryData() { + var capturedQuery icqtypes.Query + + // Setup mock ICQ keeper to capture the submitted query and prove flag + s.mockICQKeeper = MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + capturedQuery = query + return nil + }, + } + s.App.ICQOracleKeeper.IcqKeeper = s.mockICQKeeper + + // Set up test parameters + tokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + params := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-0", + UpdateIntervalSec: 60, + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Submit ICQ request + err := s.App.ICQOracleKeeper.SubmitOsmosisClPoolICQ(s.Ctx, tokenPrice) + s.Require().NoError(err) + + // Verify the captured query data + s.Require().Equal(params.OsmosisChainId, capturedQuery.ChainId) + s.Require().Equal(params.OsmosisConnectionId, capturedQuery.ConnectionId) + s.Require().Equal(icqtypes.CONCENTRATEDLIQUIDITY_STORE_QUERY_WITH_PROOF, capturedQuery.QueryType) + s.Require().Equal(types.ModuleName, capturedQuery.CallbackModule) + s.Require().Equal(keeper.ICQCallbackID_OsmosisClPool, capturedQuery.CallbackId) + + // Verify request data format (pool key) + expectedRequestData := icqtypes.FormatOsmosisKeyPool(tokenPrice.OsmosisPoolId) + s.Require().Equal(expectedRequestData, capturedQuery.RequestData) + + // Verify callback data contains the token price + var decodedTokenPrice types.TokenPrice + err = s.App.AppCodec().Unmarshal(capturedQuery.CallbackData, &decodedTokenPrice) + s.Require().NoError(err) + s.Require().Equal(tokenPrice.BaseDenom, decodedTokenPrice.BaseDenom) + s.Require().Equal(tokenPrice.QuoteDenom, decodedTokenPrice.QuoteDenom) + s.Require().Equal(tokenPrice.OsmosisPoolId, decodedTokenPrice.OsmosisPoolId) + + // Verify timeout settings + expectedTimeout := time.Duration(params.UpdateIntervalSec) * time.Second + s.Require().Equal(expectedTimeout, capturedQuery.TimeoutDuration) + s.Require().Equal(icqtypes.TimeoutPolicy_REJECT_QUERY_RESPONSE, capturedQuery.TimeoutPolicy) +} + +// Helper function to create mock pool data +func (s *KeeperTestSuite) createMockPoolData(baseDenom string, quoteDenom string) []byte { + pool := deps.OsmosisConcentratedLiquidityPool{ + Token0: baseDenom, + Token1: quoteDenom, + // The square root of the price + // For a price of 1.5, 1.224744871 is the square root + CurrentSqrtPrice: osmomath.NewBigDecWithPrec(1224744871, 9), + } + + bz, err := proto.Marshal(&pool) + s.Require().NoError(err, "no error expected when marshaling mock pool data") + return bz +} + +func (s *KeeperTestSuite) TestOsmosisClPoolCallback() { + // Setup base test parameters used across test cases + baseTokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "ibc/uusdc", + SpotPrice: math.LegacyNewDec(2), + QueryInProgress: true, + } + + testCases := []struct { + name string + setup func() ([]byte, icqtypes.Query) + expectedError string + verify func(err error) + }{ + { + name: "invalid callback data", + setup: func() ([]byte, icqtypes.Query) { + return []byte{}, icqtypes.Query{ + CallbackData: []byte("invalid callback data"), + } + }, + expectedError: "Error deserializing query.CallbackData", + }, + { + name: "token price not found", + setup: func() ([]byte, icqtypes.Query) { + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Don't set the token price in state + return []byte{}, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "price not found", + }, + { + name: "query not in progress", + setup: func() ([]byte, icqtypes.Query) { + tokenPrice := baseTokenPrice + tokenPrice.QueryInProgress = false + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&tokenPrice) + s.Require().NoError(err) + + return []byte{}, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "", + verify: func(err error) { + s.Require().NoError(err, "no error expected when query not in progress") + }, + }, + { + name: "invalid pool data", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + return []byte("invalid pool data"), icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "Error determining spot price from query response", + }, + { + name: "successful update with valid pool data", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create mock pool data with expected price of 2.0 + poolData := s.createMockPoolData( + baseTokenPrice.OsmosisBaseDenom, + baseTokenPrice.OsmosisQuoteDenom, + ) + + return poolData, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "", + verify: func(err error) { + s.Require().NoError(err) + + // Verify token price was updated correctly + tokenPrice := s.MustGetTokenPrice( + baseTokenPrice.BaseDenom, + baseTokenPrice.QuoteDenom, + baseTokenPrice.OsmosisPoolId, + ) + + // Verify updated fields + s.Require().False(tokenPrice.QueryInProgress) + s.Require().Equal(s.Ctx.BlockTime().UnixNano(), tokenPrice.LastResponseTime.UnixNano()) + s.Require().InDelta(1.5, tokenPrice.SpotPrice.MustFloat64(), 0.01) + }, + }, + { + name: "successful update with inverse pool data", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create pool with swapped denoms + poolData := s.createMockPoolData( + baseTokenPrice.OsmosisQuoteDenom, // Swapped! + baseTokenPrice.OsmosisBaseDenom, // Swapped! + ) + + return poolData, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "", + verify: func(err error) { + s.Require().NoError(err) + + // Verify token price was updated correctly + tokenPrice := s.MustGetTokenPrice( + baseTokenPrice.BaseDenom, + baseTokenPrice.QuoteDenom, + baseTokenPrice.OsmosisPoolId, + ) + + // Verify updated fields + s.Require().False(tokenPrice.QueryInProgress) + s.Require().Equal(s.Ctx.BlockTime().UnixNano(), tokenPrice.LastResponseTime.UnixNano()) + s.Require().InDelta(1/1.5, tokenPrice.SpotPrice.MustFloat64(), 0.01) // inversed price + }, + }, + { + name: "empty query callback data", + setup: func() ([]byte, icqtypes.Query) { + return []byte{}, icqtypes.Query{ + CallbackData: []byte{}, + } + }, + expectedError: "price not found for baseDenom='' quoteDenom='' poolId='0'", + }, + { + name: "nil query callback data", + setup: func() ([]byte, icqtypes.Query) { + return []byte{}, icqtypes.Query{ + CallbackData: nil, + } + }, + expectedError: "price not found for baseDenom='' quoteDenom='' poolId='0'", + }, + { + name: "corrupted token price in callback data", + setup: func() ([]byte, icqtypes.Query) { + // Create corrupted protobuf data + corruptedData := []byte{0xFF, 0xFF, 0xFF, 0xFF} + return []byte{}, icqtypes.Query{ + CallbackData: corruptedData, + } + }, + expectedError: "Error deserializing query.CallbackData", + }, + { + name: "empty pool response data", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + return []byte{}, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "Error determining spot price from query response", + }, + { + name: "nil pool response data", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + return nil, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "Error determining spot price from query response", + }, + { + name: "corrupted pool response data", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create corrupted protobuf data + corruptedPoolData := []byte{0xFF, 0xFF, 0xFF, 0xFF} + return corruptedPoolData, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "Error determining spot price from query response", + }, + { + name: "pool with empty tokens", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create pool with empty token denoms + pool := deps.OsmosisConcentratedLiquidityPool{ + Token0: "", + Token1: "", + CurrentSqrtPrice: osmomath.NewBigDecWithPrec(1224744871, 9), + } + poolBz, err := proto.Marshal(&pool) + s.Require().NoError(err) + + return poolBz, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "Error determining spot price from query response", + }, + { + name: "pool with invalid sqrt price", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create pool with invalid sqrt price + pool := deps.OsmosisConcentratedLiquidityPool{ + Token0: baseTokenPrice.OsmosisBaseDenom, + Token1: baseTokenPrice.OsmosisQuoteDenom, + CurrentSqrtPrice: osmomath.NewBigDec(0), // Invalid sqrt price of 0 + } + poolBz, err := proto.Marshal(&pool) + s.Require().NoError(err) + + return poolBz, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "zero sqrt price", + }, + { + name: "pool with invalid inverse sqrt price", + setup: func() ([]byte, icqtypes.Query) { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create pool with invalid sqrt price + pool := deps.OsmosisConcentratedLiquidityPool{ + Token0: baseTokenPrice.OsmosisQuoteDenom, + Token1: baseTokenPrice.OsmosisBaseDenom, + CurrentSqrtPrice: osmomath.NewBigDec(0), // Invalid sqrt price of 0 + } + poolBz, err := proto.Marshal(&pool) + s.Require().NoError(err) + + return poolBz, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: "zero sqrt price", + }, + { + name: "error setting updated token price", + setup: func() ([]byte, icqtypes.Query) { + // First set the token price + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, baseTokenPrice) + + tokenPriceBz, err := s.App.AppCodec().Marshal(&baseTokenPrice) + s.Require().NoError(err) + + // Create valid pool data + poolData := s.createMockPoolData( + baseTokenPrice.OsmosisBaseDenom, + baseTokenPrice.OsmosisQuoteDenom, + ) + + // Remove the token price from state right before setting the updated price + s.App.ICQOracleKeeper.RemoveTokenPrice(s.Ctx, baseTokenPrice.BaseDenom, baseTokenPrice.QuoteDenom, baseTokenPrice.OsmosisPoolId) + + return poolData, icqtypes.Query{ + CallbackData: tokenPriceBz, + } + }, + expectedError: fmt.Sprintf( + "price not found for baseDenom='%s' quoteDenom='%s' poolId='%d'", + baseTokenPrice.BaseDenom, + baseTokenPrice.QuoteDenom, + baseTokenPrice.OsmosisPoolId), + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + // Reset context for each test case + s.SetupTest() + + // Run test case setup + poolData, query := tc.setup() + + // Execute callback + err := keeper.OsmosisClPoolCallback(s.App.ICQOracleKeeper, s.Ctx, poolData, query) + + // Verify results + if tc.expectedError != "" { + s.Require().ErrorContains(err, tc.expectedError) + } else if tc.verify != nil { + tc.verify(err) + } + }) + } +} + +func (s *KeeperTestSuite) TestUnmarshalSpotPriceFromOsmosisClPool() { + baseTokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "uusdc", + BaseDenomDecimals: 6, + QuoteDenomDecimals: 6, + } + + testCases := []struct { + name string + tokenPrice types.TokenPrice + poolData []byte + expectedPrice math.LegacyDec + expectedError string + }{ + { + name: "invalid pool data", + tokenPrice: baseTokenPrice, + poolData: []byte("invalid pool data"), + expectedError: "proto: wrong wireType", + }, + { + name: "successful price calculation with equal decimals", + tokenPrice: baseTokenPrice, + poolData: s.createMockPoolData( + baseTokenPrice.OsmosisBaseDenom, + baseTokenPrice.OsmosisQuoteDenom, + ), + expectedPrice: math.LegacyNewDecWithPrec(15, 1), // 1.5 from mock pool data + }, + { + name: "successful price calculation with more base decimals", + tokenPrice: types.TokenPrice{ + BaseDenom: "satoshi", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/satoshi", + OsmosisQuoteDenom: "ibc/uusdc", + BaseDenomDecimals: 8, // BTC has 8 decimals + QuoteDenomDecimals: 6, // USDC has 6 decimals + }, + poolData: s.createMockPoolData( + "ibc/satoshi", + "ibc/uusdc", + ), + expectedPrice: math.LegacyNewDecWithPrec(15, 1).Mul(math.LegacyNewDec(100)), // 1.5 * 10^2 + }, + { + name: "successful price calculation with more quote decimals", + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "ibc/uusdc", + BaseDenomDecimals: 6, // ATOM has 6 decimals + QuoteDenomDecimals: 8, // Quote has 8 decimals + }, + poolData: s.createMockPoolData( + "ibc/uatom", + "ibc/uusdc", + ), + expectedPrice: math.LegacyNewDecWithPrec(15, 1).Quo(math.LegacyNewDec(100)), // 1.5 / 10^2 + }, + { + name: "price calculation with inverse pool ordering", + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "ibc/uusdc", + BaseDenomDecimals: 8, + QuoteDenomDecimals: 6, + }, + poolData: s.createMockPoolData( + "ibc/uusdc", + "ibc/uatom", + ), + expectedPrice: math.LegacyMustNewDecFromStr("0.666666666666666667").Mul(math.LegacyNewDec(100)), // (1/1.5) * 10^2 + }, + { + name: "different denom ordering in pool", + tokenPrice: types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "different_denom", + BaseDenomDecimals: 6, + QuoteDenomDecimals: 6, + }, + poolData: s.createMockPoolData( + "ibc/uatom", + "uusdc", + ), + expectedError: "quote asset denom (different_denom) is not in pool with (ibc/uatom, uusdc) pair", + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + spotPrice, err := keeper.UnmarshalSpotPriceFromOsmosisClPool(tc.tokenPrice, tc.poolData) + + if tc.expectedError != "" { + s.Require().ErrorContains(err, tc.expectedError) + } else { + s.Require().NoError(err) + s.Require().InDelta( + tc.expectedPrice.MustFloat64(), + spotPrice.MustFloat64(), + 0.000001, + "expected price %v, got %v", tc.expectedPrice, spotPrice, + ) + } + }) + } +} + +func (s *KeeperTestSuite) TestAdjustSpotPriceForDecimals() { + testCases := []struct { + name string + rawPrice math.LegacyDec + baseDecimals int64 + quoteDecimals int64 + expectedPrice math.LegacyDec + }{ + { + name: "equal decimals", + rawPrice: math.LegacyNewDec(1000), + baseDecimals: 6, + quoteDecimals: 6, + expectedPrice: math.LegacyNewDec(1000), + }, + { + name: "base has more decimals", + rawPrice: math.LegacyNewDec(1000), + baseDecimals: 8, // BTC + quoteDecimals: 6, // USDC + expectedPrice: math.LegacyNewDec(100000), // 1000 * 10^(8-6) + }, + { + name: "quote has more decimals", + rawPrice: math.LegacyNewDec(1000), + baseDecimals: 6, // USDC + quoteDecimals: 8, // BTC + expectedPrice: math.LegacyNewDec(10), // 1000 / 10^(8-6) + }, + { + name: "large base decimal", + rawPrice: math.LegacyNewDec(1), + baseDecimals: 18, // ETH + quoteDecimals: 6, // USDC + expectedPrice: math.LegacyNewDec(1000000000000), // 1 * 10^(18-6) + }, + { + name: "large quote decimal", + rawPrice: math.LegacyNewDec(1000000000000), + baseDecimals: 6, // USDC + quoteDecimals: 18, // ETH + expectedPrice: math.LegacyNewDec(1), // 1000000000000 / 10^(18-6) + }, + { + name: "zero base decimals", + rawPrice: math.LegacyNewDec(100), + baseDecimals: 0, + quoteDecimals: 6, + expectedPrice: math.LegacyNewDec(1).Quo(math.LegacyNewDec(1000000)), // 100 / 10^6 + }, + { + name: "zero quote decimals", + rawPrice: math.LegacyNewDec(100), + baseDecimals: 6, + quoteDecimals: 0, + expectedPrice: math.LegacyNewDec(100000000), // 100 * 10^6 + }, + { + name: "both zero decimals", + rawPrice: math.LegacyNewDec(100), + baseDecimals: 0, + quoteDecimals: 0, + expectedPrice: math.LegacyNewDec(100), + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + adjustedPrice := keeper.AdjustSpotPriceForDecimals( + tc.rawPrice, + tc.baseDecimals, + tc.quoteDecimals, + ) + + s.Require().InDelta( + tc.expectedPrice.MustFloat64(), + adjustedPrice.MustFloat64(), + 0.0001, + "expected price %v, got %v", tc.expectedPrice, adjustedPrice, + ) + }) + } +} diff --git a/x/icqoracle/keeper/keeper.go b/x/icqoracle/keeper/keeper.go new file mode 100644 index 0000000000..1a77e5362f --- /dev/null +++ b/x/icqoracle/keeper/keeper.go @@ -0,0 +1,38 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +type Keeper struct { + cdc codec.Codec + storeKey storetypes.StoreKey + IcqKeeper types.IcqKeeper + ibcTransferKeeper types.IbcTransferKeeper +} + +func NewKeeper( + cdc codec.Codec, + storeKey storetypes.StoreKey, + icqKeeper types.IcqKeeper, + ibcTransferKeeper types.IbcTransferKeeper, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + IcqKeeper: icqKeeper, + ibcTransferKeeper: ibcTransferKeeper, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/icqoracle/keeper/keeper_test.go b/x/icqoracle/keeper/keeper_test.go new file mode 100644 index 0000000000..da7ba9cf41 --- /dev/null +++ b/x/icqoracle/keeper/keeper_test.go @@ -0,0 +1,58 @@ +package keeper_test + +import ( + "testing" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + + "github.com/Stride-Labs/stride/v25/app/apptesting" + "github.com/Stride-Labs/stride/v25/x/icqoracle/keeper" + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" + icqtypes "github.com/Stride-Labs/stride/v25/x/interchainquery/types" +) + +type KeeperTestSuite struct { + apptesting.AppTestHelper + mockICQKeeper types.IcqKeeper +} + +// Helper function to setup keeper with mock ICQ keeper +func (s *KeeperTestSuite) SetupMockICQKeeper() { + mockICQKeeper := MockICQKeeper{ + SubmitICQRequestFn: func(ctx sdk.Context, query icqtypes.Query, forceUnique bool) error { + return nil + }, + } + s.App.ICQOracleKeeper.IcqKeeper = mockICQKeeper +} + +// Modify SetupTest to include mock setup +func (s *KeeperTestSuite) SetupTest() { + s.Setup() + s.SetupMockICQKeeper() + + // Set the time to test price staleness + s.Ctx = s.Ctx.WithBlockTime(time.Now().UTC()) +} + +// Dynamically gets the MsgServer for this module's keeper +// this function must be used so that the MsgServer is always created with the most updated App context +// +// which can change depending on the type of test +// (e.g. tests with only one Stride chain vs tests with multiple chains and IBC support) +func (s *KeeperTestSuite) GetMsgServer() types.MsgServer { + return keeper.NewMsgServerImpl(s.App.ICQOracleKeeper) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +// Helper function to get a token price and confirm there's no error +func (s *KeeperTestSuite) MustGetTokenPrice(baseDenom string, quoteDenom string, osmosisPoolId uint64) types.TokenPrice { + tp, err := s.App.ICQOracleKeeper.GetTokenPrice(s.Ctx, baseDenom, quoteDenom, osmosisPoolId) + s.Require().NoError(err, "no error expected when getting token price") + return tp +} diff --git a/x/icqoracle/keeper/msg_server.go b/x/icqoracle/keeper/msg_server.go new file mode 100644 index 0000000000..558fc59b52 --- /dev/null +++ b/x/icqoracle/keeper/msg_server.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "context" + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// RegisterTokenPriceQuery registers a token to price tracking +func (ms msgServer) RegisterTokenPriceQuery(goCtx context.Context, msg *types.MsgRegisterTokenPriceQuery) (*types.MsgRegisterTokenPriceQueryResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + _, err := ms.Keeper.GetTokenPrice(ctx, msg.BaseDenom, msg.QuoteDenom, msg.OsmosisPoolId) + if err == nil { + return nil, types.ErrTokenPriceAlreadyExists.Wrapf("token price BaseDenom='%s' QuoteDenom='%s' OsmosisPoolId='%d'", msg.BaseDenom, msg.QuoteDenom, msg.OsmosisPoolId) + } + + tokenPrice := types.TokenPrice{ + BaseDenom: msg.BaseDenom, + QuoteDenom: msg.QuoteDenom, + OsmosisPoolId: msg.OsmosisPoolId, + OsmosisBaseDenom: msg.OsmosisBaseDenom, + OsmosisQuoteDenom: msg.OsmosisQuoteDenom, + LastRequestTime: time.Time{}, + SpotPrice: sdkmath.LegacyZeroDec(), + QueryInProgress: false, + } + ms.Keeper.SetTokenPrice(ctx, tokenPrice) + + return &types.MsgRegisterTokenPriceQueryResponse{}, nil +} + +// RemoveTokenPriceQuery removes a token from price tracking +func (ms msgServer) RemoveTokenPriceQuery(goCtx context.Context, msg *types.MsgRemoveTokenPriceQuery) (*types.MsgRemoveTokenPriceQueryResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + ms.Keeper.RemoveTokenPrice(ctx, msg.BaseDenom, msg.QuoteDenom, msg.OsmosisPoolId) + + return &types.MsgRemoveTokenPriceQueryResponse{}, nil +} diff --git a/x/icqoracle/keeper/msg_server_test.go b/x/icqoracle/keeper/msg_server_test.go new file mode 100644 index 0000000000..1d757ba798 --- /dev/null +++ b/x/icqoracle/keeper/msg_server_test.go @@ -0,0 +1,71 @@ +package keeper_test + +import ( + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +func (s *KeeperTestSuite) TestRegisterTokenPriceQuery() { + // Create a new token price query + msg := types.MsgRegisterTokenPriceQuery{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "uusdc", + } + _, err := s.GetMsgServer().RegisterTokenPriceQuery(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().NoError(err, "no error expected when registering token price query") + + // Confirm the token price was created + tokenPrice := s.MustGetTokenPrice(msg.BaseDenom, msg.QuoteDenom, msg.OsmosisPoolId) + + s.Require().Equal(msg.BaseDenom, tokenPrice.BaseDenom, "base denom") + s.Require().Equal(msg.QuoteDenom, tokenPrice.QuoteDenom, "quote denom") + s.Require().Equal(msg.OsmosisPoolId, tokenPrice.OsmosisPoolId, "osmosis pool id") + s.Require().Equal(msg.OsmosisBaseDenom, tokenPrice.OsmosisBaseDenom, "osmosis base denom") + s.Require().Equal(msg.OsmosisQuoteDenom, tokenPrice.OsmosisQuoteDenom, "osmosis quote denom") + s.Require().Equal(sdkmath.LegacyZeroDec(), tokenPrice.SpotPrice, "spot price") + s.Require().Equal(false, tokenPrice.QueryInProgress, "query in progress") + s.Require().Equal(time.Time{}, tokenPrice.LastRequestTime, "updated at") + + // Attempt to register it again, it should fail + _, err = s.GetMsgServer().RegisterTokenPriceQuery(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().ErrorIs(err, types.ErrTokenPriceAlreadyExists) +} + +func (s *KeeperTestSuite) TestRemoveTokenPriceQuery() { + // Create a token price + tokenPrice := types.TokenPrice{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + OsmosisBaseDenom: "ibc/uatom", + OsmosisQuoteDenom: "uusdc", + SpotPrice: sdkmath.LegacyNewDec(1), + LastRequestTime: time.Now().UTC(), + QueryInProgress: false, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Remove the token price + msg := types.MsgRemoveTokenPriceQuery{ + BaseDenom: tokenPrice.BaseDenom, + QuoteDenom: tokenPrice.QuoteDenom, + OsmosisPoolId: tokenPrice.OsmosisPoolId, + } + _, err := s.GetMsgServer().RemoveTokenPriceQuery(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().NoError(err, "no error expected when removing token price query") + + // Confirm the token price was removed + tp, err := s.App.ICQOracleKeeper.GetTokenPrice(s.Ctx, msg.BaseDenom, msg.QuoteDenom, msg.OsmosisPoolId) + s.Require().Error(err, "token price %+v should have been removed", tp) + + // Try to remove it again, it should still succeed + _, err = s.GetMsgServer().RemoveTokenPriceQuery(sdk.UnwrapSDKContext(s.Ctx), &msg) + s.Require().NoError(err, "no error expected when removing non-existent token price query") +} diff --git a/x/icqoracle/keeper/params.go b/x/icqoracle/keeper/params.go new file mode 100644 index 0000000000..2b7e64c1a5 --- /dev/null +++ b/x/icqoracle/keeper/params.go @@ -0,0 +1,22 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +// GetParams get params +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) +} diff --git a/x/icqoracle/keeper/params_test.go b/x/icqoracle/keeper/params_test.go new file mode 100644 index 0000000000..85826b455d --- /dev/null +++ b/x/icqoracle/keeper/params_test.go @@ -0,0 +1,16 @@ +package keeper_test + +import "github.com/Stride-Labs/stride/v25/x/icqoracle/types" + +func (s *KeeperTestSuite) TestParams() { + expectedParams := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-2", + UpdateIntervalSec: 5 * 60, // 5 min + PriceExpirationTimeoutSec: 15 * 60, // 15 min + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, expectedParams) + + actualParams := s.App.ICQOracleKeeper.GetParams(s.Ctx) + s.Require().Equal(expectedParams, actualParams, "params") +} diff --git a/x/icqoracle/keeper/query.go b/x/icqoracle/keeper/query.go new file mode 100644 index 0000000000..4ba93db786 --- /dev/null +++ b/x/icqoracle/keeper/query.go @@ -0,0 +1,127 @@ +package keeper + +import ( + "context" + "strings" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +var _ types.QueryServer = Keeper{} + +// TokenPrice queries the current price for a specific token +func (k Keeper) TokenPrice(goCtx context.Context, req *types.QueryTokenPriceRequest) (*types.QueryTokenPriceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + tokenPrice, err := k.GetTokenPrice(ctx, req.BaseDenom, req.QuoteDenom, req.PoolId) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryTokenPriceResponse{ + TokenPrice: k.TokenPriceToTokenPriceResponse(ctx, tokenPrice)[0], + }, nil +} + +// TokenPrices queries all token prices +func (k Keeper) TokenPrices(goCtx context.Context, req *types.QueryTokenPricesRequest) (*types.QueryTokenPricesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO impl paging + + prices := k.GetAllTokenPrices(ctx) + + return &types.QueryTokenPricesResponse{ + TokenPrices: k.TokenPriceToTokenPriceResponse(ctx, prices...), + }, nil +} + +// Params queries the oracle parameters +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{ + Params: params, + }, nil +} + +// TokenPriceForQuoteDenom queries the exchange rate between two tokens +func (k Keeper) TokenPriceForQuoteDenom(goCtx context.Context, req *types.QueryTokenPriceForQuoteDenomRequest) (*types.QueryTokenPriceForQuoteDenomResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + price, err := k.GetTokenPriceForQuoteDenom(ctx, req.BaseDenom, req.QuoteDenom) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryTokenPriceForQuoteDenomResponse{ + Price: price, + }, nil +} + +func (k Keeper) unwrapIBCDenom(ctx sdk.Context, denom string) string { + if !strings.HasPrefix(denom, "ibc/") { + return denom + } + + hash, err := ibctransfertypes.ParseHexHash(strings.TrimPrefix(denom, "ibc/")) + if err == nil { + denomTrace, found := k.ibcTransferKeeper.GetDenomTrace(ctx, hash) + if found { + return denomTrace.BaseDenom + } + } + return denom +} + +// TokenPriceToTokenPriceResponse converts TokenPrices to TokenPriceResponses format +func (k Keeper) TokenPriceToTokenPriceResponse(ctx sdk.Context, tokenPrices ...types.TokenPrice) []types.TokenPriceResponse { + responses := make([]types.TokenPriceResponse, len(tokenPrices)) + + for i, tokenPrice := range tokenPrices { + baseDenomUnwrapped := k.unwrapIBCDenom(ctx, tokenPrice.BaseDenom) + quoteDenomUnwrapped := k.unwrapIBCDenom(ctx, tokenPrice.QuoteDenom) + + responses[i] = types.TokenPriceResponse{ + BaseDenomUnwrapped: baseDenomUnwrapped, + QuoteDenomUnwrapped: quoteDenomUnwrapped, + BaseDenom: tokenPrice.BaseDenom, + QuoteDenom: tokenPrice.QuoteDenom, + BaseDenomDecimals: tokenPrice.BaseDenomDecimals, + QuoteDenomDecimals: tokenPrice.QuoteDenomDecimals, + OsmosisBaseDenom: tokenPrice.OsmosisBaseDenom, + OsmosisQuoteDenom: tokenPrice.OsmosisQuoteDenom, + OsmosisPoolId: tokenPrice.OsmosisPoolId, + SpotPrice: tokenPrice.SpotPrice, + LastRequestTime: tokenPrice.LastRequestTime, + QueryInProgress: tokenPrice.QueryInProgress, + } + } + + return responses +} diff --git a/x/icqoracle/keeper/query_test.go b/x/icqoracle/keeper/query_test.go new file mode 100644 index 0000000000..9241f83346 --- /dev/null +++ b/x/icqoracle/keeper/query_test.go @@ -0,0 +1,399 @@ +package keeper_test + +import ( + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +func (s *KeeperTestSuite) TestQueryTokenPrice() { + // Create token price entry + baseDenom := "uatom" + quoteDenom := "uusdc" + poolId := uint64(1) + expectedPrice := sdkmath.LegacyNewDec(1000000) + + tokenPrice := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + OsmosisPoolId: poolId, + SpotPrice: expectedPrice, + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Query for the token price + req := &types.QueryTokenPriceRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + PoolId: poolId, + } + resp, err := s.App.ICQOracleKeeper.TokenPrice(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying token price") + s.Require().Equal(expectedPrice, resp.TokenPrice.SpotPrice, "token price") + + // Query with invalid request + _, err = s.App.ICQOracleKeeper.TokenPrice(sdk.WrapSDKContext(s.Ctx), nil) + s.Require().Error(err, "error expected when querying with nil request") + + // Query with non existing + req = &types.QueryTokenPriceRequest{ + BaseDenom: "banana", + QuoteDenom: "papaya", + PoolId: 1, + } + _, err = s.App.ICQOracleKeeper.TokenPrice(sdk.WrapSDKContext(s.Ctx), req) + s.Require().Error(err, "error expected when querying non existing token price") +} + +func (s *KeeperTestSuite) TestQueryTokenPrices() { + // Create multiple token prices + expectedPrices := []types.TokenPrice{ + { + BaseDenom: "uatom", + QuoteDenom: "uusdc", + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1000000), + }, + { + BaseDenom: "uosmo", + QuoteDenom: "uusdc", + OsmosisPoolId: 2, + SpotPrice: sdkmath.LegacyNewDec(2000000), + }, + } + + for _, price := range expectedPrices { + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, price) + + } + + // Query all token prices + req := &types.QueryTokenPricesRequest{} + resp, err := s.App.ICQOracleKeeper.TokenPrices(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying all token prices") + s.Require().Equal(s.App.ICQOracleKeeper.TokenPriceToTokenPriceResponse(s.Ctx, expectedPrices...), resp.TokenPrices, "token prices") + + // Query with invalid request + _, err = s.App.ICQOracleKeeper.TokenPrices(sdk.WrapSDKContext(s.Ctx), nil) + s.Require().Error(err, "error expected when querying with nil request") +} + +func (s *KeeperTestSuite) TestQueryParams() { + // Set parameters + expectedParams := types.Params{ + OsmosisChainId: "osmosis-1", + OsmosisConnectionId: "connection-2", + UpdateIntervalSec: 5 * 60, // 5 min + PriceExpirationTimeoutSec: 15 * 60, // 15 min + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, expectedParams) + + // Query parameters + req := &types.QueryParamsRequest{} + resp, err := s.App.ICQOracleKeeper.Params(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying params") + s.Require().Equal(expectedParams, resp.Params, "params") + + // Query with invalid request + _, err = s.App.ICQOracleKeeper.Params(sdk.WrapSDKContext(s.Ctx), nil) + s.Require().Error(err, "error expected when querying with nil request") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomSimple() { + // Setup params + s.App.ICQOracleKeeper.SetParams(s.Ctx, types.Params{ + PriceExpirationTimeoutSec: 60, + }) + + // Create token price with same quote denom + baseDenom := "uatom" + quoteDenom := "uusdc" + expectedPrice := sdkmath.LegacyNewDec(1000000) + + tokenPrice := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + OsmosisPoolId: 1, + SpotPrice: expectedPrice, + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Query for token price using quote denom + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + } + resp, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying token price for quote denom") + s.Require().Equal(expectedPrice, resp.Price, "token price") + + // Query with invalid request + _, err = s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), nil) + s.Require().Error(err, "error expected when querying with nil request") + + // Query with non-existent denom pair + reqNonExistent := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: "nonexistent", + QuoteDenom: "nonexistent", + } + _, err = s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), reqNonExistent) + s.Require().Error(err, "error expected when querying non-existent denom pair") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenom() { + s.App.ICQOracleKeeper.SetParams(s.Ctx, types.Params{ + PriceExpirationTimeoutSec: 60, + }) + + // Create two token prices with same quote denom + baseDenom1 := "uatom" + baseDenom2 := "uosmo" + quoteDenom := "uusdc" + expectedPrice1 := sdkmath.LegacyNewDec(1000000) + expectedPrice2 := sdkmath.LegacyNewDec(2000000) + + // Set uatom price + tokenPrice1 := types.TokenPrice{ + BaseDenom: baseDenom1, + QuoteDenom: quoteDenom, + OsmosisPoolId: 1, + SpotPrice: expectedPrice1, + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice1) + + // Set uosmo price + tokenPrice2 := types.TokenPrice{ + BaseDenom: baseDenom2, + QuoteDenom: quoteDenom, + OsmosisPoolId: 2, + SpotPrice: expectedPrice2, + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice2) + + // Query for token price using a common quote denom + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom1, + QuoteDenom: baseDenom2, + } + resp, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying token price for quote denom") + s.Require().Equal(expectedPrice1.Quo(expectedPrice2), resp.Price, "token price") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomStalePrice() { + // Set up parameters with short expiration time + params := types.Params{ + PriceExpirationTimeoutSec: 60, // 1 minute timeout + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Create token prices + baseDenom := "uatom" + quoteDenom := "uusdc" + expectedPrice := sdkmath.LegacyNewDec(1000000) + + tokenPrice := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + OsmosisPoolId: 1, + SpotPrice: expectedPrice, + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + + // Fast forward block time to make price stale + s.Ctx = s.Ctx.WithBlockTime(s.Ctx.BlockTime().Add(time.Minute * 2)) + + // Query should fail due to stale price + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "foundAlreadyHasStalePrice='true'", "error should indicate price calculation failure") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomZeroPrice() { + // Create token prices with zero price for quote token + baseDenom := "uatom" + quoteDenom := "uusdc" + intermediateQuote := "uosmo" + + // Set base token price + tokenPrice1 := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: intermediateQuote, + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1000000), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice1) + + // Set quote token price with zero value + tokenPrice2 := types.TokenPrice{ + BaseDenom: quoteDenom, + QuoteDenom: intermediateQuote, + OsmosisPoolId: 2, + SpotPrice: sdkmath.LegacyZeroDec(), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice2) + + // Query should fail due to zero price + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "could not calculate price", "error should indicate price calculation failure") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomNoCommonQuote() { + // Create token prices with different quote denoms + baseDenom := "uatom" + quoteDenom := "uusdc" + + // Set base token price with one quote denom + tokenPrice1 := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: "quote1", + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1000000), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice1) + + // Set quote token price with different quote denom + tokenPrice2 := types.TokenPrice{ + BaseDenom: quoteDenom, + QuoteDenom: "quote2", + OsmosisPoolId: 2, + SpotPrice: sdkmath.LegacyNewDec(2000000), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice2) + + // Query should fail due to no common quote denom + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "could not calculate price", "error should indicate price calculation failure") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomNoBaseDenom() { + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: "banana", + QuoteDenom: "papaya", + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "no price for baseDenom 'banana'") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomNoQuoteDenom() { + // Set base token price with one quote denom + tokenPrice1 := types.TokenPrice{ + BaseDenom: "banana", + QuoteDenom: "quote1", + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1000000), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice1) + + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: "banana", + QuoteDenom: "papaya", + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "no price for quoteDenom 'papaya'") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomStaleBasePrice() { + // Set up parameters with short expiration time + params := types.Params{ + PriceExpirationTimeoutSec: 60, // 1 minute timeout + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Create token prices with same quote denom + baseDenom := "uatom" + quoteDenom := "uusdc" + intermediateQuote := "uosmo" + + // Set base token price (will become stale) + tokenPrice1 := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: intermediateQuote, + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1000000), + LastRequestTime: s.Ctx.BlockTime().Add(-2 * time.Minute), // Stale + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice1) + + // Set quote token price (fresh) + tokenPrice2 := types.TokenPrice{ + BaseDenom: quoteDenom, + QuoteDenom: intermediateQuote, + OsmosisPoolId: 2, + SpotPrice: sdkmath.LegacyNewDec(2000000), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice2) + + // Query should fail due to stale base price + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "foundBaseTokenStalePrice='true'", "error should indicate base token price is stale") +} + +func (s *KeeperTestSuite) TestQueryTokenPriceForQuoteDenomStaleQuotePrice() { + // Set up parameters with short expiration time + params := types.Params{ + PriceExpirationTimeoutSec: 60, // 1 minute timeout + } + s.App.ICQOracleKeeper.SetParams(s.Ctx, params) + + // Create token prices with same quote denom + baseDenom := "uatom" + quoteDenom := "uusdc" + intermediateQuote := "uosmo" + + // Set base token price (fresh) + tokenPrice1 := types.TokenPrice{ + BaseDenom: baseDenom, + QuoteDenom: intermediateQuote, + OsmosisPoolId: 1, + SpotPrice: sdkmath.LegacyNewDec(1000000), + LastRequestTime: s.Ctx.BlockTime(), + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice1) + + // Set quote token price (will be stale) + tokenPrice2 := types.TokenPrice{ + BaseDenom: quoteDenom, + QuoteDenom: intermediateQuote, + OsmosisPoolId: 2, + SpotPrice: sdkmath.LegacyNewDec(2000000), + LastRequestTime: s.Ctx.BlockTime().Add(-2 * time.Minute), // Stale + } + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice2) + + // Query should fail due to stale quote price + req := &types.QueryTokenPriceForQuoteDenomRequest{ + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + } + _, err := s.App.ICQOracleKeeper.TokenPriceForQuoteDenom(sdk.WrapSDKContext(s.Ctx), req) + s.Require().ErrorContains(err, "foundQuoteTokenStalePrice='true'", "error should indicate quote token price is stale") +} diff --git a/x/icqoracle/keeper/token_price.go b/x/icqoracle/keeper/token_price.go new file mode 100644 index 0000000000..1054290cc6 --- /dev/null +++ b/x/icqoracle/keeper/token_price.go @@ -0,0 +1,216 @@ +package keeper + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +// SetTokenPrice stores price query for a token +func (k Keeper) SetTokenPrice(ctx sdk.Context, tokenPrice types.TokenPrice) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.TokenPricePrefix) + key := types.TokenPriceKey(tokenPrice.BaseDenom, tokenPrice.QuoteDenom, tokenPrice.OsmosisPoolId) + bz := k.cdc.MustMarshal(&tokenPrice) + store.Set(key, bz) +} + +// RemoveTokenPrice removes price query for a token +func (k Keeper) RemoveTokenPrice(ctx sdk.Context, baseDenom string, quoteDenom string, osmosisPoolId uint64) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.TokenPricePrefix) + key := types.TokenPriceKey(baseDenom, quoteDenom, osmosisPoolId) + store.Delete(key) +} + +// Updates the token price when a query is requested +func (k Keeper) SetQueryInProgress(ctx sdk.Context, baseDenom string, quoteDenom string, osmosisPoolId uint64) error { + tokenPrice, err := k.GetTokenPrice(ctx, baseDenom, quoteDenom, osmosisPoolId) + if err != nil { + return err + } + + tokenPrice.QueryInProgress = true + tokenPrice.LastRequestTime = ctx.BlockTime() + + k.SetTokenPrice(ctx, tokenPrice) + + return nil +} + +// Updates the token price when a query response is received +func (k Keeper) SetQueryComplete(ctx sdk.Context, tokenPrice types.TokenPrice, newSpotPrice math.LegacyDec) { + tokenPrice.SpotPrice = newSpotPrice + tokenPrice.QueryInProgress = false + tokenPrice.LastResponseTime = ctx.BlockTime() + k.SetTokenPrice(ctx, tokenPrice) +} + +// GetTokenPrice retrieves price data for a token +func (k Keeper) GetTokenPrice(ctx sdk.Context, baseDenom string, quoteDenom string, osmosisPoolId uint64) (types.TokenPrice, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.TokenPricePrefix) + key := types.TokenPriceKey(baseDenom, quoteDenom, osmosisPoolId) + + bz := store.Get(key) + if bz == nil { + return types.TokenPrice{}, fmt.Errorf("price not found for baseDenom='%s' quoteDenom='%s' poolId='%d'", baseDenom, quoteDenom, osmosisPoolId) + } + + var price types.TokenPrice + if err := k.cdc.Unmarshal(bz, &price); err != nil { + return types.TokenPrice{}, errorsmod.Wrapf(err, "unable to unmarshal token price") + } + + return price, nil +} + +// GetTokenPriceByDenom retrieves all price data for a base denom +// Returned as a mapping of each quote denom to the spot price +func (k Keeper) GetTokenPricesByDenom(ctx sdk.Context, baseDenom string) (map[string]*types.TokenPrice, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.TokenPricePrefix) + + // Create prefix iterator for all keys starting with baseDenom + iterator := sdk.KVStorePrefixIterator(store, types.TokenPriceByDenomKey(baseDenom)) + defer iterator.Close() + + prices := make(map[string]*types.TokenPrice) + + for ; iterator.Valid(); iterator.Next() { + var price types.TokenPrice + if err := k.cdc.Unmarshal(iterator.Value(), &price); err != nil { + return nil, err + } + + // Use quoteDenom as the map key + prices[price.QuoteDenom] = &price + } + + return prices, nil +} + +// GetTokenPriceForQuoteDenom calculates and retrieves the exchange rate between two tokens. +// The exchange rate is determined by finding a common quote token between both tokens, +// and then dividing their respective spot prices. +// +// For example, if we have: +// - baseToken/USDC = 10 +// - quoteToken/USDC = 5 +// +// Then: +// - baseToken/quoteToken = 10/5 = 2 +// +// Parameters: +// - ctx: SDK Context for accessing the store +// - baseDenom: The denom of the token to get the price for +// - quoteDenom: The denom to price the base token in +// +// Returns: +// - math.LegacyDec: The exchange rate of 1 baseToken in terms of quoteToken +// - error: Returns an error if: +// - No prices exist for either token +// - No common quote token exists between the two tokens +// - All available prices with a common quote token are stale (exceeded the stale timeout) +func (k Keeper) GetTokenPriceForQuoteDenom(ctx sdk.Context, baseDenom string, quoteDenom string) (price math.LegacyDec, err error) { + // Get all price for baseToken + baseTokenPrices, err := k.GetTokenPricesByDenom(ctx, baseDenom) + if err != nil { + return math.LegacyDec{}, fmt.Errorf("error getting price for '%s': %w", baseDenom, err) + } + if len(baseTokenPrices) == 0 { + return math.LegacyDec{}, fmt.Errorf("no price for baseDenom '%s'", baseDenom) + } + + // Get price expiration timeout + params := k.GetParams(ctx) + priceExpirationTimeoutSec := int64(params.PriceExpirationTimeoutSec) + + // Check if baseDenom already has a price for quoteDenom + foundAlreadyHasStalePrice := false + if price, ok := baseTokenPrices[quoteDenom]; ok { + if ctx.BlockTime().Unix()-price.LastRequestTime.Unix() <= priceExpirationTimeoutSec { + return price.SpotPrice, nil + } else { + foundAlreadyHasStalePrice = true + } + } + + // Get all price for quoteToken + quoteTokenPrices, err := k.GetTokenPricesByDenom(ctx, quoteDenom) + if err != nil { + return math.LegacyDec{}, fmt.Errorf("error getting price for '%s': %w", quoteDenom, err) + } + if len(quoteTokenPrices) == 0 { + return math.LegacyDec{}, fmt.Errorf("no price for quoteDenom '%s' (foundAlreadyHasStalePrice='%v')", quoteDenom, foundAlreadyHasStalePrice) + } + + // Init price + price = math.LegacyZeroDec() + + // Define flags to allow for better error messages + foundCommonQuoteToken := false + foundBaseTokenStalePrice := false + foundQuoteTokenStalePrice := false + foundQuoteTokenZeroPrice := false + + // Find a common quote denom and calculate baseToken to quoteToken price + for commonQuoteDenom1, baseTokenPrice := range baseTokenPrices { + for commonQuoteDenom2, quoteTokenPrice := range quoteTokenPrices { + if commonQuoteDenom1 == commonQuoteDenom2 { + foundCommonQuoteToken = true + + // Check that both prices are not stale + if ctx.BlockTime().Unix()-baseTokenPrice.LastRequestTime.Unix() > priceExpirationTimeoutSec { + foundBaseTokenStalePrice = true + continue + } + if ctx.BlockTime().Unix()-quoteTokenPrice.LastRequestTime.Unix() > priceExpirationTimeoutSec { + foundQuoteTokenStalePrice = true + continue + } + + // Check that quote price is not zero to prevent division by zero + if quoteTokenPrice.SpotPrice.IsZero() { + foundQuoteTokenZeroPrice = true + continue + } + + // Calculate the price of 1 baseToken in quoteToken + price = baseTokenPrice.SpotPrice.Quo(quoteTokenPrice.SpotPrice) + break + } + } + } + + if price.IsZero() { + return math.LegacyDec{}, fmt.Errorf( + "could not calculate price for baseToken='%s' quoteToken='%s' (foundCommonQuoteToken='%v', foundBaseTokenStalePrice='%v', foundQuoteTokenStalePrice='%v', foundQuoteTokenZeroPrice='%v', foundAlreadyHasStalePrice='%v')", + baseDenom, + quoteDenom, + foundCommonQuoteToken, + foundBaseTokenStalePrice, + foundQuoteTokenStalePrice, + foundQuoteTokenZeroPrice, + foundAlreadyHasStalePrice, + ) + } + + return price, nil +} + +// GetAllTokenPrices retrieves all stored token prices +func (k Keeper) GetAllTokenPrices(ctx sdk.Context) []types.TokenPrice { + iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), []byte(types.TokenPricePrefix)) + defer iterator.Close() + + prices := []types.TokenPrice{} + for ; iterator.Valid(); iterator.Next() { + var price types.TokenPrice + k.cdc.MustUnmarshal(iterator.Value(), &price) + prices = append(prices, price) + } + + return prices +} diff --git a/x/icqoracle/keeper/token_price_test.go b/x/icqoracle/keeper/token_price_test.go new file mode 100644 index 0000000000..5a9d155981 --- /dev/null +++ b/x/icqoracle/keeper/token_price_test.go @@ -0,0 +1,51 @@ +package keeper_test + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +// Helper function to create 5 tokenPrice objects with various attributes +func (s *KeeperTestSuite) createTokenPrices() []types.TokenPrice { + tokenPrices := []types.TokenPrice{} + for i := int64(1); i <= 5; i++ { + tokenPrice := types.TokenPrice{ + BaseDenom: fmt.Sprintf("base-%d", i), + QuoteDenom: fmt.Sprintf("quote-%d", i), + SpotPrice: sdk.ZeroDec(), + } + + tokenPrices = append(tokenPrices, tokenPrice) + s.App.ICQOracleKeeper.SetTokenPrice(s.Ctx, tokenPrice) + } + return tokenPrices +} + +// Tests Get/Set TokenPrice +func (s *KeeperTestSuite) TestGetTokenPrice() { + tokenPrices := s.createTokenPrices() + + for _, expected := range tokenPrices { + actual, err := s.App.ICQOracleKeeper.GetTokenPrice(s.Ctx, expected.BaseDenom, expected.QuoteDenom, expected.OsmosisPoolId) + s.Require().NoError(err, "tokenPrice %s should have been found", expected.BaseDenom) + s.Require().Equal(expected, actual) + } + + _, err := s.App.ICQOracleKeeper.GetTokenPrice(s.Ctx, "non-existent", "non-existent", 0) + s.Require().ErrorContains(err, "price not found") +} + +// Tests getting all tokenPrices +func (s *KeeperTestSuite) TestGetAllTokenPrices() { + expectedTokenPrices := s.createTokenPrices() + + actualTokenPrices := s.App.ICQOracleKeeper.GetAllTokenPrices(s.Ctx) + s.Require().Equal(len(actualTokenPrices), len(expectedTokenPrices), "number of tokenPrices") + + for i, expectedTokenPrice := range expectedTokenPrices { + s.Require().Equal(expectedTokenPrice, actualTokenPrices[i]) + } +} diff --git a/x/icqoracle/module.go b/x/icqoracle/module.go new file mode 100644 index 0000000000..ddce849b14 --- /dev/null +++ b/x/icqoracle/module.go @@ -0,0 +1,158 @@ +package icqoracle + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/Stride-Labs/stride/v25/x/icqoracle/client/cli" + "github.com/Stride-Labs/stride/v25/x/icqoracle/keeper" + "github.com/Stride-Labs/stride/v25/x/icqoracle/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + am.keeper.InitGenesis(ctx, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + am.keeper.BeginBlocker(ctx) +} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/icqoracle/types/codec.go b/x/icqoracle/types/codec.go new file mode 100644 index 0000000000..1c2bbd1582 --- /dev/null +++ b/x/icqoracle/types/codec.go @@ -0,0 +1,40 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgRegisterTokenPriceQuery{}, "icqoracle/MsgRegisterTokenPriceQuery") + legacy.RegisterAminoMsg(cdc, &MsgRemoveTokenPriceQuery{}, "icqoracle/MsgRemoveTokenPriceQuery") +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgRegisterTokenPriceQuery{}, + &MsgRemoveTokenPriceQuery{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgSubmitProposal instances + RegisterLegacyAminoCodec(govcodec.Amino) +} diff --git a/x/icqoracle/types/errors.go b/x/icqoracle/types/errors.go new file mode 100644 index 0000000000..181434f4fa --- /dev/null +++ b/x/icqoracle/types/errors.go @@ -0,0 +1,12 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/icqoracle module sentinel errors +var ( + ErrTokenPriceAlreadyExists = sdkerrors.Register(ModuleName, 16001, "token price already exists") +) diff --git a/x/icqoracle/types/expected_keepers.go b/x/icqoracle/types/expected_keepers.go new file mode 100644 index 0000000000..e35b6e6493 --- /dev/null +++ b/x/icqoracle/types/expected_keepers.go @@ -0,0 +1,20 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + tmbytes "github.com/cometbft/cometbft/libs/bytes" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + + "github.com/Stride-Labs/stride/v25/x/interchainquery/types" +) + +// IcqKeeper defines the expected interface needed to send ICQ requests. +type IcqKeeper interface { + SubmitICQRequest(ctx sdk.Context, icqtypes types.Query, forceUnique bool) error +} + +// IbcTransferKeeper defines the expected interface needed to convert an ibc token hash to its denom on the source chain. +type IbcTransferKeeper interface { + GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (ibctransfertypes.DenomTrace, bool) +} diff --git a/x/icqoracle/types/genesis.go b/x/icqoracle/types/genesis.go new file mode 100644 index 0000000000..02aeffd24c --- /dev/null +++ b/x/icqoracle/types/genesis.go @@ -0,0 +1,30 @@ +package types + +import ( + fmt "fmt" +) + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{} +} + +// Performs basic genesis state validation by iterating through all token prices and validating +// using ValidateTokenPriceQueryParams(). +func (gs GenesisState) Validate() error { + for i, tokenPrice := range gs.TokenPrices { + err := ValidateTokenPriceQueryParams( + tokenPrice.BaseDenom, + tokenPrice.QuoteDenom, + tokenPrice.BaseDenomDecimals, + tokenPrice.QuoteDenomDecimals, + tokenPrice.OsmosisPoolId, + tokenPrice.OsmosisBaseDenom, + tokenPrice.OsmosisQuoteDenom, + ) + if err != nil { + return fmt.Errorf("invalid genesis token price query at index %d: %w", i, err) + } + } + return nil +} diff --git a/x/icqoracle/types/genesis.pb.go b/x/icqoracle/types/genesis.pb.go new file mode 100644 index 0000000000..8c80d63e1c --- /dev/null +++ b/x/icqoracle/types/genesis.pb.go @@ -0,0 +1,387 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/icqoracle/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the icqoracle module's genesis state +type GenesisState struct { + // Module parameters + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // List of token prices + TokenPrices []TokenPrice `protobuf:"bytes,2,rep,name=token_prices,json=tokenPrices,proto3" json:"token_prices"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_a0cfd8712dde4d4a, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetTokenPrices() []TokenPrice { + if m != nil { + return m.TokenPrices + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "stride.icqoracle.GenesisState") +} + +func init() { proto.RegisterFile("stride/icqoracle/genesis.proto", fileDescriptor_a0cfd8712dde4d4a) } + +var fileDescriptor_a0cfd8712dde4d4a = []byte{ + // 240 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x2e, 0x29, 0xca, + 0x4c, 0x49, 0xd5, 0xcf, 0x4c, 0x2e, 0xcc, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0x4f, 0xcd, + 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xc8, 0xeb, 0xc1, + 0xe5, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0x94, 0x02, + 0x86, 0x39, 0x70, 0x16, 0x44, 0x85, 0x52, 0x2f, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xec, 0xe0, 0x92, + 0xc4, 0x92, 0x54, 0x21, 0x33, 0x2e, 0xb6, 0x82, 0xc4, 0xa2, 0xc4, 0xdc, 0x62, 0x09, 0x46, 0x05, + 0x46, 0x0d, 0x6e, 0x23, 0x09, 0x3d, 0x74, 0xbb, 0xf4, 0x02, 0xc0, 0xf2, 0x4e, 0x2c, 0x27, 0xee, + 0xc9, 0x33, 0x04, 0x41, 0x55, 0x0b, 0xb9, 0x72, 0xf1, 0x94, 0xe4, 0x67, 0xa7, 0xe6, 0xc5, 0x17, + 0x14, 0x65, 0x26, 0xa7, 0x16, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0xc9, 0x60, 0xea, 0x0e, + 0x01, 0xa9, 0x0a, 0x00, 0x29, 0x82, 0x9a, 0xc0, 0x5d, 0x02, 0x17, 0x29, 0x76, 0xf2, 0x3d, 0xf1, + 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, + 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xe3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, + 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x60, 0xb0, 0xa1, 0xba, 0x3e, 0x89, 0x49, 0xc5, 0xfa, 0x50, 0x2f, + 0x96, 0x19, 0x99, 0xea, 0x57, 0x20, 0x79, 0xb4, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, + 0x4b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x60, 0x51, 0xd6, 0x94, 0x51, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenPrices) > 0 { + for iNdEx := len(m.TokenPrices) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenPrices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.TokenPrices) > 0 { + for _, e := range m.TokenPrices { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenPrices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenPrices = append(m.TokenPrices, TokenPrice{}) + if err := m.TokenPrices[len(m.TokenPrices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/icqoracle/types/icqoracle.pb.go b/x/icqoracle/types/icqoracle.pb.go new file mode 100644 index 0000000000..573eff2fe4 --- /dev/null +++ b/x/icqoracle/types/icqoracle.pb.go @@ -0,0 +1,1108 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/icqoracle/icqoracle.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// TokenPrice stores latest price data for a token +type TokenPrice struct { + // Base denom on Stride + BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + // Quote denom on Stride + QuoteDenom string `protobuf:"bytes,2,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty"` + // Decimals of base token, used for normalizing price feed from Osmosis + BaseDenomDecimals int64 `protobuf:"varint,3,opt,name=base_denom_decimals,json=baseDenomDecimals,proto3" json:"base_denom_decimals,omitempty"` + // Decimals of quote token, used for normalizing price feed from Osmosis + QuoteDenomDecimals int64 `protobuf:"varint,4,opt,name=quote_denom_decimals,json=quoteDenomDecimals,proto3" json:"quote_denom_decimals,omitempty"` + // Base denom on Osmosis + OsmosisBaseDenom string `protobuf:"bytes,5,opt,name=osmosis_base_denom,json=osmosisBaseDenom,proto3" json:"osmosis_base_denom,omitempty"` + // Quote denom on Osmosis + OsmosisQuoteDenom string `protobuf:"bytes,6,opt,name=osmosis_quote_denom,json=osmosisQuoteDenom,proto3" json:"osmosis_quote_denom,omitempty"` + // Pool ID on Osmosis + OsmosisPoolId uint64 `protobuf:"varint,7,opt,name=osmosis_pool_id,json=osmosisPoolId,proto3" json:"osmosis_pool_id,omitempty"` + // Spot price of base_denom denominated in quote_denom + SpotPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=spot_price,json=spotPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"spot_price"` + // Last time a query request was submitted + LastRequestTime time.Time `protobuf:"bytes,9,opt,name=last_request_time,json=lastRequestTime,proto3,stdtime" json:"last_request_time"` + // Last time a query response was received + LastResponseTime time.Time `protobuf:"bytes,10,opt,name=last_response_time,json=lastResponseTime,proto3,stdtime" json:"last_response_time"` + // Whether there is a spot price query currently in progress + QueryInProgress bool `protobuf:"varint,11,opt,name=query_in_progress,json=queryInProgress,proto3" json:"query_in_progress,omitempty"` +} + +func (m *TokenPrice) Reset() { *m = TokenPrice{} } +func (m *TokenPrice) String() string { return proto.CompactTextString(m) } +func (*TokenPrice) ProtoMessage() {} +func (*TokenPrice) Descriptor() ([]byte, []int) { + return fileDescriptor_08ead8ab9516d7fc, []int{0} +} +func (m *TokenPrice) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenPrice.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TokenPrice) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenPrice.Merge(m, src) +} +func (m *TokenPrice) XXX_Size() int { + return m.Size() +} +func (m *TokenPrice) XXX_DiscardUnknown() { + xxx_messageInfo_TokenPrice.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenPrice proto.InternalMessageInfo + +func (m *TokenPrice) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func (m *TokenPrice) GetQuoteDenom() string { + if m != nil { + return m.QuoteDenom + } + return "" +} + +func (m *TokenPrice) GetBaseDenomDecimals() int64 { + if m != nil { + return m.BaseDenomDecimals + } + return 0 +} + +func (m *TokenPrice) GetQuoteDenomDecimals() int64 { + if m != nil { + return m.QuoteDenomDecimals + } + return 0 +} + +func (m *TokenPrice) GetOsmosisBaseDenom() string { + if m != nil { + return m.OsmosisBaseDenom + } + return "" +} + +func (m *TokenPrice) GetOsmosisQuoteDenom() string { + if m != nil { + return m.OsmosisQuoteDenom + } + return "" +} + +func (m *TokenPrice) GetOsmosisPoolId() uint64 { + if m != nil { + return m.OsmosisPoolId + } + return 0 +} + +func (m *TokenPrice) GetLastRequestTime() time.Time { + if m != nil { + return m.LastRequestTime + } + return time.Time{} +} + +func (m *TokenPrice) GetLastResponseTime() time.Time { + if m != nil { + return m.LastResponseTime + } + return time.Time{} +} + +func (m *TokenPrice) GetQueryInProgress() bool { + if m != nil { + return m.QueryInProgress + } + return false +} + +// OracleParams stores global oracle parameters +type Params struct { + // Osmosis chain identifier + OsmosisChainId string `protobuf:"bytes,1,opt,name=osmosis_chain_id,json=osmosisChainId,proto3" json:"osmosis_chain_id" yaml:"osmosis_chain_id"` + // Osmosis IBC connection identifier + OsmosisConnectionId string `protobuf:"bytes,2,opt,name=osmosis_connection_id,json=osmosisConnectionId,proto3" json:"osmosis_connection_id" yaml:"osmosis_connection_id"` + // Time between price updates + // Also used to timeout icq requests + UpdateIntervalSec uint64 `protobuf:"varint,3,opt,name=update_interval_sec,json=updateIntervalSec,proto3" json:"update_interval_sec" yaml:"update_interval_sec"` + // Max time before price is considered stale/expired + PriceExpirationTimeoutSec uint64 `protobuf:"varint,4,opt,name=price_expiration_timeout_sec,json=priceExpirationTimeoutSec,proto3" json:"price_expiration_timeout_sec" yaml:"price_expiration_timeout_sec"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_08ead8ab9516d7fc, []int{1} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetOsmosisChainId() string { + if m != nil { + return m.OsmosisChainId + } + return "" +} + +func (m *Params) GetOsmosisConnectionId() string { + if m != nil { + return m.OsmosisConnectionId + } + return "" +} + +func (m *Params) GetUpdateIntervalSec() uint64 { + if m != nil { + return m.UpdateIntervalSec + } + return 0 +} + +func (m *Params) GetPriceExpirationTimeoutSec() uint64 { + if m != nil { + return m.PriceExpirationTimeoutSec + } + return 0 +} + +func init() { + proto.RegisterType((*TokenPrice)(nil), "stride.icqoracle.TokenPrice") + proto.RegisterType((*Params)(nil), "stride.icqoracle.Params") +} + +func init() { proto.RegisterFile("stride/icqoracle/icqoracle.proto", fileDescriptor_08ead8ab9516d7fc) } + +var fileDescriptor_08ead8ab9516d7fc = []byte{ + // 655 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x3f, 0x6f, 0xd3, 0x40, + 0x14, 0x8f, 0x69, 0x28, 0xcd, 0x55, 0xd0, 0xc6, 0x2d, 0x22, 0x84, 0x12, 0x47, 0xae, 0x84, 0x22, + 0x04, 0x36, 0x6a, 0xd5, 0x01, 0x46, 0xb7, 0x08, 0x45, 0x2a, 0x52, 0x70, 0xbb, 0xc0, 0x62, 0x5d, + 0xce, 0x87, 0x7b, 0xaa, 0xed, 0x73, 0x7c, 0xe7, 0xaa, 0xf9, 0x06, 0x8c, 0xfd, 0x50, 0x0c, 0x15, + 0x53, 0x47, 0xc4, 0x60, 0x50, 0xbb, 0x65, 0xcc, 0x27, 0x40, 0x77, 0x67, 0x3b, 0x51, 0x89, 0x2a, + 0xb1, 0xd9, 0xbf, 0x7f, 0xef, 0xe9, 0xde, 0xd3, 0x03, 0x5d, 0xc6, 0x53, 0xe2, 0x63, 0x9b, 0xa0, + 0x11, 0x4d, 0x21, 0x0a, 0xe7, 0xbe, 0xac, 0x24, 0xa5, 0x9c, 0xea, 0xeb, 0x4a, 0x61, 0x55, 0x78, + 0x7b, 0x33, 0xa0, 0x01, 0x95, 0xa4, 0x2d, 0xbe, 0x94, 0xae, 0x6d, 0x04, 0x94, 0x06, 0x21, 0xb6, + 0xe5, 0xdf, 0x30, 0xfb, 0x6a, 0x73, 0x12, 0x61, 0xc6, 0x61, 0x94, 0x28, 0x81, 0xf9, 0xa3, 0x0e, + 0xc0, 0x31, 0x3d, 0xc5, 0xf1, 0x20, 0x25, 0x08, 0xeb, 0xcf, 0x01, 0x18, 0x42, 0x86, 0x3d, 0x1f, + 0xc7, 0x34, 0x6a, 0x69, 0x5d, 0xad, 0xd7, 0x70, 0x1b, 0x02, 0x39, 0x10, 0x80, 0x6e, 0x80, 0xd5, + 0x51, 0x46, 0x79, 0xc9, 0xdf, 0x93, 0x3c, 0x90, 0x90, 0x12, 0x58, 0x60, 0x63, 0xe6, 0xf7, 0x7c, + 0x8c, 0x48, 0x04, 0x43, 0xd6, 0x5a, 0xea, 0x6a, 0xbd, 0x25, 0xb7, 0x59, 0x05, 0x1d, 0x14, 0x84, + 0xfe, 0x06, 0x6c, 0xce, 0x05, 0xce, 0x0c, 0x75, 0x69, 0xd0, 0x67, 0xc9, 0x95, 0xe3, 0x15, 0xd0, + 0x29, 0x8b, 0x28, 0x23, 0xcc, 0x9b, 0xeb, 0xf4, 0xbe, 0xec, 0x64, 0xbd, 0x60, 0x9c, 0xaa, 0x61, + 0x0b, 0x6c, 0x94, 0xea, 0xf9, 0xc6, 0x97, 0xa5, 0xbc, 0x59, 0x50, 0x9f, 0x66, 0xfd, 0xbf, 0x00, + 0x6b, 0xa5, 0x3e, 0xa1, 0x34, 0xf4, 0x88, 0xdf, 0x7a, 0xd0, 0xd5, 0x7a, 0x75, 0xf7, 0x61, 0x01, + 0x0f, 0x28, 0x0d, 0xfb, 0xbe, 0xee, 0x00, 0xc0, 0x12, 0xca, 0xbd, 0x44, 0xbc, 0x5a, 0x6b, 0x45, + 0xc4, 0x39, 0xdb, 0x97, 0xb9, 0x51, 0xfb, 0x95, 0x1b, 0xcf, 0x90, 0xd4, 0x32, 0xff, 0xd4, 0x22, + 0xd4, 0x8e, 0x20, 0x3f, 0xb1, 0x0e, 0x71, 0x00, 0xd1, 0xf8, 0x00, 0x23, 0xb7, 0x21, 0x6c, 0xea, + 0xad, 0x07, 0xa0, 0x19, 0x42, 0xc6, 0xbd, 0x14, 0x8f, 0x32, 0xcc, 0xb8, 0x27, 0x46, 0xd3, 0x6a, + 0x74, 0xb5, 0xde, 0xea, 0x4e, 0xdb, 0x52, 0x73, 0xb3, 0xca, 0xb9, 0x59, 0xc7, 0xe5, 0xdc, 0x9c, + 0x15, 0x51, 0xe6, 0xe2, 0xb7, 0xa1, 0xb9, 0x6b, 0xc2, 0xee, 0x2a, 0xb7, 0xe0, 0x75, 0x17, 0xe8, + 0x45, 0x22, 0x4b, 0x68, 0xcc, 0xb0, 0x8a, 0x04, 0xff, 0x11, 0xb9, 0xae, 0x22, 0x95, 0x5d, 0x66, + 0xbe, 0x04, 0xcd, 0x51, 0x86, 0xd3, 0xb1, 0x47, 0x62, 0x2f, 0x49, 0x69, 0x90, 0x62, 0xc6, 0x5a, + 0xab, 0x5d, 0xad, 0xb7, 0xe2, 0xae, 0x49, 0xa2, 0x1f, 0x0f, 0x0a, 0xd8, 0xfc, 0xbe, 0x04, 0x96, + 0x07, 0x30, 0x85, 0x11, 0xd3, 0x3f, 0x83, 0x72, 0x18, 0x1e, 0x3a, 0x81, 0x24, 0x16, 0x2f, 0x29, + 0xd7, 0xc9, 0xb1, 0x27, 0xb9, 0xf1, 0x0f, 0x37, 0xcd, 0x8d, 0x27, 0x63, 0x18, 0x85, 0xef, 0xcc, + 0xdb, 0x8c, 0xe9, 0x3e, 0x2a, 0xa0, 0x7d, 0x81, 0xf4, 0x7d, 0x3d, 0x02, 0x8f, 0x2b, 0x11, 0x8d, + 0x63, 0x8c, 0x38, 0xa1, 0x32, 0x5f, 0xae, 0xa3, 0xf3, 0x76, 0x92, 0x1b, 0x8b, 0x05, 0xd3, 0xdc, + 0xd8, 0xba, 0x55, 0x64, 0x9e, 0x36, 0xdd, 0x72, 0x57, 0xf6, 0x2b, 0xb8, 0xef, 0xeb, 0x18, 0x6c, + 0x64, 0x89, 0x0f, 0x39, 0xf6, 0x48, 0xcc, 0x71, 0x7a, 0x06, 0x43, 0x8f, 0x61, 0x24, 0x57, 0xba, + 0xee, 0xec, 0x4d, 0x72, 0x63, 0x11, 0x3d, 0xcd, 0x8d, 0xb6, 0x2a, 0xb5, 0x80, 0x34, 0xdd, 0xa6, + 0x42, 0xfb, 0x05, 0x78, 0x84, 0x91, 0xfe, 0x4d, 0x03, 0x5b, 0x72, 0x9b, 0x3c, 0x7c, 0x9e, 0x90, + 0x14, 0xca, 0xa6, 0xc4, 0xfc, 0x68, 0xc6, 0x65, 0xc1, 0xba, 0x2c, 0xf8, 0x61, 0x92, 0x1b, 0x77, + 0xea, 0xa6, 0xb9, 0xb1, 0xad, 0x2a, 0xdf, 0xa5, 0x32, 0xdd, 0xa7, 0x92, 0x7e, 0x5f, 0xb1, 0xc7, + 0x8a, 0x3c, 0xc2, 0xc8, 0xf9, 0x78, 0x79, 0xdd, 0xd1, 0xae, 0xae, 0x3b, 0xda, 0x9f, 0xeb, 0x8e, + 0x76, 0x71, 0xd3, 0xa9, 0x5d, 0xdd, 0x74, 0x6a, 0x3f, 0x6f, 0x3a, 0xb5, 0x2f, 0xbb, 0x01, 0xe1, + 0x27, 0xd9, 0xd0, 0x42, 0x34, 0xb2, 0x8f, 0xe4, 0x05, 0x7a, 0x7d, 0x08, 0x87, 0xcc, 0x2e, 0xee, + 0xd5, 0xd9, 0xce, 0x9e, 0x7d, 0x3e, 0x77, 0xb5, 0xf8, 0x38, 0xc1, 0x6c, 0xb8, 0x2c, 0x37, 0x6e, + 0xf7, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xe2, 0x80, 0x97, 0xd6, 0x04, 0x00, 0x00, +} + +func (m *TokenPrice) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenPrice) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.QueryInProgress { + i-- + if m.QueryInProgress { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastResponseTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastResponseTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintIcqoracle(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x52 + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastRequestTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRequestTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintIcqoracle(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x4a + { + size := m.SpotPrice.Size() + i -= size + if _, err := m.SpotPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintIcqoracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if m.OsmosisPoolId != 0 { + i = encodeVarintIcqoracle(dAtA, i, uint64(m.OsmosisPoolId)) + i-- + dAtA[i] = 0x38 + } + if len(m.OsmosisQuoteDenom) > 0 { + i -= len(m.OsmosisQuoteDenom) + copy(dAtA[i:], m.OsmosisQuoteDenom) + i = encodeVarintIcqoracle(dAtA, i, uint64(len(m.OsmosisQuoteDenom))) + i-- + dAtA[i] = 0x32 + } + if len(m.OsmosisBaseDenom) > 0 { + i -= len(m.OsmosisBaseDenom) + copy(dAtA[i:], m.OsmosisBaseDenom) + i = encodeVarintIcqoracle(dAtA, i, uint64(len(m.OsmosisBaseDenom))) + i-- + dAtA[i] = 0x2a + } + if m.QuoteDenomDecimals != 0 { + i = encodeVarintIcqoracle(dAtA, i, uint64(m.QuoteDenomDecimals)) + i-- + dAtA[i] = 0x20 + } + if m.BaseDenomDecimals != 0 { + i = encodeVarintIcqoracle(dAtA, i, uint64(m.BaseDenomDecimals)) + i-- + dAtA[i] = 0x18 + } + if len(m.QuoteDenom) > 0 { + i -= len(m.QuoteDenom) + copy(dAtA[i:], m.QuoteDenom) + i = encodeVarintIcqoracle(dAtA, i, uint64(len(m.QuoteDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintIcqoracle(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PriceExpirationTimeoutSec != 0 { + i = encodeVarintIcqoracle(dAtA, i, uint64(m.PriceExpirationTimeoutSec)) + i-- + dAtA[i] = 0x20 + } + if m.UpdateIntervalSec != 0 { + i = encodeVarintIcqoracle(dAtA, i, uint64(m.UpdateIntervalSec)) + i-- + dAtA[i] = 0x18 + } + if len(m.OsmosisConnectionId) > 0 { + i -= len(m.OsmosisConnectionId) + copy(dAtA[i:], m.OsmosisConnectionId) + i = encodeVarintIcqoracle(dAtA, i, uint64(len(m.OsmosisConnectionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.OsmosisChainId) > 0 { + i -= len(m.OsmosisChainId) + copy(dAtA[i:], m.OsmosisChainId) + i = encodeVarintIcqoracle(dAtA, i, uint64(len(m.OsmosisChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintIcqoracle(dAtA []byte, offset int, v uint64) int { + offset -= sovIcqoracle(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TokenPrice) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovIcqoracle(uint64(l)) + } + l = len(m.QuoteDenom) + if l > 0 { + n += 1 + l + sovIcqoracle(uint64(l)) + } + if m.BaseDenomDecimals != 0 { + n += 1 + sovIcqoracle(uint64(m.BaseDenomDecimals)) + } + if m.QuoteDenomDecimals != 0 { + n += 1 + sovIcqoracle(uint64(m.QuoteDenomDecimals)) + } + l = len(m.OsmosisBaseDenom) + if l > 0 { + n += 1 + l + sovIcqoracle(uint64(l)) + } + l = len(m.OsmosisQuoteDenom) + if l > 0 { + n += 1 + l + sovIcqoracle(uint64(l)) + } + if m.OsmosisPoolId != 0 { + n += 1 + sovIcqoracle(uint64(m.OsmosisPoolId)) + } + l = m.SpotPrice.Size() + n += 1 + l + sovIcqoracle(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRequestTime) + n += 1 + l + sovIcqoracle(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastResponseTime) + n += 1 + l + sovIcqoracle(uint64(l)) + if m.QueryInProgress { + n += 2 + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OsmosisChainId) + if l > 0 { + n += 1 + l + sovIcqoracle(uint64(l)) + } + l = len(m.OsmosisConnectionId) + if l > 0 { + n += 1 + l + sovIcqoracle(uint64(l)) + } + if m.UpdateIntervalSec != 0 { + n += 1 + sovIcqoracle(uint64(m.UpdateIntervalSec)) + } + if m.PriceExpirationTimeoutSec != 0 { + n += 1 + sovIcqoracle(uint64(m.PriceExpirationTimeoutSec)) + } + return n +} + +func sovIcqoracle(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozIcqoracle(x uint64) (n int) { + return sovIcqoracle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TokenPrice) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenPrice: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenPrice: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenomDecimals", wireType) + } + m.BaseDenomDecimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseDenomDecimals |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenomDecimals", wireType) + } + m.QuoteDenomDecimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuoteDenomDecimals |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisBaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisBaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisQuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisQuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisPoolId", wireType) + } + m.OsmosisPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OsmosisPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpotPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SpotPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastRequestTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastRequestTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastResponseTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastResponseTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryInProgress", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.QueryInProgress = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipIcqoracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIcqoracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisConnectionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIcqoracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIcqoracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisConnectionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateIntervalSec", wireType) + } + m.UpdateIntervalSec = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UpdateIntervalSec |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceExpirationTimeoutSec", wireType) + } + m.PriceExpirationTimeoutSec = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PriceExpirationTimeoutSec |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIcqoracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIcqoracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipIcqoracle(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIcqoracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthIcqoracle + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIcqoracle + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthIcqoracle + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthIcqoracle = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIcqoracle = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIcqoracle = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/icqoracle/types/keys.go b/x/icqoracle/types/keys.go new file mode 100644 index 0000000000..9d46bc6c50 --- /dev/null +++ b/x/icqoracle/types/keys.go @@ -0,0 +1,28 @@ +package types + +import ( + fmt "fmt" +) + +const ( + ModuleName = "icqoracle" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the routing key + RouterKey = ModuleName +) + +var ( + ParamsKey = []byte("params") + TokenPricePrefix = []byte("tokenprice") +) + +func TokenPriceKey(baseDenom, quoteDenom string, poolId uint64) []byte { + return []byte(fmt.Sprintf("%s|%s|%d", baseDenom, quoteDenom, poolId)) +} + +func TokenPriceByDenomKey(baseDenom string) []byte { + return []byte(baseDenom) +} diff --git a/x/icqoracle/types/msgs.go b/x/icqoracle/types/msgs.go new file mode 100644 index 0000000000..056d5310e7 --- /dev/null +++ b/x/icqoracle/types/msgs.go @@ -0,0 +1,137 @@ +package types + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + + "github.com/Stride-Labs/stride/v25/utils" +) + +const ( + TypeMsgRegisterTokenPriceQuery = "register_token_price_query" + TypeMsgRemoveTokenPriceQuery = "remove_token_price_query" +) + +var ( + _ sdk.Msg = &MsgRegisterTokenPriceQuery{} + _ sdk.Msg = &MsgRemoveTokenPriceQuery{} + + // Implement legacy interface for ledger support + _ legacytx.LegacyMsg = &MsgRegisterTokenPriceQuery{} + _ legacytx.LegacyMsg = &MsgRemoveTokenPriceQuery{} +) + +// ---------------------------------------------- +// MsgClaim +// ---------------------------------------------- + +func NewMsgRegisterTokenPriceQuery( + admin string, + baseDenom string, + quoteDenom string, + baseDecimals int64, + quoteDecimals int64, + poolId uint64, + osmosisBaseDenom string, + osmosisQuoteDenom string, +) *MsgRegisterTokenPriceQuery { + return &MsgRegisterTokenPriceQuery{ + Admin: admin, + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + BaseDenomDecimals: baseDecimals, + QuoteDenomDecimals: quoteDecimals, + OsmosisBaseDenom: osmosisBaseDenom, + OsmosisQuoteDenom: osmosisQuoteDenom, + OsmosisPoolId: poolId, + } +} + +func (msg MsgRegisterTokenPriceQuery) Type() string { + return TypeMsgRegisterTokenPriceQuery +} + +func (msg MsgRegisterTokenPriceQuery) Route() string { + return RouterKey +} + +func (msg *MsgRegisterTokenPriceQuery) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Admin) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgRegisterTokenPriceQuery) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgRegisterTokenPriceQuery) ValidateBasic() error { + if err := utils.ValidateAdminAddress(msg.Admin); err != nil { + return err + } + return ValidateTokenPriceQueryParams( + msg.BaseDenom, + msg.QuoteDenom, + msg.BaseDenomDecimals, + msg.QuoteDenomDecimals, + msg.OsmosisPoolId, + msg.OsmosisBaseDenom, + msg.OsmosisQuoteDenom, + ) +} + +// ---------------------------------------------- +// MsgRemoveTokenPriceQuery +// ---------------------------------------------- + +func NewMsgRemoveTokenPriceQuery(admin, baseDenom, quoteDenom string, osmosisPoolId uint64) *MsgRemoveTokenPriceQuery { + return &MsgRemoveTokenPriceQuery{ + Admin: admin, + BaseDenom: baseDenom, + QuoteDenom: quoteDenom, + OsmosisPoolId: osmosisPoolId, + } +} + +func (msg MsgRemoveTokenPriceQuery) Type() string { + return TypeMsgRemoveTokenPriceQuery +} + +func (msg MsgRemoveTokenPriceQuery) Route() string { + return RouterKey +} + +func (msg *MsgRemoveTokenPriceQuery) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Admin) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgRemoveTokenPriceQuery) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgRemoveTokenPriceQuery) ValidateBasic() error { + if err := utils.ValidateAdminAddress(msg.Admin); err != nil { + return err + } + if msg.BaseDenom == "" { + return errors.New("base-denom must be specified") + } + if msg.QuoteDenom == "" { + return errors.New("quote-denom must be specified") + } + if msg.OsmosisPoolId == 0 { + return errors.New("osmosis-pool-id must be specified") + } + + return nil +} diff --git a/x/icqoracle/types/params.go b/x/icqoracle/types/params.go new file mode 100644 index 0000000000..874012a4b8 --- /dev/null +++ b/x/icqoracle/types/params.go @@ -0,0 +1,16 @@ +package types + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/icqoracle/types/query.pb.go b/x/icqoracle/types/query.pb.go new file mode 100644 index 0000000000..a605b5452a --- /dev/null +++ b/x/icqoracle/types/query.pb.go @@ -0,0 +1,2675 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/icqoracle/query.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryTokenPriceRequest is the request type for the Query/TokenPrice RPC +// method +type QueryTokenPriceRequest struct { + BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + QuoteDenom string `protobuf:"bytes,2,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty"` + PoolId uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` +} + +func (m *QueryTokenPriceRequest) Reset() { *m = QueryTokenPriceRequest{} } +func (m *QueryTokenPriceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenPriceRequest) ProtoMessage() {} +func (*QueryTokenPriceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{0} +} +func (m *QueryTokenPriceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenPriceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenPriceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenPriceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenPriceRequest.Merge(m, src) +} +func (m *QueryTokenPriceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenPriceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenPriceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenPriceRequest proto.InternalMessageInfo + +func (m *QueryTokenPriceRequest) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func (m *QueryTokenPriceRequest) GetQuoteDenom() string { + if m != nil { + return m.QuoteDenom + } + return "" +} + +func (m *QueryTokenPriceRequest) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +// QueryTokenPriceResponse is the response type for the Query/TokenPrice RPC +// method +type QueryTokenPriceResponse struct { + TokenPrice TokenPriceResponse `protobuf:"bytes,1,opt,name=token_price,json=tokenPrice,proto3" json:"token_price"` +} + +func (m *QueryTokenPriceResponse) Reset() { *m = QueryTokenPriceResponse{} } +func (m *QueryTokenPriceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenPriceResponse) ProtoMessage() {} +func (*QueryTokenPriceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{1} +} +func (m *QueryTokenPriceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenPriceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenPriceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenPriceResponse.Merge(m, src) +} +func (m *QueryTokenPriceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenPriceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenPriceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenPriceResponse proto.InternalMessageInfo + +func (m *QueryTokenPriceResponse) GetTokenPrice() TokenPriceResponse { + if m != nil { + return m.TokenPrice + } + return TokenPriceResponse{} +} + +// QueryTokenPricesRequest is the request type for the Query/TokenPrices RPC +// method +type QueryTokenPricesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryTokenPricesRequest) Reset() { *m = QueryTokenPricesRequest{} } +func (m *QueryTokenPricesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenPricesRequest) ProtoMessage() {} +func (*QueryTokenPricesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{2} +} +func (m *QueryTokenPricesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenPricesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenPricesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenPricesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenPricesRequest.Merge(m, src) +} +func (m *QueryTokenPricesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenPricesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenPricesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenPricesRequest proto.InternalMessageInfo + +func (m *QueryTokenPricesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryTokenPricesResponse is the response type for the Query/TokenPrices RPC +// method +type QueryTokenPricesResponse struct { + TokenPrices []TokenPriceResponse `protobuf:"bytes,1,rep,name=token_prices,json=tokenPrices,proto3" json:"token_prices"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryTokenPricesResponse) Reset() { *m = QueryTokenPricesResponse{} } +func (m *QueryTokenPricesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenPricesResponse) ProtoMessage() {} +func (*QueryTokenPricesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{3} +} +func (m *QueryTokenPricesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenPricesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenPricesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenPricesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenPricesResponse.Merge(m, src) +} +func (m *QueryTokenPricesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenPricesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenPricesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenPricesResponse proto.InternalMessageInfo + +func (m *QueryTokenPricesResponse) GetTokenPrices() []TokenPriceResponse { + if m != nil { + return m.TokenPrices + } + return nil +} + +func (m *QueryTokenPricesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryParamsRequest is the request type for the Query/Params RPC method +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{4} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{5} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// QueryTokenPriceForQuoteDenomRequest is the request type for the +// Query/TokenPriceForQuoteDenom RPC method +type QueryTokenPriceForQuoteDenomRequest struct { + BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + QuoteDenom string `protobuf:"bytes,2,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty"` +} + +func (m *QueryTokenPriceForQuoteDenomRequest) Reset() { *m = QueryTokenPriceForQuoteDenomRequest{} } +func (m *QueryTokenPriceForQuoteDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenPriceForQuoteDenomRequest) ProtoMessage() {} +func (*QueryTokenPriceForQuoteDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{6} +} +func (m *QueryTokenPriceForQuoteDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenPriceForQuoteDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenPriceForQuoteDenomRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenPriceForQuoteDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenPriceForQuoteDenomRequest.Merge(m, src) +} +func (m *QueryTokenPriceForQuoteDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenPriceForQuoteDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenPriceForQuoteDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenPriceForQuoteDenomRequest proto.InternalMessageInfo + +func (m *QueryTokenPriceForQuoteDenomRequest) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func (m *QueryTokenPriceForQuoteDenomRequest) GetQuoteDenom() string { + if m != nil { + return m.QuoteDenom + } + return "" +} + +// QueryTokenPriceForQuoteDenomResponse is the response type for the +// Query/TokenPriceForQuoteDenom RPC method +type QueryTokenPriceForQuoteDenomResponse struct { + Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` +} + +func (m *QueryTokenPriceForQuoteDenomResponse) Reset() { *m = QueryTokenPriceForQuoteDenomResponse{} } +func (m *QueryTokenPriceForQuoteDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenPriceForQuoteDenomResponse) ProtoMessage() {} +func (*QueryTokenPriceForQuoteDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{7} +} +func (m *QueryTokenPriceForQuoteDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenPriceForQuoteDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenPriceForQuoteDenomResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTokenPriceForQuoteDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenPriceForQuoteDenomResponse.Merge(m, src) +} +func (m *QueryTokenPriceForQuoteDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenPriceForQuoteDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenPriceForQuoteDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenPriceForQuoteDenomResponse proto.InternalMessageInfo + +// TokenPriceResponse adds human readable info on to of TokenPrice +type TokenPriceResponse struct { + // If IBC token, base denom unwrapped (e.g. ibc/... -> uatom) + BaseDenomUnwrapped string `protobuf:"bytes,1,opt,name=base_denom_unwrapped,json=baseDenomUnwrapped,proto3" json:"base_denom_unwrapped,omitempty"` + // If IBC token, Quote denom unwrapped (e.g. ibc/... -> uatom) + QuoteDenomUnwrapped string `protobuf:"bytes,2,opt,name=quote_denom_unwrapped,json=quoteDenomUnwrapped,proto3" json:"quote_denom_unwrapped,omitempty"` + // Base denom on Stride, can be IBC denom + BaseDenom string `protobuf:"bytes,3,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + // Quote denom on Stride, can be IBC denom + QuoteDenom string `protobuf:"bytes,4,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty"` + // Decimals of base token, used for normalizing price feed from Osmosis + BaseDenomDecimals int64 `protobuf:"varint,5,opt,name=base_denom_decimals,json=baseDenomDecimals,proto3" json:"base_denom_decimals,omitempty"` + // Decimals of quote token, used for normalizing price feed from Osmosis + QuoteDenomDecimals int64 `protobuf:"varint,6,opt,name=quote_denom_decimals,json=quoteDenomDecimals,proto3" json:"quote_denom_decimals,omitempty"` + // Base denom on Osmosis + OsmosisBaseDenom string `protobuf:"bytes,7,opt,name=osmosis_base_denom,json=osmosisBaseDenom,proto3" json:"osmosis_base_denom,omitempty"` + // Quote denom on Osmosis + OsmosisQuoteDenom string `protobuf:"bytes,8,opt,name=osmosis_quote_denom,json=osmosisQuoteDenom,proto3" json:"osmosis_quote_denom,omitempty"` + // Pool ID on Osmosis + OsmosisPoolId uint64 `protobuf:"varint,9,opt,name=osmosis_pool_id,json=osmosisPoolId,proto3" json:"osmosis_pool_id,omitempty"` + // Spot price of base_denom denominated in quote_denom + SpotPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,10,opt,name=spot_price,json=spotPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"spot_price"` + // Last time a query request was submitted + LastRequestTime time.Time `protobuf:"bytes,11,opt,name=last_request_time,json=lastRequestTime,proto3,stdtime" json:"last_request_time"` + // Last time a query response was received + LastResponseTime time.Time `protobuf:"bytes,12,opt,name=last_response_time,json=lastResponseTime,proto3,stdtime" json:"last_response_time"` + // Whether there is a spot price query currently in progress + QueryInProgress bool `protobuf:"varint,13,opt,name=query_in_progress,json=queryInProgress,proto3" json:"query_in_progress,omitempty"` +} + +func (m *TokenPriceResponse) Reset() { *m = TokenPriceResponse{} } +func (m *TokenPriceResponse) String() string { return proto.CompactTextString(m) } +func (*TokenPriceResponse) ProtoMessage() {} +func (*TokenPriceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_51a2bacbcf1e1cb4, []int{8} +} +func (m *TokenPriceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenPriceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TokenPriceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenPriceResponse.Merge(m, src) +} +func (m *TokenPriceResponse) XXX_Size() int { + return m.Size() +} +func (m *TokenPriceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TokenPriceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenPriceResponse proto.InternalMessageInfo + +func (m *TokenPriceResponse) GetBaseDenomUnwrapped() string { + if m != nil { + return m.BaseDenomUnwrapped + } + return "" +} + +func (m *TokenPriceResponse) GetQuoteDenomUnwrapped() string { + if m != nil { + return m.QuoteDenomUnwrapped + } + return "" +} + +func (m *TokenPriceResponse) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func (m *TokenPriceResponse) GetQuoteDenom() string { + if m != nil { + return m.QuoteDenom + } + return "" +} + +func (m *TokenPriceResponse) GetBaseDenomDecimals() int64 { + if m != nil { + return m.BaseDenomDecimals + } + return 0 +} + +func (m *TokenPriceResponse) GetQuoteDenomDecimals() int64 { + if m != nil { + return m.QuoteDenomDecimals + } + return 0 +} + +func (m *TokenPriceResponse) GetOsmosisBaseDenom() string { + if m != nil { + return m.OsmosisBaseDenom + } + return "" +} + +func (m *TokenPriceResponse) GetOsmosisQuoteDenom() string { + if m != nil { + return m.OsmosisQuoteDenom + } + return "" +} + +func (m *TokenPriceResponse) GetOsmosisPoolId() uint64 { + if m != nil { + return m.OsmosisPoolId + } + return 0 +} + +func (m *TokenPriceResponse) GetLastRequestTime() time.Time { + if m != nil { + return m.LastRequestTime + } + return time.Time{} +} + +func (m *TokenPriceResponse) GetLastResponseTime() time.Time { + if m != nil { + return m.LastResponseTime + } + return time.Time{} +} + +func (m *TokenPriceResponse) GetQueryInProgress() bool { + if m != nil { + return m.QueryInProgress + } + return false +} + +func init() { + proto.RegisterType((*QueryTokenPriceRequest)(nil), "stride.icqoracle.QueryTokenPriceRequest") + proto.RegisterType((*QueryTokenPriceResponse)(nil), "stride.icqoracle.QueryTokenPriceResponse") + proto.RegisterType((*QueryTokenPricesRequest)(nil), "stride.icqoracle.QueryTokenPricesRequest") + proto.RegisterType((*QueryTokenPricesResponse)(nil), "stride.icqoracle.QueryTokenPricesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "stride.icqoracle.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "stride.icqoracle.QueryParamsResponse") + proto.RegisterType((*QueryTokenPriceForQuoteDenomRequest)(nil), "stride.icqoracle.QueryTokenPriceForQuoteDenomRequest") + proto.RegisterType((*QueryTokenPriceForQuoteDenomResponse)(nil), "stride.icqoracle.QueryTokenPriceForQuoteDenomResponse") + proto.RegisterType((*TokenPriceResponse)(nil), "stride.icqoracle.TokenPriceResponse") +} + +func init() { proto.RegisterFile("stride/icqoracle/query.proto", fileDescriptor_51a2bacbcf1e1cb4) } + +var fileDescriptor_51a2bacbcf1e1cb4 = []byte{ + // 906 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcb, 0x6e, 0xdb, 0x46, + 0x14, 0x35, 0xfd, 0x50, 0xac, 0xab, 0x04, 0xb6, 0xc7, 0x6e, 0xcd, 0xaa, 0x89, 0x24, 0x30, 0x8e, + 0xab, 0x1a, 0xcd, 0xb0, 0x71, 0x90, 0x7c, 0x80, 0x60, 0xa4, 0x08, 0x1a, 0x03, 0x0a, 0x9b, 0x6e, + 0xba, 0x11, 0x46, 0xe2, 0x84, 0x21, 0x2c, 0x72, 0x28, 0xce, 0x28, 0xa9, 0xb7, 0x59, 0x74, 0x1d, + 0xa0, 0x1f, 0x52, 0xa0, 0xab, 0x2e, 0xbb, 0xcc, 0x32, 0x40, 0x37, 0x45, 0x17, 0x69, 0x61, 0xf7, + 0x43, 0x8a, 0x79, 0xf0, 0xa1, 0x50, 0xae, 0x6c, 0x20, 0x2b, 0x4b, 0xf7, 0x79, 0xce, 0xbd, 0x77, + 0x8e, 0x0c, 0x37, 0xb9, 0x48, 0x43, 0x9f, 0xba, 0xe1, 0x68, 0xc2, 0x52, 0x32, 0x1a, 0x53, 0x77, + 0x32, 0xa5, 0xe9, 0x29, 0x4e, 0x52, 0x26, 0x18, 0xda, 0xd4, 0x5e, 0x9c, 0x7b, 0x9b, 0x07, 0x23, + 0xc6, 0x23, 0xc6, 0xdd, 0x21, 0xe1, 0x26, 0xd4, 0x7d, 0x79, 0x6f, 0x48, 0x05, 0xb9, 0xe7, 0x26, + 0x24, 0x08, 0x63, 0x22, 0x42, 0x16, 0xeb, 0xec, 0xe6, 0x4e, 0xc0, 0x02, 0xa6, 0x3e, 0xba, 0xf2, + 0x93, 0xb1, 0xde, 0x0c, 0x18, 0x0b, 0xc6, 0xd4, 0x25, 0x49, 0xe8, 0x92, 0x38, 0x66, 0x42, 0xa5, + 0x70, 0xe3, 0x6d, 0x1b, 0xaf, 0xfa, 0x36, 0x9c, 0x3e, 0x77, 0x45, 0x18, 0x51, 0x2e, 0x48, 0x94, + 0x98, 0x80, 0x4e, 0x05, 0x70, 0xfe, 0x49, 0x47, 0x38, 0x13, 0xf8, 0xf4, 0xa9, 0x04, 0xf6, 0x8c, + 0x9d, 0xd0, 0xb8, 0x9f, 0x86, 0x23, 0xea, 0xd1, 0xc9, 0x94, 0x72, 0x81, 0x6e, 0x01, 0x48, 0xdc, + 0x03, 0x9f, 0xc6, 0x2c, 0xb2, 0xad, 0x8e, 0xd5, 0xad, 0x7b, 0x75, 0x69, 0x39, 0x92, 0x06, 0xd4, + 0x86, 0xc6, 0x64, 0xca, 0x44, 0xe6, 0x5f, 0x56, 0x7e, 0x50, 0x26, 0x1d, 0xb0, 0x0b, 0xd7, 0x12, + 0xc6, 0xc6, 0x83, 0xd0, 0xb7, 0x57, 0x3a, 0x56, 0x77, 0xd5, 0xab, 0xc9, 0xaf, 0x8f, 0x7d, 0xe7, + 0x39, 0xec, 0x56, 0x5a, 0xf2, 0x84, 0xc5, 0x9c, 0xa2, 0x6f, 0xa1, 0x21, 0xa4, 0x75, 0x90, 0x48, + 0xb3, 0x6a, 0xda, 0x38, 0xdc, 0xc3, 0x1f, 0x0e, 0x16, 0x57, 0x53, 0x7b, 0xab, 0x6f, 0xdf, 0xb7, + 0x97, 0x3c, 0x10, 0xb9, 0xc7, 0x21, 0x95, 0x3e, 0x3c, 0xe3, 0xf6, 0x08, 0xa0, 0x58, 0x80, 0x69, + 0xb3, 0x8f, 0xf5, 0xb6, 0xb0, 0xe4, 0x88, 0xf5, 0x62, 0xcd, 0xb6, 0x70, 0x9f, 0x04, 0xd9, 0x5c, + 0xbc, 0x52, 0xa6, 0xf3, 0xab, 0x05, 0x76, 0xb5, 0x87, 0x21, 0x73, 0x0c, 0xd7, 0x4b, 0x64, 0xb8, + 0x6d, 0x75, 0x56, 0xae, 0xc8, 0xa6, 0x51, 0xb0, 0xe1, 0xe8, 0x9b, 0x19, 0xcc, 0xcb, 0x0a, 0xf3, + 0x17, 0x0b, 0x31, 0xeb, 0x7a, 0x33, 0xa0, 0x77, 0x00, 0x29, 0xcc, 0x7d, 0x92, 0x92, 0x28, 0x1b, + 0x89, 0x73, 0x0c, 0xdb, 0x33, 0x56, 0x43, 0xe2, 0x21, 0xd4, 0x12, 0x65, 0x31, 0x53, 0xb2, 0xab, + 0xf0, 0x75, 0x86, 0x81, 0x6c, 0xa2, 0x1d, 0x0a, 0xb7, 0x3f, 0x18, 0xcc, 0x23, 0x96, 0x3e, 0xcd, + 0xaf, 0xe3, 0x23, 0x1d, 0x99, 0x33, 0x86, 0xbd, 0xff, 0x6f, 0x63, 0x68, 0x1c, 0xc1, 0x5a, 0x71, + 0x52, 0xf5, 0x1e, 0x96, 0x58, 0xff, 0x7a, 0xdf, 0xde, 0x0f, 0x42, 0xf1, 0x62, 0x3a, 0xc4, 0x23, + 0x16, 0xb9, 0xe6, 0xad, 0xea, 0x3f, 0x77, 0xb9, 0x7f, 0xe2, 0x8a, 0xd3, 0x84, 0x72, 0x7c, 0x44, + 0x47, 0x9e, 0x4e, 0x76, 0x7e, 0x5b, 0x03, 0x34, 0xe7, 0x6a, 0xbf, 0x86, 0x9d, 0x82, 0xc4, 0x60, + 0x1a, 0xbf, 0x4a, 0x49, 0x92, 0x50, 0xdf, 0xd0, 0x41, 0x39, 0x9d, 0xef, 0x33, 0x0f, 0x3a, 0x84, + 0x4f, 0x4a, 0xbc, 0x4a, 0x29, 0x9a, 0xe1, 0x76, 0xc1, 0xb0, 0xc8, 0x99, 0x1d, 0xd5, 0xca, 0x82, + 0x51, 0xad, 0x56, 0xde, 0x23, 0x86, 0xed, 0x12, 0x4a, 0x9f, 0x8e, 0xc2, 0x88, 0x8c, 0xb9, 0xbd, + 0xd6, 0xb1, 0xba, 0x2b, 0xde, 0x56, 0x5e, 0xe8, 0xc8, 0x38, 0x24, 0xab, 0x32, 0xc6, 0x3c, 0xa1, + 0xa6, 0x12, 0x50, 0x51, 0x39, 0xcf, 0xf8, 0x0a, 0x90, 0x1a, 0x5e, 0xc8, 0x07, 0x25, 0xa4, 0xd7, + 0x14, 0x92, 0x4d, 0xe3, 0xe9, 0xe5, 0x80, 0x31, 0x6c, 0x67, 0xd1, 0x65, 0xe0, 0xeb, 0x2a, 0x7c, + 0xcb, 0xb8, 0x8a, 0x55, 0xa2, 0x7d, 0xd8, 0xc8, 0xe2, 0x33, 0x5d, 0xa9, 0x2b, 0x5d, 0xb9, 0x61, + 0xcc, 0x7d, 0x25, 0x2f, 0xa8, 0x07, 0xc0, 0x13, 0x26, 0x8c, 0x84, 0x80, 0xda, 0xf7, 0x6d, 0xb3, + 0xef, 0xcf, 0xf5, 0x76, 0xb9, 0x7f, 0x82, 0x43, 0xe6, 0x46, 0x44, 0xbc, 0xc0, 0x4f, 0x68, 0x40, + 0x46, 0xa7, 0x72, 0xc9, 0x75, 0x99, 0xa6, 0x36, 0x8b, 0xfa, 0xb0, 0x35, 0x26, 0x5c, 0x0c, 0x52, + 0x7d, 0xa6, 0x03, 0xa9, 0xab, 0x76, 0x43, 0x3d, 0x80, 0x26, 0xd6, 0xa2, 0x8b, 0x33, 0xd1, 0xc5, + 0xcf, 0x32, 0xd1, 0xed, 0xad, 0xcb, 0x36, 0x6f, 0xfe, 0x6e, 0x5b, 0xde, 0x86, 0x4c, 0x37, 0x47, + 0x2e, 0xfd, 0xc8, 0x03, 0x64, 0x2a, 0xea, 0xa3, 0xd1, 0x25, 0xaf, 0x5f, 0xa1, 0xe4, 0xa6, 0x2e, + 0xa9, 0xd3, 0x55, 0xcd, 0x03, 0xd8, 0x52, 0x4f, 0x7e, 0x10, 0x4a, 0x8d, 0x61, 0x41, 0x4a, 0x39, + 0xb7, 0x6f, 0x74, 0xac, 0xee, 0xba, 0xb7, 0xa1, 0x1c, 0x8f, 0xe3, 0xbe, 0x31, 0x1f, 0xfe, 0xbe, + 0x0a, 0x6b, 0xea, 0xa5, 0xa0, 0xd7, 0x16, 0x40, 0x71, 0xc4, 0xa8, 0x5b, 0x7d, 0xd0, 0xf3, 0x7f, + 0x10, 0x9a, 0x5f, 0x5e, 0x22, 0x52, 0xa3, 0x73, 0xda, 0xaf, 0xff, 0xf8, 0xf7, 0xe7, 0xe5, 0xcf, + 0xd0, 0xae, 0x5b, 0xf9, 0x01, 0x52, 0x6b, 0x41, 0x3f, 0x59, 0xd0, 0x28, 0x69, 0x26, 0x5a, 0x5c, + 0x3b, 0x13, 0xaa, 0xe6, 0xc1, 0x65, 0x42, 0x0d, 0x8e, 0x8e, 0xc2, 0xd1, 0x44, 0xf6, 0x05, 0x38, + 0x38, 0x7a, 0x05, 0x35, 0xad, 0x5f, 0x68, 0xef, 0x82, 0xba, 0x33, 0x32, 0xd9, 0xbc, 0xb3, 0x20, + 0xea, 0x12, 0x8d, 0x75, 0xbb, 0x5f, 0x2c, 0xd8, 0xbd, 0x40, 0xb5, 0xd0, 0x83, 0x85, 0x14, 0xe7, + 0x89, 0x69, 0xf3, 0xe1, 0x55, 0xd3, 0x0c, 0xd8, 0x3b, 0x0a, 0x6c, 0x1b, 0xdd, 0x72, 0xe7, 0xfc, + 0x7f, 0x23, 0x5f, 0xa6, 0x9a, 0x55, 0xef, 0xf8, 0xed, 0x59, 0xcb, 0x7a, 0x77, 0xd6, 0xb2, 0xfe, + 0x39, 0x6b, 0x59, 0x6f, 0xce, 0x5b, 0x4b, 0xef, 0xce, 0x5b, 0x4b, 0x7f, 0x9e, 0xb7, 0x96, 0x7e, + 0xb8, 0x5f, 0x92, 0xd1, 0xef, 0x54, 0x89, 0xbb, 0x4f, 0xc8, 0x90, 0x67, 0xe5, 0x5e, 0x1e, 0x3e, + 0x70, 0x7f, 0x2c, 0x15, 0x55, 0xba, 0x3a, 0xac, 0xa9, 0x6b, 0xbf, 0xff, 0x5f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x2d, 0x74, 0x16, 0x15, 0x55, 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // TokenPrice queries the current price for a specific token + TokenPrice(ctx context.Context, in *QueryTokenPriceRequest, opts ...grpc.CallOption) (*QueryTokenPriceResponse, error) + // TokenPrices queries all token prices + TokenPrices(ctx context.Context, in *QueryTokenPricesRequest, opts ...grpc.CallOption) (*QueryTokenPricesResponse, error) + // Params queries the oracle parameters + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // TokenPriceForQuoteDenom queries the exchange rate between two tokens + TokenPriceForQuoteDenom(ctx context.Context, in *QueryTokenPriceForQuoteDenomRequest, opts ...grpc.CallOption) (*QueryTokenPriceForQuoteDenomResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) TokenPrice(ctx context.Context, in *QueryTokenPriceRequest, opts ...grpc.CallOption) (*QueryTokenPriceResponse, error) { + out := new(QueryTokenPriceResponse) + err := c.cc.Invoke(ctx, "/stride.icqoracle.Query/TokenPrice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TokenPrices(ctx context.Context, in *QueryTokenPricesRequest, opts ...grpc.CallOption) (*QueryTokenPricesResponse, error) { + out := new(QueryTokenPricesResponse) + err := c.cc.Invoke(ctx, "/stride.icqoracle.Query/TokenPrices", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/stride.icqoracle.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TokenPriceForQuoteDenom(ctx context.Context, in *QueryTokenPriceForQuoteDenomRequest, opts ...grpc.CallOption) (*QueryTokenPriceForQuoteDenomResponse, error) { + out := new(QueryTokenPriceForQuoteDenomResponse) + err := c.cc.Invoke(ctx, "/stride.icqoracle.Query/TokenPriceForQuoteDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // TokenPrice queries the current price for a specific token + TokenPrice(context.Context, *QueryTokenPriceRequest) (*QueryTokenPriceResponse, error) + // TokenPrices queries all token prices + TokenPrices(context.Context, *QueryTokenPricesRequest) (*QueryTokenPricesResponse, error) + // Params queries the oracle parameters + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // TokenPriceForQuoteDenom queries the exchange rate between two tokens + TokenPriceForQuoteDenom(context.Context, *QueryTokenPriceForQuoteDenomRequest) (*QueryTokenPriceForQuoteDenomResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) TokenPrice(ctx context.Context, req *QueryTokenPriceRequest) (*QueryTokenPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenPrice not implemented") +} +func (*UnimplementedQueryServer) TokenPrices(ctx context.Context, req *QueryTokenPricesRequest) (*QueryTokenPricesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenPrices not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) TokenPriceForQuoteDenom(ctx context.Context, req *QueryTokenPriceForQuoteDenomRequest) (*QueryTokenPriceForQuoteDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenPriceForQuoteDenom not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_TokenPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenPriceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenPrice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.icqoracle.Query/TokenPrice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenPrice(ctx, req.(*QueryTokenPriceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TokenPrices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenPricesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenPrices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.icqoracle.Query/TokenPrices", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenPrices(ctx, req.(*QueryTokenPricesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.icqoracle.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TokenPriceForQuoteDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenPriceForQuoteDenomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenPriceForQuoteDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.icqoracle.Query/TokenPriceForQuoteDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenPriceForQuoteDenom(ctx, req.(*QueryTokenPriceForQuoteDenomRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stride.icqoracle.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "TokenPrice", + Handler: _Query_TokenPrice_Handler, + }, + { + MethodName: "TokenPrices", + Handler: _Query_TokenPrices_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "TokenPriceForQuoteDenom", + Handler: _Query_TokenPriceForQuoteDenom_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stride/icqoracle/query.proto", +} + +func (m *QueryTokenPriceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenPriceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x18 + } + if len(m.QuoteDenom) > 0 { + i -= len(m.QuoteDenom) + copy(dAtA[i:], m.QuoteDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.QuoteDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenPriceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TokenPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTokenPricesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenPricesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenPricesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenPricesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenPricesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenPricesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.TokenPrices) > 0 { + for iNdEx := len(m.TokenPrices) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenPrices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTokenPriceForQuoteDenomRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenPriceForQuoteDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenPriceForQuoteDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.QuoteDenom) > 0 { + i -= len(m.QuoteDenom) + copy(dAtA[i:], m.QuoteDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.QuoteDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenPriceForQuoteDenomResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTokenPriceForQuoteDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenPriceForQuoteDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Price.Size() + i -= size + if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TokenPriceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.QueryInProgress { + i-- + if m.QueryInProgress { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastResponseTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastResponseTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintQuery(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x62 + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastRequestTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRequestTime):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintQuery(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x5a + { + size := m.SpotPrice.Size() + i -= size + if _, err := m.SpotPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + if m.OsmosisPoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.OsmosisPoolId)) + i-- + dAtA[i] = 0x48 + } + if len(m.OsmosisQuoteDenom) > 0 { + i -= len(m.OsmosisQuoteDenom) + copy(dAtA[i:], m.OsmosisQuoteDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OsmosisQuoteDenom))) + i-- + dAtA[i] = 0x42 + } + if len(m.OsmosisBaseDenom) > 0 { + i -= len(m.OsmosisBaseDenom) + copy(dAtA[i:], m.OsmosisBaseDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OsmosisBaseDenom))) + i-- + dAtA[i] = 0x3a + } + if m.QuoteDenomDecimals != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.QuoteDenomDecimals)) + i-- + dAtA[i] = 0x30 + } + if m.BaseDenomDecimals != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BaseDenomDecimals)) + i-- + dAtA[i] = 0x28 + } + if len(m.QuoteDenom) > 0 { + i -= len(m.QuoteDenom) + copy(dAtA[i:], m.QuoteDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.QuoteDenom))) + i-- + dAtA[i] = 0x22 + } + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.QuoteDenomUnwrapped) > 0 { + i -= len(m.QuoteDenomUnwrapped) + copy(dAtA[i:], m.QuoteDenomUnwrapped) + i = encodeVarintQuery(dAtA, i, uint64(len(m.QuoteDenomUnwrapped))) + i-- + dAtA[i] = 0x12 + } + if len(m.BaseDenomUnwrapped) > 0 { + i -= len(m.BaseDenomUnwrapped) + copy(dAtA[i:], m.BaseDenomUnwrapped) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseDenomUnwrapped))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryTokenPriceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.QuoteDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + return n +} + +func (m *QueryTokenPriceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TokenPrice.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTokenPricesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokenPricesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TokenPrices) > 0 { + for _, e := range m.TokenPrices { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTokenPriceForQuoteDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.QuoteDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokenPriceForQuoteDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Price.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *TokenPriceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BaseDenomUnwrapped) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.QuoteDenomUnwrapped) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.QuoteDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.BaseDenomDecimals != 0 { + n += 1 + sovQuery(uint64(m.BaseDenomDecimals)) + } + if m.QuoteDenomDecimals != 0 { + n += 1 + sovQuery(uint64(m.QuoteDenomDecimals)) + } + l = len(m.OsmosisBaseDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OsmosisQuoteDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.OsmosisPoolId != 0 { + n += 1 + sovQuery(uint64(m.OsmosisPoolId)) + } + l = m.SpotPrice.Size() + n += 1 + l + sovQuery(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRequestTime) + n += 1 + l + sovQuery(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastResponseTime) + n += 1 + l + sovQuery(uint64(l)) + if m.QueryInProgress { + n += 2 + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryTokenPriceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenPriceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenPriceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenPriceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenPricesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenPricesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenPricesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenPricesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenPricesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenPricesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenPrices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenPrices = append(m.TokenPrices, TokenPriceResponse{}) + if err := m.TokenPrices[len(m.TokenPrices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenPriceForQuoteDenomRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenPriceForQuoteDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenPriceForQuoteDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenPriceForQuoteDenomResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTokenPriceForQuoteDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenPriceForQuoteDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TokenPriceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenPriceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenomUnwrapped", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenomUnwrapped = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenomUnwrapped", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenomUnwrapped = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenomDecimals", wireType) + } + m.BaseDenomDecimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseDenomDecimals |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenomDecimals", wireType) + } + m.QuoteDenomDecimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuoteDenomDecimals |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisBaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisBaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisQuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisQuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisPoolId", wireType) + } + m.OsmosisPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OsmosisPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpotPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SpotPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastRequestTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastRequestTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastResponseTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastResponseTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryInProgress", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.QueryInProgress = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/icqoracle/types/query.pb.gw.go b/x/icqoracle/types/query.pb.gw.go new file mode 100644 index 0000000000..26446a8d16 --- /dev/null +++ b/x/icqoracle/types/query.pb.gw.go @@ -0,0 +1,402 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stride/icqoracle/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Query_TokenPrice_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TokenPrice_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenPriceRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TokenPrice_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TokenPrice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TokenPrice_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenPriceRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TokenPrice_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TokenPrice(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TokenPrices_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TokenPrices_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenPricesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TokenPrices_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TokenPrices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TokenPrices_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenPricesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TokenPrices_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TokenPrices(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TokenPriceForQuoteDenom_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TokenPriceForQuoteDenom_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenPriceForQuoteDenomRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TokenPriceForQuoteDenom_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TokenPriceForQuoteDenom(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TokenPriceForQuoteDenom_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenPriceForQuoteDenomRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TokenPriceForQuoteDenom_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TokenPriceForQuoteDenom(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_TokenPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TokenPrice_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TokenPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TokenPrices_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenPrices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TokenPriceForQuoteDenom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TokenPriceForQuoteDenom_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenPriceForQuoteDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_TokenPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TokenPrice_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TokenPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TokenPrices_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenPrices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TokenPriceForQuoteDenom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TokenPriceForQuoteDenom_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenPriceForQuoteDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_TokenPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "icqoracle", "price"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TokenPrices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "icqoracle", "prices"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "icqoracle", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TokenPriceForQuoteDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "icqoracle", "quote_price"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_TokenPrice_0 = runtime.ForwardResponseMessage + + forward_Query_TokenPrices_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_TokenPriceForQuoteDenom_0 = runtime.ForwardResponseMessage +) diff --git a/x/icqoracle/types/tx.pb.go b/x/icqoracle/types/tx.pb.go new file mode 100644 index 0000000000..53ae5b9138 --- /dev/null +++ b/x/icqoracle/types/tx.pb.go @@ -0,0 +1,1332 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/icqoracle/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgRegisterTokenPriceQuery defines the message for adding a new token to +// track prices +type MsgRegisterTokenPriceQuery struct { + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` + // Token denom on Stride + BaseDenom string `protobuf:"bytes,2,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + // Quote denom on Stride + QuoteDenom string `protobuf:"bytes,3,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty"` + // Decimals of base token, used for normalizing price feed from Osmosis + BaseDenomDecimals int64 `protobuf:"varint,4,opt,name=base_denom_decimals,json=baseDenomDecimals,proto3" json:"base_denom_decimals,omitempty"` + // Decimals of quote token, used for normalizing price feed from Osmosis + QuoteDenomDecimals int64 `protobuf:"varint,5,opt,name=quote_denom_decimals,json=quoteDenomDecimals,proto3" json:"quote_denom_decimals,omitempty"` + // Token denom on Osmosis + OsmosisBaseDenom string `protobuf:"bytes,6,opt,name=osmosis_base_denom,json=osmosisBaseDenom,proto3" json:"osmosis_base_denom,omitempty"` + // Quote denom on Osmosis + OsmosisQuoteDenom string `protobuf:"bytes,7,opt,name=osmosis_quote_denom,json=osmosisQuoteDenom,proto3" json:"osmosis_quote_denom,omitempty"` + // Pool ID on Osmosis + OsmosisPoolId uint64 `protobuf:"varint,8,opt,name=osmosis_pool_id,json=osmosisPoolId,proto3" json:"osmosis_pool_id,omitempty"` +} + +func (m *MsgRegisterTokenPriceQuery) Reset() { *m = MsgRegisterTokenPriceQuery{} } +func (m *MsgRegisterTokenPriceQuery) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterTokenPriceQuery) ProtoMessage() {} +func (*MsgRegisterTokenPriceQuery) Descriptor() ([]byte, []int) { + return fileDescriptor_be640eb75c1babd5, []int{0} +} +func (m *MsgRegisterTokenPriceQuery) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterTokenPriceQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterTokenPriceQuery.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterTokenPriceQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterTokenPriceQuery.Merge(m, src) +} +func (m *MsgRegisterTokenPriceQuery) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterTokenPriceQuery) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterTokenPriceQuery.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterTokenPriceQuery proto.InternalMessageInfo + +func (m *MsgRegisterTokenPriceQuery) GetAdmin() string { + if m != nil { + return m.Admin + } + return "" +} + +func (m *MsgRegisterTokenPriceQuery) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func (m *MsgRegisterTokenPriceQuery) GetQuoteDenom() string { + if m != nil { + return m.QuoteDenom + } + return "" +} + +func (m *MsgRegisterTokenPriceQuery) GetBaseDenomDecimals() int64 { + if m != nil { + return m.BaseDenomDecimals + } + return 0 +} + +func (m *MsgRegisterTokenPriceQuery) GetQuoteDenomDecimals() int64 { + if m != nil { + return m.QuoteDenomDecimals + } + return 0 +} + +func (m *MsgRegisterTokenPriceQuery) GetOsmosisBaseDenom() string { + if m != nil { + return m.OsmosisBaseDenom + } + return "" +} + +func (m *MsgRegisterTokenPriceQuery) GetOsmosisQuoteDenom() string { + if m != nil { + return m.OsmosisQuoteDenom + } + return "" +} + +func (m *MsgRegisterTokenPriceQuery) GetOsmosisPoolId() uint64 { + if m != nil { + return m.OsmosisPoolId + } + return 0 +} + +type MsgRegisterTokenPriceQueryResponse struct { +} + +func (m *MsgRegisterTokenPriceQueryResponse) Reset() { *m = MsgRegisterTokenPriceQueryResponse{} } +func (m *MsgRegisterTokenPriceQueryResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterTokenPriceQueryResponse) ProtoMessage() {} +func (*MsgRegisterTokenPriceQueryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_be640eb75c1babd5, []int{1} +} +func (m *MsgRegisterTokenPriceQueryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterTokenPriceQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterTokenPriceQueryResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterTokenPriceQueryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterTokenPriceQueryResponse.Merge(m, src) +} +func (m *MsgRegisterTokenPriceQueryResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterTokenPriceQueryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterTokenPriceQueryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterTokenPriceQueryResponse proto.InternalMessageInfo + +// MsgRemoveTokenPriceQuery defines the message for removing a token from price +// tracking +type MsgRemoveTokenPriceQuery struct { + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` + // Token denom on Stride + BaseDenom string `protobuf:"bytes,2,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"` + // Quote denom on Stride + QuoteDenom string `protobuf:"bytes,3,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty"` + // Pool ID on Osmosis + OsmosisPoolId uint64 `protobuf:"varint,4,opt,name=osmosis_pool_id,json=osmosisPoolId,proto3" json:"osmosis_pool_id,omitempty"` +} + +func (m *MsgRemoveTokenPriceQuery) Reset() { *m = MsgRemoveTokenPriceQuery{} } +func (m *MsgRemoveTokenPriceQuery) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveTokenPriceQuery) ProtoMessage() {} +func (*MsgRemoveTokenPriceQuery) Descriptor() ([]byte, []int) { + return fileDescriptor_be640eb75c1babd5, []int{2} +} +func (m *MsgRemoveTokenPriceQuery) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveTokenPriceQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveTokenPriceQuery.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveTokenPriceQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveTokenPriceQuery.Merge(m, src) +} +func (m *MsgRemoveTokenPriceQuery) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveTokenPriceQuery) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveTokenPriceQuery.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveTokenPriceQuery proto.InternalMessageInfo + +func (m *MsgRemoveTokenPriceQuery) GetAdmin() string { + if m != nil { + return m.Admin + } + return "" +} + +func (m *MsgRemoveTokenPriceQuery) GetBaseDenom() string { + if m != nil { + return m.BaseDenom + } + return "" +} + +func (m *MsgRemoveTokenPriceQuery) GetQuoteDenom() string { + if m != nil { + return m.QuoteDenom + } + return "" +} + +func (m *MsgRemoveTokenPriceQuery) GetOsmosisPoolId() uint64 { + if m != nil { + return m.OsmosisPoolId + } + return 0 +} + +type MsgRemoveTokenPriceQueryResponse struct { +} + +func (m *MsgRemoveTokenPriceQueryResponse) Reset() { *m = MsgRemoveTokenPriceQueryResponse{} } +func (m *MsgRemoveTokenPriceQueryResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveTokenPriceQueryResponse) ProtoMessage() {} +func (*MsgRemoveTokenPriceQueryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_be640eb75c1babd5, []int{3} +} +func (m *MsgRemoveTokenPriceQueryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveTokenPriceQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveTokenPriceQueryResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveTokenPriceQueryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveTokenPriceQueryResponse.Merge(m, src) +} +func (m *MsgRemoveTokenPriceQueryResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveTokenPriceQueryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveTokenPriceQueryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveTokenPriceQueryResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgRegisterTokenPriceQuery)(nil), "stride.icqoracle.MsgRegisterTokenPriceQuery") + proto.RegisterType((*MsgRegisterTokenPriceQueryResponse)(nil), "stride.icqoracle.MsgRegisterTokenPriceQueryResponse") + proto.RegisterType((*MsgRemoveTokenPriceQuery)(nil), "stride.icqoracle.MsgRemoveTokenPriceQuery") + proto.RegisterType((*MsgRemoveTokenPriceQueryResponse)(nil), "stride.icqoracle.MsgRemoveTokenPriceQueryResponse") +} + +func init() { proto.RegisterFile("stride/icqoracle/tx.proto", fileDescriptor_be640eb75c1babd5) } + +var fileDescriptor_be640eb75c1babd5 = []byte{ + // 508 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0x35, 0x49, 0xa1, 0x0f, 0x21, 0x9a, 0x6b, 0x51, 0x5d, 0x4b, 0x98, 0xc8, 0xaa, 0x50, + 0x14, 0xb5, 0x3e, 0x9a, 0xc0, 0xc2, 0x46, 0xd4, 0x05, 0x89, 0x48, 0xad, 0xcb, 0xc4, 0x62, 0x39, + 0xf6, 0xc9, 0x9c, 0x88, 0x7d, 0xa9, 0xcf, 0x09, 0xed, 0x80, 0x84, 0x10, 0x13, 0x13, 0x7f, 0x83, + 0x2d, 0x03, 0x3f, 0x82, 0xb1, 0x62, 0x62, 0x44, 0x89, 0x50, 0xfe, 0x06, 0xca, 0xd9, 0x8e, 0x4d, + 0x64, 0x4b, 0x30, 0x75, 0xb1, 0x75, 0xef, 0xfb, 0xde, 0xe7, 0xcf, 0xdf, 0xb3, 0x1f, 0xec, 0x8b, + 0x28, 0x64, 0x2e, 0x25, 0xcc, 0xb9, 0xe0, 0xa1, 0xed, 0x0c, 0x29, 0x89, 0x2e, 0x8d, 0x51, 0xc8, + 0x23, 0x8e, 0xb7, 0x63, 0xc8, 0x58, 0x41, 0x6a, 0xc3, 0xf6, 0x59, 0xc0, 0x89, 0xbc, 0xc6, 0x24, + 0x75, 0xdf, 0xe1, 0xc2, 0xe7, 0xc2, 0x92, 0x27, 0x12, 0x1f, 0x12, 0x68, 0x2f, 0x3e, 0x11, 0x5f, + 0x78, 0x64, 0x72, 0xbc, 0xbc, 0xc5, 0x80, 0xfe, 0xb5, 0x0a, 0x6a, 0x5f, 0x78, 0x26, 0xf5, 0x98, + 0x88, 0x68, 0xf8, 0x8a, 0xbf, 0xa5, 0xc1, 0x69, 0xc8, 0x1c, 0x7a, 0x36, 0xa6, 0xe1, 0x15, 0x36, + 0xa0, 0x6e, 0xbb, 0x3e, 0x0b, 0x14, 0xd4, 0x44, 0xad, 0xad, 0x9e, 0xf2, 0xe3, 0xdb, 0xd1, 0x6e, + 0x22, 0xfc, 0xdc, 0x75, 0x43, 0x2a, 0xc4, 0x79, 0x14, 0xb2, 0xc0, 0x33, 0x63, 0x1a, 0x7e, 0x00, + 0x30, 0xb0, 0x05, 0xb5, 0x5c, 0x1a, 0x70, 0x5f, 0xd9, 0x58, 0x36, 0x99, 0x5b, 0xcb, 0xca, 0xc9, + 0xb2, 0x80, 0x1f, 0xc2, 0x9d, 0x8b, 0x31, 0x8f, 0x52, 0xbc, 0x2a, 0x71, 0x90, 0xa5, 0x98, 0x60, + 0xc0, 0x4e, 0xd6, 0x6f, 0xb9, 0xd4, 0x61, 0xbe, 0x3d, 0x14, 0x4a, 0xad, 0x89, 0x5a, 0x55, 0xb3, + 0xb1, 0x12, 0x3a, 0x49, 0x00, 0xfc, 0x18, 0x76, 0x73, 0x82, 0x59, 0x43, 0x5d, 0x36, 0xe0, 0x4c, + 0x79, 0xd5, 0x71, 0x08, 0x58, 0xfa, 0x67, 0xc2, 0xca, 0x39, 0xdd, 0x94, 0x4e, 0xb6, 0x13, 0xa4, + 0xb7, 0x32, 0x6c, 0xc0, 0x4e, 0xca, 0xce, 0x1b, 0xbf, 0x25, 0xe9, 0x8d, 0x04, 0x3a, 0xcb, 0xfc, + 0x3f, 0x82, 0x7b, 0x29, 0x7f, 0xc4, 0xf9, 0xd0, 0x62, 0xae, 0x72, 0xbb, 0x89, 0x5a, 0x35, 0xf3, + 0x6e, 0x52, 0x3e, 0xe5, 0x7c, 0xf8, 0xc2, 0x7d, 0xd6, 0xfd, 0xb8, 0x98, 0xb6, 0xe3, 0xcc, 0x3e, + 0x2f, 0xa6, 0xed, 0x83, 0x6c, 0xe4, 0xe5, 0xc3, 0xd0, 0x0f, 0x40, 0x2f, 0x47, 0x4d, 0x2a, 0x46, + 0x3c, 0x10, 0x54, 0xff, 0x8d, 0x40, 0x91, 0x34, 0x9f, 0x4f, 0xe8, 0x4d, 0xcf, 0xb3, 0x20, 0x8f, + 0x5a, 0x51, 0x1e, 0xc7, 0x7f, 0xe7, 0xa1, 0xaf, 0xe5, 0x51, 0xf0, 0x2a, 0xba, 0x0e, 0xcd, 0x32, + 0x2c, 0xcd, 0xa2, 0xf3, 0x69, 0x03, 0xaa, 0x7d, 0xe1, 0xe1, 0xf7, 0xb0, 0x57, 0xf6, 0x85, 0x1f, + 0x1a, 0xeb, 0xbf, 0x96, 0x51, 0x1e, 0xb2, 0xfa, 0xe4, 0x7f, 0xd8, 0xa9, 0x0d, 0xfc, 0x0e, 0xee, + 0x17, 0x8f, 0xa3, 0x5d, 0x22, 0x57, 0xc0, 0x55, 0x3b, 0xff, 0xce, 0x4d, 0x1f, 0xac, 0xd6, 0x3f, + 0x2c, 0xa6, 0x6d, 0xd4, 0xeb, 0x7f, 0x9f, 0x69, 0xe8, 0x7a, 0xa6, 0xa1, 0x5f, 0x33, 0x0d, 0x7d, + 0x99, 0x6b, 0x95, 0xeb, 0xb9, 0x56, 0xf9, 0x39, 0xd7, 0x2a, 0xaf, 0xbb, 0x1e, 0x8b, 0xde, 0x8c, + 0x07, 0x86, 0xc3, 0x7d, 0x72, 0x2e, 0xe5, 0x8f, 0x5e, 0xda, 0x03, 0x41, 0x92, 0x4d, 0x34, 0xe9, + 0x3c, 0x25, 0x97, 0xf9, 0x7d, 0x74, 0x35, 0xa2, 0x62, 0xb0, 0x29, 0x57, 0x47, 0xf7, 0x4f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xd0, 0x5a, 0x62, 0x60, 0xb0, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // RegisterTokenPriceQuery registers a new token to track prices for + RegisterTokenPriceQuery(ctx context.Context, in *MsgRegisterTokenPriceQuery, opts ...grpc.CallOption) (*MsgRegisterTokenPriceQueryResponse, error) + // RemoveTokenPriceQuery removes a token from price tracking + RemoveTokenPriceQuery(ctx context.Context, in *MsgRemoveTokenPriceQuery, opts ...grpc.CallOption) (*MsgRemoveTokenPriceQueryResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) RegisterTokenPriceQuery(ctx context.Context, in *MsgRegisterTokenPriceQuery, opts ...grpc.CallOption) (*MsgRegisterTokenPriceQueryResponse, error) { + out := new(MsgRegisterTokenPriceQueryResponse) + err := c.cc.Invoke(ctx, "/stride.icqoracle.Msg/RegisterTokenPriceQuery", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveTokenPriceQuery(ctx context.Context, in *MsgRemoveTokenPriceQuery, opts ...grpc.CallOption) (*MsgRemoveTokenPriceQueryResponse, error) { + out := new(MsgRemoveTokenPriceQueryResponse) + err := c.cc.Invoke(ctx, "/stride.icqoracle.Msg/RemoveTokenPriceQuery", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // RegisterTokenPriceQuery registers a new token to track prices for + RegisterTokenPriceQuery(context.Context, *MsgRegisterTokenPriceQuery) (*MsgRegisterTokenPriceQueryResponse, error) + // RemoveTokenPriceQuery removes a token from price tracking + RemoveTokenPriceQuery(context.Context, *MsgRemoveTokenPriceQuery) (*MsgRemoveTokenPriceQueryResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) RegisterTokenPriceQuery(ctx context.Context, req *MsgRegisterTokenPriceQuery) (*MsgRegisterTokenPriceQueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterTokenPriceQuery not implemented") +} +func (*UnimplementedMsgServer) RemoveTokenPriceQuery(ctx context.Context, req *MsgRemoveTokenPriceQuery) (*MsgRemoveTokenPriceQueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveTokenPriceQuery not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_RegisterTokenPriceQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterTokenPriceQuery) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterTokenPriceQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.icqoracle.Msg/RegisterTokenPriceQuery", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterTokenPriceQuery(ctx, req.(*MsgRegisterTokenPriceQuery)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveTokenPriceQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveTokenPriceQuery) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveTokenPriceQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.icqoracle.Msg/RemoveTokenPriceQuery", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveTokenPriceQuery(ctx, req.(*MsgRemoveTokenPriceQuery)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stride.icqoracle.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterTokenPriceQuery", + Handler: _Msg_RegisterTokenPriceQuery_Handler, + }, + { + MethodName: "RemoveTokenPriceQuery", + Handler: _Msg_RemoveTokenPriceQuery_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stride/icqoracle/tx.proto", +} + +func (m *MsgRegisterTokenPriceQuery) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterTokenPriceQuery) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterTokenPriceQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OsmosisPoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.OsmosisPoolId)) + i-- + dAtA[i] = 0x40 + } + if len(m.OsmosisQuoteDenom) > 0 { + i -= len(m.OsmosisQuoteDenom) + copy(dAtA[i:], m.OsmosisQuoteDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.OsmosisQuoteDenom))) + i-- + dAtA[i] = 0x3a + } + if len(m.OsmosisBaseDenom) > 0 { + i -= len(m.OsmosisBaseDenom) + copy(dAtA[i:], m.OsmosisBaseDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.OsmosisBaseDenom))) + i-- + dAtA[i] = 0x32 + } + if m.QuoteDenomDecimals != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.QuoteDenomDecimals)) + i-- + dAtA[i] = 0x28 + } + if m.BaseDenomDecimals != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BaseDenomDecimals)) + i-- + dAtA[i] = 0x20 + } + if len(m.QuoteDenom) > 0 { + i -= len(m.QuoteDenom) + copy(dAtA[i:], m.QuoteDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.QuoteDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterTokenPriceQueryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterTokenPriceQueryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterTokenPriceQueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRemoveTokenPriceQuery) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveTokenPriceQuery) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveTokenPriceQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OsmosisPoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.OsmosisPoolId)) + i-- + dAtA[i] = 0x20 + } + if len(m.QuoteDenom) > 0 { + i -= len(m.QuoteDenom) + copy(dAtA[i:], m.QuoteDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.QuoteDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveTokenPriceQueryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveTokenPriceQueryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveTokenPriceQueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterTokenPriceQuery) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.QuoteDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BaseDenomDecimals != 0 { + n += 1 + sovTx(uint64(m.BaseDenomDecimals)) + } + if m.QuoteDenomDecimals != 0 { + n += 1 + sovTx(uint64(m.QuoteDenomDecimals)) + } + l = len(m.OsmosisBaseDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OsmosisQuoteDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.OsmosisPoolId != 0 { + n += 1 + sovTx(uint64(m.OsmosisPoolId)) + } + return n +} + +func (m *MsgRegisterTokenPriceQueryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveTokenPriceQuery) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.QuoteDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.OsmosisPoolId != 0 { + n += 1 + sovTx(uint64(m.OsmosisPoolId)) + } + return n +} + +func (m *MsgRemoveTokenPriceQueryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterTokenPriceQuery) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterTokenPriceQuery: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterTokenPriceQuery: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenomDecimals", wireType) + } + m.BaseDenomDecimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseDenomDecimals |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenomDecimals", wireType) + } + m.QuoteDenomDecimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QuoteDenomDecimals |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisBaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisBaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisQuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OsmosisQuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisPoolId", wireType) + } + m.OsmosisPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OsmosisPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterTokenPriceQueryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterTokenPriceQueryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterTokenPriceQueryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveTokenPriceQuery) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveTokenPriceQuery: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveTokenPriceQuery: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OsmosisPoolId", wireType) + } + m.OsmosisPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OsmosisPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveTokenPriceQueryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveTokenPriceQueryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveTokenPriceQueryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/icqoracle/types/validate.go b/x/icqoracle/types/validate.go new file mode 100644 index 0000000000..404faa8353 --- /dev/null +++ b/x/icqoracle/types/validate.go @@ -0,0 +1,39 @@ +package types + +import ( + "errors" +) + +func ValidateTokenPriceQueryParams( + baseDenom string, + quoteDenom string, + baseDenomDecimals int64, + quoteDenomDecimals int64, + osmosisPoolId uint64, + osmosisBaseDenom string, + osmosisQuoteDenom string, +) error { + if baseDenom == "" { + return errors.New("base-denom must be specified") + } + if quoteDenom == "" { + return errors.New("quote-denom must be specified") + } + if baseDenomDecimals <= 0 { + return errors.New("base-denom-decimals must be bigger than 0") + } + if quoteDenomDecimals <= 0 { + return errors.New("quote-denom-decimals must be bigger than 0") + } + if osmosisPoolId == 0 { + return errors.New("osmosis-pool-id must be specified") + } + if osmosisBaseDenom == "" { + return errors.New("osmosis-base-denom must be specified") + } + if osmosisQuoteDenom == "" { + return errors.New("osmosis-quote-denom must be specified") + } + + return nil +} diff --git a/x/interchainquery/keeper/events.go b/x/interchainquery/keeper/events.go new file mode 100644 index 0000000000..99fd17b03d --- /dev/null +++ b/x/interchainquery/keeper/events.go @@ -0,0 +1,24 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/interchainquery/types" +) + +// Emits an event when a ICQ response is submitted +func EmitEventQueryResponse(ctx sdk.Context, query types.Query) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeyQueryId, query.Id), + ), + sdk.NewEvent( + types.EventTypeQueryResponse, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeyQueryId, query.Id), + sdk.NewAttribute(types.AttributeKeyChainId, query.ChainId), + ), + }) +} diff --git a/x/interchainquery/keeper/msg_server.go b/x/interchainquery/keeper/msg_server.go index 45d9be4f2e..618e22efff 100644 --- a/x/interchainquery/keeper/msg_server.go +++ b/x/interchainquery/keeper/msg_server.go @@ -172,23 +172,12 @@ func (k msgServer) SubmitQueryResponse(goCtx context.Context, msg *types.MsgSubm // check if the response has an associated query stored on stride query, found := k.GetQuery(ctx, msg.QueryId) if !found { - k.Logger(ctx).Info("ICQ RESPONSE | Ignoring non-existent query response (note: duplicate responses are nonexistent)") + k.Logger(ctx).Error("ICQ RESPONSE | Ignoring non-existent query response (note: duplicate responses are nonexistent)") return &types.MsgSubmitQueryResponseResponse{}, nil // technically this is an error, but will cause the entire tx to fail if we have one 'bad' message, so we can just no-op here. } - defer ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(types.AttributeKeyQueryId, query.Id), - ), - sdk.NewEvent( - "query_response", - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(types.AttributeKeyQueryId, query.Id), - sdk.NewAttribute(types.AttributeKeyChainId, query.ChainId), - ), - }) + // Emit an event for the relayer + EmitEventQueryResponse(ctx, query) // Verify the response's proof, if one exists err := k.VerifyKeyProof(ctx, msg, query) diff --git a/x/interchainquery/types/error.go b/x/interchainquery/types/error.go index c4780f68b8..0e773acaeb 100644 --- a/x/interchainquery/types/error.go +++ b/x/interchainquery/types/error.go @@ -10,4 +10,5 @@ var ( ErrInvalidConsensusState = errors.New("invalid consensus state") ErrInvalidICQRequest = errors.New("invalid interchain query request") ErrFailedToRetryQuery = errors.New("failed to retry query") + ErrQueryNotFound = errors.New("Query not found") ) diff --git a/x/interchainquery/types/events.go b/x/interchainquery/types/events.go index d5dec6cc27..8287df4ada 100644 --- a/x/interchainquery/types/events.go +++ b/x/interchainquery/types/events.go @@ -11,4 +11,6 @@ const ( AttributeValueCategory = ModuleName AttributeValueQuery = "query" + + EventTypeQueryResponse = "query_response" ) diff --git a/x/interchainquery/types/keys.go b/x/interchainquery/types/keys.go index 7da8303e94..e3ca5c9e4a 100644 --- a/x/interchainquery/types/keys.go +++ b/x/interchainquery/types/keys.go @@ -1,6 +1,9 @@ package types -import fmt "fmt" +import ( + fmt "fmt" + "strconv" +) const ( // ModuleName defines the module name @@ -35,6 +38,8 @@ const ( BANK_STORE_QUERY_WITH_PROOF = "store/bank/key" // The Osmosis twap store - key'd by the pool ID and denom's TWAP_STORE_QUERY_WITH_PROOF = "store/twap/key" + // The Osmosis concentrated liquidity store + CONCENTRATEDLIQUIDITY_STORE_QUERY_WITH_PROOF = "store/concentratedliquidity/key" ) var ( @@ -62,3 +67,17 @@ func FormatOsmosisMostRecentTWAPKey(poolId uint64, denom1, denom2 string) []byte poolIdBz := fmt.Sprintf("%0.20d", poolId) return []byte(fmt.Sprintf("%s%s%s%s%s%s", OsmosisMostRecentTWAPsPrefix, poolIdBz, OsmosisKeySeparator, denom1, OsmosisKeySeparator, denom2)) } + +// Source: https://github.com/osmosis-labs/osmosis/blob/v27.0.0/x/concentrated-liquidity/types/keys.go#L227-L235 +// Used by: https://github.com/osmosis-labs/osmosis/blob/v27.0.0/x/concentrated-liquidity/pool.go#L117-L130 +// Which is used by: https://github.com/osmosis-labs/osmosis/blob/v27.0.0/x/concentrated-liquidity/pool.go#L179-L209 +// +// Pool Prefix Keys +// keyPool is used to map a pool id to a pool struct +func FormatOsmosisKeyPool(poolId uint64) []byte { + // Start with PoolPrefix initialized + result := []byte{0x03} + // Directly append the string representation of poolId as bytes + result = strconv.AppendUint(result, poolId, 10) + return result +} diff --git a/x/stakeibc/keeper/hooks.go b/x/stakeibc/keeper/hooks.go index 4b49acd68d..58c294c02f 100644 --- a/x/stakeibc/keeper/hooks.go +++ b/x/stakeibc/keeper/hooks.go @@ -90,7 +90,7 @@ func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInf k.TransferAllRewardTokens(ctx) } if epochInfo.Identifier == epochstypes.MINT_EPOCH { - k.AllocateHostZoneReward(ctx) + k.AuctionOffRewardCollectorBalance(ctx) } } diff --git a/x/stakeibc/keeper/reward_allocation.go b/x/stakeibc/keeper/reward_allocation.go index 59f31ccdb7..7e576b6c51 100644 --- a/x/stakeibc/keeper/reward_allocation.go +++ b/x/stakeibc/keeper/reward_allocation.go @@ -3,84 +3,27 @@ package keeper import ( "fmt" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - + auctiontypes "github.com/Stride-Labs/stride/v25/x/auction/types" "github.com/Stride-Labs/stride/v25/x/stakeibc/types" ) -// Liquid Stake Reward Collector Balance -func (k Keeper) LiquidStakeRewardCollectorBalance(ctx sdk.Context, msgSvr types.MsgServer) bool { - k.Logger(ctx).Info("Liquid Staking reward collector balance") - rewardCollectorAddress := k.AccountKeeper.GetModuleAccount(ctx, types.RewardCollectorName).GetAddress() - rewardedTokens := k.bankKeeper.GetAllBalances(ctx, rewardCollectorAddress) - if rewardedTokens.IsEqual(sdk.Coins{}) { - k.Logger(ctx).Info("No reward to allocate from RewardCollector") - return false - } - - rewardsAccrued := false - for _, token := range rewardedTokens { - // get hostzone by reward token (in ibc denom format) - hz, err := k.GetHostZoneFromIBCDenom(ctx, token.Denom) - if err != nil { - k.Logger(ctx).Info("Token denom %s in module account is not from a supported host zone", token.Denom) - continue - } - - // liquid stake all tokens - msg := types.NewMsgLiquidStake(rewardCollectorAddress.String(), token.Amount, hz.HostDenom) - if err := msg.ValidateBasic(); err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Liquid stake from reward collector address failed validate basic: %s", err.Error())) - continue - } - _, err = msgSvr.LiquidStake(ctx, msg) - if err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Failed to liquid stake %s for hostzone %s: %s", token.String(), hz.ChainId, err.Error())) - continue - } - k.Logger(ctx).Info(fmt.Sprintf("Liquid staked %s for hostzone %s's accrued rewards", token.String(), hz.ChainId)) - rewardsAccrued = true - } - return rewardsAccrued -} +// AuctionOffRewardCollectorBalance transfers all balances from the reward collector module account +// to the auction module account. If the reward collector has no balance, it does nothing. +func (k Keeper) AuctionOffRewardCollectorBalance(ctx sdk.Context) { + k.Logger(ctx).Info("Auctioning reward collector balance") -// Sweep stTokens from Reward Collector to Fee Collector -func (k Keeper) SweepStTokensFromRewardCollToFeeColl(ctx sdk.Context) error { - // Send all stTokens to fee collector to distribute to delegator later rewardCollectorAddress := k.AccountKeeper.GetModuleAccount(ctx, types.RewardCollectorName).GetAddress() - rewardCollCoins := k.bankKeeper.GetAllBalances(ctx, rewardCollectorAddress) - k.Logger(ctx).Info(fmt.Sprintf("Reward collector has %s", rewardCollCoins.String())) - stTokens := sdk.NewCoins() - for _, token := range rewardCollCoins { - // get hostzone by reward token (in stToken denom format) - isStToken := k.CheckIsStToken(ctx, token.Denom) - k.Logger(ctx).Info(fmt.Sprintf("%s is stToken: %t", token.String(), isStToken)) - if isStToken { - stTokens = append(stTokens, token) - } + rewardCollectorBalances := k.bankKeeper.GetAllBalances(ctx, rewardCollectorAddress) + if rewardCollectorBalances.Empty() { + k.Logger(ctx).Info("No rewards to auction from RewardCollector") + return } - k.Logger(ctx).Info(fmt.Sprintf("Sending %s stTokens from %s to %s", stTokens.String(), types.RewardCollectorName, authtypes.FeeCollectorName)) - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.RewardCollectorName, authtypes.FeeCollectorName, stTokens) + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.RewardCollectorName, auctiontypes.ModuleName, rewardCollectorBalances) if err != nil { - return errorsmod.Wrapf(err, "Can't send coins from module %s to module %s", types.RewardCollectorName, authtypes.FeeCollectorName) - } - return nil -} - -// (1) liquid stake reward collector balance, then (2) sweet stTokens from reward collector to fee collector -func (k Keeper) AllocateHostZoneReward(ctx sdk.Context) { - // TODO: Move LS function to keeper method instead of message server - msgSvr := NewMsgServerImpl(k) - if rewardsFound := k.LiquidStakeRewardCollectorBalance(ctx, msgSvr); !rewardsFound { - k.Logger(ctx).Info("No accrued rewards in the reward collector account") - return - } - if err := k.SweepStTokensFromRewardCollToFeeColl(ctx); err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Unable to allocate host zone reward, err: %s", err.Error())) + k.Logger(ctx).Error(fmt.Sprintf("Cannot send rewards from RewardCollector to Auction module: %s", err)) } } diff --git a/x/stakeibc/keeper/reward_allocation_test.go b/x/stakeibc/keeper/reward_allocation_test.go index 8ff4acd11a..75c98a1cc6 100644 --- a/x/stakeibc/keeper/reward_allocation_test.go +++ b/x/stakeibc/keeper/reward_allocation_test.go @@ -15,6 +15,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/stretchr/testify/suite" + auctiontypes "github.com/Stride-Labs/stride/v25/x/auction/types" epochtypes "github.com/Stride-Labs/stride/v25/x/epochs/types" recordtypes "github.com/Stride-Labs/stride/v25/x/records/types" stakeibctypes "github.com/Stride-Labs/stride/v25/x/stakeibc/types" @@ -80,14 +81,14 @@ func (s *KeeperTestSuite) TestLiquidStakeRewardCollectorBalance_Success() { s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin(IbcAtom, rewardAmount)) s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin(IbcOsmo, rewardAmount)) - // Liquid stake all hostzone token then get stTokens back - rewardsAccrued := s.App.StakeibcKeeper.LiquidStakeRewardCollectorBalance(s.Ctx, s.GetMsgServer()) - s.Require().True(rewardsAccrued, "rewards should have been liquid staked") + // Send all rewrds to auction module + s.App.StakeibcKeeper.AuctionOffRewardCollectorBalance(s.Ctx) - // Reward Collector acct should have all ibc/XXX tokens converted to stTokens - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StAtom, rewardAmount) - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StOsmo, rewardAmount) + // Check Auction module balance + s.checkModuleAccountBalance(auctiontypes.ModuleName, IbcAtom, rewardAmount) + s.checkModuleAccountBalance(auctiontypes.ModuleName, IbcOsmo, rewardAmount) + // Check RewardCollector module balance s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, IbcAtom, sdkmath.ZeroInt()) s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, IbcOsmo, sdkmath.ZeroInt()) } @@ -95,74 +96,20 @@ func (s *KeeperTestSuite) TestLiquidStakeRewardCollectorBalance_Success() { func (s *KeeperTestSuite) TestLiquidStakeRewardCollectorBalance_NoRewardsAccrued() { s.SetupTestRewardAllocation() - // With no IBC tokens in the rewards collector account, the liquid stake rewards function should return false - rewardsAccrued := s.App.StakeibcKeeper.LiquidStakeRewardCollectorBalance(s.Ctx, s.GetMsgServer()) - s.Require().False(rewardsAccrued, "no rewards should have been liquid staked") - - // There should also be no stTokens in the account - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StAtom, sdkmath.ZeroInt()) - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StOsmo, sdkmath.ZeroInt()) -} - -func (s *KeeperTestSuite) TestLiquidStakeRewardCollectorBalance_BalanceDoesNotBelongToHost() { - s.SetupTestRewardAllocation() - amount := sdkmath.NewInt(1000) - - // Fund the reward collector with ibc/atom and a denom that is not registerd to a host zone - s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin(IbcAtom, amount)) - s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin("fake_denom", amount)) - - // Liquid stake should only succeed with atom - rewardsAccrued := s.App.StakeibcKeeper.LiquidStakeRewardCollectorBalance(s.Ctx, s.GetMsgServer()) - s.Require().True(rewardsAccrued, "rewards should have been liquid staked") - - // The atom should have been liquid staked + // balances should be 0 before s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, IbcAtom, sdkmath.ZeroInt()) - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StAtom, amount) - - // But the fake denom and uosmo should not have been touched - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, "fake_denom", amount) - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StOsmo, sdkmath.ZeroInt()) -} - -func (s *KeeperTestSuite) TestSweepRewardCollToFeeCollector_Success() { - s.SetupTestRewardAllocation() - rewardAmount := sdkmath.NewInt(1000) - - // Add stTokens to reward collector - s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin(StAtom, rewardAmount)) - s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin(StOsmo, rewardAmount)) - - // Sweep stTokens from Reward Collector to Fee Collector - err := s.App.StakeibcKeeper.SweepStTokensFromRewardCollToFeeColl(s.Ctx) - s.Require().NoError(err) - - // Fee Collector acct should have stTokens after they're swept there from Reward Collector - // The reward collector should have nothing - s.checkModuleAccountBalance(authtypes.FeeCollectorName, StAtom, rewardAmount) - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StAtom, sdkmath.ZeroInt()) - - s.checkModuleAccountBalance(authtypes.FeeCollectorName, StOsmo, rewardAmount) - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, StOsmo, sdkmath.ZeroInt()) -} - -func (s *KeeperTestSuite) TestSweepRewardCollToFeeCollector_NonStTokens() { - s.SetupTestRewardAllocation() - amount := sdkmath.NewInt(1000) - nonStTokenDenom := "XXX" - - // Fund reward collector account with stTokens - s.FundModuleAccount(stakeibctypes.RewardCollectorName, sdk.NewCoin(nonStTokenDenom, amount)) - - // Sweep stTokens from Reward Collector to Fee Collector - err := s.App.StakeibcKeeper.SweepStTokensFromRewardCollToFeeColl(s.Ctx) - s.Require().NoError(err) + s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, IbcAtom, sdkmath.ZeroInt()) + s.checkModuleAccountBalance(auctiontypes.ModuleName, IbcAtom, sdkmath.ZeroInt()) + s.checkModuleAccountBalance(auctiontypes.ModuleName, IbcOsmo, sdkmath.ZeroInt()) - // Reward Collector acct should still contain nonStTokenDenom after stTokens after they're swept - s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, nonStTokenDenom, amount) + // With no IBC tokens in the rewards collector account, the auction off rewards function should do nothing + s.App.StakeibcKeeper.AuctionOffRewardCollectorBalance(s.Ctx) - // Fee Collector acct should have nothing - s.checkModuleAccountBalance(authtypes.FeeCollectorName, nonStTokenDenom, sdkmath.ZeroInt()) + // balances should be 0 after + s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, IbcAtom, sdkmath.ZeroInt()) + s.checkModuleAccountBalance(stakeibctypes.RewardCollectorName, IbcAtom, sdkmath.ZeroInt()) + s.checkModuleAccountBalance(auctiontypes.ModuleName, IbcAtom, sdkmath.ZeroInt()) + s.checkModuleAccountBalance(auctiontypes.ModuleName, IbcOsmo, sdkmath.ZeroInt()) } // Test the process of a delegator claiming staking reward stTokens (tests that Fee Account can distribute arbitrary denoms) diff --git a/x/strdburner/client/cli/query.go b/x/strdburner/client/cli/query.go new file mode 100644 index 0000000000..29abc33986 --- /dev/null +++ b/x/strdburner/client/cli/query.go @@ -0,0 +1,51 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdQueryStrdBurnerAddress(), + ) + + return cmd +} + +func CmdQueryStrdBurnerAddress() *cobra.Command { + cmd := &cobra.Command{ + Use: "address", + Short: "Query the address of the stride burner module", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryStrdBurnerAddressRequest{} + res, err := queryClient.StrdBurnerAddress(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + return cmd +} diff --git a/x/strdburner/keeper/abci.go b/x/strdburner/keeper/abci.go new file mode 100644 index 0000000000..7f909be290 --- /dev/null +++ b/x/strdburner/keeper/abci.go @@ -0,0 +1,39 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +func EndBlocker(ctx sdk.Context, k Keeper) { + strdBurnerAddress := k.GetStrdBurnerAddress() + + // Get STRD balance + strdBalance := k.bankKeeper.GetBalance(ctx, strdBurnerAddress, "ustrd") + + // Exit early if nothing to burn + if strdBalance.IsZero() { + return + } + + // Burn all STRD balance + err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(strdBalance)) + if err != nil { + k.Logger(ctx).Error("unable to burn %s: %w", strdBalance.String(), err) + return + } + + // Update TotalStrdBurned + currentTotalBurned := k.GetTotalStrdBurned(ctx) + newTotalBurned := currentTotalBurned.Add(strdBalance.Amount) + k.SetTotalStrdBurned(ctx, newTotalBurned) + + // Emit burn event + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeBurn, + sdk.NewAttribute(types.AttributeAmount, strdBalance.String()), + ), + ) +} diff --git a/x/strdburner/keeper/abci_test.go b/x/strdburner/keeper/abci_test.go new file mode 100644 index 0000000000..60489a949f --- /dev/null +++ b/x/strdburner/keeper/abci_test.go @@ -0,0 +1,79 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/Stride-Labs/stride/v25/x/strdburner/keeper" + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +func (s *KeeperTestSuite) TestEndBlocker() { + t := s.T() + burnerAddress := s.App.StrdBurnerKeeper.GetStrdBurnerAddress() + + tests := []struct { + name string + initialBalance sdk.Coin + shouldBurn bool + }{ + { + name: "burn non-zero balance", + initialBalance: sdk.NewCoin("ustrd", sdk.NewInt(1000)), + shouldBurn: true, + }, + { + name: "zero balance - no burn", + initialBalance: sdk.NewCoin("ustrd", sdk.NewInt(0)), + shouldBurn: false, + }, + } + + for _, tc := range tests { + s.Run(tc.name, func() { + // Setup test state + s.SetupTest() + + // Set initial balance if non-zero + if !tc.initialBalance.IsZero() { + s.FundModuleAccount(types.ModuleName, tc.initialBalance) + } + + // Verify initial state + initialBalance := s.App.BankKeeper.GetBalance(s.Ctx, burnerAddress, "ustrd") + require.Equal(t, tc.initialBalance, initialBalance) + + initialTotalBurned := s.App.StrdBurnerKeeper.GetTotalStrdBurned(s.Ctx) + require.Equal(t, sdk.ZeroInt(), initialTotalBurned) + + // Run EndBlocker + keeper.EndBlocker(s.Ctx, s.App.StrdBurnerKeeper) + + // Verify final state + finalBalance := s.App.BankKeeper.GetBalance(s.Ctx, burnerAddress, "ustrd") + require.Equal(t, sdk.NewCoin("ustrd", sdk.ZeroInt()), finalBalance) + + finalTotalBurned := s.App.StrdBurnerKeeper.GetTotalStrdBurned(s.Ctx) + if tc.shouldBurn { + require.Equal(t, tc.initialBalance.Amount, finalTotalBurned) + + // Verify event was emitted + events := s.Ctx.EventManager().Events() + var found bool + for _, event := range events { + if event.Type == types.EventTypeBurn { + found = true + for _, attr := range event.Attributes { + if string(attr.Key) == types.AttributeAmount { + require.Equal(t, tc.initialBalance.String(), string(attr.Value)) + } + } + } + } + require.True(t, found, "burn event should have been emitted") + } else { + require.Equal(t, sdk.ZeroInt(), finalTotalBurned) + } + }) + } +} diff --git a/x/strdburner/keeper/genesis.go b/x/strdburner/keeper/genesis.go new file mode 100644 index 0000000000..10ea4df54c --- /dev/null +++ b/x/strdburner/keeper/genesis.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +// Loads module state from genesis +func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + k.SetTotalStrdBurned(ctx, genState.TotalUstrdBurned) +} + +// Export's module state into genesis file +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.TotalUstrdBurned = k.GetTotalStrdBurned(ctx) + return genesis +} diff --git a/x/strdburner/keeper/keeper.go b/x/strdburner/keeper/keeper.go new file mode 100644 index 0000000000..780c9edf7a --- /dev/null +++ b/x/strdburner/keeper/keeper.go @@ -0,0 +1,59 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/math" + "github.com/cometbft/cometbft/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +func (k Keeper) GetStrdBurnerAddress() sdk.AccAddress { + return k.accountKeeper.GetModuleAddress(types.ModuleName) +} + +func (k Keeper) SetTotalStrdBurned(ctx sdk.Context, amount math.Int) { + bz := sdk.Uint64ToBigEndian(amount.Uint64()) + ctx.KVStore(k.storeKey).Set([]byte(types.TotalStrdBurnedKey), bz) +} + +func (k Keeper) GetTotalStrdBurned(ctx sdk.Context) math.Int { + bz := ctx.KVStore(k.storeKey).Get([]byte(types.TotalStrdBurnedKey)) + + // If no value has been set, return zero + if bz == nil { + return math.ZeroInt() + } + + return math.NewIntFromUint64(sdk.BigEndianToUint64(bz)) +} diff --git a/x/strdburner/keeper/keeper_test.go b/x/strdburner/keeper/keeper_test.go new file mode 100644 index 0000000000..f6fe724c36 --- /dev/null +++ b/x/strdburner/keeper/keeper_test.go @@ -0,0 +1,70 @@ +package keeper_test + +import ( + "bytes" + "testing" + + "cosmossdk.io/math" + "github.com/cometbft/cometbft/libs/log" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/Stride-Labs/stride/v25/app/apptesting" + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +type KeeperTestSuite struct { + apptesting.AppTestHelper + logBuffer bytes.Buffer +} + +func (s *KeeperTestSuite) SetupTest() { + s.Setup() + + // Create a logger with accessible output + logger := log.NewTMLogger(&s.logBuffer) + s.Ctx = s.Ctx.WithLogger(logger) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) TestGetStrdBurnerAddress() { + address := s.App.StrdBurnerKeeper.GetStrdBurnerAddress() + require.NotNil(s.T(), address) + require.Equal(s.T(), types.ModuleName, s.App.AccountKeeper.GetModuleAccount(s.Ctx, types.ModuleName).GetName()) +} + +func (s *KeeperTestSuite) TestSetAndGetTotalStrdBurned() { + // Test initial state (should be zero) + initialAmount := s.App.StrdBurnerKeeper.GetTotalStrdBurned(s.Ctx) + require.Equal(s.T(), math.ZeroInt(), initialAmount) + + // Clear any potential existing value to explicitly test nil case + store := s.Ctx.KVStore(s.App.GetKey(types.StoreKey)) + store.Delete([]byte(types.TotalStrdBurnedKey)) + + // Test getting value when none exists (should return zero) + nilAmount := s.App.StrdBurnerKeeper.GetTotalStrdBurned(s.Ctx) + require.Equal(s.T(), math.ZeroInt(), nilAmount) + + // Test setting and getting a value + testAmount := math.NewInt(1000) + s.App.StrdBurnerKeeper.SetTotalStrdBurned(s.Ctx, testAmount) + + storedAmount := s.App.StrdBurnerKeeper.GetTotalStrdBurned(s.Ctx) + require.Equal(s.T(), testAmount, storedAmount) + + // Test updating the value + newAmount := math.NewInt(2000) + s.App.StrdBurnerKeeper.SetTotalStrdBurned(s.Ctx, newAmount) + + updatedAmount := s.App.StrdBurnerKeeper.GetTotalStrdBurned(s.Ctx) + require.Equal(s.T(), newAmount, updatedAmount) +} + +func (s *KeeperTestSuite) TestLogger() { + logger := s.App.StrdBurnerKeeper.Logger(s.Ctx) + require.NotNil(s.T(), logger) +} diff --git a/x/strdburner/keeper/query.go b/x/strdburner/keeper/query.go new file mode 100644 index 0000000000..204ffa5178 --- /dev/null +++ b/x/strdburner/keeper/query.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +var _ types.QueryServer = Keeper{} + +// Auction queries the auction info for a specific token +func (k Keeper) StrdBurnerAddress(goCtx context.Context, req *types.QueryStrdBurnerAddressRequest) (*types.QueryStrdBurnerAddressResponse, error) { + return &types.QueryStrdBurnerAddressResponse{ + Address: k.GetStrdBurnerAddress().String(), + }, nil +} + +func (k Keeper) TotalStrdBurned(goCtx context.Context, req *types.QueryTotalStrdBurnedRequest) (*types.QueryTotalStrdBurnedResponse, error) { + return &types.QueryTotalStrdBurnedResponse{ + TotalBurned: k.GetTotalStrdBurned(sdk.UnwrapSDKContext(goCtx)), + }, nil +} diff --git a/x/strdburner/keeper/query_test.go b/x/strdburner/keeper/query_test.go new file mode 100644 index 0000000000..42a125a701 --- /dev/null +++ b/x/strdburner/keeper/query_test.go @@ -0,0 +1,28 @@ +package keeper_test + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +func (s *KeeperTestSuite) TestQueryStrdBurnerAddress() { + // Query for the strd burner address + req := &types.QueryStrdBurnerAddressRequest{} + resp, err := s.App.StrdBurnerKeeper.StrdBurnerAddress(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying strd burner address") + s.Require().Equal(s.App.StrdBurnerKeeper.GetStrdBurnerAddress().String(), resp.Address, "address") +} + +func (s *KeeperTestSuite) TestQueryTotalStrdBurned() { + // Set initial total burned amount + expectedAmount := sdkmath.NewInt(1000000) + s.App.StrdBurnerKeeper.SetTotalStrdBurned(s.Ctx, expectedAmount) + + // Query for the total burned amount + req := &types.QueryTotalStrdBurnedRequest{} + resp, err := s.App.StrdBurnerKeeper.TotalStrdBurned(sdk.WrapSDKContext(s.Ctx), req) + s.Require().NoError(err, "no error expected when querying total strd burned") + s.Require().Equal(expectedAmount, resp.TotalBurned, "total burned amount") +} diff --git a/x/strdburner/module.go b/x/strdburner/module.go new file mode 100644 index 0000000000..284c35a972 --- /dev/null +++ b/x/strdburner/module.go @@ -0,0 +1,155 @@ +package strdburner + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/Stride-Labs/stride/v25/x/strdburner/client/cli" + "github.com/Stride-Labs/stride/v25/x/strdburner/keeper" + "github.com/Stride-Labs/stride/v25/x/strdburner/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + am.keeper.InitGenesis(ctx, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/strdburner/types/codec.go b/x/strdburner/types/codec.go new file mode 100644 index 0000000000..f19b5671fb --- /dev/null +++ b/x/strdburner/types/codec.go @@ -0,0 +1,30 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgSubmitProposal instances + RegisterLegacyAminoCodec(govcodec.Amino) +} diff --git a/x/strdburner/types/events.go b/x/strdburner/types/events.go new file mode 100644 index 0000000000..bd53b10940 --- /dev/null +++ b/x/strdburner/types/events.go @@ -0,0 +1,8 @@ +package types + +// strdburner module event typs +const ( + EventTypeBurn = "burn" + + AttributeAmount = "amount" +) diff --git a/x/strdburner/types/expected_keepers.go b/x/strdburner/types/expected_keepers.go new file mode 100644 index 0000000000..b6ef118391 --- /dev/null +++ b/x/strdburner/types/expected_keepers.go @@ -0,0 +1,16 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Required AccountKeeper functions +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} + +// Required BankKeeper functions +type BankKeeper interface { + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + BurnCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error +} diff --git a/x/strdburner/types/genesis.go b/x/strdburner/types/genesis.go new file mode 100644 index 0000000000..aa88885642 --- /dev/null +++ b/x/strdburner/types/genesis.go @@ -0,0 +1,23 @@ +package types + +import ( + "fmt" + + "cosmossdk.io/math" +) + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + TotalUstrdBurned: math.ZeroInt(), + } +} + +// Performs basic genesis state validation by +func (gs GenesisState) Validate() error { + if gs.TotalUstrdBurned.IsNil() { + return fmt.Errorf("GenesisState.TotalUstrdBurned cannot be nil") + } else { + return nil + } +} diff --git a/x/strdburner/types/genesis.pb.go b/x/strdburner/types/genesis.pb.go new file mode 100644 index 0000000000..9fb1397c3a --- /dev/null +++ b/x/strdburner/types/genesis.pb.go @@ -0,0 +1,318 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/strdburner/genesis.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the strdburner module's genesis state +type GenesisState struct { + // Total amount of ustrd burned + TotalUstrdBurned cosmossdk_io_math.Int `protobuf:"bytes,9,opt,name=total_ustrd_burned,json=totalUstrdBurned,proto3,customtype=cosmossdk.io/math.Int" json:"total_ustrd_burned"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_003ecc60d66895bb, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func init() { + proto.RegisterType((*GenesisState)(nil), "stride.strdburner.GenesisState") +} + +func init() { proto.RegisterFile("stride/strdburner/genesis.proto", fileDescriptor_003ecc60d66895bb) } + +var fileDescriptor_003ecc60d66895bb = []byte{ + // 223 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x2e, 0x29, 0xca, + 0x4c, 0x49, 0xd5, 0x2f, 0x2e, 0x29, 0x4a, 0x49, 0x2a, 0x2d, 0xca, 0x4b, 0x2d, 0xd2, 0x4f, 0x4f, + 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0x28, 0xd0, + 0x43, 0x28, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xea, 0x83, 0x58, 0x10, 0x85, 0x4a, + 0xd1, 0x5c, 0x3c, 0xee, 0x10, 0x9d, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0xde, 0x5c, 0x42, 0x25, + 0xf9, 0x25, 0x89, 0x39, 0xf1, 0xa5, 0x20, 0xad, 0xf1, 0x60, 0xbd, 0x29, 0x12, 0x9c, 0x0a, 0x8c, + 0x1a, 0x9c, 0x4e, 0xb2, 0x27, 0xee, 0xc9, 0x33, 0xdc, 0xba, 0x27, 0x2f, 0x9a, 0x9c, 0x5f, 0x9c, + 0x9b, 0x5f, 0x5c, 0x9c, 0x92, 0xad, 0x97, 0x99, 0xaf, 0x9f, 0x9b, 0x58, 0x92, 0xa1, 0xe7, 0x99, + 0x57, 0x12, 0x24, 0x00, 0xd6, 0x18, 0x0a, 0xd2, 0xe7, 0x04, 0xd6, 0xe6, 0xe4, 0x77, 0xe2, 0x91, + 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, + 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x26, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, + 0xc9, 0xf9, 0xb9, 0xfa, 0xc1, 0x60, 0xa7, 0xea, 0xfa, 0x24, 0x26, 0x15, 0xeb, 0x43, 0xfd, 0x55, + 0x66, 0x64, 0xaa, 0x5f, 0x81, 0xec, 0xbb, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x9b, + 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0xec, 0x8f, 0xa1, 0xff, 0x00, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TotalUstrdBurned.Size() + i -= size + if _, err := m.TotalUstrdBurned.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TotalUstrdBurned.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalUstrdBurned", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalUstrdBurned.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/strdburner/types/keys.go b/x/strdburner/types/keys.go new file mode 100644 index 0000000000..269cc15aef --- /dev/null +++ b/x/strdburner/types/keys.go @@ -0,0 +1,13 @@ +package types + +const ( + ModuleName = "strdburner" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the routing key + RouterKey = ModuleName + + TotalStrdBurnedKey = "total_burned" +) diff --git a/x/strdburner/types/query.pb.go b/x/strdburner/types/query.pb.go new file mode 100644 index 0000000000..ee154cb9c3 --- /dev/null +++ b/x/strdburner/types/query.pb.go @@ -0,0 +1,871 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stride/strdburner/query.proto + +package types + +import ( + context "context" + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryStrdBurnerAddressRequest is the request type for the Query/strdburner +// RPC method +type QueryStrdBurnerAddressRequest struct { +} + +func (m *QueryStrdBurnerAddressRequest) Reset() { *m = QueryStrdBurnerAddressRequest{} } +func (m *QueryStrdBurnerAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStrdBurnerAddressRequest) ProtoMessage() {} +func (*QueryStrdBurnerAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_76c45869caa19016, []int{0} +} +func (m *QueryStrdBurnerAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStrdBurnerAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStrdBurnerAddressRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryStrdBurnerAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStrdBurnerAddressRequest.Merge(m, src) +} +func (m *QueryStrdBurnerAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStrdBurnerAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStrdBurnerAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStrdBurnerAddressRequest proto.InternalMessageInfo + +// QueryStrdBurnerAddressResponse is the response type for the Query/strdburner +// RPC method +type QueryStrdBurnerAddressResponse struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryStrdBurnerAddressResponse) Reset() { *m = QueryStrdBurnerAddressResponse{} } +func (m *QueryStrdBurnerAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStrdBurnerAddressResponse) ProtoMessage() {} +func (*QueryStrdBurnerAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_76c45869caa19016, []int{1} +} +func (m *QueryStrdBurnerAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStrdBurnerAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStrdBurnerAddressResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryStrdBurnerAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStrdBurnerAddressResponse.Merge(m, src) +} +func (m *QueryStrdBurnerAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStrdBurnerAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStrdBurnerAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStrdBurnerAddressResponse proto.InternalMessageInfo + +func (m *QueryStrdBurnerAddressResponse) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// QueryTotalStrdBurnedRequest is the request type for the Query/strdburner +// RPC method +type QueryTotalStrdBurnedRequest struct { +} + +func (m *QueryTotalStrdBurnedRequest) Reset() { *m = QueryTotalStrdBurnedRequest{} } +func (m *QueryTotalStrdBurnedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalStrdBurnedRequest) ProtoMessage() {} +func (*QueryTotalStrdBurnedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_76c45869caa19016, []int{2} +} +func (m *QueryTotalStrdBurnedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalStrdBurnedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalStrdBurnedRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalStrdBurnedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalStrdBurnedRequest.Merge(m, src) +} +func (m *QueryTotalStrdBurnedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalStrdBurnedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalStrdBurnedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalStrdBurnedRequest proto.InternalMessageInfo + +// QueryTotalStrdBurnedResponse is the response type for the Query/strdburner +// RPC method +type QueryTotalStrdBurnedResponse struct { + TotalBurned cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=total_burned,json=totalBurned,proto3,customtype=cosmossdk.io/math.Int" json:"total_burned"` +} + +func (m *QueryTotalStrdBurnedResponse) Reset() { *m = QueryTotalStrdBurnedResponse{} } +func (m *QueryTotalStrdBurnedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalStrdBurnedResponse) ProtoMessage() {} +func (*QueryTotalStrdBurnedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_76c45869caa19016, []int{3} +} +func (m *QueryTotalStrdBurnedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalStrdBurnedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalStrdBurnedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalStrdBurnedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalStrdBurnedResponse.Merge(m, src) +} +func (m *QueryTotalStrdBurnedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalStrdBurnedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalStrdBurnedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalStrdBurnedResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QueryStrdBurnerAddressRequest)(nil), "stride.strdburner.QueryStrdBurnerAddressRequest") + proto.RegisterType((*QueryStrdBurnerAddressResponse)(nil), "stride.strdburner.QueryStrdBurnerAddressResponse") + proto.RegisterType((*QueryTotalStrdBurnedRequest)(nil), "stride.strdburner.QueryTotalStrdBurnedRequest") + proto.RegisterType((*QueryTotalStrdBurnedResponse)(nil), "stride.strdburner.QueryTotalStrdBurnedResponse") +} + +func init() { proto.RegisterFile("stride/strdburner/query.proto", fileDescriptor_76c45869caa19016) } + +var fileDescriptor_76c45869caa19016 = []byte{ + // 402 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x2e, 0x29, 0xca, + 0x4c, 0x49, 0xd5, 0x2f, 0x2e, 0x29, 0x4a, 0x49, 0x2a, 0x2d, 0xca, 0x4b, 0x2d, 0xd2, 0x2f, 0x2c, + 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0x48, 0xeb, 0x21, 0xa4, + 0xa5, 0x24, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0x0a, 0xf4, 0x21, 0x1c, 0x88, 0x6a, + 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x88, 0x38, 0x88, 0x05, 0x15, 0x95, 0x49, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, + 0xcf, 0x83, 0xea, 0x51, 0x92, 0xe7, 0x92, 0x0d, 0x04, 0x59, 0x18, 0x5c, 0x52, 0x94, 0xe2, 0x04, + 0xb6, 0xc1, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x38, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, + 0x29, 0x84, 0x4b, 0x0e, 0x97, 0x82, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x21, 0x23, 0x2e, 0xf6, + 0x44, 0x88, 0x90, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, + 0x97, 0x41, 0x15, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0xc1, 0x14, 0x2a, 0xc9, 0x72, 0x49, + 0x83, 0x4d, 0x0d, 0xc9, 0x2f, 0x49, 0xcc, 0x81, 0x1b, 0x9d, 0x02, 0xb3, 0x34, 0x81, 0x4b, 0x06, + 0xbb, 0x34, 0xd4, 0x4a, 0x07, 0x2e, 0x9e, 0x12, 0x90, 0x54, 0x3c, 0x38, 0x50, 0x52, 0xa0, 0xf6, + 0xca, 0x9e, 0xb8, 0x27, 0xcf, 0x70, 0xeb, 0x9e, 0xbc, 0x28, 0xc4, 0xee, 0xe2, 0x94, 0x6c, 0xbd, + 0xcc, 0x7c, 0xfd, 0xdc, 0xc4, 0x92, 0x0c, 0x3d, 0xcf, 0xbc, 0x92, 0x20, 0x6e, 0xb0, 0x16, 0x88, + 0x49, 0x46, 0x47, 0x98, 0xb8, 0x58, 0xc1, 0x56, 0x08, 0xcd, 0x61, 0xe4, 0x12, 0xc4, 0xf0, 0x9c, + 0x90, 0x81, 0x1e, 0x46, 0xd0, 0xeb, 0xe1, 0x0d, 0x28, 0x29, 0x43, 0x12, 0x74, 0x40, 0xbc, 0xa1, + 0xa4, 0xd4, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x19, 0x21, 0x29, 0x7d, 0xcc, 0x64, 0x00, 0x0d, 0x29, + 0xa1, 0xd9, 0x8c, 0x5c, 0xfc, 0x68, 0xc1, 0x20, 0xa4, 0x87, 0xcb, 0x2a, 0xec, 0xc1, 0x29, 0xa5, + 0x4f, 0xb4, 0x7a, 0xa8, 0xc3, 0xd4, 0xc1, 0x0e, 0x53, 0x14, 0x92, 0xc7, 0xe2, 0x30, 0xe4, 0x80, + 0x77, 0xf2, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, + 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x93, 0xf4, 0xcc, + 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x60, 0xb0, 0x21, 0xba, 0x3e, 0x89, 0x49, + 0xc5, 0x30, 0x03, 0xcb, 0x8c, 0x4c, 0xf5, 0x2b, 0x50, 0x8c, 0xad, 0x2c, 0x48, 0x2d, 0x4e, 0x62, + 0x03, 0xa7, 0x4a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xf1, 0xbf, 0x2e, 0x18, 0x03, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // StrdBurnerAddress queries the address of the strdburner module + StrdBurnerAddress(ctx context.Context, in *QueryStrdBurnerAddressRequest, opts ...grpc.CallOption) (*QueryStrdBurnerAddressResponse, error) + // StrdBurnerAddress queries the address of the strdburner module + TotalStrdBurned(ctx context.Context, in *QueryTotalStrdBurnedRequest, opts ...grpc.CallOption) (*QueryTotalStrdBurnedResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) StrdBurnerAddress(ctx context.Context, in *QueryStrdBurnerAddressRequest, opts ...grpc.CallOption) (*QueryStrdBurnerAddressResponse, error) { + out := new(QueryStrdBurnerAddressResponse) + err := c.cc.Invoke(ctx, "/stride.strdburner.Query/StrdBurnerAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalStrdBurned(ctx context.Context, in *QueryTotalStrdBurnedRequest, opts ...grpc.CallOption) (*QueryTotalStrdBurnedResponse, error) { + out := new(QueryTotalStrdBurnedResponse) + err := c.cc.Invoke(ctx, "/stride.strdburner.Query/TotalStrdBurned", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // StrdBurnerAddress queries the address of the strdburner module + StrdBurnerAddress(context.Context, *QueryStrdBurnerAddressRequest) (*QueryStrdBurnerAddressResponse, error) + // StrdBurnerAddress queries the address of the strdburner module + TotalStrdBurned(context.Context, *QueryTotalStrdBurnedRequest) (*QueryTotalStrdBurnedResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) StrdBurnerAddress(ctx context.Context, req *QueryStrdBurnerAddressRequest) (*QueryStrdBurnerAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StrdBurnerAddress not implemented") +} +func (*UnimplementedQueryServer) TotalStrdBurned(ctx context.Context, req *QueryTotalStrdBurnedRequest) (*QueryTotalStrdBurnedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalStrdBurned not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_StrdBurnerAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStrdBurnerAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StrdBurnerAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.strdburner.Query/StrdBurnerAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StrdBurnerAddress(ctx, req.(*QueryStrdBurnerAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalStrdBurned_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalStrdBurnedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalStrdBurned(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stride.strdburner.Query/TotalStrdBurned", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalStrdBurned(ctx, req.(*QueryTotalStrdBurnedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stride.strdburner.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "StrdBurnerAddress", + Handler: _Query_StrdBurnerAddress_Handler, + }, + { + MethodName: "TotalStrdBurned", + Handler: _Query_TotalStrdBurned_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stride/strdburner/query.proto", +} + +func (m *QueryStrdBurnerAddressRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryStrdBurnerAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStrdBurnerAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryStrdBurnerAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryStrdBurnerAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStrdBurnerAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalStrdBurnedRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalStrdBurnedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalStrdBurnedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalStrdBurnedResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalStrdBurnedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalStrdBurnedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TotalBurned.Size() + i -= size + if _, err := m.TotalBurned.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryStrdBurnerAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryStrdBurnerAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTotalStrdBurnedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalStrdBurnedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TotalBurned.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryStrdBurnerAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryStrdBurnerAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStrdBurnerAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryStrdBurnerAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryStrdBurnerAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStrdBurnerAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalStrdBurnedRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalStrdBurnedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalStrdBurnedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalStrdBurnedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalStrdBurnedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalStrdBurnedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBurned", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalBurned.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/strdburner/types/query.pb.gw.go b/x/strdburner/types/query.pb.gw.go new file mode 100644 index 0000000000..64ef5e65ae --- /dev/null +++ b/x/strdburner/types/query.pb.gw.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stride/strdburner/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_StrdBurnerAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStrdBurnerAddressRequest + var metadata runtime.ServerMetadata + + msg, err := client.StrdBurnerAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StrdBurnerAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStrdBurnerAddressRequest + var metadata runtime.ServerMetadata + + msg, err := server.StrdBurnerAddress(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalStrdBurned_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalStrdBurnedRequest + var metadata runtime.ServerMetadata + + msg, err := client.TotalStrdBurned(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalStrdBurned_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalStrdBurnedRequest + var metadata runtime.ServerMetadata + + msg, err := server.TotalStrdBurned(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_StrdBurnerAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StrdBurnerAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StrdBurnerAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalStrdBurned_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TotalStrdBurned_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TotalStrdBurned_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_StrdBurnerAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_StrdBurnerAddress_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StrdBurnerAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalStrdBurned_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TotalStrdBurned_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TotalStrdBurned_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_StrdBurnerAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "strdburner", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TotalStrdBurned_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"stride", "strdburner", "total_burned"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_StrdBurnerAddress_0 = runtime.ForwardResponseMessage + + forward_Query_TotalStrdBurned_0 = runtime.ForwardResponseMessage +)