diff --git a/app/app.go b/app/app.go index f6a31588a..6a4c00929 100644 --- a/app/app.go +++ b/app/app.go @@ -8,6 +8,8 @@ import ( "path/filepath" "strings" + "github.com/jackalLabs/canine-chain/app/upgrades" + "github.com/prometheus/client_golang/prometheus" "github.com/cosmos/cosmos-sdk/baseapp" @@ -120,6 +122,10 @@ import ( rnsmodulekeeper "github.com/jackalLabs/canine-chain/x/rns/keeper" rnsmoduletypes "github.com/jackalLabs/canine-chain/x/rns/types" + oraclemodule "github.com/jackalLabs/canine-chain/x/oracle" + oraclemodulekeeper "github.com/jackalLabs/canine-chain/x/oracle/keeper" + oraclemoduletypes "github.com/jackalLabs/canine-chain/x/oracle/types" + storagemodule "github.com/jackalLabs/canine-chain/x/storage" storagemodulekeeper "github.com/jackalLabs/canine-chain/x/storage/keeper" storagemoduletypes "github.com/jackalLabs/canine-chain/x/storage/types" @@ -139,10 +145,6 @@ import ( notificationsmoduletypes "github.com/jackalLabs/canine-chain/x/notifications/types" */ - store "github.com/cosmos/cosmos-sdk/store/types" - alpha7 "github.com/jackalLabs/canine-chain/app/upgrades/alpha7" - v120alpha6 "github.com/jackalLabs/canine-chain/app/upgrades/v1.2.0-alpha.6" - v2 "github.com/jackalLabs/canine-chain/app/upgrades/v2" v3 "github.com/jackalLabs/canine-chain/app/upgrades/v3" // unnamed import of statik for swagger UI support @@ -244,6 +246,7 @@ var ( rnsmodule.AppModuleBasic{}, storagemodule.AppModuleBasic{}, filetreemodule.AppModuleBasic{}, + oraclemodule.AppModuleBasic{}, /* dsigmodule.AppModuleBasic{}, @@ -262,8 +265,9 @@ var ( ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, icatypes.ModuleName: nil, wasm.ModuleName: {authtypes.Burner}, - rnsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, + rnsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, storagemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + oraclemoduletypes.ModuleName: nil, /* dsigmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, @@ -320,6 +324,7 @@ type JackalApp struct { scopedWasmKeeper capabilitykeeper.ScopedKeeper RnsKeeper rnsmodulekeeper.Keeper + OracleKeeper oraclemodulekeeper.Keeper StorageKeeper storagemodulekeeper.Keeper FileTreeKeeper filetreemodulekeeper.Keeper @@ -367,15 +372,22 @@ func NewJackalApp( minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, - feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, intertxtypes.StoreKey, - rnsmoduletypes.StoreKey, storagemoduletypes.StoreKey, filetreemoduletypes.StoreKey, + feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, icahosttypes.StoreKey, + icacontrollertypes.StoreKey, intertxtypes.StoreKey, rnsmoduletypes.StoreKey, + storagemoduletypes.StoreKey, filetreemoduletypes.StoreKey, oraclemoduletypes.StoreKey, + /* , dsigmoduletypes.StoreKey, f notificationsmoduletypes.StoreKey, */ ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + memKeys := sdk.NewMemoryStoreKeys( + capabilitytypes.MemStoreKey, + oraclemoduletypes.MemStoreKey, + storagemoduletypes.MemStoreKey, + // filetreemoduletypes.MemStoreKey, rnsmoduletypes.MemStoreKey, minttypes.MemStoreKey + ) app := &JackalApp{ BaseApp: bApp, @@ -607,10 +619,18 @@ func NewJackalApp( ) rnsModule := rnsmodule.NewAppModule(appCodec, app.RnsKeeper, app.AccountKeeper, app.BankKeeper) + app.OracleKeeper = *oraclemodulekeeper.NewKeeper( + appCodec, + keys[oraclemoduletypes.StoreKey], + app.getSubspace(oraclemoduletypes.ModuleName), + + app.BankKeeper, + ) + oracleModule := oraclemodule.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper) + app.StorageKeeper = *storagemodulekeeper.NewKeeper( appCodec, keys[storagemoduletypes.StoreKey], - keys[storagemoduletypes.MemStoreKey], app.getSubspace(storagemoduletypes.ModuleName), app.BankKeeper, app.AccountKeeper, @@ -710,6 +730,7 @@ func NewJackalApp( rnsModule, storageModule, filetreeModule, + oracleModule, /* dsigModule, @@ -747,6 +768,7 @@ func NewJackalApp( rnsmoduletypes.ModuleName, storagemoduletypes.ModuleName, filetreemoduletypes.ModuleName, + oraclemoduletypes.ModuleName, /* dsigmoduletypes.ModuleName, @@ -780,6 +802,7 @@ func NewJackalApp( rnsmoduletypes.ModuleName, storagemoduletypes.ModuleName, filetreemoduletypes.ModuleName, + oraclemoduletypes.ModuleName, /* dsigmoduletypes.ModuleName, @@ -821,6 +844,7 @@ func NewJackalApp( rnsmoduletypes.ModuleName, storagemoduletypes.ModuleName, filetreemoduletypes.ModuleName, + oraclemoduletypes.ModuleName, /* dsigmoduletypes.ModuleName, @@ -855,6 +879,41 @@ func NewJackalApp( rnsmoduletypes.ModuleName, storagemoduletypes.ModuleName, filetreemoduletypes.ModuleName, + oraclemoduletypes.ModuleName, + ) + + // NOTE: The auth module must occur before everyone else. All other modules can be sorted + // alphabetically (default order) + // NOTE: The relationships module must occur before the profiles module, or all relationships will be deleted + app.mm.SetOrderMigrations( + authtypes.ModuleName, + authz.ModuleName, + banktypes.ModuleName, + capabilitytypes.ModuleName, + distrtypes.ModuleName, + evidencetypes.ModuleName, + feegrant.ModuleName, + genutiltypes.ModuleName, + govtypes.ModuleName, + ibchost.ModuleName, + minttypes.ModuleName, + slashingtypes.ModuleName, + stakingtypes.ModuleName, + ibctransfertypes.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + wasm.ModuleName, + + icatypes.ModuleName, + intertxtypes.ModuleName, + + rnsmoduletypes.ModuleName, + oraclemoduletypes.ModuleName, + storagemoduletypes.ModuleName, + filetreemoduletypes.ModuleName, + + crisistypes.ModuleName, ) // Uncomment if you want to set a custom migration order here. @@ -866,7 +925,7 @@ func NewJackalApp( app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) - app.setupUpgradeHandlers() + app.registerUpgradeHandlers() // create the simulation manager and define the order of the modules for deterministic simulations // @@ -890,6 +949,8 @@ func NewJackalApp( transferModule, rnsModule, storageModule, + oracleModule, + filetreeModule, ) app.sm.RegisterStoreDecoders() @@ -1053,73 +1114,23 @@ func (app *JackalApp) RegisterTendermintService(clientCtx client.Context) { tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.InterfaceRegistry) } -// Add new modules store loader -func (app *JackalApp) setupUpgradeHandlers() { - // version 2 upgrade keeper - app.upgradeKeeper.SetUpgradeHandler( - v2.UpgradeName, - v2.CreateUpgradeHandler( - app.mm, - app.configurator, - ), - ) - - // version 1.2.0-alpha.6 upgrade keeper - app.upgradeKeeper.SetUpgradeHandler( - v120alpha6.UpgradeName, - v120alpha6.CreateUpgradeHandler( - app.mm, - app.configurator, - ), - ) - - // version 1.2.0-alpha.7 upgrade keeper - app.upgradeKeeper.SetUpgradeHandler( - alpha7.UpgradeName, - alpha7.CreateUpgradeHandler( - app.mm, - app.configurator, - ), - ) +func (app *JackalApp) registerUpgradeHandlers() { + // app.registerUpgrade(v2.NewUpgrade(app.mm, app.configurator)) + app.registerUpgrade(v3.NewUpgrade(app.mm, app.configurator, app.OracleKeeper)) +} - // version 3 upgrade keeper - app.upgradeKeeper.SetUpgradeHandler( - v3.UpgradeName, - v3.CreateUpgradeHandler( - app.mm, - app.configurator, - ), - ) +// registerUpgrade registers the given upgrade to be supported by the app +func (app *JackalApp) registerUpgrade(upgrade upgrades.Upgrade) { + app.upgradeKeeper.SetUpgradeHandler(upgrade.Name(), upgrade.Handler()) - // When a planned update height is reached, the old binary will panic - // writing on disk the height and name of the update that triggered it - // This will read that value, and execute the preparations for the upgrade. upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() if err != nil { - panic(fmt.Errorf("failed to read upgrade info from disk: %w", err)) - } - - if app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - return - } - - var storeUpgrades *store.StoreUpgrades - - if upgradeInfo.Name == v2.UpgradeName { - storeUpgrades = &store.StoreUpgrades{ - Deleted: []string{"storage", "dsig", "notifications", "filetree"}, - } - } - - if upgradeInfo.Name == v3.UpgradeName { - storeUpgrades = &store.StoreUpgrades{ - Added: []string{"storage", "filetree"}, - } + panic(err) } - if storeUpgrades != nil { - // configure store loader that checks if version == upgradeHeight and applies store upgrades - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades)) + if upgradeInfo.Name == upgrade.Name() && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + // Configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, upgrade.StoreUpgrades())) } } @@ -1165,6 +1176,9 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(icacontrollertypes.SubModuleName) paramsKeeper.Subspace(wasm.ModuleName) paramsKeeper.Subspace(rnsmoduletypes.ModuleName) + paramsKeeper.Subspace(oraclemoduletypes.ModuleName) + paramsKeeper.Subspace(storagemoduletypes.ModuleName) + paramsKeeper.Subspace(filetreemoduletypes.ModuleName) return paramsKeeper } diff --git a/app/sim_test.go b/app/sim_test.go index 4db2a127b..6b905b602 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -8,6 +8,10 @@ import ( "testing" "time" + filetreemoduletypes "github.com/jackalLabs/canine-chain/x/filetree/types" + oraclemoduletypes "github.com/jackalLabs/canine-chain/x/oracle/types" + storagemoduletypes "github.com/jackalLabs/canine-chain/x/storage/types" + "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -193,6 +197,9 @@ func TestAppImportExport(t *testing.T) { {app.keys[authzkeeper.StoreKey], newApp.keys[authzkeeper.StoreKey], [][]byte{}}, {app.keys[feegrant.StoreKey], newApp.keys[feegrant.StoreKey], [][]byte{}}, {app.keys[wasm.StoreKey], newApp.keys[wasm.StoreKey], [][]byte{}}, + {app.keys[oraclemoduletypes.StoreKey], newApp.keys[oraclemoduletypes.StoreKey], [][]byte{}}, + {app.keys[storagemoduletypes.StoreKey], newApp.keys[storagemoduletypes.StoreKey], [][]byte{}}, + {app.keys[filetreemoduletypes.StoreKey], newApp.keys[filetreemoduletypes.StoreKey], [][]byte{}}, } // delete persistent tx counter value diff --git a/app/upgrades/upgrades.go b/app/upgrades/upgrades.go new file mode 100644 index 000000000..0e2df775f --- /dev/null +++ b/app/upgrades/upgrades.go @@ -0,0 +1,13 @@ +package upgrades + +import ( + storetypes "github.com/cosmos/cosmos-sdk/store/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +// Upgrade represents a generic on-chain upgrade +type Upgrade interface { + Name() string + Handler() upgradetypes.UpgradeHandler + StoreUpgrades() *storetypes.StoreUpgrades +} diff --git a/app/upgrades/v3/constant.go b/app/upgrades/v3/constant.go deleted file mode 100644 index 4d2364f77..000000000 --- a/app/upgrades/v3/constant.go +++ /dev/null @@ -1,5 +0,0 @@ -package v3 - -const ( - UpgradeName = "v3" -) diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go index cc5133087..883f8b104 100644 --- a/app/upgrades/v3/upgrades.go +++ b/app/upgrades/v3/upgrades.go @@ -1,28 +1,64 @@ package v3 import ( - "fmt" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/jackalLabs/canine-chain/app/upgrades" + filetreemoduletypes "github.com/jackalLabs/canine-chain/x/filetree/types" + oraclekeeper "github.com/jackalLabs/canine-chain/x/oracle/keeper" + oraclemoduletypes "github.com/jackalLabs/canine-chain/x/oracle/types" + storagemoduletypes "github.com/jackalLabs/canine-chain/x/storage/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - logger := ctx.Logger().With("upgrade", UpgradeName) +var _ upgrades.Upgrade = &Upgrade{} - for _, moduleName := range []string{"storage", "filetree"} { - logger.Debug("adding module", moduleName, "to version map") - } +// Upgrade represents the v4 upgrade +type Upgrade struct { + mm *module.Manager + configurator module.Configurator + ok oraclekeeper.Keeper +} + +// NewUpgrade returns a new Upgrade instance +func NewUpgrade(mm *module.Manager, configurator module.Configurator, ok oraclekeeper.Keeper) *Upgrade { + return &Upgrade{ + mm: mm, + configurator: configurator, + ok: ok, + } +} - logger.Debug("running module migrations") +// Name implements upgrades.Upgrade +func (u *Upgrade) Name() string { + return "v3" +} - logger.Debug(fmt.Sprintf("mm is nil = %v", mm == nil)) +// Handler implements upgrades.Upgrade +func (u *Upgrade) Handler() upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + fromVM[storagemoduletypes.ModuleName] = 1 + fromVM[filetreemoduletypes.ModuleName] = 1 + fromVM[oraclemoduletypes.ModuleName] = 1 + + newVM, err := u.mm.RunMigrations(ctx, u.configurator, fromVM) + if err != nil { + return newVM, err + } + + return newVM, err + } +} - return mm.RunMigrations(ctx, configurator, vm) +// StoreUpgrades implements upgrades.Upgrade +func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades { + return &storetypes.StoreUpgrades{ + Added: []string{ + storagemoduletypes.StoreKey, + filetreemoduletypes.StoreKey, + oraclemoduletypes.StoreKey, + }, } } diff --git a/cmd/contract_tests/main.go b/cmd/contract_tests/main.go deleted file mode 100644 index 4f27b0338..000000000 --- a/cmd/contract_tests/main.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/snikch/goodman/hooks" - "github.com/snikch/goodman/transaction" -) - -func main() { - // This must be compiled beforehand and given to dredd as parameter, in the meantime the server should be running - h := hooks.NewHooks() - server := hooks.NewServer(hooks.NewHooksRunner(h)) - h.BeforeAll(func(t []*transaction.Transaction) { - fmt.Println("Sleep 5 seconds before all modification") - }) - h.BeforeEach(func(t *transaction.Transaction) { - fmt.Println("before each modification") - }) - h.Before("/version > GET", func(t *transaction.Transaction) { - fmt.Println("before version TEST") - }) - h.Before("/node_version > GET", func(t *transaction.Transaction) { - fmt.Println("before node_version TEST") - }) - h.BeforeEachValidation(func(t *transaction.Transaction) { - fmt.Println("before each validation modification") - }) - h.BeforeValidation("/node_version > GET", func(t *transaction.Transaction) { - fmt.Println("before validation node_version TEST") - }) - h.After("/node_version > GET", func(t *transaction.Transaction) { - fmt.Println("after node_version TEST") - }) - h.AfterEach(func(t *transaction.Transaction) { - fmt.Println("after each modification") - }) - h.AfterAll(func(t []*transaction.Transaction) { - fmt.Println("after all modification") - }) - server.Serve() - defer server.Listener.Close() - fmt.Print(h) -} diff --git a/go.mod b/go.mod index b32d9d773..b0f359f4b 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/tendermint/tendermint v0.34.23 github.com/tendermint/tm-db v0.6.7 github.com/wealdtech/go-merkletree v1.0.0 + github.com/zondax/hid v0.9.1 // indirect google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a google.golang.org/grpc v1.50.1 gopkg.in/yaml.v2 v2.4.0 @@ -130,7 +131,6 @@ require ( github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/crypto v0.1.0 // indirect golang.org/x/net v0.1.0 // indirect diff --git a/go.sum b/go.sum index 48fca813c..a1ec03c31 100644 --- a/go.sum +++ b/go.sum @@ -962,8 +962,9 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= +github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= diff --git a/proto/canine_chain/oracle/feed.proto b/proto/canine_chain/oracle/feed.proto new file mode 100644 index 000000000..02c9ca5f1 --- /dev/null +++ b/proto/canine_chain/oracle/feed.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package canine_chain.oracle; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/jackalLabs/canine-chain/x/oracle/types"; + +message Feed { + string owner = 1; + string data = 2; + google.protobuf.Timestamp last_update = 3 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + string name = 4; +} + diff --git a/proto/canine_chain/oracle/genesis.proto b/proto/canine_chain/oracle/genesis.proto new file mode 100644 index 000000000..08c165632 --- /dev/null +++ b/proto/canine_chain/oracle/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package canine_chain.oracle; + +import "gogoproto/gogo.proto"; +import "canine_chain/oracle/params.proto"; +import "canine_chain/oracle/feed.proto"; + +option go_package = "github.com/jackalLabs/canine-chain/x/oracle/types"; + +// GenesisState defines the rns module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; + repeated Feed feed_list = 2 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/canine_chain/oracle/params.proto b/proto/canine_chain/oracle/params.proto new file mode 100644 index 000000000..40af15c83 --- /dev/null +++ b/proto/canine_chain/oracle/params.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package canine_chain.oracle; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/jackalLabs/canine-chain/x/oracle/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + string deposit = 1; +} \ No newline at end of file diff --git a/proto/canine_chain/oracle/query.proto b/proto/canine_chain/oracle/query.proto new file mode 100644 index 000000000..d9cf06953 --- /dev/null +++ b/proto/canine_chain/oracle/query.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; +package canine_chain.oracle; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "canine_chain/oracle/params.proto"; +import "canine_chain/oracle/feed.proto"; + +option go_package = "github.com/jackalLabs/canine-chain/x/oracle/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/jackal-dao/canine-chain/oracle/params"; + } + + rpc Feed(QueryFeedRequest) returns (QueryFeedResponse) { + option (google.api.http).get = "/jackal-dao/canine-chain/oracle/feeds/{name}"; + } + + rpc AllFeeds(QueryAllFeedsRequest) returns (QueryAllFeedsResponse) { + option (google.api.http).get = "/jackal-dao/canine-chain/oracle/feeds"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryFeedRequest { + string name = 1; +} + +message QueryFeedResponse { + // params holds all the parameters of this module. + Feed feed = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryAllFeedsRequest {} + +message QueryAllFeedsResponse { + // params holds all the parameters of this module. + repeated Feed feed = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/canine_chain/oracle/tx.proto b/proto/canine_chain/oracle/tx.proto new file mode 100644 index 000000000..8fc988885 --- /dev/null +++ b/proto/canine_chain/oracle/tx.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package canine_chain.oracle; + +option go_package = "github.com/jackalLabs/canine-chain/x/oracle/types"; + +// Msg defines the Msg service. +service Msg { + rpc CreateFeed(MsgCreateFeed) returns (MsgCreateFeedResponse); + rpc UpdateFeed(MsgUpdateFeed) returns (MsgUpdateFeedResponse); +} + + +message MsgCreateFeed { + string creator = 1; + string name = 2; +} + +message MsgCreateFeedResponse {} + +message MsgUpdateFeed { + string creator = 1; + string name = 2; + string data = 3; +} + +message MsgUpdateFeedResponse {} \ No newline at end of file diff --git a/proto/canine_chain/storage/client_usage.proto b/proto/canine_chain/storage/client_usage.proto deleted file mode 100644 index 931815705..000000000 --- a/proto/canine_chain/storage/client_usage.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; -package canine_chain.storage; - -option go_package = "github.com/jackalLabs/canine-chain/x/storage/types"; - -message ClientUsage { - string address = 1; - string usage = 2; -} diff --git a/proto/canine_chain/storage/genesis.proto b/proto/canine_chain/storage/genesis.proto index ff5db1969..a29c3c78b 100644 --- a/proto/canine_chain/storage/genesis.proto +++ b/proto/canine_chain/storage/genesis.proto @@ -6,8 +6,6 @@ import "canine_chain/storage/params.proto"; import "canine_chain/storage/contracts.proto"; import "canine_chain/storage/active_deals.proto"; import "canine_chain/storage/providers.proto"; -import "canine_chain/storage/pay_blocks.proto"; -import "canine_chain/storage/client_usage.proto"; import "canine_chain/storage/strays.proto"; import "canine_chain/storage/fid_cid.proto"; // this line is used by starport scaffolding # genesis/proto/import @@ -20,9 +18,7 @@ message GenesisState { repeated Contracts contracts_list = 2 [ (gogoproto.nullable) = false ]; repeated ActiveDeals active_deals_list = 3 [ (gogoproto.nullable) = false ]; repeated Providers providers_list = 4 [ (gogoproto.nullable) = false ]; - repeated PayBlocks pay_blocks_list = 5 [ (gogoproto.nullable) = false ]; - repeated ClientUsage client_usage_list = 6 [ (gogoproto.nullable) = false ]; repeated Strays strays_list = 7 [ (gogoproto.nullable) = false ]; - repeated FidCid fid_cid_list = 8 [ (gogoproto.nullable) = false ]; + repeated FidCid fid_cid_list = 5 [ (gogoproto.nullable) = false ]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/canine_chain/storage/params.proto b/proto/canine_chain/storage/params.proto index 2d7f4e5c9..279390641 100644 --- a/proto/canine_chain/storage/params.proto +++ b/proto/canine_chain/storage/params.proto @@ -6,4 +6,8 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/jackalLabs/canine-chain/x/storage/types"; // Params defines the parameters for the module. -message Params { option (gogoproto.goproto_stringer) = false; } \ No newline at end of file +message Params { + option (gogoproto.goproto_stringer) = false; + + string deposit_account = 1; +} diff --git a/proto/canine_chain/storage/pay_blocks.proto b/proto/canine_chain/storage/pay_blocks.proto deleted file mode 100644 index 31e48ffab..000000000 --- a/proto/canine_chain/storage/pay_blocks.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -package canine_chain.storage; - -option go_package = "github.com/jackalLabs/canine-chain/x/storage/types"; - -message PayBlocks { - string blockid = 1; - string bytes = 2; - string blocktype = 3; - string blocknum = 4; -} diff --git a/proto/canine_chain/storage/payment_info.proto b/proto/canine_chain/storage/payment_info.proto new file mode 100644 index 000000000..c235a335c --- /dev/null +++ b/proto/canine_chain/storage/payment_info.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package canine_chain.storage; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/jackalLabs/canine-chain/x/storage/types"; + +message StoragePaymentInfo { + google.protobuf.Timestamp start = 1 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + google.protobuf.Timestamp end = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + int64 spaceAvailable = 3; + int64 spaceUsed = 4; + string address = 5; +} diff --git a/proto/canine_chain/storage/query.proto b/proto/canine_chain/storage/query.proto index 96f488735..992765360 100644 --- a/proto/canine_chain/storage/query.proto +++ b/proto/canine_chain/storage/query.proto @@ -8,10 +8,10 @@ import "canine_chain/storage/params.proto"; import "canine_chain/storage/contracts.proto"; import "canine_chain/storage/active_deals.proto"; import "canine_chain/storage/providers.proto"; -import "canine_chain/storage/pay_blocks.proto"; -import "canine_chain/storage/client_usage.proto"; import "canine_chain/storage/strays.proto"; import "canine_chain/storage/fid_cid.proto"; +import "canine_chain/storage/payment_info.proto"; + // this line is used by starport scaffolding # 1 option go_package = "github.com/jackalLabs/canine-chain/x/storage/types"; @@ -71,32 +71,6 @@ service Query { "/jackal-dao/canine-chain/storage/find_file/{fid}"; } - // Queries a PayBlocks by index. - rpc PayBlocks(QueryPayBlockRequest) returns (QueryPayBlockResponse) { - option (google.api.http).get = - "/jackal-dao/canine-chain/storage/pay_blocks/{blockid}"; - } - - // Queries a list of PayBlocks items. - rpc PayBlocksAll(QueryAllPayBlocksRequest) - returns (QueryAllPayBlocksResponse) { - option (google.api.http).get = - "/jackal-dao/canine-chain/storage/pay_blocks"; - } - - // Queries a ClientUsage by index. - rpc ClientUsage(QueryClientUsageRequest) returns (QueryClientUsageResponse) { - option (google.api.http).get = - "/jackal-dao/canine-chain/storage/client_usage/{address}"; - } - - // Queries a list of ClientUsage items. - rpc ClientUsageAll(QueryAllClientUsageRequest) - returns (QueryAllClientUsageResponse) { - option (google.api.http).get = - "/jackal-dao/canine-chain/storage/client_usage"; - } - // Queries a Strays by index. rpc Strays(QueryStrayRequest) returns (QueryStrayResponse) { option (google.api.http).get = @@ -132,7 +106,24 @@ service Query { "/jackal-dao/canine-chain/storage/get_pay_data/{address}"; } - // this line is used by starport scaffolding # 2 + // Queries a StoragePaymentInfo by address. + rpc StoragePaymentInfo(QueryStoragePaymentInfoRequest) returns (QueryStoragePaymentInfoResponse) { + option (google.api.http).get = + "/jackal-dao/canine-chain/storage/payment_info/{address}"; + } + + // Queries a list of StoragePaymentInfo items. + rpc StoragePaymentInfoAll(QueryAllStoragePaymentInfoRequest) + returns (QueryAllStoragePaymentInfoResponse) { + option (google.api.http).get = + "/jackal-dao/canine-chain/storage/payment_info"; + } + + // Queries whether user can upload a file based on size + rpc FileUploadCheck(QueryFileUploadCheck) returns (QueryFileUploadCheckResponse) { + option (google.api.http).get = + "/jackal-dao/canine-chain/storage/file_upload_check"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -197,35 +188,6 @@ message QueryFindFileRequest { string fid = 1; } message QueryFindFileResponse { string provider_ips = 1; } -message QueryPayBlockRequest { string blockid = 1; } - -message QueryPayBlockResponse { - PayBlocks pay_blocks = 1 [ (gogoproto.nullable) = false ]; -} - -message QueryAllPayBlocksRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllPayBlocksResponse { - repeated PayBlocks pay_blocks = 1 [ (gogoproto.nullable) = false ]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryClientUsageRequest { string address = 1; } - -message QueryClientUsageResponse { - ClientUsage client_usage = 1 [ (gogoproto.nullable) = false ]; -} - -message QueryAllClientUsageRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllClientUsageResponse { - repeated ClientUsage client_usage = 1 [ (gogoproto.nullable) = false ]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} message QueryStrayRequest { string cid = 1; } @@ -244,7 +206,7 @@ message QueryAllStraysResponse { message QueryClientFreeSpaceRequest { string address = 1; } -message QueryClientFreeSpaceResponse { string bytesfree = 1; } +message QueryClientFreeSpaceResponse { int64 bytesfree = 1; } message QueryFidCidRequest { string fid = 1; } @@ -264,8 +226,32 @@ message QueryAllFidCidResponse { message QueryPayDataRequest { string address = 1; } message QueryPayDataResponse { - int64 blocks_remaining = 1; + int64 time_remaining = 1; int64 bytes = 2; } +message QueryStoragePaymentInfoRequest { string address = 1; } + +message QueryStoragePaymentInfoResponse { + StoragePaymentInfo storage_payment_info = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryAllStoragePaymentInfoRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllStoragePaymentInfoResponse { + repeated StoragePaymentInfo storage_payment_info = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryFileUploadCheck { + string address = 1; + int64 bytes = 2; +} + +message QueryFileUploadCheckResponse { + bool valid = 1; +} + // this line is used by starport scaffolding # 3 diff --git a/scripts/run-upgrade-node.sh b/scripts/run-upgrade-node.sh index c5c5fd414..ece6eda0b 100644 --- a/scripts/run-upgrade-node.sh +++ b/scripts/run-upgrade-node.sh @@ -33,6 +33,8 @@ update_test_genesis '.app_state["gov"]["deposit_params"]["min_deposit"]=[{"denom update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom": $DENOM,"amount": "1000"}' $DENOM update_test_genesis '.app_state["staking"]["params"]["bond_denom"]=$DENOM' $DENOM + +sed -i '' 's/enable = false/enable = true/' $HOME/config/app.toml # Sign genesis transaction $BINARY gentx $KEY "1000000${DENOM}" --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME diff --git a/scripts/upgrade-test.sh b/scripts/upgrade-test.sh old mode 100644 new mode 100755 index 531e7f4b7..f44447b46 --- a/scripts/upgrade-test.sh +++ b/scripts/upgrade-test.sh @@ -1,69 +1,65 @@ #!/bin/bash OLD_VERSION=1.1.2-hotfix -UPGRADE_HEIGHT=30 +UPGRADE_HEIGHT=20 HOME=mytestnet ROOT=$(pwd) DENOM=ujkl SOFTWARE_UPGRADE_NAME=v3 # underscore so that go tool will not take gocache into account -mkdir -p _build/gocache -export GOMODCACHE=$ROOT/_build/gocache +mkdir -p ${ROOT}/../_build/gocache +export GOMODCACHE=${ROOT}/../_build/gocache # install old binary -if ! command -v _build/old/canined &> /dev/null +if ! command -v ./../_build/old/canined &> /dev/null then - mkdir -p _build/old - wget -c "https://github.com/JackalLabs/canine-chain/archive/refs/tags/v${OLD_VERSION}.zip" -O _build/v${OLD_VERSION}.zip - unzip _build/v${OLD_VERSION}.zip -d _build - cd ./_build/canine-chain-${OLD_VERSION} - GOBIN="$ROOT/_build/old" go install -mod=readonly ./... + mkdir -p ../_build/old + wget -c "https://github.com/JackalLabs/canine-chain/archive/refs/tags/v${OLD_VERSION}.zip" -O ../_build/v${OLD_VERSION}.zip + unzip ../_build/v${OLD_VERSION}.zip -d ../_build + cd ../_build/canine-chain-${OLD_VERSION} + make build + mv build/canined ../old/canined cd ../.. fi -# install new binary -if ! command -v _build/new/canined &> /dev/null -then - GOBIN="$ROOT/_build/new" go install -mod=readonly ./... 2> /dev/null -fi # start old node -screen -dmS node1 bash scripts/run-upgrade-node.sh _build/old/canined $DENOM +screen -dmS node1 bash scripts/run-upgrade-node.sh ./../_build/old/canined $DENOM sleep 20 -./_build/old/canined tx gov submit-proposal software-upgrade "$SOFTWARE_UPGRADE_NAME" --upgrade-height $UPGRADE_HEIGHT --upgrade-info "temp" --title "upgrade" --description "upgrade" --from test1 --keyring-backend test --chain-id test --home $HOME -y +./../_build/old/canined tx gov submit-proposal software-upgrade "$SOFTWARE_UPGRADE_NAME" --upgrade-height $UPGRADE_HEIGHT --upgrade-info "temp" --title "upgrade" --description "upgrade" --from test1 --keyring-backend test --chain-id test --home $HOME -y sleep 3 -./_build/old/canined tx gov deposit 1 "20000000${DENOM}" --from test1 --keyring-backend test --chain-id test --home $HOME -y +./../_build/old/canined tx gov deposit 1 "20000000${DENOM}" --from test1 --keyring-backend test --chain-id test --home $HOME -y sleep 3 -./_build/old/canined tx gov vote 1 yes --from test --keyring-backend test --chain-id test --home $HOME -y +./../_build/old/canined tx gov vote 1 yes --from test --keyring-backend test --chain-id test --home $HOME -y sleep 3 -./_build/old/canined tx gov vote 1 yes --from test1 --keyring-backend test --chain-id test --home $HOME -y +./../_build/old/canined tx gov vote 1 yes --from test1 --keyring-backend test --chain-id test --home $HOME -y sleep 3 # determine block_height to halt while true; do - BLOCK_HEIGHT=$(./_build/old/canined status | jq '.SyncInfo.latest_block_height' -r) + BLOCK_HEIGHT=$(./../_build/old/canined status | jq '.SyncInfo.latest_block_height' -r) if [ $BLOCK_HEIGHT = "$UPGRADE_HEIGHT" ]; then # assuming running only 1 canined echo "BLOCK HEIGHT = $UPGRADE_HEIGHT REACHED, KILLING OLD ONE" pkill canined break else - ./_build/old/canined q gov proposal 1 --output=json | jq ".status" + ./../_build/old/canined q gov proposal 1 --output=json | jq ".status" echo "BLOCK_HEIGHT = $BLOCK_HEIGHT" sleep 10 fi done -sleep 3 +#sleep 3 -./_build/new/canined start --log_level debug --home $HOME \ No newline at end of file +#canined start --log_level debug --home $HOME \ No newline at end of file diff --git a/types/utils.go b/types/utils.go index 2b1e223b4..e3f58adec 100644 --- a/types/utils.go +++ b/types/utils.go @@ -5,6 +5,7 @@ import "strings" const ( MainnetChainID = "jackal" TestnetChainID = "lupulella" + Bech32Prefix = "jkl" ) // IsMainnet returns true if the chain-id has the Evmos mainnet EIP155 chain prefix. diff --git a/x/filetree/keeper/migrations.go b/x/filetree/keeper/migrations.go new file mode 100644 index 000000000..70073db90 --- /dev/null +++ b/x/filetree/keeper/migrations.go @@ -0,0 +1,25 @@ +package keeper + +// DONTCOVER + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v2 "github.com/jackalLabs/canine-chain/x/filetree/legacy/v2" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + k Keeper +} + +// NewMigrator returns a new Migrator +func NewMigrator(keeper Keeper) Migrator { + return Migrator{ + k: keeper, + } +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, &m.k.paramstore) +} diff --git a/x/filetree/keeper/params.go b/x/filetree/keeper/params.go index 6150a8b27..99ceb8500 100644 --- a/x/filetree/keeper/params.go +++ b/x/filetree/keeper/params.go @@ -6,8 +6,9 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + k.paramstore.GetParamSet(ctx, &p) + return } // SetParams set the params diff --git a/x/filetree/legacy/v2/store.go b/x/filetree/legacy/v2/store.go new file mode 100644 index 000000000..78b6d94e3 --- /dev/null +++ b/x/filetree/legacy/v2/store.go @@ -0,0 +1,20 @@ +package v2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/jackalLabs/canine-chain/x/filetree/types" +) + +// MigrateStore performs in-place store migrations from v1 to v2 +// The things done here are the following: +// 1. setting up the next reason id and report id keys for existing subspaces +// 2. setting up the module params +func MigrateStore(ctx sdk.Context, paramsSubspace *paramstypes.Subspace) error { + ctx.Logger().Error("MIGRATING FILETREE STORE!") + // Set the module params + params := types.NewParams() + paramsSubspace.SetParamSet(ctx, ¶ms) + + return nil +} diff --git a/x/filetree/module.go b/x/filetree/module.go index 6436b49b1..b6258c14c 100644 --- a/x/filetree/module.go +++ b/x/filetree/module.go @@ -142,6 +142,11 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + m := keeper.NewMigrator(am.keeper) + err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(err) + } } // RegisterInvariants registers the capability module's invariants. diff --git a/x/filetree/types/params.go b/x/filetree/types/params.go index 357196ad6..6a19fe12c 100644 --- a/x/filetree/types/params.go +++ b/x/filetree/types/params.go @@ -24,7 +24,9 @@ func DefaultParams() Params { // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + // paramtypes.NewParamSetPair(KeyDepositAccount, &p.DepositAccount, validateDeposit), + } } // Validate validates the set of params diff --git a/x/oracle/README.md b/x/oracle/README.md new file mode 100644 index 000000000..2de82c69f --- /dev/null +++ b/x/oracle/README.md @@ -0,0 +1,128 @@ + +[◀ modules](/x/README.md) + +# `rns` + +## Contents +1. [Concept](#concept) +2. [Client](#client) + + [Query](#query) + + [list-names](#list-names) + + [show-names](#show-names) + + [list-bids](#list-bids) + + [show-bids](#show-bids) + + [list-forsale](#list-forsale) + + [show-forsale](#show-forsale) + + [params](#params) + + [Transactions](#transactions) + + [register](#register) + + [add-record](#add-record) + + [del-record](#del-record) + + [list](#list) + + [delist](#delist) + + [buy](#buy) + + [bid](#bid) + + [cancel-bid](#cancel-bid) + + [accpet-bid](#accept-bid) + + +## Concept +The `rns` module is a nameservice that allows users to use a human readable name when interacting with the Jackal Blockchain. Users can register names, list names for sale, buy names on sale, and place/accept bids from other users on their names. + +## Client +### Query +The `query` commands allow users to query `rns` state. +```sh +canined q rns --help +``` +#### list-names +The `list-names` command allows users to see a list of registered names. +```sh +canined q rns list-names +``` +#### show-name +The `show-names` command allows users to see information about a single name. +```sh +canined q rns show-names +``` +#### list-bids +The `list-bids` command allows users to see a list of currently active bids. +```sh +canined q rns list-bids +``` +#### show-bids +The `show-bids` command allows users to see information about an active bid. +```sh +canined q rns show-bids +``` +#### list-forsale +The `list-forsale` command allows users to see a list of names on sale. +```sh +canined q rns list-forsale +``` +#### show-forsale +The `show-forsale` command allows users to see information about a name on sale. +```sh +canined q rns show-forsale +``` +#### params +The `params` command allows users to view the params of the module. +```sh +canined q rns params +``` + +### Transactions +The `tx` commands allow users to interact with the `rns` module. +```sh +canined tx rns --help +``` +#### register +The `register` command registers a name for the years specified under the user account. Must also pass in a data field, used for storing a JSON structure defining extra characteristics of the name. Will take tokens from user account proportional to years registered & length of name. +```sh +canined tx rns register [name] [years] [data] +``` +#### add-record +The `add-record` command appends the new record to the name acting as a subdomain. +```sh +canined tx rns add-record [name] [record] [data] +``` +#### del-record +The `del-record` command removes the record from the name. +```sh +canined tx rns del-record [name] [record] [data] +``` +#### list +The `list` command lists a name for sale at a specified price. When bought, the amount specified will be sent to the user. +```sh +canined tx rns list [name] [price] +``` +#### delist +The `delist` command removes a name from the sale listings. +```sh +canined tx rns delist [name] +``` +#### buy +The `buy` command buys a name that is listed for sale. +```sh +canined tx rns buy [name] +``` +#### bid +The `bid` command places a bid for a name. The price of the bid is locked up in escrow until either the bid is cancelled or is accepted. The owner can accept this bid and the name will be transfered. +```sh +canined tx rns bid [name] [price] +``` +#### cancel-bid +The `cancel-bid` command removes a bid from the bid list and returns the funds locked in escrow. +```sh +canined tx rns cancel-bid [bid-id] +``` +#### accept-bid +The `accept-bid` command accepts a bid, transferring ownership of the name specified and taking the tokens locked in escrow. +```sh +canined tx rns accept-bid [bid-id] +``` \ No newline at end of file diff --git a/x/oracle/client/cli/query.go b/x/oracle/client/cli/query.go new file mode 100644 index 000000000..921dbd413 --- /dev/null +++ b/x/oracle/client/cli/query.go @@ -0,0 +1,31 @@ +package cli + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *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(CmdQueryParams()) + cmd.AddCommand(CmdQueryFeed()) + cmd.AddCommand(CmdQueryAllFeeds()) + + return cmd +} diff --git a/x/oracle/client/cli/query_feeds.go b/x/oracle/client/cli/query_feeds.go new file mode 100644 index 000000000..17b2092b6 --- /dev/null +++ b/x/oracle/client/cli/query_feeds.go @@ -0,0 +1,58 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/jackalLabs/canine-chain/x/oracle/types" + "github.com/spf13/cobra" +) + +func CmdQueryAllFeeds() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-feeds", + Short: "lists feeds", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.AllFeeds(context.Background(), &types.QueryAllFeedsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryFeed() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-feed [feed]", + Short: "query a single feed", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Feed(context.Background(), &types.QueryFeedRequest{Name: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/oracle/client/cli/query_params.go b/x/oracle/client/cli/query_params.go new file mode 100644 index 000000000..45df62ab2 --- /dev/null +++ b/x/oracle/client/cli/query_params.go @@ -0,0 +1,34 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/jackalLabs/canine-chain/x/rns/types" + "github.com/spf13/cobra" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go new file mode 100644 index 000000000..9b90936e5 --- /dev/null +++ b/x/oracle/client/cli/tx.go @@ -0,0 +1,35 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) + +//nolint:unused +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// 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(CmdUpdateFeed()) + cmd.AddCommand(CmdCreateFeed()) + return cmd +} diff --git a/x/oracle/client/cli/tx_feeds.go b/x/oracle/client/cli/tx_feeds.go new file mode 100644 index 000000000..7416ab103 --- /dev/null +++ b/x/oracle/client/cli/tx_feeds.go @@ -0,0 +1,67 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client/flags" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/jackalLabs/canine-chain/x/oracle/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdCreateFeed() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-feed [name]", + Short: "Creates a new data feed", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgCreateFeed( + clientCtx.GetFromAddress().String(), + args[0], + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdUpdateFeed() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-feed [name]", + Short: "Updates a data feed", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUpdateFeed( + clientCtx.GetFromAddress().String(), + args[0], + args[1], + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go new file mode 100644 index 000000000..46c89c392 --- /dev/null +++ b/x/oracle/genesis.go @@ -0,0 +1,27 @@ +package oracle + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/oracle/keeper" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + + // Set all the feeds + for _, elem := range genState.FeedList { + k.SetFeed(ctx, elem) + } +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + genesis.FeedList = k.GetAllFeeds(ctx) + + return genesis +} diff --git a/x/oracle/handler.go b/x/oracle/handler.go new file mode 100644 index 000000000..3a17a07f3 --- /dev/null +++ b/x/oracle/handler.go @@ -0,0 +1,30 @@ +package oracle + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/jackalLabs/canine-chain/x/oracle/keeper" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// NewHandler ... +func NewHandler(k keeper.Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + _ = ctx + switch msg := msg.(type) { + case *types.MsgCreateFeed: + res, err := msgServer.CreateFeed(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateFeed: + res, err := msgServer.UpdateFeed(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + } +} diff --git a/x/oracle/keeper/common_test.go b/x/oracle/keeper/common_test.go new file mode 100644 index 000000000..e4ec04a4b --- /dev/null +++ b/x/oracle/keeper/common_test.go @@ -0,0 +1,97 @@ +package keeper_test + +import ( + "fmt" + "testing" + + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/cosmos/cosmos-sdk/baseapp" + + typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + moduletestutil "github.com/jackalLabs/canine-chain/types/module/testutil" // when importing from sdk,'go mod tidy' keeps trying to import from v0.46. + + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/golang/mock/gomock" + canineglobaltestutil "github.com/jackalLabs/canine-chain/testutil" + "github.com/jackalLabs/canine-chain/x/oracle/keeper" + oracletestutil "github.com/jackalLabs/canine-chain/x/oracle/testutil" + types "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// setupOracleKeeper creates a oracleKeeper as well as all its dependencies. +func setupOracleKeeper(t *testing.T) ( + *keeper.Keeper, + *oracletestutil.MockBankKeeper, + moduletestutil.TestEncodingConfig, + sdk.Context, +) { + key := sdk.NewKVStoreKey(types.StoreKey) + // memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + tkey := sdk.NewTransientStoreKey("transient_test") + testCtx := canineglobaltestutil.DefaultContextWithDB(t, key, tkey) + ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) + encCfg := moduletestutil.MakeTestEncodingConfig() + + types.RegisterInterfaces(encCfg.InterfaceRegistry) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) + + // Create MsgServiceRouter, but don't populate it before creating the oracle keeper. + msr := baseapp.NewMsgServiceRouter() + + // gomock initializations + ctrl := gomock.NewController(t) + bankKeeper := oracletestutil.NewMockBankKeeper(ctrl) + trackMockBalances(bankKeeper) + + paramsSubspace := typesparams.NewSubspace(encCfg.Codec, + types.Amino, + key, + tkey, + "OracleParams", + ) + + // oracle keeper initializations + oracleKeeper := keeper.NewKeeper(encCfg.Codec, key, paramsSubspace, bankKeeper) + oracleKeeper.SetParams(ctx, types.DefaultParams()) + + // Register all handlers for the MegServiceRouter. + msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) + types.RegisterMsgServer(msr, keeper.NewMsgServerImpl(*oracleKeeper)) + banktypes.RegisterMsgServer(msr, nil) // Nil is fine here as long as we never execute the proposal's Msgs. + + return oracleKeeper, bankKeeper, encCfg, ctx +} + +// trackMockBalances sets up expected calls on the Mock BankKeeper, and also +// locally tracks accounts balances (not modules balances). +func trackMockBalances(bankKeeper *oracletestutil.MockBankKeeper) { + balances := make(map[string]sdk.Coins) + + // We don't track module account balances. + bankKeeper.EXPECT().MintCoins(gomock.Any(), minttypes.ModuleName, gomock.Any()).AnyTimes() + bankKeeper.EXPECT().BurnCoins(gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() + bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), minttypes.ModuleName, types.ModuleName, gomock.Any()).AnyTimes() + + // But we do track normal account balances. + bankKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).DoAndReturn(func(_ sdk.Context, sender sdk.AccAddress, _ string, coins sdk.Coins) error { + newBalance, negative := balances[sender.String()].SafeSub(coins) // in v0.46, this method is variadic + if negative { + return fmt.Errorf("not enough balance") + } + balances[sender.String()] = newBalance + return nil + }).AnyTimes() + bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, module string, rcpt sdk.AccAddress, coins sdk.Coins) error { + balances[rcpt.String()] = balances[rcpt.String()].Add(coins...) + return nil + }).AnyTimes() + bankKeeper.EXPECT().GetAllBalances(gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, addr sdk.AccAddress) sdk.Coins { + return balances[addr.String()] + }).AnyTimes() +} diff --git a/x/oracle/keeper/feeds.go b/x/oracle/keeper/feeds.go new file mode 100644 index 000000000..c8e545130 --- /dev/null +++ b/x/oracle/keeper/feeds.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// SetFeed set a specific Feed in the store from its index +func (k Keeper) SetFeed(ctx sdk.Context, feed types.Feed) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.FeedKeyPrefix)) + f := k.cdc.MustMarshal(&feed) + store.Set(types.FeedKey(feed.Name), f) +} + +// GetFeed returns a Feed from its index +func (k Keeper) GetFeed( + ctx sdk.Context, + index string, +) (val types.Feed, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.FeedKeyPrefix)) + + key := types.FeedKey(index) + if !store.Has(key) { + return types.Feed{}, false + } + + k.cdc.MustUnmarshal(store.Get(key), &val) + return val, true +} + +// RemoveFeed removes a Feed from the store +func (k Keeper) RemoveFeed( + ctx sdk.Context, + index string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.FeedKeyPrefix)) + store.Delete(types.FeedKey( + index, + )) +} + +// GetAllFeed returns all Feed +func (k Keeper) GetAllFeeds(ctx sdk.Context) (list []types.Feed) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.FeedKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Feed + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/oracle/keeper/grpc_query.go b/x/oracle/keeper/grpc_query.go new file mode 100644 index 000000000..96846a44c --- /dev/null +++ b/x/oracle/keeper/grpc_query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/oracle/keeper/grpc_query_feeds.go b/x/oracle/keeper/grpc_query_feeds.go new file mode 100644 index 000000000..302a602c5 --- /dev/null +++ b/x/oracle/keeper/grpc_query_feeds.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Feed(c context.Context, req *types.QueryFeedRequest) (*types.QueryFeedResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + ctx.Logger().Error(req.Name) + + feed, found := k.GetFeed(ctx, req.Name) + ctx.Logger().Error(feed.Name) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryFeedResponse{Feed: feed}, nil +} + +func (k Keeper) AllFeeds(c context.Context, req *types.QueryAllFeedsRequest) (*types.QueryAllFeedsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + f := k.GetAllFeeds(ctx) + + return &types.QueryAllFeedsResponse{Feed: f, Pagination: nil}, nil +} diff --git a/x/oracle/keeper/grpc_query_params.go b/x/oracle/keeper/grpc_query_params.go new file mode 100644 index 000000000..091124d0d --- /dev/null +++ b/x/oracle/keeper/grpc_query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go new file mode 100644 index 000000000..90470eb0b --- /dev/null +++ b/x/oracle/keeper/keeper.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey sdk.StoreKey + paramstore paramtypes.Subspace + + bankKeeper types.BankKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey sdk.StoreKey, + ps paramtypes.Subspace, + + bankKeeper types.BankKeeper, +) *Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + paramstore: ps, + bankKeeper: bankKeeper, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go new file mode 100644 index 000000000..ef6634f6f --- /dev/null +++ b/x/oracle/keeper/keeper_test.go @@ -0,0 +1,71 @@ +package keeper_test + +import ( + "testing" + + gocontext "context" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/jackalLabs/canine-chain/x/oracle/keeper" + oracletestutil "github.com/jackalLabs/canine-chain/x/oracle/testutil" + "github.com/jackalLabs/canine-chain/x/oracle/types" + "github.com/stretchr/testify/suite" +) + +type KeeperTestSuite struct { + suite.Suite + + cdc codec.Codec + ctx sdk.Context + oracleKeeper *keeper.Keeper + bankKeeper *oracletestutil.MockBankKeeper + queryClient types.QueryClient + msgSrvr types.MsgServer +} + +func (suite *KeeperTestSuite) SetupSuite() { + suite.reset() +} + +func (suite *KeeperTestSuite) reset() { + oracleKeeper, bankKeeper, encCfg, ctx := setupOracleKeeper(suite.T()) + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) + types.RegisterQueryServer(queryHelper, oracleKeeper) + queryClient := types.NewQueryClient(queryHelper) + + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000000000))) + err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + suite.NoError(err) + err = bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + suite.NoError(err) + + suite.ctx = ctx + suite.oracleKeeper = oracleKeeper + suite.bankKeeper = bankKeeper + suite.cdc = encCfg.Codec + suite.queryClient = queryClient + suite.msgSrvr = keeper.NewMsgServerImpl(*suite.oracleKeeper) +} + +// TODO: add msgServer tests +// func setupMsgServer(suite *KeeperTestSuite) (types.MsgServer, keeper.Keeper, gocontext.Context) { +// k := suite.oracleKeeper +// oracle.InitGenesis(suite.ctx, *k, *types.DefaultGenesis()) +// ctx := sdk.WrapSDKContext(suite.ctx) +// return keeper.NewMsgServerImpl(*k), *k, ctx +// } + +func (suite *KeeperTestSuite) TestGRPCParams() { + suite.SetupSuite() + params, err := suite.queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(params.Params, suite.oracleKeeper.GetParams(suite.ctx)) +} + +func TestOracleTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/x/oracle/keeper/migrations.go b/x/oracle/keeper/migrations.go new file mode 100644 index 000000000..d51aa2cc8 --- /dev/null +++ b/x/oracle/keeper/migrations.go @@ -0,0 +1,25 @@ +package keeper + +// DONTCOVER + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v2 "github.com/jackalLabs/canine-chain/x/oracle/legacy/v2" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + k Keeper +} + +// NewMigrator returns a new Migrator +func NewMigrator(keeper Keeper) Migrator { + return Migrator{ + k: keeper, + } +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, m.k.paramstore) +} diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go new file mode 100644 index 000000000..5733a1439 --- /dev/null +++ b/x/oracle/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/jackalLabs/canine-chain/x/oracle/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{} diff --git a/x/oracle/keeper/msg_server_feeds.go b/x/oracle/keeper/msg_server_feeds.go new file mode 100644 index 000000000..635689fd8 --- /dev/null +++ b/x/oracle/keeper/msg_server_feeds.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +func (k msgServer) CreateFeed(goCtx context.Context, msg *types.MsgCreateFeed) (*types.MsgCreateFeedResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + _, found := k.GetFeed(ctx, msg.Name) + if found { + return nil, fmt.Errorf("cannot overwrite feed, name exists") + } + + feed := types.Feed{ + Owner: msg.Creator, + Data: "", + LastUpdate: ctx.BlockTime(), + Name: msg.Name, + } + + add, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return nil, err + } + + c := sdk.NewInt64Coin("ujkl", 100*1000000) + cs := sdk.NewCoins(c) + + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, add, types.ModuleName, cs) + if err != nil { + return nil, err + } + + depo, err := sdk.AccAddressFromBech32(k.GetParams(ctx).Deposit) + if err != nil { + return nil, err + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depo, cs) + if err != nil { + return nil, err + } + + k.SetFeed(ctx, feed) + + return &types.MsgCreateFeedResponse{}, nil +} + +func (k msgServer) UpdateFeed(goCtx context.Context, msg *types.MsgUpdateFeed) (*types.MsgUpdateFeedResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + feed, found := k.GetFeed(ctx, msg.Name) + if !found { + return nil, fmt.Errorf("cannot find feed") + } + + if feed.Owner != msg.Creator { + return nil, fmt.Errorf("you do not own this feed") + } + + feed.Data = msg.Data + feed.LastUpdate = ctx.BlockTime() + + k.SetFeed(ctx, feed) + + return &types.MsgUpdateFeedResponse{}, nil +} diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go new file mode 100644 index 000000000..381cca67a --- /dev/null +++ b/x/oracle/keeper/params.go @@ -0,0 +1,17 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// GetParams returns the total set of parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramstore.GetParamSet(ctx, ¶ms) + return params +} + +// SetParams sets the total set of parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/oracle/legacy/v2/store.go b/x/oracle/legacy/v2/store.go new file mode 100644 index 000000000..9947b6532 --- /dev/null +++ b/x/oracle/legacy/v2/store.go @@ -0,0 +1,23 @@ +package v2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// MigrateStore performs in-place store migrations from v1 to v2 +// The things done here are the following: +// 1. setting up the next reason id and report id keys for existing subspaces +// 2. setting up the module params +func MigrateStore(ctx sdk.Context, paramsSubspace paramstypes.Subspace) error { + ctx.Logger().Error("MIGRATING ORACLE STORE!") + // Set the module params + params := types.NewParams() + + params.Deposit = "jkl1arsaayyj5tash86mwqudmcs2fd5jt5zgc3sexc" + + paramsSubspace.SetParamSet(ctx, ¶ms) + + return nil +} diff --git a/x/oracle/module.go b/x/oracle/module.go new file mode 100644 index 000000000..92d57f0e3 --- /dev/null +++ b/x/oracle/module.go @@ -0,0 +1,180 @@ +package oracle + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/tendermint/tendermint/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/jackalLabs/canine-chain/x/oracle/client/cli" + "github.com/jackalLabs/canine-chain/x/oracle/keeper" + "github.com/jackalLabs/canine-chain/x/oracle/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) RegisterCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(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) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) //nolint:errcheck +} + +// 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(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the capability module's message routing key. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the capability module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// 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) + m := keeper.NewMigrator(am.keeper) + err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(err) + } +} + +// 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) + + InitGenesis(ctx, am.keeper, 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 := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/oracle/module_simulation.go b/x/oracle/module_simulation.go new file mode 100644 index 000000000..b969271d1 --- /dev/null +++ b/x/oracle/module_simulation.go @@ -0,0 +1,61 @@ +package oracle + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + // "github.com/jackalLabs/canine-chain/testutil/sample" + oraclesimulation "github.com/jackalLabs/canine-chain/x/oracle/simulation" + "github.com/jackalLabs/canine-chain/x/oracle/types" +) + +// TODO: rewrite tests but don't use ignite + +// avoid unused import issue +var ( + // _ = sample.AccAddress + _ = oraclesimulation.FindAccount + _ = simappparams.StakePerAccount + _ = simulation.MsgEntryKind + _ = baseapp.Paramspace +) + +// GenerateGenesisState creates a randomized GenState of the module +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + oracleGenesis := types.GenesisState{ + Params: types.DefaultParams(), + FeedList: []types.Feed{}, + } + + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&oracleGenesis) +} + +// ProposalContents doesn't return any content functions for governance proposals +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// RandomizedParams creates randomized param changes for the simulator +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { + return []simtypes.ParamChange{} +} + +// RegisterStoreDecoder registers a decoder +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + return operations +} diff --git a/x/oracle/simulation/accept_bid.go b/x/oracle/simulation/accept_bid.go new file mode 100644 index 000000000..bb2c8d18a --- /dev/null +++ b/x/oracle/simulation/accept_bid.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgAcceptBid( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgAcceptBid{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the AcceptBid simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "AcceptBid simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/bid.go b/x/oracle/simulation/bid.go new file mode 100644 index 000000000..8c5cab49e --- /dev/null +++ b/x/oracle/simulation/bid.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgBid( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgBid{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the Bid simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "Bid simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/buy.go b/x/oracle/simulation/buy.go new file mode 100644 index 000000000..5262edcf5 --- /dev/null +++ b/x/oracle/simulation/buy.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgBuy( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgBuy{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the Buy simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "Buy simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/cancel_bid.go b/x/oracle/simulation/cancel_bid.go new file mode 100644 index 000000000..e42fa0688 --- /dev/null +++ b/x/oracle/simulation/cancel_bid.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgCancelBid( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgCancelBid{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the CancelBid simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CancelBid simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/delist.go b/x/oracle/simulation/delist.go new file mode 100644 index 000000000..c970dec28 --- /dev/null +++ b/x/oracle/simulation/delist.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgDelist( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgDelist{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the Delist simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "Delist simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/list.go b/x/oracle/simulation/list.go new file mode 100644 index 000000000..749b1d515 --- /dev/null +++ b/x/oracle/simulation/list.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgList( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgList{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the List simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "List simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/register.go b/x/oracle/simulation/register.go new file mode 100644 index 000000000..e3c2ff54d --- /dev/null +++ b/x/oracle/simulation/register.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgRegister( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgRegister{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the Register simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "Register simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/simulation/simap.go b/x/oracle/simulation/simap.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/oracle/simulation/simap.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/oracle/simulation/transfer.go b/x/oracle/simulation/transfer.go new file mode 100644 index 000000000..d94be93f6 --- /dev/null +++ b/x/oracle/simulation/transfer.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/jackalLabs/canine-chain/x/rns/keeper" + "github.com/jackalLabs/canine-chain/x/rns/types" +) + +func SimulateMsgTransfer( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgTransfer{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the Transfer simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "Transfer simulation not implemented"), nil, nil + } +} diff --git a/x/oracle/testutil/expected_keepers_mocks.go b/x/oracle/testutil/expected_keepers_mocks.go new file mode 100644 index 000000000..29b75f993 --- /dev/null +++ b/x/oracle/testutil/expected_keepers_mocks.go @@ -0,0 +1,185 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/rns/types/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// BurnCoins mocks base method. +func (m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// BurnCoins indicates an expected call of BurnCoins. +func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt) +} + +// GetAllBalances mocks base method. +func (m *MockBankKeeper) GetAllBalances(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllBalances", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// GetAllBalances indicates an expected call of GetAllBalances. +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) +} + +// MintCoins mocks base method. +func (m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// MintCoins indicates an expected call of MintCoins. +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) +} + +// SendCoins mocks base method. +func (m *MockBankKeeper) SendCoins(ctx types.Context, fromAddr, toAddr types.AccAddress, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoins", ctx, fromAddr, toAddr, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoins indicates an expected call of SendCoins. +func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt) +} + +// SendCoinsFromAccountToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) +} + +// SendCoinsFromModuleToAccount mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) +} + +// SendCoinsFromModuleToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderModule, recipientModule string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToModule", ctx, senderModule, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) +} + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +} diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go new file mode 100644 index 000000000..7af823b51 --- /dev/null +++ b/x/oracle/types/codec.go @@ -0,0 +1,21 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go new file mode 100644 index 000000000..4f8886af9 --- /dev/null +++ b/x/oracle/types/expected_keepers.go @@ -0,0 +1,25 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} diff --git a/x/oracle/types/feed.pb.go b/x/oracle/types/feed.pb.go new file mode 100644 index 000000000..03515e0a2 --- /dev/null +++ b/x/oracle/types/feed.pb.go @@ -0,0 +1,479 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: canine_chain/oracle/feed.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/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 + +type Feed struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + LastUpdate time.Time `protobuf:"bytes,3,opt,name=last_update,json=lastUpdate,proto3,stdtime" json:"last_update"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *Feed) Reset() { *m = Feed{} } +func (m *Feed) String() string { return proto.CompactTextString(m) } +func (*Feed) ProtoMessage() {} +func (*Feed) Descriptor() ([]byte, []int) { + return fileDescriptor_3b6c62baf4208166, []int{0} +} +func (m *Feed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Feed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Feed.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 *Feed) XXX_Merge(src proto.Message) { + xxx_messageInfo_Feed.Merge(m, src) +} +func (m *Feed) XXX_Size() int { + return m.Size() +} +func (m *Feed) XXX_DiscardUnknown() { + xxx_messageInfo_Feed.DiscardUnknown(m) +} + +var xxx_messageInfo_Feed proto.InternalMessageInfo + +func (m *Feed) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *Feed) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +func (m *Feed) GetLastUpdate() time.Time { + if m != nil { + return m.LastUpdate + } + return time.Time{} +} + +func (m *Feed) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func init() { + proto.RegisterType((*Feed)(nil), "canine_chain.oracle.Feed") +} + +func init() { proto.RegisterFile("canine_chain/oracle/feed.proto", fileDescriptor_3b6c62baf4208166) } + +var fileDescriptor_3b6c62baf4208166 = []byte{ + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x50, 0x3d, 0x4e, 0xc3, 0x30, + 0x14, 0x8e, 0x21, 0x20, 0x70, 0xb7, 0xd0, 0x21, 0xca, 0xe0, 0x54, 0x4c, 0x5d, 0xb0, 0x05, 0xdc, + 0xa0, 0x12, 0x2c, 0x30, 0x55, 0xb0, 0xb0, 0x54, 0x2f, 0xc9, 0xab, 0x1b, 0x48, 0xec, 0x28, 0x71, + 0x04, 0x9c, 0x81, 0xa5, 0xc7, 0xea, 0xd8, 0x91, 0x09, 0x50, 0x72, 0x11, 0x14, 0x5b, 0x91, 0xba, + 0x7d, 0xcf, 0xdf, 0x9f, 0xf5, 0x51, 0x96, 0x82, 0xca, 0x15, 0xae, 0xd2, 0x0d, 0xe4, 0x4a, 0xe8, + 0x1a, 0xd2, 0x02, 0xc5, 0x1a, 0x31, 0xe3, 0x55, 0xad, 0x8d, 0x0e, 0x2e, 0x0e, 0x79, 0xee, 0xf8, + 0x68, 0x2a, 0xb5, 0xd4, 0x96, 0x17, 0x03, 0x72, 0xd2, 0x28, 0x96, 0x5a, 0xcb, 0x02, 0x85, 0xbd, + 0x92, 0x76, 0x2d, 0x4c, 0x5e, 0x62, 0x63, 0xa0, 0xac, 0x9c, 0xe0, 0xf2, 0x8b, 0x50, 0xff, 0x1e, + 0x31, 0x0b, 0xa6, 0xf4, 0x44, 0xbf, 0x2b, 0xac, 0x43, 0x32, 0x23, 0xf3, 0xf3, 0xa5, 0x3b, 0x82, + 0x80, 0xfa, 0x19, 0x18, 0x08, 0x8f, 0xec, 0xa3, 0xc5, 0xc1, 0x1d, 0x9d, 0x14, 0xd0, 0x98, 0x55, + 0x5b, 0x65, 0x60, 0x30, 0x3c, 0x9e, 0x91, 0xf9, 0xe4, 0x26, 0xe2, 0xae, 0x89, 0x8f, 0x4d, 0xfc, + 0x69, 0x6c, 0x5a, 0x9c, 0xed, 0x7e, 0x62, 0x6f, 0xfb, 0x1b, 0x93, 0x25, 0x1d, 0x8c, 0xcf, 0xd6, + 0x37, 0x44, 0x2b, 0x28, 0x31, 0xf4, 0x5d, 0xf4, 0x80, 0x17, 0x0f, 0xbb, 0x8e, 0x91, 0x7d, 0xc7, + 0xc8, 0x5f, 0xc7, 0xc8, 0xb6, 0x67, 0xde, 0xbe, 0x67, 0xde, 0x77, 0xcf, 0xbc, 0x97, 0x6b, 0x99, + 0x9b, 0x4d, 0x9b, 0xf0, 0x54, 0x97, 0xe2, 0x15, 0xd2, 0x37, 0x28, 0x1e, 0x21, 0x69, 0x84, 0x5b, + 0xe2, 0xca, 0x2d, 0xf5, 0x31, 0x6e, 0x65, 0x3e, 0x2b, 0x6c, 0x92, 0x53, 0xfb, 0x95, 0xdb, 0xff, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x2e, 0x9f, 0xfc, 0x4f, 0x01, 0x00, 0x00, +} + +func (m *Feed) 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 *Feed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Feed) 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 = encodeVarintFeed(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x22 + } + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastUpdate, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastUpdate):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintFeed(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintFeed(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintFeed(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintFeed(dAtA []byte, offset int, v uint64) int { + offset -= sovFeed(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Feed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovFeed(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovFeed(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastUpdate) + n += 1 + l + sovFeed(uint64(l)) + l = len(m.Name) + if l > 0 { + n += 1 + l + sovFeed(uint64(l)) + } + return n +} + +func sovFeed(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFeed(x uint64) (n int) { + return sovFeed(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Feed) 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 ErrIntOverflowFeed + } + 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: Feed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Feed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFeed + } + 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 ErrInvalidLengthFeed + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFeed + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFeed + } + 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 ErrInvalidLengthFeed + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFeed + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpdate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFeed + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFeed + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFeed + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.LastUpdate, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + 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 ErrIntOverflowFeed + } + 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 ErrInvalidLengthFeed + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFeed + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFeed(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFeed + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFeed(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, ErrIntOverflowFeed + } + 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, ErrIntOverflowFeed + } + 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, ErrIntOverflowFeed + } + 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, ErrInvalidLengthFeed + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFeed + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFeed + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFeed = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFeed = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFeed = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go new file mode 100644 index 000000000..6b9105aea --- /dev/null +++ b/x/oracle/types/genesis.go @@ -0,0 +1,31 @@ +package types + +import "fmt" + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + FeedList: []Feed{}, + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in whois + feedMap := make(map[string]struct{}) + + for _, elem := range gs.FeedList { + index := string(FeedKey(elem.Name)) + if _, ok := feedMap[index]; ok { + return fmt.Errorf("duplicated index for whois") + } + feedMap[index] = struct{}{} + } + + return gs.Params.Validate() +} diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go new file mode 100644 index 000000000..ffc7ff2bf --- /dev/null +++ b/x/oracle/types/genesis.pb.go @@ -0,0 +1,386 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: canine_chain/oracle/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/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 rns module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + FeedList []Feed `protobuf:"bytes,2,rep,name=feed_list,json=feedList,proto3" json:"feed_list"` +} + +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_1f4ce83de6d85da5, []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) GetFeedList() []Feed { + if m != nil { + return m.FeedList + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "canine_chain.oracle.GenesisState") +} + +func init() { proto.RegisterFile("canine_chain/oracle/genesis.proto", fileDescriptor_1f4ce83de6d85da5) } + +var fileDescriptor_1f4ce83de6d85da5 = []byte{ + // 249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0x4e, 0xcc, 0xcb, + 0xcc, 0x4b, 0x8d, 0x4f, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, + 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x46, + 0x56, 0xa2, 0x07, 0x51, 0x22, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd7, 0x07, 0xb1, 0x20, + 0x4a, 0xa5, 0x14, 0xb0, 0x99, 0x56, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x35, 0x4c, 0x4a, 0x0e, 0x9b, + 0x8a, 0xb4, 0xd4, 0xd4, 0x14, 0x88, 0xbc, 0x52, 0x3b, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xfa, 0xe0, + 0x92, 0xc4, 0x92, 0x54, 0x21, 0x4b, 0x2e, 0x36, 0x88, 0x01, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, + 0x46, 0xd2, 0x7a, 0x58, 0x9c, 0xa3, 0x17, 0x00, 0x56, 0xe2, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, + 0x10, 0x54, 0x83, 0x90, 0x0d, 0x17, 0x27, 0xc8, 0xe4, 0xf8, 0x9c, 0xcc, 0xe2, 0x12, 0x09, 0x26, + 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x49, 0xac, 0xba, 0xdd, 0x52, 0x53, 0x53, 0xa0, 0x7a, 0x39, 0x40, + 0x3a, 0x7c, 0x32, 0x8b, 0x4b, 0x9c, 0xbc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, + 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, + 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x2b, 0x31, + 0x39, 0x3b, 0x31, 0xc7, 0x27, 0x31, 0xa9, 0x58, 0x1f, 0x62, 0xb2, 0x2e, 0xc4, 0x67, 0x15, 0x30, + 0xbf, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x7d, 0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, + 0xff, 0x63, 0x24, 0xdf, 0x7f, 0x6f, 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.FeedList) > 0 { + for iNdEx := len(m.FeedList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeedList[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.FeedList) > 0 { + for _, e := range m.FeedList { + 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 FeedList", 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.FeedList = append(m.FeedList, Feed{}) + if err := m.FeedList[len(m.FeedList)-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/oracle/types/genesis_test.go b/x/oracle/types/genesis_test.go new file mode 100644 index 000000000..b0539c355 --- /dev/null +++ b/x/oracle/types/genesis_test.go @@ -0,0 +1,36 @@ +package types_test + +import ( + "testing" + + "github.com/jackalLabs/canine-chain/x/oracle/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + for _, tc := range []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "empty genesis state", + genState: &types.GenesisState{}, + valid: false, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/oracle/types/key_feed.go b/x/oracle/types/key_feed.go new file mode 100644 index 000000000..c8fc6a10a --- /dev/null +++ b/x/oracle/types/key_feed.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // FeedKeyPrefix is the prefix to retrieve all Feed + FeedKeyPrefix = "Feed/value/" +) + +// FeedKey returns the store key to retrieve a Feed from the index fields +func FeedKey( + index string, +) []byte { + var key []byte + + indexBytes := []byte(index) + key = append(key, indexBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go new file mode 100644 index 000000000..4574f155f --- /dev/null +++ b/x/oracle/types/keys.go @@ -0,0 +1,22 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "oracle" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_oracle" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/oracle/types/message_create_feed.go b/x/oracle/types/message_create_feed.go new file mode 100644 index 000000000..45fd62706 --- /dev/null +++ b/x/oracle/types/message_create_feed.go @@ -0,0 +1,54 @@ +package types + +import ( + fmt "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + apptypes "github.com/jackalLabs/canine-chain/types" +) + +const TypeMsgCreateFeed = "create_feed" + +var _ sdk.Msg = &MsgCreateFeed{} + +func NewMsgCreateFeed(creator string, name string) *MsgCreateFeed { + return &MsgCreateFeed{ + Creator: creator, + Name: name, + } +} + +func (msg *MsgCreateFeed) Route() string { + return RouterKey +} + +func (msg *MsgCreateFeed) Type() string { + return TypeMsgCreateFeed +} + +func (msg *MsgCreateFeed) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgCreateFeed) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgCreateFeed) ValidateBasic() error { + prefix, _, err := bech32.DecodeAndConvert(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if prefix != apptypes.Bech32Prefix { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator prefix (%s)", fmt.Errorf("%s is not a valid prefix here. Expected `jkl`", prefix)) + } + + return nil +} diff --git a/x/oracle/types/message_update_feed.go b/x/oracle/types/message_update_feed.go new file mode 100644 index 000000000..0201cbc1e --- /dev/null +++ b/x/oracle/types/message_update_feed.go @@ -0,0 +1,55 @@ +package types + +import ( + fmt "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + apptypes "github.com/jackalLabs/canine-chain/types" +) + +const TypeMsgUpdateFeed = "update_feed" + +var _ sdk.Msg = &MsgUpdateFeed{} + +func NewMsgUpdateFeed(creator string, name string, data string) *MsgUpdateFeed { + return &MsgUpdateFeed{ + Creator: creator, + Name: name, + Data: data, + } +} + +func (msg *MsgUpdateFeed) Route() string { + return RouterKey +} + +func (msg *MsgUpdateFeed) Type() string { + return TypeMsgUpdateFeed +} + +func (msg *MsgUpdateFeed) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateFeed) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateFeed) ValidateBasic() error { + prefix, _, err := bech32.DecodeAndConvert(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if prefix != apptypes.Bech32Prefix { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator prefix (%s)", fmt.Errorf("%s is not a valid prefix here. Expected `jkl`", prefix)) + } + + return nil +} diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go new file mode 100644 index 000000000..3e83c4cec --- /dev/null +++ b/x/oracle/types/params.go @@ -0,0 +1,69 @@ +package types + +import ( + "errors" + "fmt" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var KeyDeposit = []byte("Deposit") + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{ + Deposit: "cosmos1arsaayyj5tash86mwqudmcs2fd5jt5zgp07gl8", + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +func validateDeposit(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if strings.TrimSpace(v) == "" { + return errors.New("deposit cannot be blank") + } + if _, err := sdk.AccAddressFromBech32(v); err != nil { + return err + } + + return nil +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyDeposit, &p.Deposit, validateDeposit), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + if err := validateDeposit(p.Deposit); err != nil { + return err + } + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/oracle/types/params.pb.go b/x/oracle/types/params.pb.go new file mode 100644 index 000000000..e62aa1476 --- /dev/null +++ b/x/oracle/types/params.pb.go @@ -0,0 +1,317 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: canine_chain/oracle/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/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 + +// Params defines the parameters for the module. +type Params struct { + Deposit string `protobuf:"bytes,1,opt,name=deposit,proto3" json:"deposit,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1a409be8fbb84f87, []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 + +func (m *Params) GetDeposit() string { + if m != nil { + return m.Deposit + } + return "" +} + +func init() { + proto.RegisterType((*Params)(nil), "canine_chain.oracle.Params") +} + +func init() { proto.RegisterFile("canine_chain/oracle/params.proto", fileDescriptor_1a409be8fbb84f87) } + +var fileDescriptor_1a409be8fbb84f87 = []byte{ + // 181 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0x4e, 0xcc, 0xcb, + 0xcc, 0x4b, 0x8d, 0x4f, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, + 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x46, 0x56, + 0xa1, 0x07, 0x51, 0x21, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd7, 0x07, 0xb1, 0x20, 0x4a, + 0x95, 0x34, 0xb8, 0xd8, 0x02, 0xc0, 0x5a, 0x85, 0x24, 0xb8, 0xd8, 0x53, 0x52, 0x0b, 0xf2, 0x8b, + 0x33, 0x4b, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x60, 0x5c, 0x2b, 0x96, 0x19, 0x0b, 0xe4, + 0x19, 0x9c, 0xbc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, + 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, + 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x2b, 0x31, 0x39, 0x3b, 0x31, 0xc7, + 0x27, 0x31, 0xa9, 0x58, 0x1f, 0xe2, 0x08, 0x5d, 0x88, 0x33, 0x2b, 0x60, 0x0e, 0x2d, 0xa9, 0x2c, + 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xdb, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x0d, 0x5e, + 0xc2, 0xcc, 0x00, 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 + if len(m.Deposit) > 0 { + i -= len(m.Deposit) + copy(dAtA[i:], m.Deposit) + i = encodeVarintParams(dAtA, i, uint64(len(m.Deposit))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(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 + l = len(m.Deposit) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(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 ErrIntOverflowParams + } + 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 Deposit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go new file mode 100644 index 000000000..560a48b93 --- /dev/null +++ b/x/oracle/types/query.pb.go @@ -0,0 +1,1325 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: canine_chain/oracle/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/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// QueryParamsRequest is 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_2a4eedcae49363dd, []int{0} +} +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 response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + 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_2a4eedcae49363dd, []int{1} +} +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{} +} + +type QueryFeedRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *QueryFeedRequest) Reset() { *m = QueryFeedRequest{} } +func (m *QueryFeedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFeedRequest) ProtoMessage() {} +func (*QueryFeedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2a4eedcae49363dd, []int{2} +} +func (m *QueryFeedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedRequest.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 *QueryFeedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedRequest.Merge(m, src) +} +func (m *QueryFeedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedRequest proto.InternalMessageInfo + +func (m *QueryFeedRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type QueryFeedResponse struct { + // params holds all the parameters of this module. + Feed Feed `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed"` +} + +func (m *QueryFeedResponse) Reset() { *m = QueryFeedResponse{} } +func (m *QueryFeedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFeedResponse) ProtoMessage() {} +func (*QueryFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2a4eedcae49363dd, []int{3} +} +func (m *QueryFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedResponse.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 *QueryFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedResponse.Merge(m, src) +} +func (m *QueryFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedResponse proto.InternalMessageInfo + +func (m *QueryFeedResponse) GetFeed() Feed { + if m != nil { + return m.Feed + } + return Feed{} +} + +type QueryAllFeedsRequest struct { +} + +func (m *QueryAllFeedsRequest) Reset() { *m = QueryAllFeedsRequest{} } +func (m *QueryAllFeedsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllFeedsRequest) ProtoMessage() {} +func (*QueryAllFeedsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2a4eedcae49363dd, []int{4} +} +func (m *QueryAllFeedsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllFeedsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllFeedsRequest.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 *QueryAllFeedsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllFeedsRequest.Merge(m, src) +} +func (m *QueryAllFeedsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllFeedsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllFeedsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllFeedsRequest proto.InternalMessageInfo + +type QueryAllFeedsResponse struct { + // params holds all the parameters of this module. + Feed []Feed `protobuf:"bytes,1,rep,name=feed,proto3" json:"feed"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllFeedsResponse) Reset() { *m = QueryAllFeedsResponse{} } +func (m *QueryAllFeedsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllFeedsResponse) ProtoMessage() {} +func (*QueryAllFeedsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2a4eedcae49363dd, []int{5} +} +func (m *QueryAllFeedsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllFeedsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllFeedsResponse.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 *QueryAllFeedsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllFeedsResponse.Merge(m, src) +} +func (m *QueryAllFeedsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllFeedsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllFeedsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllFeedsResponse proto.InternalMessageInfo + +func (m *QueryAllFeedsResponse) GetFeed() []Feed { + if m != nil { + return m.Feed + } + return nil +} + +func (m *QueryAllFeedsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "canine_chain.oracle.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "canine_chain.oracle.QueryParamsResponse") + proto.RegisterType((*QueryFeedRequest)(nil), "canine_chain.oracle.QueryFeedRequest") + proto.RegisterType((*QueryFeedResponse)(nil), "canine_chain.oracle.QueryFeedResponse") + proto.RegisterType((*QueryAllFeedsRequest)(nil), "canine_chain.oracle.QueryAllFeedsRequest") + proto.RegisterType((*QueryAllFeedsResponse)(nil), "canine_chain.oracle.QueryAllFeedsResponse") +} + +func init() { proto.RegisterFile("canine_chain/oracle/query.proto", fileDescriptor_2a4eedcae49363dd) } + +var fileDescriptor_2a4eedcae49363dd = []byte{ + // 490 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0xc6, 0x73, 0x6d, 0x88, 0xe0, 0x58, 0xe0, 0x1a, 0x50, 0x31, 0xc8, 0xad, 0x2c, 0x35, 0x09, + 0x15, 0xb9, 0x53, 0x5a, 0x16, 0x46, 0x3a, 0x00, 0x12, 0x0c, 0x21, 0x23, 0x0b, 0x7a, 0xed, 0x1c, + 0xae, 0xc1, 0xb9, 0x73, 0x7d, 0x0e, 0xa2, 0x42, 0x2c, 0xac, 0x2c, 0x95, 0x10, 0x5f, 0x85, 0xcf, + 0xd0, 0xb1, 0x12, 0x0b, 0x13, 0x42, 0x09, 0x1f, 0x04, 0xdd, 0x1f, 0x83, 0xdb, 0x3a, 0x4a, 0x36, + 0x2b, 0xef, 0xf3, 0x3e, 0xbf, 0xe7, 0xee, 0xb9, 0xe0, 0xad, 0x08, 0x44, 0x22, 0xf8, 0xeb, 0xe8, + 0x10, 0x12, 0xc1, 0x64, 0x0e, 0x51, 0xca, 0xd9, 0xd1, 0x94, 0xe7, 0xc7, 0x34, 0xcb, 0x65, 0x21, + 0xc9, 0x46, 0x55, 0x40, 0xad, 0xc0, 0x6b, 0xc7, 0x32, 0x96, 0x66, 0xce, 0xf4, 0x97, 0x95, 0x7a, + 0xf7, 0x62, 0x29, 0xe3, 0x94, 0x33, 0xc8, 0x12, 0x06, 0x42, 0xc8, 0x02, 0x8a, 0x44, 0x0a, 0xe5, + 0xa6, 0xbb, 0x91, 0x54, 0x13, 0xa9, 0x58, 0x08, 0xca, 0x11, 0xd8, 0xfb, 0x41, 0xc8, 0x0b, 0x18, + 0xb0, 0x0c, 0xe2, 0x44, 0x18, 0xb1, 0xd3, 0x6e, 0xd7, 0xa5, 0xca, 0x20, 0x87, 0x49, 0xe9, 0xe6, + 0xd7, 0x29, 0xde, 0x70, 0x3e, 0xb6, 0xf3, 0xa0, 0x8d, 0xc9, 0x4b, 0xcd, 0x18, 0x9a, 0xa5, 0x11, + 0x3f, 0x9a, 0x72, 0x55, 0x04, 0x43, 0xbc, 0x71, 0xee, 0x57, 0x95, 0x49, 0xa1, 0x38, 0x79, 0x84, + 0x5b, 0xd6, 0x7c, 0x13, 0x6d, 0xa3, 0xde, 0xf5, 0xbd, 0xbb, 0xb4, 0xe6, 0xd0, 0xd4, 0x2e, 0x1d, + 0x34, 0x4f, 0x7f, 0x6d, 0x35, 0x46, 0x6e, 0x21, 0xe8, 0xe0, 0x1b, 0xc6, 0xf1, 0x09, 0xe7, 0x63, + 0x47, 0x21, 0x04, 0x37, 0x05, 0x4c, 0xb8, 0x31, 0xbb, 0x36, 0x32, 0xdf, 0xc1, 0x33, 0x7c, 0xb3, + 0xa2, 0x73, 0xdc, 0x7d, 0xdc, 0xd4, 0x91, 0x1d, 0xf5, 0x4e, 0x2d, 0x55, 0x2f, 0x38, 0xa6, 0x11, + 0x07, 0xb7, 0x71, 0xdb, 0x38, 0x3d, 0x4e, 0x53, 0x3d, 0xfb, 0x77, 0xb6, 0x6f, 0x08, 0xdf, 0xba, + 0x30, 0xb8, 0x84, 0x59, 0x5f, 0x19, 0x43, 0x9e, 0x62, 0xfc, 0xbf, 0x96, 0xcd, 0x35, 0x93, 0xb0, + 0x4b, 0x6d, 0x87, 0x54, 0x77, 0x48, 0xed, 0x2b, 0x71, 0x1d, 0xd2, 0x21, 0xc4, 0xbc, 0x24, 0x8e, + 0x2a, 0xab, 0x7b, 0xdf, 0xd7, 0xf1, 0x15, 0x93, 0x8b, 0x7c, 0x41, 0xb8, 0x65, 0x2f, 0x91, 0x74, + 0x6b, 0x43, 0x5c, 0x6e, 0xcc, 0xeb, 0x2d, 0x17, 0x5a, 0x66, 0x40, 0x3f, 0xff, 0xf8, 0xf3, 0x75, + 0xad, 0x47, 0x3a, 0xec, 0x2d, 0x44, 0xef, 0x20, 0xed, 0x8f, 0x41, 0x32, 0xbb, 0xdc, 0xaf, 0x79, + 0x47, 0x3a, 0x4d, 0x53, 0x9f, 0x9a, 0xec, 0x2c, 0x46, 0x54, 0x5a, 0xf5, 0x3a, 0xcb, 0x64, 0x2e, + 0xc7, 0x43, 0x93, 0x83, 0x92, 0x07, 0xcb, 0x72, 0xe8, 0x6b, 0x56, 0xec, 0xa3, 0x7e, 0x1e, 0x9f, + 0xc8, 0x09, 0xc2, 0x57, 0xcb, 0xe2, 0xc8, 0xfd, 0xc5, 0xa8, 0x0b, 0xad, 0x7b, 0xbb, 0xab, 0x48, + 0x5d, 0xb2, 0xbe, 0x49, 0xd6, 0x25, 0x3b, 0x2b, 0x25, 0x3b, 0x78, 0x7e, 0x3a, 0xf3, 0xd1, 0xd9, + 0xcc, 0x47, 0xbf, 0x67, 0x3e, 0x3a, 0x99, 0xfb, 0x8d, 0xb3, 0xb9, 0xdf, 0xf8, 0x39, 0xf7, 0x1b, + 0xaf, 0x06, 0x71, 0x52, 0x1c, 0x4e, 0x43, 0x1a, 0xc9, 0x89, 0xb3, 0x7a, 0x01, 0xa1, 0x3a, 0x6f, + 0xf5, 0xa1, 0x34, 0x2b, 0x8e, 0x33, 0xae, 0xc2, 0x96, 0xf9, 0x5b, 0xee, 0xff, 0x0d, 0x00, 0x00, + 0xff, 0xff, 0x73, 0x5e, 0xae, 0xea, 0x70, 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 + +// 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + Feed(ctx context.Context, in *QueryFeedRequest, opts ...grpc.CallOption) (*QueryFeedResponse, error) + AllFeeds(ctx context.Context, in *QueryAllFeedsRequest, opts ...grpc.CallOption) (*QueryAllFeedsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/canine_chain.oracle.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Feed(ctx context.Context, in *QueryFeedRequest, opts ...grpc.CallOption) (*QueryFeedResponse, error) { + out := new(QueryFeedResponse) + err := c.cc.Invoke(ctx, "/canine_chain.oracle.Query/Feed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllFeeds(ctx context.Context, in *QueryAllFeedsRequest, opts ...grpc.CallOption) (*QueryAllFeedsResponse, error) { + out := new(QueryAllFeedsResponse) + err := c.cc.Invoke(ctx, "/canine_chain.oracle.Query/AllFeeds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + Feed(context.Context, *QueryFeedRequest) (*QueryFeedResponse, error) + AllFeeds(context.Context, *QueryAllFeedsRequest) (*QueryAllFeedsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Feed(ctx context.Context, req *QueryFeedRequest) (*QueryFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Feed not implemented") +} +func (*UnimplementedQueryServer) AllFeeds(ctx context.Context, req *QueryAllFeedsRequest) (*QueryAllFeedsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllFeeds not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +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: "/canine_chain.oracle.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_Feed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFeedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Feed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/canine_chain.oracle.Query/Feed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Feed(ctx, req.(*QueryFeedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllFeeds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllFeedsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllFeeds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/canine_chain.oracle.Query/AllFeeds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllFeeds(ctx, req.(*QueryAllFeedsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "canine_chain.oracle.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Feed", + Handler: _Query_Feed_Handler, + }, + { + MethodName: "AllFeeds", + Handler: _Query_AllFeeds_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "canine_chain/oracle/query.proto", +} + +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 *QueryFeedRequest) 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 *QueryFeedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedRequest) 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 *QueryFeedResponse) 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 *QueryFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Feed.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 *QueryAllFeedsRequest) 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 *QueryAllFeedsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllFeedsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllFeedsResponse) 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 *QueryAllFeedsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllFeedsResponse) 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.Feed) > 0 { + for iNdEx := len(m.Feed) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Feed[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 *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 *QueryFeedRequest) 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 *QueryFeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Feed.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllFeedsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllFeedsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Feed) > 0 { + for _, e := range m.Feed { + 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 *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 *QueryFeedRequest) 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: QueryFeedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedRequest: 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 *QueryFeedResponse) 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: QueryFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Feed", 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.Feed.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 *QueryAllFeedsRequest) 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: QueryAllFeedsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllFeedsRequest: 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 *QueryAllFeedsResponse) 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: QueryAllFeedsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllFeedsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Feed", 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.Feed = append(m.Feed, Feed{}) + if err := m.Feed[len(m.Feed)-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/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go new file mode 100644 index 000000000..4d115f3f3 --- /dev/null +++ b/x/oracle/types/query.pb.gw.go @@ -0,0 +1,319 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: canine_chain/oracle/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_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 + +} + +func request_Query_Feed_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFeedRequest + 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.Feed(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Feed_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFeedRequest + 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.Feed(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AllFeeds_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllFeedsRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllFeeds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllFeeds_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllFeedsRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllFeeds(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_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_Feed_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_Feed_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_Feed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllFeeds_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_AllFeeds_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_AllFeeds_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_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_Feed_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_Feed_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_Feed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllFeeds_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_AllFeeds_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_AllFeeds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "oracle", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Feed_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "oracle", "feeds", "name"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllFeeds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "oracle", "feeds"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Feed_0 = runtime.ForwardResponseMessage + + forward_Query_AllFeeds_0 = runtime.ForwardResponseMessage +) diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go new file mode 100644 index 000000000..ddbebf725 --- /dev/null +++ b/x/oracle/types/tx.pb.go @@ -0,0 +1,1003 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: canine_chain/oracle/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +type MsgCreateFeed struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *MsgCreateFeed) Reset() { *m = MsgCreateFeed{} } +func (m *MsgCreateFeed) String() string { return proto.CompactTextString(m) } +func (*MsgCreateFeed) ProtoMessage() {} +func (*MsgCreateFeed) Descriptor() ([]byte, []int) { + return fileDescriptor_04da893cf5a4b95a, []int{0} +} +func (m *MsgCreateFeed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateFeed.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 *MsgCreateFeed) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateFeed.Merge(m, src) +} +func (m *MsgCreateFeed) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateFeed) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateFeed.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateFeed proto.InternalMessageInfo + +func (m *MsgCreateFeed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateFeed) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type MsgCreateFeedResponse struct { +} + +func (m *MsgCreateFeedResponse) Reset() { *m = MsgCreateFeedResponse{} } +func (m *MsgCreateFeedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateFeedResponse) ProtoMessage() {} +func (*MsgCreateFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_04da893cf5a4b95a, []int{1} +} +func (m *MsgCreateFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateFeedResponse.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 *MsgCreateFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateFeedResponse.Merge(m, src) +} +func (m *MsgCreateFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateFeedResponse proto.InternalMessageInfo + +type MsgUpdateFeed struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgUpdateFeed) Reset() { *m = MsgUpdateFeed{} } +func (m *MsgUpdateFeed) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateFeed) ProtoMessage() {} +func (*MsgUpdateFeed) Descriptor() ([]byte, []int) { + return fileDescriptor_04da893cf5a4b95a, []int{2} +} +func (m *MsgUpdateFeed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateFeed.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 *MsgUpdateFeed) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateFeed.Merge(m, src) +} +func (m *MsgUpdateFeed) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateFeed) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateFeed.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateFeed proto.InternalMessageInfo + +func (m *MsgUpdateFeed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateFeed) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgUpdateFeed) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +type MsgUpdateFeedResponse struct { +} + +func (m *MsgUpdateFeedResponse) Reset() { *m = MsgUpdateFeedResponse{} } +func (m *MsgUpdateFeedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateFeedResponse) ProtoMessage() {} +func (*MsgUpdateFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_04da893cf5a4b95a, []int{3} +} +func (m *MsgUpdateFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateFeedResponse.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 *MsgUpdateFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateFeedResponse.Merge(m, src) +} +func (m *MsgUpdateFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateFeedResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateFeed)(nil), "canine_chain.oracle.MsgCreateFeed") + proto.RegisterType((*MsgCreateFeedResponse)(nil), "canine_chain.oracle.MsgCreateFeedResponse") + proto.RegisterType((*MsgUpdateFeed)(nil), "canine_chain.oracle.MsgUpdateFeed") + proto.RegisterType((*MsgUpdateFeedResponse)(nil), "canine_chain.oracle.MsgUpdateFeedResponse") +} + +func init() { proto.RegisterFile("canine_chain/oracle/tx.proto", fileDescriptor_04da893cf5a4b95a) } + +var fileDescriptor_04da893cf5a4b95a = []byte{ + // 263 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x4e, 0xcc, 0xcb, + 0xcc, 0x4b, 0x8d, 0x4f, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, + 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x46, 0x96, 0xd5, 0x83, 0xc8, 0x2a, + 0xd9, 0x72, 0xf1, 0xfa, 0x16, 0xa7, 0x3b, 0x17, 0xa5, 0x26, 0x96, 0xa4, 0xba, 0xa5, 0xa6, 0xa6, + 0x08, 0x49, 0x70, 0xb1, 0x27, 0x83, 0x78, 0xf9, 0x45, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, + 0x30, 0xae, 0x90, 0x10, 0x17, 0x4b, 0x5e, 0x62, 0x6e, 0xaa, 0x04, 0x13, 0x58, 0x18, 0xcc, 0x56, + 0x12, 0xe7, 0x12, 0x45, 0xd1, 0x1e, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0x14, 0x08, + 0x36, 0x37, 0xb4, 0x20, 0x85, 0x2c, 0x73, 0x41, 0x62, 0x29, 0x89, 0x25, 0x89, 0x12, 0xcc, 0x10, + 0x31, 0x10, 0x1b, 0x6a, 0x17, 0xc2, 0x48, 0x98, 0x5d, 0x46, 0x07, 0x19, 0xb9, 0x98, 0x7d, 0x8b, + 0xd3, 0x85, 0x62, 0xb8, 0xb8, 0x90, 0x3c, 0xa2, 0xa4, 0x87, 0xc5, 0xbf, 0x7a, 0x28, 0xae, 0x95, + 0xd2, 0x22, 0xac, 0x06, 0x66, 0x0b, 0xc8, 0x74, 0x24, 0xef, 0xe0, 0x34, 0x1d, 0xa1, 0x06, 0xb7, + 0xe9, 0x98, 0x7e, 0x70, 0xf2, 0x3e, 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, + 0xc3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xac, 0xc4, 0xe4, 0xec, + 0xc4, 0x1c, 0x9f, 0xc4, 0xa4, 0x62, 0x7d, 0x88, 0xd1, 0xba, 0x90, 0xa8, 0xae, 0x80, 0x47, 0x76, + 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xc2, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe9, + 0x04, 0x40, 0xb1, 0x10, 0x02, 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 { + CreateFeed(ctx context.Context, in *MsgCreateFeed, opts ...grpc.CallOption) (*MsgCreateFeedResponse, error) + UpdateFeed(ctx context.Context, in *MsgUpdateFeed, opts ...grpc.CallOption) (*MsgUpdateFeedResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateFeed(ctx context.Context, in *MsgCreateFeed, opts ...grpc.CallOption) (*MsgCreateFeedResponse, error) { + out := new(MsgCreateFeedResponse) + err := c.cc.Invoke(ctx, "/canine_chain.oracle.Msg/CreateFeed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateFeed(ctx context.Context, in *MsgUpdateFeed, opts ...grpc.CallOption) (*MsgUpdateFeedResponse, error) { + out := new(MsgUpdateFeedResponse) + err := c.cc.Invoke(ctx, "/canine_chain.oracle.Msg/UpdateFeed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CreateFeed(context.Context, *MsgCreateFeed) (*MsgCreateFeedResponse, error) + UpdateFeed(context.Context, *MsgUpdateFeed) (*MsgUpdateFeedResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateFeed(ctx context.Context, req *MsgCreateFeed) (*MsgCreateFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFeed not implemented") +} +func (*UnimplementedMsgServer) UpdateFeed(ctx context.Context, req *MsgUpdateFeed) (*MsgUpdateFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateFeed not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateFeed) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateFeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/canine_chain.oracle.Msg/CreateFeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateFeed(ctx, req.(*MsgCreateFeed)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateFeed) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateFeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/canine_chain.oracle.Msg/UpdateFeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateFeed(ctx, req.(*MsgUpdateFeed)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "canine_chain.oracle.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateFeed", + Handler: _Msg_CreateFeed_Handler, + }, + { + MethodName: "UpdateFeed", + Handler: _Msg_UpdateFeed_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "canine_chain/oracle/tx.proto", +} + +func (m *MsgCreateFeed) 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 *MsgCreateFeed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateFeed) 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 = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateFeedResponse) 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 *MsgCreateFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateFeed) 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 *MsgUpdateFeed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateFeedResponse) 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 *MsgUpdateFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateFeedResponse) 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 *MsgCreateFeed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateFeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateFeed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateFeedResponse) 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 *MsgCreateFeed) 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: MsgCreateFeed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateFeed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 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.Name = 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 *MsgCreateFeedResponse) 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: MsgCreateFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateFeedResponse: 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 *MsgUpdateFeed) 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: MsgUpdateFeed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateFeed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = 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 *MsgUpdateFeedResponse) 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: MsgUpdateFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateFeedResponse: 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/storage/client/cli/query.go b/x/storage/client/cli/query.go index 5b6cc98e9..307474257 100644 --- a/x/storage/client/cli/query.go +++ b/x/storage/client/cli/query.go @@ -35,10 +35,6 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdFindFile()) - cmd.AddCommand(CmdListPayBlocks()) - cmd.AddCommand(CmdShowPayBlocks()) - cmd.AddCommand(CmdListClientUsage()) - cmd.AddCommand(CmdShowClientUsage()) cmd.AddCommand(CmdListStrays()) cmd.AddCommand(CmdShowStrays()) cmd.AddCommand(CmdGetClientFreeSpace()) @@ -47,6 +43,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdShowFidCid()) cmd.AddCommand(CmdGetPayData()) + cmd.AddCommand(CmdFileUploadCheck()) + // this line is used by starport scaffolding # 1 return cmd diff --git a/x/storage/client/cli/query_file_upload_check.go b/x/storage/client/cli/query_file_upload_check.go new file mode 100644 index 000000000..809d6d7c6 --- /dev/null +++ b/x/storage/client/cli/query_file_upload_check.go @@ -0,0 +1,46 @@ +package cli + +import ( + "context" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/jackalLabs/canine-chain/x/storage/types" + "github.com/spf13/cobra" +) + +func CmdFileUploadCheck() *cobra.Command { + cmd := &cobra.Command{ + Use: "file-upload-check [address] [bytes]", + Short: "check user can upload file based on size", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + + argAddr := args[0] + argByte := args[1] + + reqByte, err := strconv.ParseInt(argByte, 10, 64) + if err != nil { + return err + } + + params := &types.QueryFileUploadCheck{ + Address: argAddr, + Bytes: reqByte, + } + + res, err := queryClient.FileUploadCheck(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/storage/client/cli/query_pay_blocks.go b/x/storage/client/cli/query_pay_blocks.go deleted file mode 100644 index b98d5c4ce..000000000 --- a/x/storage/client/cli/query_pay_blocks.go +++ /dev/null @@ -1,73 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/jackalLabs/canine-chain/x/storage/types" - "github.com/spf13/cobra" -) - -func CmdListPayBlocks() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-pay-blocks", - Short: "list all pay-blocks", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllPayBlocksRequest{ - Pagination: pageReq, - } - - res, err := queryClient.PayBlocksAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowPayBlocks() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-pay-blocks [blockid]", - Short: "shows a pay-blocks", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - argBlockid := args[0] - - params := &types.QueryPayBlockRequest{ - Blockid: argBlockid, - } - - res, err := queryClient.PayBlocks(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/storage/client/cli/query_pay_info.go b/x/storage/client/cli/query_pay_info.go new file mode 100644 index 000000000..24a9270bb --- /dev/null +++ b/x/storage/client/cli/query_pay_info.go @@ -0,0 +1,45 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/jackalLabs/canine-chain/x/storage/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdPayInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "payment-info [address]", + Short: "Query payment-info", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqAddress := args[0] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryStoragePaymentInfoRequest{ + Address: reqAddress, + } + + res, err := queryClient.StoragePaymentInfo(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/storage/client/cli/query_client_usage.go b/x/storage/client/cli/query_payment_info.go similarity index 67% rename from x/storage/client/cli/query_client_usage.go rename to x/storage/client/cli/query_payment_info.go index 13398f11d..10d762b2a 100644 --- a/x/storage/client/cli/query_client_usage.go +++ b/x/storage/client/cli/query_payment_info.go @@ -9,10 +9,10 @@ import ( "github.com/spf13/cobra" ) -func CmdListClientUsage() *cobra.Command { +func CmdListStoragePaymentInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "list-client-usage", - Short: "list all client-usage", + Use: "list-storage-payment-info", + Short: "list all storage_payment_info", RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -23,11 +23,11 @@ func CmdListClientUsage() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllClientUsageRequest{ + params := &types.QueryAllStoragePaymentInfoRequest{ Pagination: pageReq, } - res, err := queryClient.ClientUsageAll(context.Background(), params) + res, err := queryClient.StoragePaymentInfoAll(context.Background(), params) if err != nil { return err } @@ -42,10 +42,10 @@ func CmdListClientUsage() *cobra.Command { return cmd } -func CmdShowClientUsage() *cobra.Command { +func CmdShowStoragePaymentInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "show-client-usage [address]", - Short: "shows a client-usage", + Use: "show-storage-payment-info [address]", + Short: "shows a storage_payment_info", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) @@ -54,11 +54,11 @@ func CmdShowClientUsage() *cobra.Command { argAddress := args[0] - params := &types.QueryClientUsageRequest{ + params := &types.QueryStoragePaymentInfoRequest{ Address: argAddress, } - res, err := queryClient.ClientUsage(context.Background(), params) + res, err := queryClient.StoragePaymentInfo(context.Background(), params) if err != nil { return err } diff --git a/x/storage/genesis.go b/x/storage/genesis.go index 69f65ed15..d7ff9482f 100644 --- a/x/storage/genesis.go +++ b/x/storage/genesis.go @@ -21,14 +21,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.ProvidersList { k.SetProviders(ctx, elem) } - // Set all the payBlocks - for _, elem := range genState.PayBlocksList { - k.SetPayBlocks(ctx, elem) - } - // Set all the clientUsage - for _, elem := range genState.ClientUsageList { - k.SetClientUsage(ctx, elem) - } + // Set all the strays for _, elem := range genState.StraysList { k.SetStrays(ctx, elem) @@ -49,8 +42,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.ContractsList = k.GetAllContracts(ctx) genesis.ActiveDealsList = k.GetAllActiveDeals(ctx) genesis.ProvidersList = k.GetAllProviders(ctx) - genesis.PayBlocksList = k.GetAllPayBlocks(ctx) - genesis.ClientUsageList = k.GetAllClientUsage(ctx) genesis.StraysList = k.GetAllStrays(ctx) genesis.FidCidList = k.GetAllFidCid(ctx) // this line is used by starport scaffolding # genesis/module/export diff --git a/x/storage/keeper/client_usage.go b/x/storage/keeper/client_usage.go deleted file mode 100644 index 12ddca8d5..000000000 --- a/x/storage/keeper/client_usage.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/jackalLabs/canine-chain/x/storage/types" -) - -// SetClientUsage set a specific clientUsage in the store from its index -func (k Keeper) SetClientUsage(ctx sdk.Context, clientUsage types.ClientUsage) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClientUsageKeyPrefix)) - b := k.cdc.MustMarshal(&clientUsage) - store.Set(types.ClientUsageKey( - clientUsage.Address, - ), b) -} - -// GetClientUsage returns a clientUsage from its index -func (k Keeper) GetClientUsage( - ctx sdk.Context, - address string, -) (val types.ClientUsage, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClientUsageKeyPrefix)) - - b := store.Get(types.ClientUsageKey( - address, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveClientUsage removes a clientUsage from the store -func (k Keeper) RemoveClientUsage( - ctx sdk.Context, - address string, -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClientUsageKeyPrefix)) - store.Delete(types.ClientUsageKey( - address, - )) -} - -// GetAllClientUsage returns all clientUsage -func (k Keeper) GetAllClientUsage(ctx sdk.Context) (list []types.ClientUsage) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClientUsageKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.ClientUsage - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} diff --git a/x/storage/keeper/client_usage_test.go b/x/storage/keeper/client_usage_test.go deleted file mode 100644 index b60df9ef0..000000000 --- a/x/storage/keeper/client_usage_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package keeper_test - -import ( - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/jackalLabs/canine-chain/x/storage/keeper" - "github.com/jackalLabs/canine-chain/x/storage/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func createClientUsage(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.ClientUsage { - items := make([]types.ClientUsage, n) - for i := range items { - items[i].Address = strconv.Itoa(i) - items[i].Usage = strconv.Itoa(i) - - keeper.SetClientUsage(ctx, items[i]) - } - return items -} - -func (suite *KeeperTestSuite) TestGetClientUsage() { - k := suite.storageKeeper - ctx := suite.ctx - - items := createClientUsage(k, ctx, 10) - for _, item := range items { - rst, found := k.GetClientUsage(ctx, item.Address) - suite.Require().True(found) - suite.Equal(item, rst) - } -} - -func (suite *KeeperTestSuite) TestRemoveClientUsage() { - k := suite.storageKeeper - ctx := suite.ctx - - items := createClientUsage(k, ctx, 10) - for _, item := range items { - k.RemoveClientUsage(ctx, item.Address) - - rst, found := k.GetClientUsage(ctx, item.Address) - suite.Require().Empty(rst) - suite.Require().False(found) - } -} - -func (suite *KeeperTestSuite) TestGetAllClientUsage() { - k := suite.storageKeeper - ctx := suite.ctx - - items := createClientUsage(k, ctx, 10) - suite.Require().Equal(items, k.GetAllClientUsage(ctx)) -} diff --git a/x/storage/keeper/common_test.go b/x/storage/keeper/common_test.go index e27600ec5..eeec97c9e 100644 --- a/x/storage/keeper/common_test.go +++ b/x/storage/keeper/common_test.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" - storetypes "github.com/cosmos/cosmos-sdk/store/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -35,8 +34,9 @@ func setupStorageKeeper(t *testing.T) ( sdk.Context, ) { key := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - testCtx := canineglobaltestutil.DefaultContextWithDB(t, key, sdk.NewTransientStoreKey("transient_test")) + // memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + tkey := sdk.NewTransientStoreKey("transient_test") + testCtx := canineglobaltestutil.DefaultContextWithDB(t, key, tkey) ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig() @@ -57,12 +57,12 @@ func setupStorageKeeper(t *testing.T) ( paramsSubspace := typesparams.NewSubspace(encCfg.Codec, types.Amino, key, - memStoreKey, + tkey, "StorageParams", ) // storage keeper initializations - storageKeeper := keeper.NewKeeper(encCfg.Codec, key, memStoreKey, paramsSubspace, bankKeeper, accountKeeper) + storageKeeper := keeper.NewKeeper(encCfg.Codec, key, paramsSubspace, bankKeeper, accountKeeper) storageKeeper.SetParams(ctx, types.DefaultParams()) // Register all handlers for the MegServiceRouter. diff --git a/x/storage/keeper/grpc_query_client_usage.go b/x/storage/keeper/grpc_query_client_usage.go deleted file mode 100644 index 252bfb7d2..000000000 --- a/x/storage/keeper/grpc_query_client_usage.go +++ /dev/null @@ -1,56 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/jackalLabs/canine-chain/x/storage/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) ClientUsageAll(c context.Context, req *types.QueryAllClientUsageRequest) (*types.QueryAllClientUsageResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var clientUsages []types.ClientUsage - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - clientUsageStore := prefix.NewStore(store, types.KeyPrefix(types.ClientUsageKeyPrefix)) - - pageRes, err := query.Paginate(clientUsageStore, req.Pagination, func(key []byte, value []byte) error { - var clientUsage types.ClientUsage - if err := k.cdc.Unmarshal(value, &clientUsage); err != nil { - return err - } - - clientUsages = append(clientUsages, clientUsage) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllClientUsageResponse{ClientUsage: clientUsages, Pagination: pageRes}, nil -} - -func (k Keeper) ClientUsage(c context.Context, req *types.QueryClientUsageRequest) (*types.QueryClientUsageResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetClientUsage( - ctx, - req.Address, - ) - if !found { - return nil, status.Error(codes.NotFound, "not found") - } - - return &types.QueryClientUsageResponse{ClientUsage: val}, nil -} diff --git a/x/storage/keeper/grpc_query_file_upload_check.go b/x/storage/keeper/grpc_query_file_upload_check.go new file mode 100644 index 000000000..ffbd19c2b --- /dev/null +++ b/x/storage/keeper/grpc_query_file_upload_check.go @@ -0,0 +1,30 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/storage/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) FileUploadCheck(c context.Context, req *types.QueryFileUploadCheck) (*types.QueryFileUploadCheckResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + + spi, found := k.GetStoragePaymentInfo(ctx, req.Address) + + if !found { + return nil, status.Error(codes.NotFound, "address not found") + } + + if req.Bytes < 0 { + return nil, status.Error(codes.InvalidArgument, "bytes cannot be negative") + } + + return &types.QueryFileUploadCheckResponse{Valid: (spi.SpaceAvailable - spi.SpaceUsed) < req.Bytes}, nil +} diff --git a/x/storage/keeper/grpc_query_get_client_free_space.go b/x/storage/keeper/grpc_query_get_client_free_space.go index c4bc5ca51..d73bdf9b9 100644 --- a/x/storage/keeper/grpc_query_get_client_free_space.go +++ b/x/storage/keeper/grpc_query_get_client_free_space.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/jackalLabs/canine-chain/x/storage/types" @@ -17,26 +16,10 @@ func (k Keeper) GetClientFreeSpace(goCtx context.Context, req *types.QueryClient ctx := sdk.UnwrapSDKContext(goCtx) - clientUsage, found := k.GetClientUsage(ctx, req.Address) + payInfo, found := k.GetStoragePaymentInfo(ctx, req.Address) if !found { - clientUsage = types.ClientUsage{ - Address: req.Address, - Usage: "0", - } + return &types.QueryClientFreeSpaceResponse{Bytesfree: TwoGigs}, nil } - usage, ok := sdk.NewIntFromString(clientUsage.Usage) - if !ok { - return nil, fmt.Errorf("cannot parse client usage") - } - - paid, _, _ := k.GetPaidAmount(ctx, req.Address, ctx.BlockHeight()) - - if paid < usage.Int64() { - return nil, fmt.Errorf("paid amount cannot be smaller than usage") - } - - bfree := paid - usage.Int64() - - return &types.QueryClientFreeSpaceResponse{Bytesfree: fmt.Sprintf("%d", bfree)}, nil + return &types.QueryClientFreeSpaceResponse{Bytesfree: payInfo.SpaceAvailable - payInfo.SpaceUsed}, nil } diff --git a/x/storage/keeper/grpc_query_get_pay_data.go b/x/storage/keeper/grpc_query_get_pay_data.go index 726ae3989..32d45da0d 100644 --- a/x/storage/keeper/grpc_query_get_pay_data.go +++ b/x/storage/keeper/grpc_query_get_pay_data.go @@ -16,16 +16,26 @@ func (k Keeper) GetPayData(goCtx context.Context, req *types.QueryPayDataRequest ctx := sdk.UnwrapSDKContext(goCtx) - paid, _, block := k.GetPaidAmount(ctx, req.Address, ctx.BlockHeight()) - blocks := ctx.BlockHeight() - if block != nil { - bnum, ok := sdk.NewIntFromString(block.Blocknum) - if ok { - blocks = bnum.Int64() - } + paid, _ := k.GetPaidAmount(ctx, req.Address) + + payInfo, found := k.GetStoragePaymentInfo(ctx, req.Address) + if !found { + return &types.QueryPayDataResponse{TimeRemaining: -1, Bytes: TwoGigs}, nil } - blocks -= ctx.BlockHeight() + left := payInfo.End.Unix() - ctx.BlockTime().Unix() - return &types.QueryPayDataResponse{BlocksRemaining: blocks, Bytes: paid}, nil + return &types.QueryPayDataResponse{TimeRemaining: left, Bytes: paid}, nil } + +// func (k Keeper) GetStoragePayementInfoList(goCtx context.Context, req *types.QueryStoragePaymentInfoRequest) (*types.QueryStoragePaymentInfoResponse, error) { +// if req == nil { +// return nil, status.Error(codes.InvalidArgument, "invalid request") +// } +// +// ctx := sdk.UnwrapSDKContext(goCtx) +// +// info := k.GetAllStoragePaymentInfo(ctx) +// +// return &types.QueryStoragePaymentInfoResponse{PaymentInfo: info}, nil +// } diff --git a/x/storage/keeper/grpc_query_pay_blocks.go b/x/storage/keeper/grpc_query_pay_blocks.go deleted file mode 100644 index 89efd7d46..000000000 --- a/x/storage/keeper/grpc_query_pay_blocks.go +++ /dev/null @@ -1,56 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/jackalLabs/canine-chain/x/storage/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) PayBlocksAll(c context.Context, req *types.QueryAllPayBlocksRequest) (*types.QueryAllPayBlocksResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var payBlockss []types.PayBlocks - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - payBlocksStore := prefix.NewStore(store, types.KeyPrefix(types.PayBlocksKeyPrefix)) - - pageRes, err := query.Paginate(payBlocksStore, req.Pagination, func(key []byte, value []byte) error { - var payBlocks types.PayBlocks - if err := k.cdc.Unmarshal(value, &payBlocks); err != nil { - return err - } - - payBlockss = append(payBlockss, payBlocks) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllPayBlocksResponse{PayBlocks: payBlockss, Pagination: pageRes}, nil -} - -func (k Keeper) PayBlocks(c context.Context, req *types.QueryPayBlockRequest) (*types.QueryPayBlockResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetPayBlocks( - ctx, - req.Blockid, - ) - if !found { - return nil, status.Error(codes.NotFound, "not found") - } - - return &types.QueryPayBlockResponse{PayBlocks: val}, nil -} diff --git a/x/storage/keeper/grpc_query_pay_info.go b/x/storage/keeper/grpc_query_pay_info.go new file mode 100644 index 000000000..91e41c403 --- /dev/null +++ b/x/storage/keeper/grpc_query_pay_info.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "context" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/storage/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) PaymentInfo(goCtx context.Context, req *types.QueryStoragePaymentInfoRequest) (*types.QueryStoragePaymentInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + payInfo, found := k.GetStoragePaymentInfo(ctx, req.Address) + if !found { + t := types.StoragePaymentInfo{ + Start: time.UnixMicro(0), + End: time.UnixMicro(0), + Address: req.Address, + SpaceUsed: 0, + SpaceAvailable: TwoGigs, + } + return &types.QueryStoragePaymentInfoResponse{ + StoragePaymentInfo: t, + }, nil + } + + return &types.QueryStoragePaymentInfoResponse{ + StoragePaymentInfo: payInfo, + }, nil +} diff --git a/x/storage/keeper/grpc_query_payment_info.go b/x/storage/keeper/grpc_query_payment_info.go new file mode 100644 index 000000000..d08d0be88 --- /dev/null +++ b/x/storage/keeper/grpc_query_payment_info.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/jackalLabs/canine-chain/x/storage/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) StoragePaymentInfoAll(c context.Context, req *types.QueryAllStoragePaymentInfoRequest) (*types.QueryAllStoragePaymentInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var storagePaymentInfos []types.StoragePaymentInfo + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + storagePaymentStore := prefix.NewStore(store, types.KeyPrefix(types.StoragePaymentInfoKeyPrefix)) + + pageRes, err := query.Paginate(storagePaymentStore, req.Pagination, func(key []byte, value []byte) error { + var storagePaymentInfo types.StoragePaymentInfo + if err := k.cdc.Unmarshal(value, &storagePaymentInfo); err != nil { + return err + } + + storagePaymentInfos = append(storagePaymentInfos, storagePaymentInfo) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllStoragePaymentInfoResponse{StoragePaymentInfo: storagePaymentInfos, Pagination: pageRes}, nil +} + +func (k Keeper) StoragePaymentInfo(c context.Context, req *types.QueryStoragePaymentInfoRequest) (*types.QueryStoragePaymentInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetStoragePaymentInfo( + ctx, + req.Address, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryStoragePaymentInfoResponse{StoragePaymentInfo: val}, nil +} diff --git a/x/storage/keeper/keeper.go b/x/storage/keeper/keeper.go index 6e3440f34..7208a6ac9 100644 --- a/x/storage/keeper/keeper.go +++ b/x/storage/keeper/keeper.go @@ -15,7 +15,6 @@ type ( Keeper struct { cdc codec.BinaryCodec storeKey sdk.StoreKey - memKey sdk.StoreKey paramstore paramtypes.Subspace bankkeeper types.BankKeeper accountkeeper types.AccountKeeper @@ -24,8 +23,7 @@ type ( func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey sdk.StoreKey, + storeKey sdk.StoreKey, ps paramtypes.Subspace, bankkeeper types.BankKeeper, accountkeeper types.AccountKeeper, @@ -38,7 +36,6 @@ func NewKeeper( return &Keeper{ cdc: cdc, storeKey: storeKey, - memKey: memKey, paramstore: ps, bankkeeper: bankkeeper, accountkeeper: accountkeeper, diff --git a/x/storage/keeper/migrations.go b/x/storage/keeper/migrations.go new file mode 100644 index 000000000..370161f5c --- /dev/null +++ b/x/storage/keeper/migrations.go @@ -0,0 +1,25 @@ +package keeper + +// DONTCOVER + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v2 "github.com/jackalLabs/canine-chain/x/storage/legacy/v2" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + k Keeper +} + +// NewMigrator returns a new Migrator +func NewMigrator(keeper Keeper) Migrator { + return Migrator{ + k: keeper, + } +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, &m.k.paramstore) +} diff --git a/x/storage/keeper/msg_server_buy_storage.go b/x/storage/keeper/msg_server_buy_storage.go index fa3146a7c..df5236527 100644 --- a/x/storage/keeper/msg_server_buy_storage.go +++ b/x/storage/keeper/msg_server_buy_storage.go @@ -3,6 +3,8 @@ package keeper import ( "context" "fmt" + "strconv" + "time" sdk "github.com/cosmos/cosmos-sdk/types" sdkerr "github.com/cosmos/cosmos-sdk/types/errors" @@ -13,14 +15,18 @@ import ( func (k msgServer) BuyStorage(goCtx context.Context, msg *types.MsgBuyStorage) (*types.MsgBuyStorageResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - duration, ok := sdk.NewIntFromString(msg.Duration) - if !ok { - return nil, fmt.Errorf("duration can't be parsed") + duration, err := time.ParseDuration(msg.Duration) + if err != nil { + return nil, fmt.Errorf("duration can't be parsed: %s", err.Error()) } - bytes, ok := sdk.NewIntFromString(msg.Bytes) - if !ok { - return nil, fmt.Errorf("bytes can't be parsed") + // Truncate duration into hours + dh := time.Hour + duration = duration.Truncate(dh) + + bytes, err := strconv.ParseInt(msg.Bytes, 10, 64) + if err != nil { + return nil, fmt.Errorf("bytes can't be parsed: %s", err.Error()) } denom := msg.PaymentDenom @@ -28,21 +34,24 @@ func (k msgServer) BuyStorage(goCtx context.Context, msg *types.MsgBuyStorage) ( return nil, sdkerr.Wrap(sdkerr.ErrInvalidCoins, "cannot pay with anything other than ujkl") } - var gb int64 = 1000000000 + const gb int64 = 1000000000 - gbs := bytes.Int64() / gb - if gbs == 0 { + gbs := bytes / gb + if gbs <= 0 { return nil, fmt.Errorf("cannot buy less than a gb") } - monthInBlocks := 432000 - dr := duration.Int64() - (duration.Int64() % int64(monthInBlocks)) - - if dr <= 0 { - return nil, fmt.Errorf("cannot buy less than a month") + const hoursInMonth = time.Hour * 720 + if duration <= hoursInMonth { + return nil, fmt.Errorf("cannot buy less than a month(720h)") } - price := sdk.NewCoin(denom, sdk.NewInt(gbs*4000*(dr/int64(monthInBlocks)))) + // Truncate month + dm := duration.Truncate(hoursInMonth) + + cost := gbs * 4000 * int64(dm/hoursInMonth) + + price := sdk.NewCoin(denom, sdk.NewInt(cost)) add, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return nil, err @@ -52,16 +61,48 @@ func (k msgServer) BuyStorage(goCtx context.Context, msg *types.MsgBuyStorage) ( return nil, err } - _, err = sdk.AccAddressFromBech32(msg.ForAddress) + deposit, err := sdk.AccAddressFromBech32(k.GetParams(ctx).DepositAccount) if err != nil { return nil, err } - err = k.CreatePayBlock(ctx, msg.ForAddress, dr, bytes.Int64()) + err = k.bankkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, deposit, sdk.NewCoins(price)) + if err != nil { + return nil, err + } + _, err = sdk.AccAddressFromBech32(msg.ForAddress) if err != nil { return nil, err } + var spi types.StoragePaymentInfo + + payInfo, found := k.GetStoragePaymentInfo(ctx, msg.ForAddress) + if found { + + if payInfo.SpaceUsed > bytes { + return nil, fmt.Errorf("cannot buy less than your current gb usage") + } + + spi = types.StoragePaymentInfo{ + Start: ctx.BlockTime(), + End: ctx.BlockTime().Add(dm), + SpaceAvailable: bytes, + SpaceUsed: payInfo.SpaceUsed, + Address: msg.ForAddress, + } + } else { + spi = types.StoragePaymentInfo{ + Start: ctx.BlockTime(), + End: ctx.BlockTime().Add(dm), + SpaceAvailable: bytes, + SpaceUsed: 0, + Address: msg.ForAddress, + } + } + + k.SetStoragePaymentInfo(ctx, spi) + return &types.MsgBuyStorageResponse{}, nil } diff --git a/x/storage/keeper/msg_server_buy_storage_test.go b/x/storage/keeper/msg_server_buy_storage_test.go index d775a64b9..1a238cba6 100644 --- a/x/storage/keeper/msg_server_buy_storage_test.go +++ b/x/storage/keeper/msg_server_buy_storage_test.go @@ -7,7 +7,7 @@ import ( func (suite *KeeperTestSuite) TestBuyStorage() { suite.SetupSuite() - msgSrvr, _, ctx := setupMsgServer(suite) + msgSrvr, k, ctx := setupMsgServer(suite) // Create test account testAccount, err := sdk.AccAddressFromBech32("cosmos17j2hkm7n9fz9dpntyj2kxgxy5pthzd289nvlfl") @@ -16,6 +16,17 @@ func (suite *KeeperTestSuite) TestBuyStorage() { err = suite.bankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, testAccount, coins) suite.Require().NoError(err) + suite.storageKeeper.SetParams(suite.ctx, types.Params{ + DepositAccount: testAccount.String(), + }) + + // Set user current SpaceUsed to 5GB + initialPayInfo := types.StoragePaymentInfo{ + SpaceUsed: 5000000000, + Address: testAccount.String(), + } + k.SetStoragePaymentInfo(suite.ctx, initialPayInfo) + cases := []struct { testName string msg types.MsgBuyStorage @@ -23,12 +34,24 @@ func (suite *KeeperTestSuite) TestBuyStorage() { expErrMsg string }{ { - testName: "buy 2gb for 1 month", + testName: "buy 3gb which is less than current usage of 5gb", + msg: types.MsgBuyStorage{ + Creator: testAccount.String(), + ForAddress: testAccount.String(), + Duration: "1440h", + Bytes: "3000000000", + PaymentDenom: "ujkl", + }, + expErr: true, + expErrMsg: "cannot buy less than your current gb usage", + }, + { + testName: "buy 6gb for 1 month", msg: types.MsgBuyStorage{ Creator: testAccount.String(), ForAddress: testAccount.String(), - Duration: "432000", - Bytes: "2000000000", + Duration: "1440h", + Bytes: "6000000000", PaymentDenom: "ujkl", }, expErr: false, @@ -39,8 +62,8 @@ func (suite *KeeperTestSuite) TestBuyStorage() { msg: types.MsgBuyStorage{ Creator: testAccount.String(), ForAddress: testAccount.String(), - Duration: "432000", - Bytes: "12345", + Duration: "1440h", + Bytes: "-1", PaymentDenom: "ujkl", }, expErr: true, @@ -51,7 +74,7 @@ func (suite *KeeperTestSuite) TestBuyStorage() { msg: types.MsgBuyStorage{ Creator: testAccount.String(), ForAddress: testAccount.String(), - Duration: "431999", + Duration: "1h", Bytes: "1000000000", PaymentDenom: "ujkl", }, @@ -64,7 +87,7 @@ func (suite *KeeperTestSuite) TestBuyStorage() { msg: types.MsgBuyStorage{ Creator: testAccount.String(), ForAddress: testAccount.String(), - Duration: "432000", + Duration: "400000h", Bytes: "1000000000", PaymentDenom: "uatom", }, @@ -76,7 +99,7 @@ func (suite *KeeperTestSuite) TestBuyStorage() { msg: types.MsgBuyStorage{ Creator: "invalid_address", ForAddress: testAccount.String(), - Duration: "432000", + Duration: "400000h", Bytes: "1000000000", PaymentDenom: "ujkl", }, @@ -88,7 +111,7 @@ func (suite *KeeperTestSuite) TestBuyStorage() { msg: types.MsgBuyStorage{ Creator: testAccount.String(), ForAddress: "invalid_address", - Duration: "432000", + Duration: "432000h", Bytes: "1000000000", PaymentDenom: "ujkl", }, @@ -101,7 +124,7 @@ func (suite *KeeperTestSuite) TestBuyStorage() { suite.Run(tc.testName, func() { _, err := msgSrvr.BuyStorage(ctx, &tc.msg) if tc.expErr { - suite.Require().EqualError(err, tc.expErrMsg) + suite.Require().Contains(err.Error(), tc.expErrMsg) } else { suite.Require().NoError(err) } diff --git a/x/storage/keeper/msg_server_contracts_test.go b/x/storage/keeper/msg_server_contracts_test.go index b6eb72980..fd03d3a15 100644 --- a/x/storage/keeper/msg_server_contracts_test.go +++ b/x/storage/keeper/msg_server_contracts_test.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/jackalLabs/canine-chain/x/storage/keeper" @@ -116,23 +117,26 @@ func (suite *KeeperTestSuite) TestPostContracts() { Address: creator.String(), Ip: "123.0.0.0", Totalspace: "1000000000000000", - BurnedContracts: "", + BurnedContracts: "0", Creator: creator.String(), } sKeeper.SetProviders(suite.ctx, p) // start free two gig trial suite.ctx = suite.ctx.WithBlockHeight(0) - err := sKeeper.CreatePayBlock(suite.ctx, buyer.String(), 1, 0) - suite.Require().NoError(err) - sKeeper.SetClientUsage(suite.ctx, types.ClientUsage{ - Usage: "1900000000", - Address: buyer.String(), - }) + info := types.StoragePaymentInfo{ + SpaceUsed: 1900000000, + SpaceAvailable: 2000000000, + Address: buyer.String(), + Start: time.Now().Add(-10), + End: time.Now().Add(50), + } + sKeeper.SetStoragePaymentInfo(suite.ctx, info) + return &types.MsgPostContract{ Creator: creator.String(), Merkle: "1", - Signee: "1", - Filesize: "20000000000", + Signee: buyer.String(), + Filesize: "1000000000", Fid: "1", } }, @@ -145,12 +149,10 @@ func (suite *KeeperTestSuite) TestPostContracts() { preRun: func() *types.MsgPostContract { // Start free trial suite.ctx = suite.ctx.WithBlockHeight(0) - err := sKeeper.CreatePayBlock(suite.ctx, buyer.String(), 100, 100000000) - suite.Require().NoError(err) + // end free trial and create "not paid" condition suite.ctx = suite.ctx.WithBlockHeight(100) - err = sKeeper.CreatePayBlock(suite.ctx, buyer.String(), 100000, 0) - suite.Require().NoError(err) + suite.ctx = suite.ctx.WithBlockHeight(500) goCtx = sdk.WrapSDKContext(suite.ctx) return &types.MsgPostContract{ @@ -161,14 +163,12 @@ func (suite *KeeperTestSuite) TestPostContracts() { Fid: "1", } }, - expErr: true, - expErrMsg: "user has not paid for any storage", + expErr: false, }, { name: "successful_post_contract", preRun: func() *types.MsgPostContract { - err := sKeeper.CreatePayBlock(suite.ctx, buyer.String(), 100000, 10000000000) suite.Require().NoError(err) return &types.MsgPostContract{ Creator: creator.String(), @@ -249,6 +249,7 @@ func (suite *KeeperTestSuite) TestSignContract() { { name: "invalid_permission_to_sign_contract", preRun: func() *types.MsgSignContract { + // creating a test contract to sign c := types.Contracts{ Cid: "123", Creator: provider.String(), @@ -271,10 +272,66 @@ func (suite *KeeperTestSuite) TestSignContract() { expErr: true, expErrMsg: "you do not have permission to approve this contract", }, - + { + name: "not enough storage", + preRun: func() *types.MsgSignContract { + // create a test StoragePaymentInfo + spi := types.StoragePaymentInfo{ + SpaceAvailable: 200_000_000, + SpaceUsed: 200_000_000, + Address: user.String(), + } + sKeeper.SetStoragePaymentInfo(suite.ctx, spi) + _, found := sKeeper.GetStoragePaymentInfo(suite.ctx, user.String()) + suite.Require().True(found) + return &types.MsgSignContract{ + Cid: "123", + Creator: user.String(), + } + }, + expErr: true, + expErrMsg: "not enough storage space", + postRun: func() { + sKeeper.RemoveStoragePaymentInfo(suite.ctx, user.String()) + }, + }, + { + name: "expired storage subscription", + preRun: func() *types.MsgSignContract { + // create a test StoragePaymentInfo + spi := types.StoragePaymentInfo{ + SpaceAvailable: 200_000_000, + SpaceUsed: 0, + // set expiration date to yesterday + End: time.Now().AddDate(0, -1, 0), + Address: user.String(), + } + sKeeper.SetStoragePaymentInfo(suite.ctx, spi) + _, found := sKeeper.GetStoragePaymentInfo(suite.ctx, user.String()) + suite.Require().True(found) + return &types.MsgSignContract{ + Cid: "123", + Creator: user.String(), + } + }, + expErr: true, + expErrMsg: "storage subscription has expired", + postRun: func() { + sKeeper.RemoveStoragePaymentInfo(suite.ctx, user.String()) + }, + }, { name: "successful_contract_signed", preRun: func() *types.MsgSignContract { + spi := types.StoragePaymentInfo{ + SpaceAvailable: 200_000_000, + SpaceUsed: 0, + End: time.Now().AddDate(0, 10, 0), + Address: user.String(), + } + sKeeper.SetStoragePaymentInfo(suite.ctx, spi) + _, found := sKeeper.GetStoragePaymentInfo(suite.ctx, user.String()) + suite.Require().True(found) return &types.MsgSignContract{ Cid: "123", Creator: user.String(), @@ -436,7 +493,6 @@ func (suite *KeeperTestSuite) TestCancelContract() { suite.Require().NoError(err) cids := []string{dcid} - fmt.Println(dcid) d := types.ActiveDeals{ Cid: dcid, @@ -488,11 +544,6 @@ func (suite *KeeperTestSuite) TestCancelContract() { suite.Require().NoError(err) - deals := sKeeper.GetAllActiveDeals(suite.ctx) - for _, v := range deals { - fmt.Println(v) - } - return &types.MsgCancelContract{ Creator: user.String(), Cid: right, @@ -515,7 +566,6 @@ func (suite *KeeperTestSuite) TestCancelContract() { suite.Require().NoError(err) cids := []string{dcid} - fmt.Println(dcid) d := types.ActiveDeals{ Cid: dcid, @@ -567,11 +617,6 @@ func (suite *KeeperTestSuite) TestCancelContract() { suite.Require().NoError(err) - deals := sKeeper.GetAllActiveDeals(suite.ctx) - for _, v := range deals { - fmt.Println(v) - } - return &types.MsgCancelContract{ Creator: user.String(), Cid: d.Cid, @@ -593,7 +638,6 @@ func (suite *KeeperTestSuite) TestCancelContract() { suite.Require().NoError(err) cids := []string{dcid} - fmt.Println(dcid) d := types.Strays{ Cid: dcid, @@ -642,11 +686,6 @@ func (suite *KeeperTestSuite) TestCancelContract() { suite.Require().NoError(err) - deals := sKeeper.GetAllStrays(suite.ctx) - for _, v := range deals { - fmt.Println(v) - } - return &types.MsgCancelContract{ Creator: user.String(), Cid: d.Cid, diff --git a/x/storage/keeper/msg_server_post_contract.go b/x/storage/keeper/msg_server_post_contract.go index 7d97a1ee8..cf90b5394 100644 --- a/x/storage/keeper/msg_server_post_contract.go +++ b/x/storage/keeper/msg_server_post_contract.go @@ -36,32 +36,20 @@ func (k msgServer) PostContract(goCtx context.Context, msg *types.MsgPostContrac return nil, fmt.Errorf("not enough space on provider") } - paidAMT, _, _ := k.GetPaidAmount(ctx, msg.Signee, ctx.BlockHeight()) - - if paidAMT <= 0 { - return nil, fmt.Errorf("user has not paid for any storage") - } - - usage, found := k.GetClientUsage(ctx, msg.Signee) - if !found { - usage = types.ClientUsage{ - Usage: "0", - Address: msg.Signee, - } - } - - bytesUsed, ok := sdk.NewIntFromString(usage.Usage) - if !ok { - return nil, fmt.Errorf("failed to parse usage") - } - filesize, ok := sdk.NewIntFromString(msg.Filesize) if !ok { return nil, fmt.Errorf("cannot parse filesize") } - if bytesUsed.Int64()+filesize.Int64() > paidAMT { - return nil, fmt.Errorf("not enough storage on the users account") + payInfo, found := k.GetStoragePaymentInfo(ctx, msg.Signee) + if !found { + if filesize.Int64() > TwoGigs { + return nil, fmt.Errorf("cannot save files greater than 2gb on a free plan") + } + } else { + if payInfo.SpaceUsed+filesize.Int64() > payInfo.SpaceAvailable { + return nil, fmt.Errorf("not enough storage on the users account") + } } h := sha256.New() diff --git a/x/storage/keeper/msg_server_proofs_test.go b/x/storage/keeper/msg_server_proofs_test.go index daa0c23ff..101f14e6b 100644 --- a/x/storage/keeper/msg_server_proofs_test.go +++ b/x/storage/keeper/msg_server_proofs_test.go @@ -80,11 +80,11 @@ func CreateMerkleForProof(file TestFile) (string, string, error) { verified, err := merkletree.VerifyProof(ditem, proof, k) if err != nil { - fmt.Printf("%v\n", err) + return "", "", err } if !verified { - fmt.Printf("%s\n", "Cannot verify") + return "", "", types.ErrCannotVerifyProof } return fmt.Sprintf("%x", item), string(jproof), nil @@ -92,10 +92,9 @@ func CreateMerkleForProof(file TestFile) (string, string, error) { func makeContract(file TestFile) (string, string, error) { f := []byte(file.Data) - size := 0 var list [][]byte - size += len(f) + size := len(f) h := sha256.New() _, err := io.WriteString(h, fmt.Sprintf("%d%x", 0, f)) @@ -108,7 +107,7 @@ func makeContract(file TestFile) (string, string, error) { t, err := merkletree.New(list) if err != nil { - fmt.Printf("%v\n", err) + return "", "", err } return hex.EncodeToString(t.Root()), fmt.Sprintf("%d", size), nil @@ -130,7 +129,7 @@ func (suite *KeeperTestSuite) TestPostProof() { // Init Provider _, err = msgSrvr.InitProvider(context, &types.MsgInitProvider{ Creator: testProvider.String(), - Ip: "198.0.0.1", + Ip: "192.168.0.1", Totalspace: "1_000_000", }) suite.Require().NoError(err) @@ -139,6 +138,10 @@ func (suite *KeeperTestSuite) TestPostProof() { merkleroot, filesize, err := makeContract(originalFile) suite.Require().NoError(err) + suite.Require().Equal("11", filesize) + + _, found := keeper.GetStoragePaymentInfo(suite.ctx, user.String()) + suite.Require().Equal(false, found) // Post Contract _, err = msgSrvr.PostContract(context, &types.MsgPostContract{ Creator: testProvider.String(), diff --git a/x/storage/keeper/msg_server_sign_contract.go b/x/storage/keeper/msg_server_sign_contract.go index d26f33c3b..8d4001f54 100644 --- a/x/storage/keeper/msg_server_sign_contract.go +++ b/x/storage/keeper/msg_server_sign_contract.go @@ -51,22 +51,26 @@ func (k msgServer) SignContract(goCtx context.Context, msg *types.MsgSignContrac Fid: contract.Fid, } - usage, found := k.GetClientUsage(ctx, msg.Creator) - if !found { - usage = types.ClientUsage{ - Address: msg.Creator, - Usage: "0", - } - } - - used, ok := sdk.NewIntFromString(usage.Usage) + fsize, ok := sdk.NewIntFromString(contract.Filesize) if !ok { - return nil, fmt.Errorf("cannot parse usage") + return nil, fmt.Errorf("cannot parse file size") + } + payInfo, found := k.GetStoragePaymentInfo(ctx, msg.Creator) + if found { + // check if user has any free space + if payInfo.SpaceUsed+fsize.Int64() > payInfo.SpaceAvailable { + return nil, fmt.Errorf("not enough storage space") + } + // check if storage subscription still active + if payInfo.End.Before(ctx.BlockTime()) { + return nil, fmt.Errorf("storage subscription has expired") + } } + // we going to need an else statement to check for the free trial storage since they wont have payInfo - usage.Usage = fmt.Sprintf("%d", used.Int64()+size.Int64()) + payInfo.SpaceUsed += fsize.Int64() - k.SetClientUsage(ctx, usage) + k.SetStoragePaymentInfo(ctx, payInfo) k.SetActiveDeals(ctx, deal) k.RemoveContracts(ctx, contract.Cid) diff --git a/x/storage/keeper/params.go b/x/storage/keeper/params.go index 92d474a38..0364a929c 100644 --- a/x/storage/keeper/params.go +++ b/x/storage/keeper/params.go @@ -6,8 +6,9 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + k.paramstore.GetParamSet(ctx, &p) + return } // SetParams set the params diff --git a/x/storage/keeper/pay_blocks.go b/x/storage/keeper/pay_blocks.go deleted file mode 100644 index 4ab8d903f..000000000 --- a/x/storage/keeper/pay_blocks.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/jackalLabs/canine-chain/x/storage/types" -) - -// SetPayBlocks set a specific payBlocks in the store from its index -func (k Keeper) SetPayBlocks(ctx sdk.Context, payBlocks types.PayBlocks) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PayBlocksKeyPrefix)) - b := k.cdc.MustMarshal(&payBlocks) - store.Set(types.PayBlocksKey( - payBlocks.Blockid, - ), b) -} - -// GetPayBlocks returns a payBlocks from its index -func (k Keeper) GetPayBlocks( - ctx sdk.Context, - blockid string, -) (val types.PayBlocks, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PayBlocksKeyPrefix)) - - b := store.Get(types.PayBlocksKey( - blockid, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemovePayBlocks removes a payBlocks from the store -func (k Keeper) RemovePayBlocks( - ctx sdk.Context, - blockid string, -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PayBlocksKeyPrefix)) - store.Delete(types.PayBlocksKey( - blockid, - )) -} - -// GetAllPayBlocks returns all payBlocks -func (k Keeper) GetAllPayBlocks(ctx sdk.Context) (list []types.PayBlocks) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PayBlocksKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.PayBlocks - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} diff --git a/x/storage/keeper/pay_blocks_test.go b/x/storage/keeper/pay_blocks_test.go deleted file mode 100644 index 42af1d4b8..000000000 --- a/x/storage/keeper/pay_blocks_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper_test - -import ( - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/jackalLabs/canine-chain/x/storage/keeper" - "github.com/jackalLabs/canine-chain/x/storage/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func createPayBlocks(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.PayBlocks { - items := make([]types.PayBlocks, n) - for i := range items { - items[i].Blockid = strconv.Itoa(i) - items[i].Bytes = strconv.Itoa(i) - items[i].Blocktype = strconv.Itoa(i) - items[i].Blocknum = strconv.Itoa(i) - - keeper.SetPayBlocks(ctx, items[i]) - } - return items -} - -func (suite *KeeperTestSuite) TestGetPayBlocks() { - k := suite.storageKeeper - ctx := suite.ctx - - items := createPayBlocks(k, ctx, 10) - for _, item := range items { - rst, found := k.GetPayBlocks(ctx, item.Blockid) - suite.Require().True(found) - suite.Equal(item, rst) - } -} - -func (suite *KeeperTestSuite) TestRemovePayBlocks() { - k := suite.storageKeeper - ctx := suite.ctx - - items := createPayBlocks(k, ctx, 10) - for _, item := range items { - k.RemovePayBlocks(ctx, item.Blockid) - - rst, found := k.GetPayBlocks(ctx, item.Blockid) - suite.Require().Empty(rst) - suite.Require().False(found) - } -} - -func (suite *KeeperTestSuite) TestGetAllPayBlocks() { - k := suite.storageKeeper - ctx := suite.ctx - - items := createPayBlocks(k, ctx, 10) - suite.Require().Equal(items, k.GetAllPayBlocks(ctx)) -} diff --git a/x/storage/keeper/paymen_info_test.go b/x/storage/keeper/paymen_info_test.go new file mode 100644 index 000000000..9ac371946 --- /dev/null +++ b/x/storage/keeper/paymen_info_test.go @@ -0,0 +1,56 @@ +package keeper_test + +import ( + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/storage/keeper" + "github.com/jackalLabs/canine-chain/x/storage/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createStoragePaymentInfo(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.StoragePaymentInfo { + items := make([]types.StoragePaymentInfo, n) + for i := range items { + items[i].Address = strconv.Itoa(i) + keeper.SetStoragePaymentInfo(ctx, items[i]) + } + return items +} + +func (suite *KeeperTestSuite) TestGetStoragePaymentInfo() { + k := suite.storageKeeper + ctx := suite.ctx + + items := createStoragePaymentInfo(k, ctx, 10) + for _, item := range items { + rst, found := k.GetStoragePaymentInfo(ctx, item.Address) + suite.Require().True(found) + suite.Equal(item, rst) + } +} + +func (suite *KeeperTestSuite) TestRemoveStoragePaymentInfo() { + k := suite.storageKeeper + ctx := suite.ctx + + items := createStoragePaymentInfo(k, ctx, 10) + for _, item := range items { + k.RemoveStoragePaymentInfo(ctx, item.Address) + + rst, found := k.GetStoragePaymentInfo(ctx, item.Address) + suite.Require().Empty(rst) + suite.Require().False(found) + } +} + +// fix this last test boi! +func (suite *KeeperTestSuite) TestGetAllStoragePaymentInfo() { + k := suite.storageKeeper + ctx := suite.ctx + + items := createStoragePaymentInfo(k, ctx, 10) + suite.Require().Equal(items, k.GetAllStoragePaymentInfo(ctx)) +} diff --git a/x/storage/keeper/payment_info.go b/x/storage/keeper/payment_info.go new file mode 100644 index 000000000..b0f3bc5aa --- /dev/null +++ b/x/storage/keeper/payment_info.go @@ -0,0 +1,61 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/jackalLabs/canine-chain/x/storage/types" +) + +// SetStoragePaymentInfo set a specific payBlocks in the store from its x +func (k Keeper) SetStoragePaymentInfo(ctx sdk.Context, payInfo types.StoragePaymentInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StoragePaymentInfoKeyPrefix)) + b := k.cdc.MustMarshal(&payInfo) + store.Set(types.StoragePaymentInfoKey( + payInfo.Address, + ), b) +} + +// GetStoragePaymentInfo returns StoragePaymentInfo from its address +func (k Keeper) GetStoragePaymentInfo( + ctx sdk.Context, + address string, +) (val types.StoragePaymentInfo, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StoragePaymentInfoKeyPrefix)) + + b := store.Get(types.StoragePaymentInfoKey( + address, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveStoragePaymentInfo removes a StoragePaymentInfo from the store +func (k Keeper) RemoveStoragePaymentInfo( + ctx sdk.Context, + address string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StoragePaymentInfoKeyPrefix)) + store.Delete(types.StoragePaymentInfoKey( + address, + )) +} + +// GetAllStoragePaymentInfo returns all payBlocks +func (k Keeper) GetAllStoragePaymentInfo(ctx sdk.Context) (list []types.StoragePaymentInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StoragePaymentInfoKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StoragePaymentInfo + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/storage/keeper/rewards.go b/x/storage/keeper/rewards.go index db68e0656..f1dedd801 100644 --- a/x/storage/keeper/rewards.go +++ b/x/storage/keeper/rewards.go @@ -46,7 +46,7 @@ func (k Keeper) manageDealReward(ctx sdk.Context, deal types.ActiveDeals, networ d := totalSize.TruncateInt().Int64() / fchunks if d > 0 { - iprove = (iprove + ctx.BlockHeight()*int64(byteHash)) % d + iprove = (int64(byteHash) + int64(ctx.BlockGasMeter().GasConsumed())) % d } deal.Blocktoprove = fmt.Sprintf("%d", iprove) diff --git a/x/storage/keeper/utils.go b/x/storage/keeper/utils.go index e7ca60ba3..367f1098a 100644 --- a/x/storage/keeper/utils.go +++ b/x/storage/keeper/utils.go @@ -1,18 +1,13 @@ package keeper import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/jackalLabs/canine-chain/x/storage/types" ) const ( - StartBlockType = "start" - EndBlockType = "end" - TwoGigs = 2000000000 + TwoGigs = 2000000000 ) func MakeFid(data []byte) (string, error) { @@ -23,117 +18,16 @@ func MakeCid(data []byte) (string, error) { return bech32.ConvertAndEncode(types.CidPrefix, data) } -func (k Keeper) GetPaidAmount(ctx sdk.Context, address string, blockh int64) (int64, bool, *types.PayBlocks) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PayBlocksKeyPrefix)) - - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - var highestBlock int64 - - eblock, found := k.GetPayBlocks(ctx, fmt.Sprintf(".%s", address)) +func (k Keeper) GetPaidAmount(ctx sdk.Context, address string) (int64, bool) { + payInfo, found := k.GetStoragePaymentInfo( + ctx, + address, + ) if !found { - return TwoGigs, true, nil - } - - endblock, ok := sdk.NewIntFromString(eblock.Blocknum) - if !ok { - return TwoGigs, true, nil + return TwoGigs, true } - if endblock.Int64() <= blockh { - // one month grace period - if blockh-endblock.Int64() <= 432000 { - bytes, ok := sdk.NewIntFromString(eblock.Bytes) - if ok { - return bytes.Int64(), true, nil - } - } - return TwoGigs, true, &eblock - } - - highestBlock = 0 - - // Look for highest start block - for ; iterator.Valid(); iterator.Next() { - var val types.PayBlocks - k.cdc.MustUnmarshal(iterator.Value(), &val) - - ctx.Logger().Debug("BLOCK %s: %s", val.Blocktype, val.Blocknum) - - if val.Blocktype == EndBlockType { - continue - } - - adr := val.Blockid[:len(address)] - if adr != address { - continue - } - - blocknum, ok := sdk.NewIntFromString(val.Blocknum) - if !ok { - continue - } - - if blocknum.Int64() > blockh { - continue - } - - if blocknum.Int64() > highestBlock { - highestBlock = blocknum.Int64() - ctx.Logger().Debug(fmt.Sprintf("NEW HIGHEST BLOCK: %s", val.Blocknum)) - } - - } - - if highestBlock == 0 { - return TwoGigs, true, &eblock - } - - hblock, found := k.GetPayBlocks(ctx, fmt.Sprintf("%s%d", address, highestBlock)) - if !found { - return TwoGigs, true, &eblock - } - - bytes, ok := sdk.NewIntFromString(hblock.Bytes) - if !ok { - return TwoGigs, true, &eblock - } - - return bytes.Int64(), false, &eblock -} - -func (k Keeper) CreatePayBlock(ctx sdk.Context, address string, length int64, bytes int64) error { - startBlock := ctx.BlockHeight() - - endBlock := startBlock + length - - sBlock := types.PayBlocks{ - Blockid: fmt.Sprintf("%s%d", address, startBlock), - Bytes: fmt.Sprintf("%d", bytes), - Blocktype: StartBlockType, - Blocknum: fmt.Sprintf("%d", startBlock), - } - - eBlock := types.PayBlocks{ - Blockid: fmt.Sprintf(".%s", address), - Bytes: fmt.Sprintf("%d", bytes), - Blocktype: EndBlockType, - Blocknum: fmt.Sprintf("%d", endBlock), - } - - amount, trial, _ := k.GetPaidAmount(ctx, address, startBlock) - - if !trial && bytes <= amount { // Not in trial and new storage space is - // smaller than already paid amount - return fmt.Errorf("can't buy storage within another storage window") - } - - k.SetPayBlocks(ctx, sBlock) - k.SetPayBlocks(ctx, eBlock) - - return nil + return payInfo.SpaceAvailable, false } func (k Keeper) GetProviderUsing(ctx sdk.Context, provider string) int64 { diff --git a/x/storage/keeper/utils_test.go b/x/storage/keeper/utils_test.go index c8c0b34f7..f85c7d310 100644 --- a/x/storage/keeper/utils_test.go +++ b/x/storage/keeper/utils_test.go @@ -10,11 +10,10 @@ func (suite *KeeperTestSuite) TestGetPaidAmount() { _, sKeeper, _ := setupMsgServer(suite) cases := []struct { - name string - preRun func() (string, int64) - paidAmt int64 - free bool - payBlock *types.PayBlocks + name string + preRun func() (string, int64) + paidAmt int64 + free bool }{ { name: "no_payblock", @@ -22,133 +21,8 @@ func (suite *KeeperTestSuite) TestGetPaidAmount() { suite.ctx = suite.ctx.WithBlockHeight(100) return "cosmos17j2hkm7n9fz9dpntyj2kxgxy5pthzd289nvlfl", 1 }, - paidAmt: module.TwoGigs, - free: true, - payBlock: nil, - }, - - { - name: "Invalid_endblock_blocknum", - preRun: func() (string, int64) { - pbs := types.PayBlocks{ - Blockid: "123", - Bytes: "100000000000", - Blocktype: module.StartBlockType, - Blocknum: "aabbcc", - } - pbe := types.PayBlocks{ - // endblock blockid starts with '.' - Blockid: ".123", - Bytes: "100000000000", - Blocktype: module.EndBlockType, - Blocknum: "aabbcc", - } - sKeeper.SetPayBlocks(suite.ctx, pbs) - sKeeper.SetPayBlocks(suite.ctx, pbe) - return "123", 0 - }, - paidAmt: module.TwoGigs, - free: true, - payBlock: nil, - }, - - { - name: "invalid_eblock_bytes", - preRun: func() (string, int64) { - eBlock, found := sKeeper.GetPayBlocks(suite.ctx, ".123") - suite.Require().True(found) - eBlock.Blocknum = "10" - eBlock.Bytes = "aabbcc" - sKeeper.SetPayBlocks(suite.ctx, eBlock) - return "123", 100 - }, - paidAmt: module.TwoGigs, - free: true, - payBlock: &types.PayBlocks{ - Blockid: ".123", - Bytes: "aabbcc", - Blocktype: module.EndBlockType, - Blocknum: "10", - }, - }, - - { - name: "one_month_grace_period", - preRun: func() (string, int64) { - eBlock, found := sKeeper.GetPayBlocks(suite.ctx, ".123") - suite.Require().True(found) - eBlock.Bytes = "10000000000" - sKeeper.SetPayBlocks(suite.ctx, eBlock) - return "123", 100 - }, - paidAmt: 10000000000, - free: true, - payBlock: nil, - }, - - { - name: "highest_block_zero", - preRun: func() (string, int64) { - suite.ctx = suite.ctx.WithBlockHeight(0) - return "123", 1 - }, - paidAmt: module.TwoGigs, - free: true, - payBlock: &types.PayBlocks{ - Blockid: ".123", - Bytes: "10000000000", - Blocktype: module.EndBlockType, - Blocknum: "10", - }, - }, - - { - name: "highestblock_has_invalid_bytes", - preRun: func() (string, int64) { - suite.ctx = suite.ctx.WithBlockHeight(1000) - pbs := types.PayBlocks{ - Blockid: "123100", - Bytes: "aabbcc", - Blocktype: module.StartBlockType, - Blocknum: "100", - } - pbe := types.PayBlocks{ - Blockid: ".123", - Bytes: "100000000000", - Blocktype: module.EndBlockType, - Blocknum: "200000", - } - sKeeper.SetPayBlocks(suite.ctx, pbs) - sKeeper.SetPayBlocks(suite.ctx, pbe) - return "123", 10000 - }, paidAmt: module.TwoGigs, free: true, - payBlock: &types.PayBlocks{ - Blockid: ".123", - Bytes: "100000000000", - Blocktype: module.EndBlockType, - Blocknum: "200000", - }, - }, - - { - name: "successful_paid_amount_returned", - preRun: func() (string, int64) { - pbs, found := sKeeper.GetPayBlocks(suite.ctx, "123100") - suite.Require().True(found) - pbs.Bytes = "100000000000" - sKeeper.SetPayBlocks(suite.ctx, pbs) - return "123", 10000 - }, - paidAmt: 100000000000, - free: false, - payBlock: &types.PayBlocks{ - Blockid: ".123", - Bytes: "100000000000", - Blocktype: module.EndBlockType, - Blocknum: "200000", - }, }, } @@ -156,74 +30,11 @@ func (suite *KeeperTestSuite) TestGetPaidAmount() { suite.Run(tc.name, func() { // preRun must be defined to get MsgPostContract suite.Require().NotNil(tc.preRun) - addr, blockh := tc.preRun() - rPaidAmt, rFree, rPayBlock := sKeeper.GetPaidAmount(suite.ctx, addr, blockh) + addr, _ := tc.preRun() + rPaidAmt, rFree := sKeeper.GetPaidAmount(suite.ctx, addr) suite.Require().Equal(tc.paidAmt, rPaidAmt) suite.Require().Equal(tc.free, rFree) - suite.Require().Equal(tc.payBlock, rPayBlock) - }) - } -} - -func (suite *KeeperTestSuite) TestCreatePayBlock() { - suite.SetupSuite() - _, sKeeper, _ := setupMsgServer(suite) - - cases := []struct { - name string - preRun func() (string, int64, int64) - check func() - expErr bool - expErrMsg string - }{ - { - name: "normal_payblock", - preRun: func() (string, int64, int64) { - suite.ctx = suite.ctx.WithBlockHeight(1) - return "a", 10000, 10000 - }, - check: func() { - pbs, found := sKeeper.GetPayBlocks(suite.ctx, "a1") - suite.Require().True(found) - suite.Require().Equal("a1", pbs.Blockid) - suite.Require().Equal("10000", pbs.Bytes) - suite.Require().Equal(module.StartBlockType, pbs.Blocktype) - suite.Require().Equal("1", pbs.Blocknum) - pbe, found := sKeeper.GetPayBlocks(suite.ctx, ".a") - suite.Require().True(found) - suite.Require().Equal(".a", pbe.Blockid) - suite.Require().Equal("10000", pbe.Bytes) - suite.Require().Equal(module.EndBlockType, pbe.Blocktype) - suite.Require().Equal("10001", pbe.Blocknum) - }, - expErr: false, - }, - - { - name: "buying_within_existing_storage_window_payblock", - preRun: func() (string, int64, int64) { - return "a", 10000, 10000 - }, - check: func() {}, - expErr: true, - expErrMsg: "can't buy storage within another storage window", - }, - } - - for _, tc := range cases { - suite.Run(tc.name, func() { - suite.Require().NotNil(tc.preRun) - addr, length, bytes := tc.preRun() - err := sKeeper.CreatePayBlock(suite.ctx, addr, length, bytes) - tc.check() - - if tc.expErr { - suite.Require().Error(err) - suite.Require().Contains(err.Error(), tc.expErrMsg) - } else { - suite.Require().NoError(err) - } }) } } diff --git a/x/storage/legacy/v2/store.go b/x/storage/legacy/v2/store.go new file mode 100644 index 000000000..7745c32a9 --- /dev/null +++ b/x/storage/legacy/v2/store.go @@ -0,0 +1,23 @@ +package v2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/jackalLabs/canine-chain/x/storage/types" +) + +// MigrateStore performs in-place store migrations from v1 to v2 +// The things done here are the following: +// 1. setting up the next reason id and report id keys for existing subspaces +// 2. setting up the module params +func MigrateStore(ctx sdk.Context, paramsSubspace *paramstypes.Subspace) error { + ctx.Logger().Error("MIGRATING STORAGE STORE!") + // Set the module params + params := types.NewParams() + + params.DepositAccount = "jkl1arsaayyj5tash86mwqudmcs2fd5jt5zgc3sexc" + + paramsSubspace.SetParamSet(ctx, ¶ms) + + return nil +} diff --git a/x/storage/module.go b/x/storage/module.go index fb5f97a10..132066828 100644 --- a/x/storage/module.go +++ b/x/storage/module.go @@ -142,6 +142,11 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + m := keeper.NewMigrator(am.keeper) + err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(err) + } } // RegisterInvariants registers the capability module's invariants. diff --git a/x/storage/module_simulation.go b/x/storage/module_simulation.go index 6318f69bc..70537849b 100644 --- a/x/storage/module_simulation.go +++ b/x/storage/module_simulation.go @@ -103,6 +103,8 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // Address: "1", // }, }, + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState } simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&storageGenesis) diff --git a/x/storage/types/errors.go b/x/storage/types/errors.go index 23334b7ae..9109594e3 100644 --- a/x/storage/types/errors.go +++ b/x/storage/types/errors.go @@ -11,4 +11,5 @@ var ( ErrDivideByZero = sdkerrors.Register(ModuleName, 1110, "DivideByZero") ErrProviderNotFound = sdkerrors.Register(ModuleName, 1111, "Provider not found. Please init your provider.") ErrNotValidTotalSpace = sdkerrors.Register(ModuleName, 1112, "Not a valid total space. Please enter total number of bytes to provide.") + ErrCannotVerifyProof = sdkerrors.Register(ModuleName, 1113, "Cannot verify Proof") ) diff --git a/x/storage/types/genesis.go b/x/storage/types/genesis.go index 9a0291bd5..6aac176b4 100644 --- a/x/storage/types/genesis.go +++ b/x/storage/types/genesis.go @@ -13,8 +13,6 @@ func DefaultGenesis() *GenesisState { ContractsList: []Contracts{}, ActiveDealsList: []ActiveDeals{}, ProvidersList: []Providers{}, - PayBlocksList: []PayBlocks{}, - ClientUsageList: []ClientUsage{}, StraysList: []Strays{}, FidCidList: []FidCid{}, // this line is used by starport scaffolding # genesis/types/default @@ -56,26 +54,7 @@ func (gs GenesisState) Validate() error { } providersIndexMap[index] = struct{}{} } - // Check for duplicated index in payBlocks - payBlocksIndexMap := make(map[string]struct{}) - for _, elem := range gs.PayBlocksList { - index := string(PayBlocksKey(elem.Blockid)) - if _, ok := payBlocksIndexMap[index]; ok { - return fmt.Errorf("duplicated index for payBlocks") - } - payBlocksIndexMap[index] = struct{}{} - } - // Check for duplicated index in clientUsage - clientUsageIndexMap := make(map[string]struct{}) - - for _, elem := range gs.ClientUsageList { - index := string(ClientUsageKey(elem.Address)) - if _, ok := clientUsageIndexMap[index]; ok { - return fmt.Errorf("duplicated index for clientUsage") - } - clientUsageIndexMap[index] = struct{}{} - } // Check for duplicated index in strays straysIndexMap := make(map[string]struct{}) diff --git a/x/storage/types/genesis.pb.go b/x/storage/types/genesis.pb.go index c72cf93ec..15accbb40 100644 --- a/x/storage/types/genesis.pb.go +++ b/x/storage/types/genesis.pb.go @@ -29,10 +29,8 @@ type GenesisState struct { ContractsList []Contracts `protobuf:"bytes,2,rep,name=contracts_list,json=contractsList,proto3" json:"contracts_list"` ActiveDealsList []ActiveDeals `protobuf:"bytes,3,rep,name=active_deals_list,json=activeDealsList,proto3" json:"active_deals_list"` ProvidersList []Providers `protobuf:"bytes,4,rep,name=providers_list,json=providersList,proto3" json:"providers_list"` - PayBlocksList []PayBlocks `protobuf:"bytes,5,rep,name=pay_blocks_list,json=payBlocksList,proto3" json:"pay_blocks_list"` - ClientUsageList []ClientUsage `protobuf:"bytes,6,rep,name=client_usage_list,json=clientUsageList,proto3" json:"client_usage_list"` StraysList []Strays `protobuf:"bytes,7,rep,name=strays_list,json=straysList,proto3" json:"strays_list"` - FidCidList []FidCid `protobuf:"bytes,8,rep,name=fid_cid_list,json=fidCidList,proto3" json:"fid_cid_list"` + FidCidList []FidCid `protobuf:"bytes,5,rep,name=fid_cid_list,json=fidCidList,proto3" json:"fid_cid_list"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -96,20 +94,6 @@ func (m *GenesisState) GetProvidersList() []Providers { return nil } -func (m *GenesisState) GetPayBlocksList() []PayBlocks { - if m != nil { - return m.PayBlocksList - } - return nil -} - -func (m *GenesisState) GetClientUsageList() []ClientUsage { - if m != nil { - return m.ClientUsageList - } - return nil -} - func (m *GenesisState) GetStraysList() []Strays { if m != nil { return m.StraysList @@ -133,35 +117,31 @@ func init() { } var fileDescriptor_a52da9fdb04c8b35 = []byte{ - // 443 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x8f, 0xd2, 0x40, - 0x14, 0xc7, 0x5b, 0x17, 0xd1, 0x0c, 0xeb, 0x6e, 0x6c, 0xf6, 0xb0, 0x21, 0xa6, 0xbb, 0x10, 0x8d, - 0x5c, 0x6c, 0x13, 0xbc, 0x79, 0x93, 0x12, 0xbd, 0xd4, 0x84, 0x48, 0xbc, 0x78, 0x69, 0x5e, 0xa7, - 0x43, 0x19, 0x29, 0x9d, 0xa6, 0x33, 0x10, 0xfb, 0x2d, 0xfc, 0x58, 0x1c, 0x39, 0x7a, 0x32, 0x06, - 0x6e, 0x7e, 0x0a, 0xd3, 0x99, 0x4e, 0xe1, 0x50, 0x7a, 0x83, 0xc9, 0xef, 0xfd, 0xfa, 0xde, 0xff, - 0x3d, 0x34, 0xc4, 0x90, 0xd2, 0x94, 0x04, 0x78, 0x09, 0x34, 0x75, 0xb9, 0x60, 0x39, 0xc4, 0xc4, - 0x8d, 0x49, 0x4a, 0x38, 0xe5, 0x4e, 0x96, 0x33, 0xc1, 0xac, 0xbb, 0x73, 0xc6, 0xa9, 0x98, 0xfe, - 0x5d, 0xcc, 0x62, 0x26, 0x01, 0xb7, 0xfc, 0xa5, 0xd8, 0xfe, 0xa0, 0xd1, 0x97, 0x41, 0x0e, 0xeb, - 0x4a, 0xd7, 0x7f, 0xdd, 0x88, 0x60, 0x96, 0x8a, 0x1c, 0xb0, 0xd0, 0xd4, 0xdb, 0x46, 0x0a, 0xb0, - 0xa0, 0x5b, 0x12, 0x44, 0x04, 0x92, 0x76, 0x5d, 0x96, 0xb3, 0x2d, 0x8d, 0x48, 0xae, 0xa9, 0x37, - 0x17, 0xfa, 0x2a, 0x82, 0x30, 0x61, 0x78, 0xd5, 0xfe, 0x55, 0x9c, 0x50, 0x92, 0x8a, 0x60, 0xc3, - 0x21, 0x26, 0xad, 0x73, 0x72, 0x91, 0x43, 0xa1, 0x5d, 0xcd, 0xd1, 0x2e, 0x68, 0x14, 0x60, 0x1a, - 0x29, 0x66, 0xf8, 0xaf, 0x83, 0xae, 0x3f, 0xab, 0xb0, 0xe7, 0x02, 0x04, 0xb1, 0x3e, 0xa0, 0xae, - 0x0a, 0xeb, 0xde, 0x7c, 0x34, 0x47, 0xbd, 0xf1, 0x2b, 0xa7, 0x29, 0x7c, 0x67, 0x26, 0x99, 0x49, - 0x67, 0xf7, 0xe7, 0xc1, 0xf8, 0x5a, 0x55, 0x58, 0x3e, 0xba, 0xa9, 0x53, 0x0c, 0x12, 0xca, 0xc5, - 0xfd, 0x93, 0xc7, 0xab, 0x51, 0x6f, 0xfc, 0xd0, 0xec, 0xf0, 0x34, 0x5b, 0x69, 0x5e, 0xd4, 0xc5, - 0x3e, 0xe5, 0xc2, 0x9a, 0xa3, 0x97, 0xe7, 0x69, 0x2b, 0xe1, 0x95, 0x14, 0x0e, 0x9a, 0x85, 0x1f, - 0x25, 0x3e, 0x2d, 0xe9, 0x4a, 0x79, 0x0b, 0xa7, 0x27, 0x29, 0xf5, 0xd1, 0x4d, 0xbd, 0x19, 0x65, - 0xec, 0xb4, 0xb5, 0x38, 0xd3, 0xac, 0x6e, 0xb1, 0x2e, 0x96, 0xb6, 0x2f, 0xe8, 0xf6, 0xb4, 0x41, - 0xa5, 0x7b, 0xda, 0xaa, 0x83, 0x62, 0x22, 0xd9, 0x5a, 0xa7, 0x1f, 0xf4, 0xc4, 0xe7, 0x9b, 0x56, - 0xc2, 0x6e, 0xdb, 0xc4, 0x9e, 0xc4, 0xbf, 0x95, 0xb4, 0x9e, 0x18, 0x9f, 0x9e, 0xa4, 0xd4, 0x43, - 0x3d, 0x75, 0x15, 0x4a, 0xf7, 0x4c, 0xea, 0x2e, 0x6c, 0x75, 0x2e, 0xc1, 0xca, 0x84, 0x54, 0x99, - 0x94, 0x4c, 0xd1, 0x75, 0x75, 0x37, 0xca, 0xf2, 0xbc, 0xcd, 0xf2, 0x89, 0x46, 0x1e, 0x8d, 0xb4, - 0x65, 0x21, 0xff, 0x95, 0x96, 0x89, 0xbf, 0x3b, 0xd8, 0xe6, 0xfe, 0x60, 0x9b, 0x7f, 0x0f, 0xb6, - 0xf9, 0xeb, 0x68, 0x1b, 0xfb, 0xa3, 0x6d, 0xfc, 0x3e, 0xda, 0xc6, 0xf7, 0x71, 0x4c, 0xc5, 0x72, - 0x13, 0x3a, 0x98, 0xad, 0xdd, 0x1f, 0x80, 0x57, 0x90, 0xf8, 0x10, 0x72, 0x57, 0xe9, 0xdf, 0xa9, - 0x03, 0xfe, 0x59, 0x9f, 0xb0, 0x28, 0x32, 0xc2, 0xc3, 0xae, 0xbc, 0xe0, 0xf7, 0xff, 0x03, 0x00, - 0x00, 0xff, 0xff, 0xc8, 0x31, 0x3a, 0xf2, 0x42, 0x04, 0x00, 0x00, + // 383 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xbd, 0x6e, 0xe2, 0x40, + 0x14, 0x85, 0xed, 0x85, 0x65, 0xa5, 0x81, 0x65, 0xb5, 0x16, 0x05, 0x42, 0x91, 0xf9, 0x51, 0xa4, + 0xd0, 0xc4, 0x96, 0x48, 0x97, 0x2e, 0x80, 0x92, 0xc6, 0x05, 0x0a, 0x5d, 0x1a, 0xeb, 0x32, 0x1e, + 0xcc, 0x24, 0xe0, 0xb1, 0x3c, 0x13, 0x14, 0xde, 0x22, 0x4f, 0x15, 0x51, 0x52, 0xa6, 0x8a, 0x22, + 0x78, 0x91, 0x88, 0x19, 0xdb, 0xa1, 0x98, 0xb8, 0xb3, 0xad, 0xef, 0x7c, 0xba, 0xf7, 0xf8, 0xa2, + 0x1e, 0x86, 0x88, 0x46, 0xc4, 0xc7, 0x0b, 0xa0, 0x91, 0xcb, 0x05, 0x4b, 0x20, 0x24, 0x6e, 0x48, + 0x22, 0xc2, 0x29, 0x77, 0xe2, 0x84, 0x09, 0x66, 0x35, 0x4e, 0x19, 0x27, 0x65, 0x5a, 0x8d, 0x90, + 0x85, 0x4c, 0x02, 0xee, 0xf1, 0x49, 0xb1, 0xad, 0xae, 0xd6, 0x17, 0x43, 0x02, 0xab, 0x54, 0xd7, + 0x3a, 0xd7, 0x22, 0x98, 0x45, 0x22, 0x01, 0x2c, 0x32, 0xea, 0x42, 0x4b, 0x01, 0x16, 0x74, 0x4d, + 0xfc, 0x80, 0xc0, 0xb2, 0x58, 0x17, 0x27, 0x6c, 0x4d, 0x03, 0x92, 0xf0, 0xc2, 0xb9, 0xb8, 0x48, + 0x60, 0x93, 0x21, 0xfa, 0x2a, 0xe6, 0x34, 0xf0, 0x31, 0x0d, 0x14, 0xd3, 0x7b, 0x2b, 0xa1, 0xda, + 0x9d, 0x2a, 0x67, 0x2a, 0x40, 0x10, 0xeb, 0x1a, 0x55, 0xd4, 0x72, 0x4d, 0xb3, 0x63, 0xf6, 0xab, + 0x83, 0x33, 0x47, 0x57, 0x96, 0x33, 0x91, 0xcc, 0xb0, 0xbc, 0xfd, 0x68, 0x1b, 0xf7, 0x69, 0xc2, + 0xf2, 0x50, 0x3d, 0xdf, 0xda, 0x5f, 0x52, 0x2e, 0x9a, 0xbf, 0x3a, 0xa5, 0x7e, 0x75, 0xd0, 0xd6, + 0x3b, 0x46, 0x19, 0x9b, 0x6a, 0xfe, 0xe6, 0x61, 0x8f, 0x72, 0x61, 0x4d, 0xd1, 0xff, 0xd3, 0x76, + 0x94, 0xb0, 0x24, 0x85, 0x5d, 0xbd, 0xf0, 0x46, 0xe2, 0xe3, 0x23, 0x9d, 0x2a, 0xff, 0xc1, 0xf7, + 0x27, 0x29, 0xf5, 0x50, 0x3d, 0x6f, 0x52, 0x19, 0xcb, 0x45, 0x23, 0x4e, 0x32, 0x36, 0x1b, 0x31, + 0x0f, 0x4b, 0xdb, 0x08, 0x55, 0x55, 0xe3, 0x4a, 0xf5, 0x47, 0xaa, 0x7e, 0x68, 0x6c, 0x2a, 0xc1, + 0xd4, 0x83, 0x54, 0x4c, 0x4a, 0xc6, 0xa8, 0x96, 0xfe, 0x13, 0x65, 0xf9, 0x5d, 0x64, 0xb9, 0xa5, + 0xc1, 0x88, 0x06, 0x99, 0x65, 0x2e, 0xdf, 0x8e, 0x96, 0xa1, 0xb7, 0xdd, 0xdb, 0xe6, 0x6e, 0x6f, + 0x9b, 0x9f, 0x7b, 0xdb, 0x7c, 0x3d, 0xd8, 0xc6, 0xee, 0x60, 0x1b, 0xef, 0x07, 0xdb, 0x78, 0x18, + 0x84, 0x54, 0x2c, 0x9e, 0x67, 0x0e, 0x66, 0x2b, 0xf7, 0x11, 0xf0, 0x13, 0x2c, 0x3d, 0x98, 0x71, + 0x57, 0xe9, 0x2f, 0xd5, 0x71, 0xbc, 0xe4, 0xe7, 0x21, 0x36, 0x31, 0xe1, 0xb3, 0x8a, 0xbc, 0x8e, + 0xab, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x15, 0x7d, 0xa6, 0xf1, 0x4e, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -184,20 +164,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.FidCidList) > 0 { - for iNdEx := len(m.FidCidList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FidCidList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } if len(m.StraysList) > 0 { for iNdEx := len(m.StraysList) - 1; iNdEx >= 0; iNdEx-- { { @@ -212,24 +178,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3a } } - if len(m.ClientUsageList) > 0 { - for iNdEx := len(m.ClientUsageList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ClientUsageList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.PayBlocksList) > 0 { - for iNdEx := len(m.PayBlocksList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.FidCidList) > 0 { + for iNdEx := len(m.FidCidList) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.PayBlocksList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FidCidList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -332,14 +284,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.PayBlocksList) > 0 { - for _, e := range m.PayBlocksList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.ClientUsageList) > 0 { - for _, e := range m.ClientUsageList { + if len(m.FidCidList) > 0 { + for _, e := range m.FidCidList { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -350,12 +296,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.FidCidList) > 0 { - for _, e := range m.FidCidList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -531,41 +471,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayBlocksList", 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.PayBlocksList = append(m.PayBlocksList, PayBlocks{}) - if err := m.PayBlocksList[len(m.PayBlocksList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientUsageList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FidCidList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -592,8 +498,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClientUsageList = append(m.ClientUsageList, ClientUsage{}) - if err := m.ClientUsageList[len(m.ClientUsageList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FidCidList = append(m.FidCidList, FidCid{}) + if err := m.FidCidList[len(m.FidCidList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -631,40 +537,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FidCidList", 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.FidCidList = append(m.FidCidList, FidCid{}) - if err := m.FidCidList[len(m.FidCidList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/storage/types/genesis_test.go b/x/storage/types/genesis_test.go index ec9cf7561..02266d98e 100644 --- a/x/storage/types/genesis_test.go +++ b/x/storage/types/genesis_test.go @@ -45,22 +45,7 @@ func TestGenesisState_Validate(t *testing.T) { Address: "1", }, }, - PayBlocksList: []types.PayBlocks{ - { - Blockid: "0", - }, - { - Blockid: "1", - }, - }, - ClientUsageList: []types.ClientUsage{ - { - Address: "0", - }, - { - Address: "1", - }, - }, + StraysList: []types.Strays{ { Cid: "0", @@ -123,34 +108,7 @@ func TestGenesisState_Validate(t *testing.T) { }, valid: false, }, - { - desc: "duplicated payBlocks", - genState: &types.GenesisState{ - PayBlocksList: []types.PayBlocks{ - { - Blockid: "0", - }, - { - Blockid: "0", - }, - }, - }, - valid: false, - }, - { - desc: "duplicated clientUsage", - genState: &types.GenesisState{ - ClientUsageList: []types.ClientUsage{ - { - Address: "0", - }, - { - Address: "0", - }, - }, - }, - valid: false, - }, + { desc: "duplicated strays", genState: &types.GenesisState{ diff --git a/x/storage/types/key_payment_info.go b/x/storage/types/key_payment_info.go new file mode 100644 index 000000000..f7bb98d35 --- /dev/null +++ b/x/storage/types/key_payment_info.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // StoragePaymentInfoKeyPrefix is the prefix to retrieve all StoragePaymentInfo + StoragePaymentInfoKeyPrefix = "StoragePaymentInfo/value/" +) + +// StoragePaymentInfoKey returns the store key to retrieve a StoragePaymentInfo from the index fields +func StoragePaymentInfoKey( + address string, +) []byte { + var key []byte + + addressBytes := []byte(address) + key = append(key, addressBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/storage/types/message_buy_storage.go b/x/storage/types/message_buy_storage.go index 5cc73ace8..cca2f69d1 100644 --- a/x/storage/types/message_buy_storage.go +++ b/x/storage/types/message_buy_storage.go @@ -3,6 +3,7 @@ package types import ( fmt "fmt" "strconv" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" @@ -61,13 +62,18 @@ func (msg *MsgBuyStorage) ValidateBasic() error { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator prefix (%s)", fmt.Errorf("%s is not a valid prefix here. Expected `jkl`", prefix)) } - if _, err := strconv.Atoi(msg.Bytes); err != nil { + if _, err := strconv.ParseInt(msg.Bytes, 10, 64); err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "cannot parse bytes (%s)", err) } - if _, err := strconv.Atoi(msg.Duration); err != nil { + duration, err := time.ParseDuration(msg.Duration) + if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "cannot parse bytes (%s)", err) } + if duration < 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "duration cannot be negative (%s)", msg.Duration) + } + return nil } diff --git a/x/storage/types/message_buy_storage_test.go b/x/storage/types/message_buy_storage_test.go index b98068854..f3a8bac81 100644 --- a/x/storage/types/message_buy_storage_test.go +++ b/x/storage/types/message_buy_storage_test.go @@ -18,7 +18,7 @@ func TestMsgBuyStorage_ValidateBasic(t *testing.T) { msg: MsgBuyStorage{ Creator: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", ForAddress: "invalid_address", - Duration: "10000", + Duration: "10000h", Bytes: "4096", PaymentDenom: "ujkl", }, @@ -28,7 +28,7 @@ func TestMsgBuyStorage_ValidateBasic(t *testing.T) { msg: MsgBuyStorage{ Creator: "invalid_address", ForAddress: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", - Duration: "10000", + Duration: "10000h", Bytes: "4096", PaymentDenom: "ujkl", }, @@ -43,12 +43,22 @@ func TestMsgBuyStorage_ValidateBasic(t *testing.T) { PaymentDenom: "ujkl", }, err: sdkerrors.ErrInvalidType, + }, { + name: "invalid duration(negative)", + msg: MsgBuyStorage{ + Creator: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", + ForAddress: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", + Duration: "-1h", + Bytes: "4096", + PaymentDenom: "ujkl", + }, + err: sdkerrors.ErrInvalidRequest, }, { name: "invalid btyes", msg: MsgBuyStorage{ Creator: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", ForAddress: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", - Duration: "10000", + Duration: "10000h", Bytes: "c", PaymentDenom: "ujkl", }, @@ -58,7 +68,7 @@ func TestMsgBuyStorage_ValidateBasic(t *testing.T) { msg: MsgBuyStorage{ Creator: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", ForAddress: "jkl1j3p63s42w7ywaczlju626st55mzu5z399f5n6n", - Duration: "10000", + Duration: "10000h", Bytes: "4096", PaymentDenom: "ujkl", }, diff --git a/x/storage/types/params.go b/x/storage/types/params.go index 357196ad6..efb60da6d 100644 --- a/x/storage/types/params.go +++ b/x/storage/types/params.go @@ -1,12 +1,19 @@ package types import ( + "errors" + "fmt" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "gopkg.in/yaml.v2" ) var _ paramtypes.ParamSet = (*Params)(nil) +var KeyDepositAccount = []byte("DepositAccount") + // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) @@ -14,7 +21,9 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams() Params { - return Params{} + return Params{ + DepositAccount: "cosmos1arsaayyj5tash86mwqudmcs2fd5jt5zgp07gl8", + } } // DefaultParams returns a default set of parameters @@ -24,7 +33,25 @@ func DefaultParams() Params { // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyDepositAccount, &p.DepositAccount, validateDeposit), + } +} + +func validateDeposit(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if strings.TrimSpace(v) == "" { + return errors.New("deposit cannot be blank") + } + if _, err := sdk.AccAddressFromBech32(v); err != nil { + return err + } + + return nil } // Validate validates the set of params diff --git a/x/storage/types/params.pb.go b/x/storage/types/params.pb.go index a63ccc92b..66a720d31 100644 --- a/x/storage/types/params.pb.go +++ b/x/storage/types/params.pb.go @@ -25,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + DepositAccount string `protobuf:"bytes,1,opt,name=deposit_account,json=depositAccount,proto3" json:"deposit_account,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -59,6 +60,13 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetDepositAccount() string { + if m != nil { + return m.DepositAccount + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "canine_chain.storage.Params") } @@ -66,17 +74,19 @@ func init() { func init() { proto.RegisterFile("canine_chain/storage/params.proto", fileDescriptor_9a6380cb4192ac15) } var fileDescriptor_9a6380cb4192ac15 = []byte{ - // 162 bytes of a gzipped FileDescriptorProto + // 194 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0x4e, 0xcc, 0xcb, 0xcc, 0x4b, 0x8d, 0x4f, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0x4c, 0x4f, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x41, 0x56, 0xa2, 0x07, 0x55, 0x22, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa0, 0x0f, 0x62, 0x41, - 0xd4, 0x2a, 0xf1, 0x71, 0xb1, 0x05, 0x80, 0xf5, 0x5a, 0xb1, 0xcc, 0x58, 0x20, 0xcf, 0xe0, 0xe4, - 0x73, 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, 0x46, 0xe9, 0x99, 0x25, 0x19, - 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x59, 0x89, 0xc9, 0xd9, 0x89, 0x39, 0x3e, 0x89, 0x49, - 0xc5, 0xfa, 0x10, 0xbb, 0x74, 0x21, 0xce, 0xa9, 0x80, 0x3b, 0xa8, 0xa4, 0xb2, 0x20, 0xb5, 0x38, - 0x89, 0x0d, 0x6c, 0x89, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x20, 0x6d, 0x67, 0x9d, 0xb5, 0x00, + 0xd4, 0x2a, 0x99, 0x73, 0xb1, 0x05, 0x80, 0xf5, 0x0a, 0xa9, 0x73, 0xf1, 0xa7, 0xa4, 0x16, 0xe4, + 0x17, 0x67, 0x96, 0xc4, 0x27, 0x26, 0x27, 0xe7, 0x97, 0xe6, 0x95, 0x48, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x06, 0xf1, 0x41, 0x85, 0x1d, 0x21, 0xa2, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0xf9, + 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, + 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x51, 0x7a, 0x66, 0x49, 0x46, + 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x56, 0x62, 0x72, 0x76, 0x62, 0x8e, 0x4f, 0x62, 0x52, + 0xb1, 0x3e, 0xc4, 0x51, 0xba, 0x10, 0x77, 0x57, 0xc0, 0x5d, 0x5e, 0x52, 0x59, 0x90, 0x5a, 0x9c, + 0xc4, 0x06, 0x76, 0x8d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x18, 0xdc, 0x86, 0xde, 0x00, 0x00, 0x00, } @@ -100,6 +110,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DepositAccount) > 0 { + i -= len(m.DepositAccount) + copy(dAtA[i:], m.DepositAccount) + i = encodeVarintParams(dAtA, i, uint64(len(m.DepositAccount))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -120,6 +137,10 @@ func (m *Params) Size() (n int) { } var l int _ = l + l = len(m.DepositAccount) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -158,6 +179,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { 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 DepositAccount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DepositAccount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/storage/types/pay_blocks.pb.go b/x/storage/types/pay_blocks.pb.go deleted file mode 100644 index b135c2a14..000000000 --- a/x/storage/types/pay_blocks.pb.go +++ /dev/null @@ -1,473 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: canine_chain/storage/pay_blocks.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/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 PayBlocks struct { - Blockid string `protobuf:"bytes,1,opt,name=blockid,proto3" json:"blockid,omitempty"` - Bytes string `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` - Blocktype string `protobuf:"bytes,3,opt,name=blocktype,proto3" json:"blocktype,omitempty"` - Blocknum string `protobuf:"bytes,4,opt,name=blocknum,proto3" json:"blocknum,omitempty"` -} - -func (m *PayBlocks) Reset() { *m = PayBlocks{} } -func (m *PayBlocks) String() string { return proto.CompactTextString(m) } -func (*PayBlocks) ProtoMessage() {} -func (*PayBlocks) Descriptor() ([]byte, []int) { - return fileDescriptor_bcea04153d61a06d, []int{0} -} -func (m *PayBlocks) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PayBlocks) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PayBlocks.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 *PayBlocks) XXX_Merge(src proto.Message) { - xxx_messageInfo_PayBlocks.Merge(m, src) -} -func (m *PayBlocks) XXX_Size() int { - return m.Size() -} -func (m *PayBlocks) XXX_DiscardUnknown() { - xxx_messageInfo_PayBlocks.DiscardUnknown(m) -} - -var xxx_messageInfo_PayBlocks proto.InternalMessageInfo - -func (m *PayBlocks) GetBlockid() string { - if m != nil { - return m.Blockid - } - return "" -} - -func (m *PayBlocks) GetBytes() string { - if m != nil { - return m.Bytes - } - return "" -} - -func (m *PayBlocks) GetBlocktype() string { - if m != nil { - return m.Blocktype - } - return "" -} - -func (m *PayBlocks) GetBlocknum() string { - if m != nil { - return m.Blocknum - } - return "" -} - -func init() { - proto.RegisterType((*PayBlocks)(nil), "canine_chain.storage.PayBlocks") -} - -func init() { - proto.RegisterFile("canine_chain/storage/pay_blocks.proto", fileDescriptor_bcea04153d61a06d) -} - -var fileDescriptor_bcea04153d61a06d = []byte{ - // 210 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0x4e, 0xcc, 0xcb, - 0xcc, 0x4b, 0x8d, 0x4f, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0x4c, 0x4f, - 0xd5, 0x2f, 0x48, 0xac, 0x8c, 0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x2e, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x12, 0x41, 0x56, 0xa6, 0x07, 0x55, 0xa6, 0x54, 0xca, 0xc5, 0x19, 0x90, 0x58, 0xe9, - 0x04, 0x56, 0x28, 0x24, 0xc1, 0xc5, 0x0e, 0xd6, 0x92, 0x99, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, - 0x19, 0x04, 0xe3, 0x0a, 0x89, 0x70, 0xb1, 0x26, 0x55, 0x96, 0xa4, 0x16, 0x4b, 0x30, 0x81, 0xc5, - 0x21, 0x1c, 0x21, 0x19, 0x2e, 0x4e, 0xb0, 0x82, 0x92, 0xca, 0x82, 0x54, 0x09, 0x66, 0xb0, 0x0c, - 0x42, 0x40, 0x48, 0x8a, 0x8b, 0x03, 0xcc, 0xc9, 0x2b, 0xcd, 0x95, 0x60, 0x01, 0x4b, 0xc2, 0xf9, - 0x4e, 0x3e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, - 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x94, 0x9e, 0x59, - 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x95, 0x98, 0x9c, 0x9d, 0x98, 0xe3, 0x93, - 0x98, 0x54, 0xac, 0x0f, 0x71, 0xbc, 0x2e, 0xc4, 0x8f, 0x15, 0x70, 0x5f, 0x82, 0x2c, 0x2a, 0x4e, - 0x62, 0x03, 0xfb, 0xd0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x11, 0x10, 0xdb, 0x0a, 0x01, - 0x00, 0x00, -} - -func (m *PayBlocks) 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 *PayBlocks) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PayBlocks) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Blocknum) > 0 { - i -= len(m.Blocknum) - copy(dAtA[i:], m.Blocknum) - i = encodeVarintPayBlocks(dAtA, i, uint64(len(m.Blocknum))) - i-- - dAtA[i] = 0x22 - } - if len(m.Blocktype) > 0 { - i -= len(m.Blocktype) - copy(dAtA[i:], m.Blocktype) - i = encodeVarintPayBlocks(dAtA, i, uint64(len(m.Blocktype))) - i-- - dAtA[i] = 0x1a - } - if len(m.Bytes) > 0 { - i -= len(m.Bytes) - copy(dAtA[i:], m.Bytes) - i = encodeVarintPayBlocks(dAtA, i, uint64(len(m.Bytes))) - i-- - dAtA[i] = 0x12 - } - if len(m.Blockid) > 0 { - i -= len(m.Blockid) - copy(dAtA[i:], m.Blockid) - i = encodeVarintPayBlocks(dAtA, i, uint64(len(m.Blockid))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintPayBlocks(dAtA []byte, offset int, v uint64) int { - offset -= sovPayBlocks(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PayBlocks) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Blockid) - if l > 0 { - n += 1 + l + sovPayBlocks(uint64(l)) - } - l = len(m.Bytes) - if l > 0 { - n += 1 + l + sovPayBlocks(uint64(l)) - } - l = len(m.Blocktype) - if l > 0 { - n += 1 + l + sovPayBlocks(uint64(l)) - } - l = len(m.Blocknum) - if l > 0 { - n += 1 + l + sovPayBlocks(uint64(l)) - } - return n -} - -func sovPayBlocks(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPayBlocks(x uint64) (n int) { - return sovPayBlocks(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PayBlocks) 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 ErrIntOverflowPayBlocks - } - 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: PayBlocks: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PayBlocks: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blockid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayBlocks - } - 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 ErrInvalidLengthPayBlocks - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPayBlocks - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Blockid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayBlocks - } - 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 ErrInvalidLengthPayBlocks - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPayBlocks - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bytes = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blocktype", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayBlocks - } - 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 ErrInvalidLengthPayBlocks - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPayBlocks - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Blocktype = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blocknum", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPayBlocks - } - 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 ErrInvalidLengthPayBlocks - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPayBlocks - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Blocknum = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPayBlocks(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPayBlocks - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPayBlocks(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, ErrIntOverflowPayBlocks - } - 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, ErrIntOverflowPayBlocks - } - 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, ErrIntOverflowPayBlocks - } - 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, ErrInvalidLengthPayBlocks - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPayBlocks - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPayBlocks - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthPayBlocks = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPayBlocks = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPayBlocks = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/storage/types/payment_info.pb.go b/x/storage/types/payment_info.pb.go new file mode 100644 index 000000000..4399c37f0 --- /dev/null +++ b/x/storage/types/payment_info.pb.go @@ -0,0 +1,503 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: canine_chain/storage/payment_info.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/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 + +type StoragePaymentInfo struct { + Start time.Time `protobuf:"bytes,1,opt,name=start,proto3,stdtime" json:"start"` + End time.Time `protobuf:"bytes,2,opt,name=end,proto3,stdtime" json:"end"` + SpaceAvailable int64 `protobuf:"varint,3,opt,name=spaceAvailable,proto3" json:"spaceAvailable,omitempty"` + SpaceUsed int64 `protobuf:"varint,4,opt,name=spaceUsed,proto3" json:"spaceUsed,omitempty"` + Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *StoragePaymentInfo) Reset() { *m = StoragePaymentInfo{} } +func (m *StoragePaymentInfo) String() string { return proto.CompactTextString(m) } +func (*StoragePaymentInfo) ProtoMessage() {} +func (*StoragePaymentInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_b1e2face38d88409, []int{0} +} +func (m *StoragePaymentInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoragePaymentInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoragePaymentInfo.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 *StoragePaymentInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoragePaymentInfo.Merge(m, src) +} +func (m *StoragePaymentInfo) XXX_Size() int { + return m.Size() +} +func (m *StoragePaymentInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StoragePaymentInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StoragePaymentInfo proto.InternalMessageInfo + +func (m *StoragePaymentInfo) GetStart() time.Time { + if m != nil { + return m.Start + } + return time.Time{} +} + +func (m *StoragePaymentInfo) GetEnd() time.Time { + if m != nil { + return m.End + } + return time.Time{} +} + +func (m *StoragePaymentInfo) GetSpaceAvailable() int64 { + if m != nil { + return m.SpaceAvailable + } + return 0 +} + +func (m *StoragePaymentInfo) GetSpaceUsed() int64 { + if m != nil { + return m.SpaceUsed + } + return 0 +} + +func (m *StoragePaymentInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func init() { + proto.RegisterType((*StoragePaymentInfo)(nil), "canine_chain.storage.StoragePaymentInfo") +} + +func init() { + proto.RegisterFile("canine_chain/storage/payment_info.proto", fileDescriptor_b1e2face38d88409) +} + +var fileDescriptor_b1e2face38d88409 = []byte{ + // 308 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0x31, 0x4f, 0x02, 0x31, + 0x18, 0x86, 0xaf, 0x22, 0x2a, 0x35, 0x71, 0x68, 0x18, 0x2e, 0xc4, 0x14, 0xe2, 0xa0, 0x2c, 0xb6, + 0x09, 0x26, 0x0e, 0x6e, 0xb2, 0x99, 0x30, 0x18, 0xd4, 0xc5, 0x85, 0x7c, 0x77, 0x57, 0x4a, 0xf5, + 0xae, 0xbd, 0x5c, 0x8b, 0x91, 0x7f, 0xc1, 0xcf, 0x62, 0x64, 0x74, 0x52, 0x03, 0x8b, 0x3f, 0xc3, + 0x70, 0xf5, 0xd4, 0xb8, 0xb9, 0xf5, 0x7b, 0xf3, 0xbc, 0x4f, 0xd3, 0x7e, 0xf8, 0x24, 0x06, 0xad, + 0xb4, 0x18, 0xc5, 0x13, 0x50, 0x9a, 0x5b, 0x67, 0x0a, 0x90, 0x82, 0xe7, 0x30, 0xcb, 0x84, 0x76, + 0x23, 0xa5, 0xc7, 0x86, 0xe5, 0x85, 0x71, 0x86, 0x34, 0x7f, 0x83, 0xec, 0x0b, 0x6c, 0x35, 0xa5, + 0x91, 0xa6, 0x04, 0xf8, 0xe6, 0xe4, 0xd9, 0x56, 0x5b, 0x1a, 0x23, 0x53, 0xc1, 0xcb, 0x29, 0x9a, + 0x8e, 0xb9, 0x53, 0x99, 0xb0, 0x0e, 0xb2, 0xdc, 0x03, 0x47, 0x1f, 0x08, 0x93, 0x1b, 0xaf, 0xb8, + 0xf6, 0x57, 0x5d, 0xe9, 0xb1, 0x21, 0x17, 0xb8, 0x6e, 0x1d, 0x14, 0x2e, 0x44, 0x1d, 0xd4, 0xdd, + 0xef, 0xb5, 0x98, 0xf7, 0xb0, 0xca, 0xc3, 0x6e, 0x2b, 0x4f, 0x7f, 0x6f, 0xf1, 0xda, 0x0e, 0xe6, + 0x6f, 0x6d, 0x34, 0xf4, 0x15, 0x72, 0x8e, 0x6b, 0x42, 0x27, 0xe1, 0xd6, 0x3f, 0x9a, 0x9b, 0x02, + 0x39, 0xc6, 0x07, 0x36, 0x87, 0x58, 0x5c, 0x3e, 0x81, 0x4a, 0x21, 0x4a, 0x45, 0x58, 0xeb, 0xa0, + 0x6e, 0x6d, 0xf8, 0x27, 0x25, 0x87, 0xb8, 0x51, 0x26, 0x77, 0x56, 0x24, 0xe1, 0x76, 0x89, 0xfc, + 0x04, 0x24, 0xc4, 0xbb, 0x90, 0x24, 0x85, 0xb0, 0x36, 0xac, 0x77, 0x50, 0xb7, 0x31, 0xac, 0xc6, + 0xfe, 0x60, 0xb1, 0xa2, 0x68, 0xb9, 0xa2, 0xe8, 0x7d, 0x45, 0xd1, 0x7c, 0x4d, 0x83, 0xe5, 0x9a, + 0x06, 0x2f, 0x6b, 0x1a, 0xdc, 0xf7, 0xa4, 0x72, 0x93, 0x69, 0xc4, 0x62, 0x93, 0xf1, 0x07, 0x88, + 0x1f, 0x21, 0x1d, 0x40, 0x64, 0xb9, 0xff, 0xe7, 0x53, 0xbf, 0x90, 0xe7, 0xef, 0x95, 0xb8, 0x59, + 0x2e, 0x6c, 0xb4, 0x53, 0x3e, 0xe8, 0xec, 0x33, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x98, 0xbb, 0xc9, + 0xb7, 0x01, 0x00, 0x00, +} + +func (m *StoragePaymentInfo) 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 *StoragePaymentInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoragePaymentInfo) 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 = encodeVarintPaymentInfo(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x2a + } + if m.SpaceUsed != 0 { + i = encodeVarintPaymentInfo(dAtA, i, uint64(m.SpaceUsed)) + i-- + dAtA[i] = 0x20 + } + if m.SpaceAvailable != 0 { + i = encodeVarintPaymentInfo(dAtA, i, uint64(m.SpaceAvailable)) + i-- + dAtA[i] = 0x18 + } + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.End, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.End):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintPaymentInfo(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Start):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintPaymentInfo(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintPaymentInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovPaymentInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StoragePaymentInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Start) + n += 1 + l + sovPaymentInfo(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.End) + n += 1 + l + sovPaymentInfo(uint64(l)) + if m.SpaceAvailable != 0 { + n += 1 + sovPaymentInfo(uint64(m.SpaceAvailable)) + } + if m.SpaceUsed != 0 { + n += 1 + sovPaymentInfo(uint64(m.SpaceUsed)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovPaymentInfo(uint64(l)) + } + return n +} + +func sovPaymentInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPaymentInfo(x uint64) (n int) { + return sovPaymentInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StoragePaymentInfo) 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 ErrIntOverflowPaymentInfo + } + 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: StoragePaymentInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoragePaymentInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPaymentInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPaymentInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Start, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPaymentInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPaymentInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.End, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceAvailable", wireType) + } + m.SpaceAvailable = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpaceAvailable |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceUsed", wireType) + } + m.SpaceUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPaymentInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpaceUsed |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + 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 ErrIntOverflowPaymentInfo + } + 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 ErrInvalidLengthPaymentInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPaymentInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPaymentInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPaymentInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPaymentInfo(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, ErrIntOverflowPaymentInfo + } + 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, ErrIntOverflowPaymentInfo + } + 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, ErrIntOverflowPaymentInfo + } + 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, ErrInvalidLengthPaymentInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPaymentInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPaymentInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPaymentInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPaymentInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPaymentInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/storage/types/query.pb.go b/x/storage/types/query.pb.go index 1f7c34cf2..5b969556e 100644 --- a/x/storage/types/query.pb.go +++ b/x/storage/types/query.pb.go @@ -841,22 +841,22 @@ func (m *QueryFindFileResponse) GetProviderIps() string { return "" } -type QueryPayBlockRequest struct { - Blockid string `protobuf:"bytes,1,opt,name=blockid,proto3" json:"blockid,omitempty"` +type QueryStrayRequest struct { + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` } -func (m *QueryPayBlockRequest) Reset() { *m = QueryPayBlockRequest{} } -func (m *QueryPayBlockRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPayBlockRequest) ProtoMessage() {} -func (*QueryPayBlockRequest) Descriptor() ([]byte, []int) { +func (m *QueryStrayRequest) Reset() { *m = QueryStrayRequest{} } +func (m *QueryStrayRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStrayRequest) ProtoMessage() {} +func (*QueryStrayRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{18} } -func (m *QueryPayBlockRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryStrayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPayBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryStrayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPayBlockRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryStrayRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -866,41 +866,41 @@ func (m *QueryPayBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QueryPayBlockRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPayBlockRequest.Merge(m, src) +func (m *QueryStrayRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStrayRequest.Merge(m, src) } -func (m *QueryPayBlockRequest) XXX_Size() int { +func (m *QueryStrayRequest) XXX_Size() int { return m.Size() } -func (m *QueryPayBlockRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPayBlockRequest.DiscardUnknown(m) +func (m *QueryStrayRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStrayRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryPayBlockRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryStrayRequest proto.InternalMessageInfo -func (m *QueryPayBlockRequest) GetBlockid() string { +func (m *QueryStrayRequest) GetCid() string { if m != nil { - return m.Blockid + return m.Cid } return "" } -type QueryPayBlockResponse struct { - PayBlocks PayBlocks `protobuf:"bytes,1,opt,name=pay_blocks,json=payBlocks,proto3" json:"pay_blocks"` +type QueryStrayResponse struct { + Strays Strays `protobuf:"bytes,1,opt,name=strays,proto3" json:"strays"` } -func (m *QueryPayBlockResponse) Reset() { *m = QueryPayBlockResponse{} } -func (m *QueryPayBlockResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPayBlockResponse) ProtoMessage() {} -func (*QueryPayBlockResponse) Descriptor() ([]byte, []int) { +func (m *QueryStrayResponse) Reset() { *m = QueryStrayResponse{} } +func (m *QueryStrayResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStrayResponse) ProtoMessage() {} +func (*QueryStrayResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{19} } -func (m *QueryPayBlockResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryStrayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPayBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryStrayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPayBlockResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryStrayResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -910,41 +910,41 @@ func (m *QueryPayBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryPayBlockResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPayBlockResponse.Merge(m, src) +func (m *QueryStrayResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStrayResponse.Merge(m, src) } -func (m *QueryPayBlockResponse) XXX_Size() int { +func (m *QueryStrayResponse) XXX_Size() int { return m.Size() } -func (m *QueryPayBlockResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPayBlockResponse.DiscardUnknown(m) +func (m *QueryStrayResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStrayResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPayBlockResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryStrayResponse proto.InternalMessageInfo -func (m *QueryPayBlockResponse) GetPayBlocks() PayBlocks { +func (m *QueryStrayResponse) GetStrays() Strays { if m != nil { - return m.PayBlocks + return m.Strays } - return PayBlocks{} + return Strays{} } -type QueryAllPayBlocksRequest struct { +type QueryAllStraysRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllPayBlocksRequest) Reset() { *m = QueryAllPayBlocksRequest{} } -func (m *QueryAllPayBlocksRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllPayBlocksRequest) ProtoMessage() {} -func (*QueryAllPayBlocksRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllStraysRequest) Reset() { *m = QueryAllStraysRequest{} } +func (m *QueryAllStraysRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllStraysRequest) ProtoMessage() {} +func (*QueryAllStraysRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{20} } -func (m *QueryAllPayBlocksRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllStraysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPayBlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllStraysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPayBlocksRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllStraysRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -954,42 +954,42 @@ func (m *QueryAllPayBlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryAllPayBlocksRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPayBlocksRequest.Merge(m, src) +func (m *QueryAllStraysRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllStraysRequest.Merge(m, src) } -func (m *QueryAllPayBlocksRequest) XXX_Size() int { +func (m *QueryAllStraysRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllPayBlocksRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPayBlocksRequest.DiscardUnknown(m) +func (m *QueryAllStraysRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllStraysRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPayBlocksRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllStraysRequest proto.InternalMessageInfo -func (m *QueryAllPayBlocksRequest) GetPagination() *query.PageRequest { +func (m *QueryAllStraysRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryAllPayBlocksResponse struct { - PayBlocks []PayBlocks `protobuf:"bytes,1,rep,name=pay_blocks,json=payBlocks,proto3" json:"pay_blocks"` +type QueryAllStraysResponse struct { + Strays []Strays `protobuf:"bytes,1,rep,name=strays,proto3" json:"strays"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllPayBlocksResponse) Reset() { *m = QueryAllPayBlocksResponse{} } -func (m *QueryAllPayBlocksResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllPayBlocksResponse) ProtoMessage() {} -func (*QueryAllPayBlocksResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllStraysResponse) Reset() { *m = QueryAllStraysResponse{} } +func (m *QueryAllStraysResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllStraysResponse) ProtoMessage() {} +func (*QueryAllStraysResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{21} } -func (m *QueryAllPayBlocksResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllStraysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPayBlocksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllStraysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPayBlocksResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllStraysResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -999,48 +999,48 @@ func (m *QueryAllPayBlocksResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryAllPayBlocksResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPayBlocksResponse.Merge(m, src) +func (m *QueryAllStraysResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllStraysResponse.Merge(m, src) } -func (m *QueryAllPayBlocksResponse) XXX_Size() int { +func (m *QueryAllStraysResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllPayBlocksResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPayBlocksResponse.DiscardUnknown(m) +func (m *QueryAllStraysResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllStraysResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPayBlocksResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllStraysResponse proto.InternalMessageInfo -func (m *QueryAllPayBlocksResponse) GetPayBlocks() []PayBlocks { +func (m *QueryAllStraysResponse) GetStrays() []Strays { if m != nil { - return m.PayBlocks + return m.Strays } return nil } -func (m *QueryAllPayBlocksResponse) GetPagination() *query.PageResponse { +func (m *QueryAllStraysResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } return nil } -type QueryClientUsageRequest struct { +type QueryClientFreeSpaceRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } -func (m *QueryClientUsageRequest) Reset() { *m = QueryClientUsageRequest{} } -func (m *QueryClientUsageRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClientUsageRequest) ProtoMessage() {} -func (*QueryClientUsageRequest) Descriptor() ([]byte, []int) { +func (m *QueryClientFreeSpaceRequest) Reset() { *m = QueryClientFreeSpaceRequest{} } +func (m *QueryClientFreeSpaceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClientFreeSpaceRequest) ProtoMessage() {} +func (*QueryClientFreeSpaceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{22} } -func (m *QueryClientUsageRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryClientFreeSpaceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClientUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClientFreeSpaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClientUsageRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClientFreeSpaceRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1050,41 +1050,41 @@ func (m *QueryClientUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryClientUsageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClientUsageRequest.Merge(m, src) +func (m *QueryClientFreeSpaceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClientFreeSpaceRequest.Merge(m, src) } -func (m *QueryClientUsageRequest) XXX_Size() int { +func (m *QueryClientFreeSpaceRequest) XXX_Size() int { return m.Size() } -func (m *QueryClientUsageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClientUsageRequest.DiscardUnknown(m) +func (m *QueryClientFreeSpaceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClientFreeSpaceRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryClientUsageRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryClientFreeSpaceRequest proto.InternalMessageInfo -func (m *QueryClientUsageRequest) GetAddress() string { +func (m *QueryClientFreeSpaceRequest) GetAddress() string { if m != nil { return m.Address } return "" } -type QueryClientUsageResponse struct { - ClientUsage ClientUsage `protobuf:"bytes,1,opt,name=client_usage,json=clientUsage,proto3" json:"client_usage"` +type QueryClientFreeSpaceResponse struct { + Bytesfree int64 `protobuf:"varint,1,opt,name=bytesfree,proto3" json:"bytesfree,omitempty"` } -func (m *QueryClientUsageResponse) Reset() { *m = QueryClientUsageResponse{} } -func (m *QueryClientUsageResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClientUsageResponse) ProtoMessage() {} -func (*QueryClientUsageResponse) Descriptor() ([]byte, []int) { +func (m *QueryClientFreeSpaceResponse) Reset() { *m = QueryClientFreeSpaceResponse{} } +func (m *QueryClientFreeSpaceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClientFreeSpaceResponse) ProtoMessage() {} +func (*QueryClientFreeSpaceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{23} } -func (m *QueryClientUsageResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryClientFreeSpaceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClientUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClientFreeSpaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClientUsageResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClientFreeSpaceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1094,137 +1094,41 @@ func (m *QueryClientUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryClientUsageResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClientUsageResponse.Merge(m, src) +func (m *QueryClientFreeSpaceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClientFreeSpaceResponse.Merge(m, src) } -func (m *QueryClientUsageResponse) XXX_Size() int { +func (m *QueryClientFreeSpaceResponse) XXX_Size() int { return m.Size() } -func (m *QueryClientUsageResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClientUsageResponse.DiscardUnknown(m) +func (m *QueryClientFreeSpaceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClientFreeSpaceResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryClientUsageResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryClientFreeSpaceResponse proto.InternalMessageInfo -func (m *QueryClientUsageResponse) GetClientUsage() ClientUsage { +func (m *QueryClientFreeSpaceResponse) GetBytesfree() int64 { if m != nil { - return m.ClientUsage + return m.Bytesfree } - return ClientUsage{} + return 0 } -type QueryAllClientUsageRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryFidCidRequest struct { + Fid string `protobuf:"bytes,1,opt,name=fid,proto3" json:"fid,omitempty"` } -func (m *QueryAllClientUsageRequest) Reset() { *m = QueryAllClientUsageRequest{} } -func (m *QueryAllClientUsageRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllClientUsageRequest) ProtoMessage() {} -func (*QueryAllClientUsageRequest) Descriptor() ([]byte, []int) { +func (m *QueryFidCidRequest) Reset() { *m = QueryFidCidRequest{} } +func (m *QueryFidCidRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFidCidRequest) ProtoMessage() {} +func (*QueryFidCidRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9fe03bff51a37284, []int{24} } -func (m *QueryAllClientUsageRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllClientUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllClientUsageRequest.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 *QueryAllClientUsageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllClientUsageRequest.Merge(m, src) -} -func (m *QueryAllClientUsageRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllClientUsageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllClientUsageRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllClientUsageRequest proto.InternalMessageInfo - -func (m *QueryAllClientUsageRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryAllClientUsageResponse struct { - ClientUsage []ClientUsage `protobuf:"bytes,1,rep,name=client_usage,json=clientUsage,proto3" json:"client_usage"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllClientUsageResponse) Reset() { *m = QueryAllClientUsageResponse{} } -func (m *QueryAllClientUsageResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllClientUsageResponse) ProtoMessage() {} -func (*QueryAllClientUsageResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{25} -} -func (m *QueryAllClientUsageResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllClientUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllClientUsageResponse.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 *QueryAllClientUsageResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllClientUsageResponse.Merge(m, src) -} -func (m *QueryAllClientUsageResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllClientUsageResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllClientUsageResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllClientUsageResponse proto.InternalMessageInfo - -func (m *QueryAllClientUsageResponse) GetClientUsage() []ClientUsage { - if m != nil { - return m.ClientUsage - } - return nil -} - -func (m *QueryAllClientUsageResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryStrayRequest struct { - Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` -} - -func (m *QueryStrayRequest) Reset() { *m = QueryStrayRequest{} } -func (m *QueryStrayRequest) String() string { return proto.CompactTextString(m) } -func (*QueryStrayRequest) ProtoMessage() {} -func (*QueryStrayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{26} -} -func (m *QueryStrayRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryFidCidRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryStrayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryFidCidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryStrayRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryFidCidRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1234,41 +1138,41 @@ func (m *QueryStrayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *QueryStrayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryStrayRequest.Merge(m, src) +func (m *QueryFidCidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFidCidRequest.Merge(m, src) } -func (m *QueryStrayRequest) XXX_Size() int { +func (m *QueryFidCidRequest) XXX_Size() int { return m.Size() } -func (m *QueryStrayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryStrayRequest.DiscardUnknown(m) +func (m *QueryFidCidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFidCidRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryStrayRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryFidCidRequest proto.InternalMessageInfo -func (m *QueryStrayRequest) GetCid() string { +func (m *QueryFidCidRequest) GetFid() string { if m != nil { - return m.Cid + return m.Fid } return "" } -type QueryStrayResponse struct { - Strays Strays `protobuf:"bytes,1,opt,name=strays,proto3" json:"strays"` +type QueryFidCidResponse struct { + FidCid FidCid `protobuf:"bytes,1,opt,name=fid_cid,json=fidCid,proto3" json:"fid_cid"` } -func (m *QueryStrayResponse) Reset() { *m = QueryStrayResponse{} } -func (m *QueryStrayResponse) String() string { return proto.CompactTextString(m) } -func (*QueryStrayResponse) ProtoMessage() {} -func (*QueryStrayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{27} +func (m *QueryFidCidResponse) Reset() { *m = QueryFidCidResponse{} } +func (m *QueryFidCidResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFidCidResponse) ProtoMessage() {} +func (*QueryFidCidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{25} } -func (m *QueryStrayResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryFidCidResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryStrayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryFidCidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryStrayResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryFidCidResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1278,41 +1182,41 @@ func (m *QueryStrayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryStrayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryStrayResponse.Merge(m, src) +func (m *QueryFidCidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFidCidResponse.Merge(m, src) } -func (m *QueryStrayResponse) XXX_Size() int { +func (m *QueryFidCidResponse) XXX_Size() int { return m.Size() } -func (m *QueryStrayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryStrayResponse.DiscardUnknown(m) +func (m *QueryFidCidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFidCidResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryStrayResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryFidCidResponse proto.InternalMessageInfo -func (m *QueryStrayResponse) GetStrays() Strays { +func (m *QueryFidCidResponse) GetFidCid() FidCid { if m != nil { - return m.Strays + return m.FidCid } - return Strays{} + return FidCid{} } -type QueryAllStraysRequest struct { +type QueryAllFidCidRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllStraysRequest) Reset() { *m = QueryAllStraysRequest{} } -func (m *QueryAllStraysRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllStraysRequest) ProtoMessage() {} -func (*QueryAllStraysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{28} +func (m *QueryAllFidCidRequest) Reset() { *m = QueryAllFidCidRequest{} } +func (m *QueryAllFidCidRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllFidCidRequest) ProtoMessage() {} +func (*QueryAllFidCidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{26} } -func (m *QueryAllStraysRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllFidCidRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllStraysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllFidCidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllStraysRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllFidCidRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1322,42 +1226,42 @@ func (m *QueryAllStraysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryAllStraysRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllStraysRequest.Merge(m, src) +func (m *QueryAllFidCidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllFidCidRequest.Merge(m, src) } -func (m *QueryAllStraysRequest) XXX_Size() int { +func (m *QueryAllFidCidRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllStraysRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllStraysRequest.DiscardUnknown(m) +func (m *QueryAllFidCidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllFidCidRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllStraysRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllFidCidRequest proto.InternalMessageInfo -func (m *QueryAllStraysRequest) GetPagination() *query.PageRequest { +func (m *QueryAllFidCidRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryAllStraysResponse struct { - Strays []Strays `protobuf:"bytes,1,rep,name=strays,proto3" json:"strays"` +type QueryAllFidCidResponse struct { + FidCid []FidCid `protobuf:"bytes,1,rep,name=fid_cid,json=fidCid,proto3" json:"fid_cid"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllStraysResponse) Reset() { *m = QueryAllStraysResponse{} } -func (m *QueryAllStraysResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllStraysResponse) ProtoMessage() {} -func (*QueryAllStraysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{29} +func (m *QueryAllFidCidResponse) Reset() { *m = QueryAllFidCidResponse{} } +func (m *QueryAllFidCidResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllFidCidResponse) ProtoMessage() {} +func (*QueryAllFidCidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{27} } -func (m *QueryAllStraysResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllFidCidResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllStraysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllFidCidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllStraysResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllFidCidResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1367,48 +1271,48 @@ func (m *QueryAllStraysResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryAllStraysResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllStraysResponse.Merge(m, src) +func (m *QueryAllFidCidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllFidCidResponse.Merge(m, src) } -func (m *QueryAllStraysResponse) XXX_Size() int { +func (m *QueryAllFidCidResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllStraysResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllStraysResponse.DiscardUnknown(m) +func (m *QueryAllFidCidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllFidCidResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllStraysResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllFidCidResponse proto.InternalMessageInfo -func (m *QueryAllStraysResponse) GetStrays() []Strays { +func (m *QueryAllFidCidResponse) GetFidCid() []FidCid { if m != nil { - return m.Strays + return m.FidCid } return nil } -func (m *QueryAllStraysResponse) GetPagination() *query.PageResponse { +func (m *QueryAllFidCidResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } return nil } -type QueryClientFreeSpaceRequest struct { +type QueryPayDataRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } -func (m *QueryClientFreeSpaceRequest) Reset() { *m = QueryClientFreeSpaceRequest{} } -func (m *QueryClientFreeSpaceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClientFreeSpaceRequest) ProtoMessage() {} -func (*QueryClientFreeSpaceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{30} +func (m *QueryPayDataRequest) Reset() { *m = QueryPayDataRequest{} } +func (m *QueryPayDataRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPayDataRequest) ProtoMessage() {} +func (*QueryPayDataRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{28} } -func (m *QueryClientFreeSpaceRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryPayDataRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClientFreeSpaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPayDataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClientFreeSpaceRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPayDataRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1418,41 +1322,42 @@ func (m *QueryClientFreeSpaceRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClientFreeSpaceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClientFreeSpaceRequest.Merge(m, src) +func (m *QueryPayDataRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPayDataRequest.Merge(m, src) } -func (m *QueryClientFreeSpaceRequest) XXX_Size() int { +func (m *QueryPayDataRequest) XXX_Size() int { return m.Size() } -func (m *QueryClientFreeSpaceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClientFreeSpaceRequest.DiscardUnknown(m) -} +func (m *QueryPayDataRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPayDataRequest.DiscardUnknown(m) +} -var xxx_messageInfo_QueryClientFreeSpaceRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryPayDataRequest proto.InternalMessageInfo -func (m *QueryClientFreeSpaceRequest) GetAddress() string { +func (m *QueryPayDataRequest) GetAddress() string { if m != nil { return m.Address } return "" } -type QueryClientFreeSpaceResponse struct { - Bytesfree string `protobuf:"bytes,1,opt,name=bytesfree,proto3" json:"bytesfree,omitempty"` +type QueryPayDataResponse struct { + TimeRemaining int64 `protobuf:"varint,1,opt,name=time_remaining,json=timeRemaining,proto3" json:"time_remaining,omitempty"` + Bytes int64 `protobuf:"varint,2,opt,name=bytes,proto3" json:"bytes,omitempty"` } -func (m *QueryClientFreeSpaceResponse) Reset() { *m = QueryClientFreeSpaceResponse{} } -func (m *QueryClientFreeSpaceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClientFreeSpaceResponse) ProtoMessage() {} -func (*QueryClientFreeSpaceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{31} +func (m *QueryPayDataResponse) Reset() { *m = QueryPayDataResponse{} } +func (m *QueryPayDataResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPayDataResponse) ProtoMessage() {} +func (*QueryPayDataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{29} } -func (m *QueryClientFreeSpaceResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryPayDataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClientFreeSpaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPayDataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClientFreeSpaceResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPayDataResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1462,41 +1367,48 @@ func (m *QueryClientFreeSpaceResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClientFreeSpaceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClientFreeSpaceResponse.Merge(m, src) +func (m *QueryPayDataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPayDataResponse.Merge(m, src) } -func (m *QueryClientFreeSpaceResponse) XXX_Size() int { +func (m *QueryPayDataResponse) XXX_Size() int { return m.Size() } -func (m *QueryClientFreeSpaceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClientFreeSpaceResponse.DiscardUnknown(m) +func (m *QueryPayDataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPayDataResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryClientFreeSpaceResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryPayDataResponse proto.InternalMessageInfo -func (m *QueryClientFreeSpaceResponse) GetBytesfree() string { +func (m *QueryPayDataResponse) GetTimeRemaining() int64 { if m != nil { - return m.Bytesfree + return m.TimeRemaining } - return "" + return 0 } -type QueryFidCidRequest struct { - Fid string `protobuf:"bytes,1,opt,name=fid,proto3" json:"fid,omitempty"` +func (m *QueryPayDataResponse) GetBytes() int64 { + if m != nil { + return m.Bytes + } + return 0 } -func (m *QueryFidCidRequest) Reset() { *m = QueryFidCidRequest{} } -func (m *QueryFidCidRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFidCidRequest) ProtoMessage() {} -func (*QueryFidCidRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{32} +type QueryStoragePaymentInfoRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } -func (m *QueryFidCidRequest) XXX_Unmarshal(b []byte) error { + +func (m *QueryStoragePaymentInfoRequest) Reset() { *m = QueryStoragePaymentInfoRequest{} } +func (m *QueryStoragePaymentInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStoragePaymentInfoRequest) ProtoMessage() {} +func (*QueryStoragePaymentInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{30} +} +func (m *QueryStoragePaymentInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFidCidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryStoragePaymentInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFidCidRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryStoragePaymentInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1506,41 +1418,41 @@ func (m *QueryFidCidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryFidCidRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFidCidRequest.Merge(m, src) +func (m *QueryStoragePaymentInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStoragePaymentInfoRequest.Merge(m, src) } -func (m *QueryFidCidRequest) XXX_Size() int { +func (m *QueryStoragePaymentInfoRequest) XXX_Size() int { return m.Size() } -func (m *QueryFidCidRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFidCidRequest.DiscardUnknown(m) +func (m *QueryStoragePaymentInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStoragePaymentInfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryFidCidRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryStoragePaymentInfoRequest proto.InternalMessageInfo -func (m *QueryFidCidRequest) GetFid() string { +func (m *QueryStoragePaymentInfoRequest) GetAddress() string { if m != nil { - return m.Fid + return m.Address } return "" } -type QueryFidCidResponse struct { - FidCid FidCid `protobuf:"bytes,1,opt,name=fid_cid,json=fidCid,proto3" json:"fid_cid"` +type QueryStoragePaymentInfoResponse struct { + StoragePaymentInfo StoragePaymentInfo `protobuf:"bytes,1,opt,name=storage_payment_info,json=storagePaymentInfo,proto3" json:"storage_payment_info"` } -func (m *QueryFidCidResponse) Reset() { *m = QueryFidCidResponse{} } -func (m *QueryFidCidResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFidCidResponse) ProtoMessage() {} -func (*QueryFidCidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{33} +func (m *QueryStoragePaymentInfoResponse) Reset() { *m = QueryStoragePaymentInfoResponse{} } +func (m *QueryStoragePaymentInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStoragePaymentInfoResponse) ProtoMessage() {} +func (*QueryStoragePaymentInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{31} } -func (m *QueryFidCidResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryStoragePaymentInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFidCidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryStoragePaymentInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFidCidResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryStoragePaymentInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1550,41 +1462,41 @@ func (m *QueryFidCidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryFidCidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFidCidResponse.Merge(m, src) +func (m *QueryStoragePaymentInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStoragePaymentInfoResponse.Merge(m, src) } -func (m *QueryFidCidResponse) XXX_Size() int { +func (m *QueryStoragePaymentInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryFidCidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFidCidResponse.DiscardUnknown(m) +func (m *QueryStoragePaymentInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStoragePaymentInfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryFidCidResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryStoragePaymentInfoResponse proto.InternalMessageInfo -func (m *QueryFidCidResponse) GetFidCid() FidCid { +func (m *QueryStoragePaymentInfoResponse) GetStoragePaymentInfo() StoragePaymentInfo { if m != nil { - return m.FidCid + return m.StoragePaymentInfo } - return FidCid{} + return StoragePaymentInfo{} } -type QueryAllFidCidRequest struct { +type QueryAllStoragePaymentInfoRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllFidCidRequest) Reset() { *m = QueryAllFidCidRequest{} } -func (m *QueryAllFidCidRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllFidCidRequest) ProtoMessage() {} -func (*QueryAllFidCidRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{34} +func (m *QueryAllStoragePaymentInfoRequest) Reset() { *m = QueryAllStoragePaymentInfoRequest{} } +func (m *QueryAllStoragePaymentInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllStoragePaymentInfoRequest) ProtoMessage() {} +func (*QueryAllStoragePaymentInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{32} } -func (m *QueryAllFidCidRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllStoragePaymentInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllFidCidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllStoragePaymentInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllFidCidRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllStoragePaymentInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1594,42 +1506,42 @@ func (m *QueryAllFidCidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryAllFidCidRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllFidCidRequest.Merge(m, src) +func (m *QueryAllStoragePaymentInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllStoragePaymentInfoRequest.Merge(m, src) } -func (m *QueryAllFidCidRequest) XXX_Size() int { +func (m *QueryAllStoragePaymentInfoRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllFidCidRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllFidCidRequest.DiscardUnknown(m) +func (m *QueryAllStoragePaymentInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllStoragePaymentInfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllFidCidRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllStoragePaymentInfoRequest proto.InternalMessageInfo -func (m *QueryAllFidCidRequest) GetPagination() *query.PageRequest { +func (m *QueryAllStoragePaymentInfoRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryAllFidCidResponse struct { - FidCid []FidCid `protobuf:"bytes,1,rep,name=fid_cid,json=fidCid,proto3" json:"fid_cid"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryAllStoragePaymentInfoResponse struct { + StoragePaymentInfo []StoragePaymentInfo `protobuf:"bytes,1,rep,name=storage_payment_info,json=storagePaymentInfo,proto3" json:"storage_payment_info"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllFidCidResponse) Reset() { *m = QueryAllFidCidResponse{} } -func (m *QueryAllFidCidResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllFidCidResponse) ProtoMessage() {} -func (*QueryAllFidCidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{35} +func (m *QueryAllStoragePaymentInfoResponse) Reset() { *m = QueryAllStoragePaymentInfoResponse{} } +func (m *QueryAllStoragePaymentInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllStoragePaymentInfoResponse) ProtoMessage() {} +func (*QueryAllStoragePaymentInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{33} } -func (m *QueryAllFidCidResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllStoragePaymentInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllFidCidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllStoragePaymentInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllFidCidResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllStoragePaymentInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1639,48 +1551,49 @@ func (m *QueryAllFidCidResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryAllFidCidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllFidCidResponse.Merge(m, src) +func (m *QueryAllStoragePaymentInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllStoragePaymentInfoResponse.Merge(m, src) } -func (m *QueryAllFidCidResponse) XXX_Size() int { +func (m *QueryAllStoragePaymentInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllFidCidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllFidCidResponse.DiscardUnknown(m) +func (m *QueryAllStoragePaymentInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllStoragePaymentInfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllFidCidResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllStoragePaymentInfoResponse proto.InternalMessageInfo -func (m *QueryAllFidCidResponse) GetFidCid() []FidCid { +func (m *QueryAllStoragePaymentInfoResponse) GetStoragePaymentInfo() []StoragePaymentInfo { if m != nil { - return m.FidCid + return m.StoragePaymentInfo } return nil } -func (m *QueryAllFidCidResponse) GetPagination() *query.PageResponse { +func (m *QueryAllStoragePaymentInfoResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } return nil } -type QueryPayDataRequest struct { +type QueryFileUploadCheck struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Bytes int64 `protobuf:"varint,2,opt,name=bytes,proto3" json:"bytes,omitempty"` } -func (m *QueryPayDataRequest) Reset() { *m = QueryPayDataRequest{} } -func (m *QueryPayDataRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPayDataRequest) ProtoMessage() {} -func (*QueryPayDataRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{36} +func (m *QueryFileUploadCheck) Reset() { *m = QueryFileUploadCheck{} } +func (m *QueryFileUploadCheck) String() string { return proto.CompactTextString(m) } +func (*QueryFileUploadCheck) ProtoMessage() {} +func (*QueryFileUploadCheck) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{34} } -func (m *QueryPayDataRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryFileUploadCheck) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPayDataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryFileUploadCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPayDataRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryFileUploadCheck.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1690,42 +1603,48 @@ func (m *QueryPayDataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryPayDataRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPayDataRequest.Merge(m, src) +func (m *QueryFileUploadCheck) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFileUploadCheck.Merge(m, src) } -func (m *QueryPayDataRequest) XXX_Size() int { +func (m *QueryFileUploadCheck) XXX_Size() int { return m.Size() } -func (m *QueryPayDataRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPayDataRequest.DiscardUnknown(m) +func (m *QueryFileUploadCheck) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFileUploadCheck.DiscardUnknown(m) } -var xxx_messageInfo_QueryPayDataRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryFileUploadCheck proto.InternalMessageInfo -func (m *QueryPayDataRequest) GetAddress() string { +func (m *QueryFileUploadCheck) GetAddress() string { if m != nil { return m.Address } return "" } -type QueryPayDataResponse struct { - BlocksRemaining int64 `protobuf:"varint,1,opt,name=blocks_remaining,json=blocksRemaining,proto3" json:"blocks_remaining,omitempty"` - Bytes int64 `protobuf:"varint,2,opt,name=bytes,proto3" json:"bytes,omitempty"` +func (m *QueryFileUploadCheck) GetBytes() int64 { + if m != nil { + return m.Bytes + } + return 0 } -func (m *QueryPayDataResponse) Reset() { *m = QueryPayDataResponse{} } -func (m *QueryPayDataResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPayDataResponse) ProtoMessage() {} -func (*QueryPayDataResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9fe03bff51a37284, []int{37} +type QueryFileUploadCheckResponse struct { + Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` } -func (m *QueryPayDataResponse) XXX_Unmarshal(b []byte) error { + +func (m *QueryFileUploadCheckResponse) Reset() { *m = QueryFileUploadCheckResponse{} } +func (m *QueryFileUploadCheckResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFileUploadCheckResponse) ProtoMessage() {} +func (*QueryFileUploadCheckResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9fe03bff51a37284, []int{35} +} +func (m *QueryFileUploadCheckResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPayDataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryFileUploadCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPayDataResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryFileUploadCheckResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1735,30 +1654,23 @@ func (m *QueryPayDataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QueryPayDataResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPayDataResponse.Merge(m, src) +func (m *QueryFileUploadCheckResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFileUploadCheckResponse.Merge(m, src) } -func (m *QueryPayDataResponse) XXX_Size() int { +func (m *QueryFileUploadCheckResponse) XXX_Size() int { return m.Size() } -func (m *QueryPayDataResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPayDataResponse.DiscardUnknown(m) +func (m *QueryFileUploadCheckResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFileUploadCheckResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPayDataResponse proto.InternalMessageInfo - -func (m *QueryPayDataResponse) GetBlocksRemaining() int64 { - if m != nil { - return m.BlocksRemaining - } - return 0 -} +var xxx_messageInfo_QueryFileUploadCheckResponse proto.InternalMessageInfo -func (m *QueryPayDataResponse) GetBytes() int64 { +func (m *QueryFileUploadCheckResponse) GetValid() bool { if m != nil { - return m.Bytes + return m.Valid } - return 0 + return false } func init() { @@ -1780,14 +1692,6 @@ func init() { proto.RegisterType((*QueryFreespaceResponse)(nil), "canine_chain.storage.QueryFreespaceResponse") proto.RegisterType((*QueryFindFileRequest)(nil), "canine_chain.storage.QueryFindFileRequest") proto.RegisterType((*QueryFindFileResponse)(nil), "canine_chain.storage.QueryFindFileResponse") - proto.RegisterType((*QueryPayBlockRequest)(nil), "canine_chain.storage.QueryPayBlockRequest") - proto.RegisterType((*QueryPayBlockResponse)(nil), "canine_chain.storage.QueryPayBlockResponse") - proto.RegisterType((*QueryAllPayBlocksRequest)(nil), "canine_chain.storage.QueryAllPayBlocksRequest") - proto.RegisterType((*QueryAllPayBlocksResponse)(nil), "canine_chain.storage.QueryAllPayBlocksResponse") - proto.RegisterType((*QueryClientUsageRequest)(nil), "canine_chain.storage.QueryClientUsageRequest") - proto.RegisterType((*QueryClientUsageResponse)(nil), "canine_chain.storage.QueryClientUsageResponse") - proto.RegisterType((*QueryAllClientUsageRequest)(nil), "canine_chain.storage.QueryAllClientUsageRequest") - proto.RegisterType((*QueryAllClientUsageResponse)(nil), "canine_chain.storage.QueryAllClientUsageResponse") proto.RegisterType((*QueryStrayRequest)(nil), "canine_chain.storage.QueryStrayRequest") proto.RegisterType((*QueryStrayResponse)(nil), "canine_chain.storage.QueryStrayResponse") proto.RegisterType((*QueryAllStraysRequest)(nil), "canine_chain.storage.QueryAllStraysRequest") @@ -1800,107 +1704,112 @@ func init() { proto.RegisterType((*QueryAllFidCidResponse)(nil), "canine_chain.storage.QueryAllFidCidResponse") proto.RegisterType((*QueryPayDataRequest)(nil), "canine_chain.storage.QueryPayDataRequest") proto.RegisterType((*QueryPayDataResponse)(nil), "canine_chain.storage.QueryPayDataResponse") + proto.RegisterType((*QueryStoragePaymentInfoRequest)(nil), "canine_chain.storage.QueryStoragePaymentInfoRequest") + proto.RegisterType((*QueryStoragePaymentInfoResponse)(nil), "canine_chain.storage.QueryStoragePaymentInfoResponse") + proto.RegisterType((*QueryAllStoragePaymentInfoRequest)(nil), "canine_chain.storage.QueryAllStoragePaymentInfoRequest") + proto.RegisterType((*QueryAllStoragePaymentInfoResponse)(nil), "canine_chain.storage.QueryAllStoragePaymentInfoResponse") + proto.RegisterType((*QueryFileUploadCheck)(nil), "canine_chain.storage.QueryFileUploadCheck") + proto.RegisterType((*QueryFileUploadCheckResponse)(nil), "canine_chain.storage.QueryFileUploadCheckResponse") } func init() { proto.RegisterFile("canine_chain/storage/query.proto", fileDescriptor_9fe03bff51a37284) } var fileDescriptor_9fe03bff51a37284 = []byte{ - // 1515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4d, 0x6f, 0xdc, 0xc4, - 0x1b, 0x8f, 0xbb, 0xff, 0xa6, 0xff, 0x9d, 0x44, 0x50, 0x86, 0x00, 0xc1, 0x44, 0x69, 0x6b, 0xd1, - 0x26, 0x4d, 0x13, 0x3b, 0x2f, 0xb4, 0x85, 0xb6, 0x08, 0x9a, 0x54, 0x29, 0xa0, 0x1e, 0xd2, 0xad, - 0x10, 0x12, 0x02, 0xad, 0x66, 0xed, 0xd9, 0xad, 0xa9, 0x63, 0x6f, 0xd7, 0x4e, 0xc5, 0x2a, 0xea, - 0x85, 0x0f, 0x80, 0x10, 0x08, 0xc1, 0xa5, 0x3d, 0x00, 0x12, 0x02, 0xc1, 0x85, 0xef, 0x80, 0xe8, - 0xb1, 0x12, 0x17, 0x4e, 0x08, 0x35, 0x7c, 0x10, 0xe4, 0x99, 0x67, 0xec, 0xb1, 0xe3, 0x8c, 0xed, - 0x68, 0x7b, 0x8b, 0x67, 0x9f, 0x97, 0xdf, 0xf3, 0x32, 0xcf, 0x3c, 0x3f, 0x05, 0x9d, 0xb4, 0x89, - 0xef, 0xfa, 0xb4, 0x6d, 0xdf, 0x26, 0xae, 0x6f, 0x85, 0x51, 0x30, 0x20, 0x3d, 0x6a, 0xdd, 0xdd, - 0xa1, 0x83, 0xa1, 0xd9, 0x1f, 0x04, 0x51, 0x80, 0xa7, 0x64, 0x09, 0x13, 0x24, 0xf4, 0xa9, 0x5e, - 0xd0, 0x0b, 0x98, 0x80, 0x15, 0xff, 0xc5, 0x65, 0xf5, 0x99, 0x5e, 0x10, 0xf4, 0x3c, 0x6a, 0x91, - 0xbe, 0x6b, 0x11, 0xdf, 0x0f, 0x22, 0x12, 0xb9, 0x81, 0x1f, 0xc2, 0xaf, 0x0b, 0x76, 0x10, 0x6e, - 0x07, 0xa1, 0xd5, 0x21, 0x21, 0xb8, 0xb0, 0xee, 0xad, 0x74, 0x68, 0x44, 0x56, 0xac, 0x3e, 0xe9, - 0xb9, 0x3e, 0x13, 0x06, 0xd9, 0x53, 0x85, 0xb8, 0xfa, 0x64, 0x40, 0xb6, 0x85, 0xb9, 0x57, 0x0b, - 0x45, 0xec, 0xc0, 0x8f, 0x06, 0xc4, 0x8e, 0x84, 0xd4, 0x5c, 0xa1, 0x14, 0xb1, 0x23, 0xf7, 0x1e, - 0x6d, 0x3b, 0x94, 0x78, 0x6a, 0x73, 0xfd, 0x41, 0x70, 0xcf, 0x75, 0xe8, 0x40, 0x48, 0x9d, 0x3e, - 0x00, 0xd7, 0xb0, 0xdd, 0xf1, 0x02, 0xfb, 0x8e, 0xda, 0xab, 0xed, 0xb9, 0xd4, 0x8f, 0xda, 0x3b, - 0x21, 0xe9, 0x51, 0x65, 0x9c, 0x61, 0x34, 0x20, 0x43, 0x61, 0xcb, 0x28, 0x14, 0xe9, 0xba, 0x4e, - 0xdb, 0x76, 0x1d, 0x2e, 0x63, 0x4c, 0x21, 0x7c, 0x33, 0x4e, 0xe8, 0x16, 0x4b, 0x50, 0x8b, 0xde, - 0xdd, 0xa1, 0x61, 0x64, 0xdc, 0x44, 0xcf, 0x67, 0x4e, 0xc3, 0x7e, 0xe0, 0x87, 0x14, 0x5f, 0x42, - 0xe3, 0x3c, 0x91, 0xd3, 0xda, 0x49, 0x6d, 0x7e, 0x62, 0x75, 0xc6, 0x2c, 0x2a, 0xb1, 0xc9, 0xb5, - 0xd6, 0xff, 0xf7, 0xe8, 0xef, 0x13, 0x63, 0x2d, 0xd0, 0x30, 0xe6, 0xd1, 0x14, 0x33, 0xb9, 0x01, - 0x69, 0x06, 0x57, 0xf8, 0x38, 0x6a, 0xd8, 0xae, 0xc3, 0x0c, 0x36, 0x5b, 0xf1, 0x9f, 0xc6, 0x47, - 0xe8, 0x85, 0x9c, 0x24, 0xb8, 0xdf, 0x40, 0xcd, 0xa4, 0x48, 0x80, 0xe0, 0x44, 0x31, 0x02, 0xa1, - 0x2a, 0x40, 0xa4, 0x7a, 0x46, 0x07, 0x4d, 0x33, 0xeb, 0x57, 0x3d, 0x2f, 0x91, 0x12, 0x58, 0x36, - 0x11, 0x4a, 0xfb, 0x09, 0x3c, 0x9c, 0x31, 0x79, 0xf3, 0x99, 0x71, 0xf3, 0x99, 0xbc, 0xbf, 0xa1, - 0xf9, 0xcc, 0x2d, 0xd2, 0xa3, 0xa0, 0xdb, 0x92, 0x34, 0x8d, 0x9f, 0x34, 0xf4, 0x72, 0x81, 0x93, - 0xe2, 0x30, 0x1a, 0x87, 0x09, 0x03, 0x5f, 0xcf, 0x40, 0x3d, 0xc2, 0xa0, 0xce, 0x95, 0x42, 0xe5, - 0x08, 0x32, 0x58, 0x17, 0xd0, 0x8b, 0x1c, 0x2a, 0x6b, 0xec, 0x6b, 0x94, 0x78, 0x07, 0x57, 0x86, - 0xa2, 0x97, 0xf6, 0xc9, 0x42, 0x50, 0xef, 0xa1, 0x49, 0xf9, 0x6a, 0x40, 0xf2, 0x4e, 0x15, 0xc7, - 0x95, 0xea, 0x8b, 0xc8, 0x26, 0x48, 0x7a, 0x64, 0x38, 0x48, 0x17, 0xd9, 0x93, 0x24, 0x47, 0x5d, - 0xa4, 0xdf, 0x34, 0xf4, 0x4a, 0xa1, 0x9b, 0x03, 0x23, 0x6a, 0x1c, 0x36, 0xa2, 0xd1, 0x55, 0x6b, - 0x19, 0x6e, 0xd1, 0x16, 0x4c, 0x17, 0x91, 0x94, 0x69, 0x74, 0x8c, 0x38, 0xce, 0x80, 0x86, 0x21, - 0xd4, 0x4b, 0x7c, 0x26, 0xb7, 0x29, 0xd5, 0x48, 0xdb, 0x30, 0x99, 0x51, 0xea, 0xdb, 0x24, 0x54, - 0x93, 0x36, 0x4c, 0xf4, 0xe4, 0xdb, 0x94, 0x48, 0x3d, 0xcd, 0xdb, 0x24, 0x39, 0x29, 0x0e, 0xa3, - 0x71, 0x98, 0x30, 0x46, 0x57, 0x9f, 0x15, 0xc8, 0xf6, 0xe6, 0x80, 0xd2, 0xb0, 0x4f, 0x6c, 0x5a, - 0x5e, 0x20, 0x13, 0x2e, 0xa0, 0xa4, 0x02, 0xa1, 0x4d, 0xa1, 0xa3, 0xec, 0x00, 0x34, 0xf8, 0x47, - 0x32, 0x48, 0x37, 0x5d, 0xdf, 0xd9, 0x74, 0x3d, 0x2a, 0x5d, 0xd7, 0x6e, 0x7a, 0x5d, 0xbb, 0xae, - 0x63, 0x5c, 0x12, 0x60, 0x12, 0x49, 0x30, 0x7c, 0x0a, 0x4d, 0x8a, 0xd8, 0xdb, 0x6e, 0x5f, 0x20, - 0x9a, 0x10, 0x67, 0xef, 0xf6, 0xc3, 0xb4, 0xd1, 0xc8, 0x70, 0x3d, 0x7e, 0x9f, 0xa4, 0x38, 0xd8, - 0x7b, 0x95, 0x78, 0x12, 0x9f, 0xc6, 0xc7, 0xa2, 0xd1, 0x12, 0x0d, 0xf0, 0x76, 0x2d, 0x4e, 0xae, - 0x78, 0xe6, 0x4a, 0x3a, 0x0d, 0x74, 0xd3, 0x12, 0x89, 0x83, 0x4c, 0xa7, 0x89, 0xc3, 0x51, 0x77, - 0xda, 0xcf, 0x72, 0xa7, 0xa5, 0x4e, 0x0e, 0x88, 0xa3, 0x71, 0x98, 0x38, 0x46, 0xd7, 0x6a, 0x6b, - 0x30, 0x8c, 0x37, 0xd8, 0x6e, 0xf0, 0x7e, 0x98, 0xc6, 0xa4, 0x68, 0xb6, 0x2e, 0x64, 0x31, 0xa3, - 0x94, 0x0e, 0x3c, 0x79, 0xcf, 0x50, 0x8f, 0x70, 0xc9, 0x80, 0x18, 0x78, 0x76, 0x7a, 0x24, 0x8f, - 0xf0, 0x02, 0x7c, 0x4f, 0x63, 0x84, 0x57, 0x8b, 0xa8, 0x71, 0xd8, 0x88, 0x46, 0x57, 0xb7, 0xd3, - 0xe8, 0x39, 0x86, 0xf9, 0x56, 0xbc, 0xaa, 0x1d, 0xfc, 0xd6, 0x6e, 0xc1, 0x62, 0x06, 0x62, 0xe9, - 0x06, 0xc6, 0x57, 0x3c, 0xf5, 0x06, 0xc6, 0x94, 0x92, 0x0d, 0x8c, 0x6b, 0x18, 0x6d, 0xb8, 0xa0, - 0x57, 0x3d, 0x8f, 0xff, 0x3e, 0xea, 0x72, 0x3c, 0xd0, 0xc4, 0x2e, 0x91, 0x7a, 0x28, 0xc0, 0xdd, - 0xa8, 0x87, 0x7b, 0x74, 0x99, 0xbf, 0x08, 0xdd, 0xc2, 0x2b, 0x1d, 0xcf, 0xdb, 0x5b, 0xd5, 0x46, - 0xf4, 0x15, 0x34, 0x53, 0xac, 0x08, 0xd1, 0xcd, 0xa0, 0x66, 0x67, 0x18, 0xd1, 0xb0, 0x3b, 0xa0, - 0x62, 0x58, 0xa7, 0x07, 0xc6, 0x19, 0xa8, 0xe4, 0xa6, 0xeb, 0x6c, 0xb8, 0xce, 0xc1, 0xe3, 0xba, - 0x05, 0x4b, 0xb7, 0x90, 0x03, 0xe3, 0x97, 0xd1, 0x31, 0x58, 0xd9, 0xd5, 0x35, 0xe7, 0x6a, 0x22, - 0x77, 0x5d, 0xf6, 0x25, 0xd7, 0x3c, 0xeb, 0x7e, 0x54, 0x35, 0x7f, 0x28, 0xd5, 0x5c, 0x05, 0xbc, - 0x51, 0x0f, 0xf8, 0xe8, 0x8a, 0x6e, 0x25, 0x54, 0x66, 0x78, 0x8d, 0x44, 0xa4, 0xbc, 0xd8, 0x1f, - 0xa4, 0x2f, 0x1f, 0x57, 0x80, 0x70, 0xce, 0xa2, 0xe3, 0x7c, 0xf4, 0xb7, 0x07, 0x74, 0x9b, 0xb8, - 0xbe, 0xeb, 0xf7, 0x98, 0x6a, 0xa3, 0xf5, 0x6c, 0x07, 0x1e, 0x0a, 0x38, 0x8e, 0x1f, 0x6e, 0x56, - 0x7e, 0x86, 0xbb, 0xd1, 0xe2, 0x1f, 0xab, 0x7f, 0x4c, 0xa3, 0xa3, 0xcc, 0x32, 0xfe, 0x5c, 0x43, - 0xe3, 0x9c, 0x24, 0xe1, 0xf9, 0xe2, 0x9c, 0xec, 0xe7, 0x64, 0xfa, 0xd9, 0x0a, 0x92, 0x1c, 0xaa, - 0x61, 0x7d, 0xf6, 0xe7, 0xbf, 0x5f, 0x1d, 0x39, 0x8b, 0xe7, 0xac, 0x4f, 0x88, 0x7d, 0x87, 0x78, - 0x4b, 0x0e, 0x09, 0x2c, 0xae, 0xbd, 0x54, 0xc4, 0x8b, 0xf1, 0x43, 0x0d, 0x35, 0x13, 0xb2, 0x81, - 0x17, 0x14, 0x9e, 0x72, 0xf4, 0x4d, 0x3f, 0x57, 0x49, 0x16, 0x70, 0xbd, 0xce, 0x70, 0xad, 0xe2, - 0xe5, 0x52, 0x5c, 0x09, 0xd1, 0xb1, 0x76, 0x6d, 0xd7, 0xb9, 0x8f, 0xbf, 0xd7, 0xd0, 0x64, 0x02, - 0xf0, 0xaa, 0xe7, 0x61, 0x53, 0xe1, 0xb7, 0x80, 0xda, 0xe9, 0x56, 0x65, 0x79, 0xc0, 0xba, 0xca, - 0xb0, 0x2e, 0xe2, 0x85, 0xea, 0x58, 0xf1, 0x8f, 0x1a, 0x9a, 0x90, 0x98, 0x00, 0x5e, 0x54, 0x39, - 0xcd, 0xf3, 0x2d, 0x7d, 0xa9, 0xa2, 0x34, 0x00, 0xbc, 0xcc, 0x00, 0x9e, 0xc7, 0x6b, 0xa5, 0x00, - 0x65, 0x1a, 0x03, 0xf9, 0xfc, 0x45, 0x43, 0xcf, 0x48, 0x48, 0xe3, 0x8c, 0x2e, 0xab, 0x33, 0xb4, - 0x9f, 0x89, 0xe9, 0x2b, 0x35, 0x34, 0x00, 0xf4, 0x79, 0x06, 0xda, 0xc2, 0x4b, 0xb5, 0x40, 0xe3, - 0xef, 0x34, 0xd4, 0x4c, 0xd6, 0x77, 0x65, 0x7f, 0xe6, 0x88, 0x91, 0xb2, 0x3f, 0xf3, 0x94, 0xc8, - 0xb8, 0xc2, 0xd0, 0x5d, 0xc0, 0xaf, 0x95, 0xdf, 0x1b, 0x01, 0xc6, 0xda, 0x85, 0xb9, 0xc1, 0x7b, - 0x34, 0x01, 0x59, 0xa1, 0x47, 0xf3, 0x84, 0xa9, 0xac, 0x47, 0xf7, 0x71, 0x9f, 0x1a, 0x3d, 0x9a, - 0x52, 0x9d, 0x1f, 0x34, 0xd4, 0x4c, 0xa8, 0x06, 0x56, 0xa5, 0x27, 0xcf, 0x61, 0xf4, 0xc5, 0x6a, - 0xc2, 0xb5, 0x93, 0xd9, 0x15, 0xba, 0x52, 0x32, 0x1f, 0x68, 0xe8, 0xff, 0x82, 0xb7, 0x28, 0x0b, - 0x9e, 0xa3, 0x41, 0xca, 0x82, 0xe7, 0x89, 0x50, 0x8d, 0x81, 0xd4, 0x75, 0x7d, 0xa7, 0xdd, 0x75, - 0x3d, 0x6a, 0xed, 0x76, 0x61, 0x20, 0x35, 0x93, 0x2d, 0x5f, 0xdd, 0x91, 0x59, 0x06, 0xa5, 0xee, - 0xc8, 0x1c, 0x77, 0x32, 0xde, 0x64, 0x00, 0x2f, 0xe2, 0xf3, 0x15, 0x26, 0xb9, 0xa0, 0x26, 0xd6, - 0x2e, 0x50, 0xb2, 0xfb, 0x71, 0xb1, 0x27, 0x13, 0x94, 0x55, 0x5a, 0x32, 0xc7, 0xac, 0x4a, 0x5b, - 0x32, 0x4f, 0x92, 0x8c, 0x35, 0x06, 0x78, 0x09, 0x9f, 0xab, 0x01, 0x18, 0xff, 0xaa, 0xa1, 0x09, - 0x69, 0xfd, 0xc6, 0xaa, 0x49, 0xb8, 0x9f, 0x4e, 0xe8, 0x66, 0x55, 0x71, 0xc0, 0xf8, 0x16, 0xc3, - 0xf8, 0x06, 0xbe, 0x58, 0x3e, 0xda, 0x25, 0xf6, 0x20, 0x35, 0x67, 0x3c, 0x3d, 0x25, 0xc3, 0x15, - 0xa6, 0x67, 0x01, 0xea, 0x95, 0x1a, 0x1a, 0xb5, 0xa7, 0xa7, 0x0c, 0x1c, 0x7f, 0xa9, 0xa1, 0x71, - 0xbe, 0x59, 0xe3, 0x39, 0x85, 0x53, 0x99, 0x90, 0xe8, 0xf3, 0xe5, 0x82, 0xb5, 0x41, 0xf1, 0x7d, - 0x1e, 0x5e, 0xa0, 0x6f, 0x34, 0xd4, 0xe4, 0xa0, 0xe2, 0xf4, 0x9d, 0x53, 0x27, 0x23, 0xc3, 0x57, - 0x94, 0x73, 0x68, 0x1f, 0xf5, 0xa8, 0xb1, 0x0c, 0x01, 0xdf, 0xf8, 0x5d, 0x43, 0xf8, 0x3a, 0x8d, - 0x72, 0xcb, 0x3e, 0x5e, 0x29, 0xed, 0xb2, 0x3c, 0xa3, 0xd0, 0x57, 0xeb, 0xa8, 0x00, 0xdc, 0x77, - 0x18, 0xdc, 0x75, 0xfc, 0x76, 0x29, 0xdc, 0x1e, 0x8d, 0xda, 0x50, 0xe7, 0x78, 0x82, 0xb6, 0xf3, - 0x23, 0xf4, 0x6b, 0x0d, 0x8d, 0xf3, 0xdd, 0x5a, 0xb9, 0x65, 0x66, 0x78, 0x81, 0x72, 0xcb, 0xcc, - 0xee, 0xf7, 0xc6, 0x05, 0x86, 0x74, 0x19, 0x9b, 0x15, 0x86, 0x27, 0xa3, 0x01, 0x30, 0x3a, 0xbf, - 0x8d, 0x5f, 0x20, 0x66, 0xaa, 0x42, 0xe5, 0xb3, 0xe8, 0x16, 0xab, 0x09, 0x03, 0xc0, 0x65, 0x06, - 0x70, 0x01, 0xcf, 0x57, 0x05, 0x18, 0xcf, 0x4b, 0x74, 0x9d, 0x46, 0xb0, 0xfa, 0x63, 0xf5, 0xca, - 0x2d, 0xf3, 0x09, 0x7d, 0xa1, 0x8a, 0x68, 0xed, 0xf9, 0x13, 0x97, 0x38, 0x9e, 0x93, 0x0e, 0x89, - 0x48, 0x5a, 0xd9, 0xf5, 0x1b, 0x8f, 0x9e, 0xcc, 0x6a, 0x8f, 0x9f, 0xcc, 0x6a, 0xff, 0x3c, 0x99, - 0xd5, 0xbe, 0xd8, 0x9b, 0x1d, 0x7b, 0xbc, 0x37, 0x3b, 0xf6, 0xd7, 0xde, 0xec, 0xd8, 0x87, 0xab, - 0x3d, 0x37, 0xba, 0xbd, 0xd3, 0x31, 0xed, 0x60, 0x1b, 0x8c, 0xdf, 0x20, 0x9d, 0x30, 0x6b, 0xfc, - 0xd3, 0xc4, 0x7c, 0x34, 0xec, 0xd3, 0xb0, 0x33, 0xce, 0xfe, 0x13, 0xb4, 0xf6, 0x5f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xf2, 0x8a, 0x9d, 0x14, 0xd2, 0x1b, 0x00, 0x00, + // 1494 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcf, 0x6f, 0xdc, 0xc4, + 0x17, 0xcf, 0x74, 0xbf, 0x4d, 0xbb, 0x93, 0x7e, 0x0b, 0x0c, 0x29, 0x2d, 0x26, 0xda, 0x36, 0x16, + 0x6d, 0xd2, 0x34, 0x59, 0x27, 0xdb, 0xf4, 0x07, 0x69, 0x25, 0x68, 0x53, 0xa5, 0x14, 0xf5, 0x90, + 0x6e, 0xc5, 0x05, 0x21, 0x99, 0x59, 0x7b, 0x76, 0x3b, 0xd4, 0xb1, 0xdd, 0xb5, 0x13, 0xb1, 0xaa, + 0xb8, 0xc0, 0x1d, 0x21, 0x10, 0x82, 0x4b, 0x7b, 0x00, 0x24, 0x84, 0x04, 0x17, 0xfe, 0x03, 0x90, + 0x90, 0x7a, 0xa3, 0x12, 0x1c, 0x38, 0x21, 0xd4, 0xf2, 0x87, 0x20, 0x8f, 0x9f, 0xbd, 0x5e, 0xaf, + 0x3d, 0xb6, 0xab, 0xe5, 0x16, 0xcf, 0xbe, 0xf7, 0xe6, 0xf3, 0xde, 0xfb, 0xbc, 0x37, 0xef, 0x29, + 0xf8, 0x84, 0x41, 0x6d, 0x6e, 0x33, 0xdd, 0xb8, 0x43, 0xb9, 0xad, 0x79, 0xbe, 0xd3, 0xa7, 0x3d, + 0xa6, 0xdd, 0xdb, 0x65, 0xfd, 0x41, 0xd3, 0xed, 0x3b, 0xbe, 0x43, 0x66, 0x93, 0x12, 0x4d, 0x90, + 0x50, 0x66, 0x7b, 0x4e, 0xcf, 0x11, 0x02, 0x5a, 0xf0, 0x57, 0x28, 0xab, 0xcc, 0xf5, 0x1c, 0xa7, + 0x67, 0x31, 0x8d, 0xba, 0x5c, 0xa3, 0xb6, 0xed, 0xf8, 0xd4, 0xe7, 0x8e, 0xed, 0xc1, 0xaf, 0x4b, + 0x86, 0xe3, 0xed, 0x38, 0x9e, 0xd6, 0xa1, 0x1e, 0x5c, 0xa1, 0xed, 0xad, 0x75, 0x98, 0x4f, 0xd7, + 0x34, 0x97, 0xf6, 0xb8, 0x2d, 0x84, 0x41, 0x76, 0x3e, 0x13, 0x97, 0x4b, 0xfb, 0x74, 0x27, 0x32, + 0xf7, 0x6a, 0xa6, 0x88, 0xe1, 0xd8, 0x7e, 0x9f, 0x1a, 0x7e, 0x24, 0xb5, 0x90, 0x29, 0x45, 0x0d, + 0x9f, 0xef, 0x31, 0xdd, 0x64, 0xd4, 0x92, 0x9b, 0x73, 0xfb, 0xce, 0x1e, 0x37, 0x59, 0xdf, 0x93, + 0xe2, 0xf2, 0xfc, 0x3e, 0x1d, 0x44, 0x22, 0x6a, 0xa6, 0x48, 0x97, 0x9b, 0xba, 0xc1, 0x4d, 0x29, + 0x2a, 0x97, 0x0e, 0x76, 0x98, 0xed, 0xeb, 0xdc, 0xee, 0x42, 0x44, 0xd5, 0x59, 0x4c, 0x6e, 0x05, + 0x91, 0xda, 0x16, 0x9e, 0xb7, 0xd9, 0xbd, 0x5d, 0xe6, 0xf9, 0xea, 0x2d, 0xfc, 0xe2, 0xc8, 0xa9, + 0xe7, 0x3a, 0xb6, 0xc7, 0xc8, 0x06, 0x9e, 0x0e, 0x23, 0x74, 0x0c, 0x9d, 0x40, 0x8b, 0x33, 0xad, + 0xb9, 0x66, 0x56, 0xee, 0x9a, 0xa1, 0xd6, 0xd5, 0xff, 0x3d, 0xfa, 0xeb, 0xf8, 0x54, 0x1b, 0x34, + 0xd4, 0x45, 0x3c, 0x2b, 0x4c, 0x6e, 0x42, 0xfc, 0xe0, 0x2a, 0xf2, 0x3c, 0xae, 0x19, 0xdc, 0x14, + 0x06, 0xeb, 0xed, 0xe0, 0x4f, 0xf5, 0x5d, 0x7c, 0x24, 0x25, 0x09, 0xd7, 0x6f, 0xe2, 0x7a, 0x1c, + 0x7d, 0x40, 0x70, 0x3c, 0x1b, 0x41, 0xa4, 0x1a, 0x81, 0x18, 0xea, 0xa9, 0x1d, 0x7c, 0x4c, 0x58, + 0xbf, 0x62, 0x59, 0xb1, 0x54, 0x84, 0x65, 0x0b, 0xe3, 0x21, 0x51, 0xe0, 0x86, 0x53, 0xcd, 0x90, + 0x55, 0xcd, 0x80, 0x55, 0xcd, 0x90, 0xb8, 0xc0, 0xaa, 0xe6, 0x36, 0xed, 0x31, 0xd0, 0x6d, 0x27, + 0x34, 0xd5, 0xef, 0x11, 0x7e, 0x39, 0xe3, 0x92, 0x6c, 0x37, 0x6a, 0xcf, 0xe2, 0x06, 0xb9, 0x3e, + 0x02, 0x75, 0x9f, 0x80, 0xba, 0x50, 0x08, 0x35, 0x44, 0x30, 0x82, 0x75, 0x09, 0xbf, 0x14, 0x42, + 0x15, 0x8c, 0xbd, 0xc6, 0xa8, 0x95, 0x9f, 0x19, 0x86, 0x8f, 0x8e, 0xc9, 0x82, 0x53, 0x6f, 0xe1, + 0x43, 0x49, 0xce, 0x43, 0xf0, 0xe6, 0xb3, 0xfd, 0x1a, 0xea, 0x47, 0x9e, 0xcd, 0xd0, 0xe1, 0x91, + 0x6a, 0x62, 0x25, 0x8a, 0x5e, 0x42, 0x72, 0xd2, 0x49, 0xfa, 0x09, 0xe1, 0x57, 0x32, 0xaf, 0xc9, + 0xf5, 0xa8, 0xf6, 0xac, 0x1e, 0x4d, 0x2e, 0x5b, 0xab, 0x50, 0x45, 0xdb, 0xd0, 0x36, 0xa2, 0xa0, + 0x1c, 0xc3, 0x07, 0xa8, 0x69, 0xf6, 0x99, 0xe7, 0x41, 0xbe, 0xa2, 0xcf, 0xb8, 0x9a, 0x86, 0x1a, + 0x43, 0x1a, 0xc6, 0xcd, 0x47, 0x5e, 0x4d, 0x91, 0x6a, 0x4c, 0xc3, 0x58, 0x2f, 0x59, 0x4d, 0xb1, + 0xd4, 0x7f, 0x59, 0x4d, 0x89, 0x4b, 0xb2, 0xdd, 0xa8, 0x3d, 0x8b, 0x1b, 0x93, 0xcb, 0xcf, 0x1a, + 0x44, 0x7b, 0xab, 0xcf, 0x98, 0xe7, 0x52, 0x83, 0x15, 0x27, 0xa8, 0x09, 0x05, 0x98, 0x50, 0x01, + 0xd7, 0x66, 0xf1, 0x7e, 0x71, 0x00, 0x1a, 0xe1, 0x47, 0xdc, 0x48, 0xb7, 0xb8, 0x6d, 0x6e, 0x71, + 0x8b, 0x25, 0xca, 0xb5, 0x3b, 0x2c, 0xd7, 0x2e, 0x37, 0xd5, 0x8d, 0x08, 0x4c, 0x2c, 0x09, 0x86, + 0xe7, 0xf1, 0xa1, 0xc8, 0x77, 0x9d, 0xbb, 0x11, 0xa2, 0x99, 0xe8, 0xec, 0x86, 0xeb, 0xa9, 0x27, + 0xf1, 0x0b, 0x42, 0xf7, 0x76, 0xf0, 0xf2, 0xe4, 0x77, 0x84, 0x6d, 0x78, 0x3e, 0x40, 0x6c, 0xf8, + 0x4e, 0x84, 0x2f, 0x96, 0xfc, 0x9d, 0x10, 0x4a, 0xf1, 0x3b, 0x11, 0x6a, 0xa8, 0x3a, 0x80, 0xbe, + 0x62, 0x59, 0xe1, 0xef, 0x93, 0xa6, 0xd3, 0x03, 0x14, 0x75, 0xbc, 0xe1, 0x0d, 0x19, 0xb8, 0x6b, + 0xd5, 0x70, 0x4f, 0x8e, 0x42, 0x17, 0xa0, 0x2d, 0x6d, 0x5a, 0x9c, 0xd9, 0x7e, 0xc0, 0x8a, 0xdb, + 0xe5, 0x88, 0x74, 0x19, 0xcf, 0x65, 0x2b, 0x82, 0x77, 0x73, 0xb8, 0xde, 0x19, 0xf8, 0xcc, 0xeb, + 0xf6, 0x59, 0x48, 0xa9, 0x5a, 0x7b, 0x78, 0xa0, 0x9e, 0x82, 0x4c, 0x6e, 0x71, 0x73, 0x93, 0x9b, + 0xf9, 0xa4, 0x6a, 0xc3, 0x68, 0x10, 0xc9, 0x81, 0xf1, 0x4b, 0xf8, 0x00, 0x4c, 0x20, 0xf2, 0x9c, + 0x87, 0x6a, 0x51, 0xec, 0xba, 0xe2, 0x2b, 0x99, 0xf3, 0xd1, 0xeb, 0x27, 0x95, 0xf3, 0x87, 0x89, + 0x9c, 0xcb, 0x80, 0xd7, 0xaa, 0x01, 0x9f, 0x5c, 0xd2, 0xb5, 0x78, 0xe0, 0x1a, 0x5c, 0xa3, 0x3e, + 0x2d, 0x4e, 0xf6, 0xed, 0xe8, 0x21, 0x88, 0x14, 0xc0, 0x9d, 0x93, 0xf8, 0xb0, 0xcf, 0x77, 0x98, + 0xde, 0x67, 0x3b, 0x94, 0xdb, 0xdc, 0xee, 0x41, 0xa6, 0xff, 0x1f, 0x9c, 0xb6, 0xa3, 0xc3, 0xa0, + 0xb5, 0x88, 0xd4, 0x0b, 0xcc, 0xb5, 0x76, 0xf8, 0xa1, 0x6e, 0xe0, 0x06, 0x54, 0xb3, 0xf0, 0x79, + 0x3b, 0x1c, 0x17, 0x6f, 0xd8, 0x5d, 0xa7, 0x18, 0xd0, 0xc7, 0x08, 0x1f, 0xcf, 0x55, 0x06, 0x70, + 0xef, 0xe1, 0x59, 0x08, 0xa7, 0x9e, 0x1c, 0x45, 0x21, 0xb1, 0x8b, 0x79, 0xd5, 0x96, 0xb6, 0x07, + 0x49, 0x20, 0xde, 0xd8, 0x2f, 0xea, 0x5d, 0x3c, 0x3f, 0xac, 0xed, 0x3c, 0x27, 0x26, 0xc5, 0xaa, + 0xdf, 0x10, 0x56, 0x65, 0xb7, 0x15, 0x7a, 0x5d, 0x9b, 0x8c, 0xd7, 0x93, 0xa3, 0xe1, 0x56, 0xfc, + 0xb6, 0x58, 0xec, 0x6d, 0xd7, 0x72, 0xa8, 0xb9, 0x79, 0x87, 0x19, 0x77, 0xf3, 0xd3, 0x9e, 0x43, + 0xa4, 0x75, 0x68, 0x45, 0x29, 0x3b, 0xc9, 0x97, 0x6d, 0x8f, 0x5a, 0xd0, 0x2b, 0x0e, 0xb6, 0xc3, + 0x8f, 0xd6, 0x1f, 0x47, 0xf1, 0x7e, 0xa1, 0x46, 0x3e, 0x41, 0x78, 0x3a, 0xdc, 0x22, 0x48, 0x4e, + 0x7c, 0xc6, 0x97, 0x16, 0xe5, 0x74, 0x09, 0xc9, 0xf0, 0x7e, 0x55, 0xfb, 0xe8, 0xf7, 0x7f, 0x3e, + 0xdf, 0x77, 0x9a, 0x2c, 0x68, 0xef, 0x53, 0xe3, 0x2e, 0xb5, 0x56, 0x4c, 0xea, 0x68, 0xa1, 0xf6, + 0x4a, 0xd6, 0x46, 0x48, 0x1e, 0x22, 0x5c, 0x8f, 0xa7, 0x71, 0xb2, 0x24, 0xb9, 0x29, 0xb5, 0xdf, + 0x28, 0x67, 0x4a, 0xc9, 0x02, 0xae, 0x8b, 0x02, 0x57, 0x8b, 0xac, 0x16, 0xe2, 0x8a, 0x37, 0x01, + 0xed, 0xbe, 0xc1, 0xcd, 0x0f, 0xc9, 0x37, 0x08, 0x1f, 0x8a, 0x01, 0x5e, 0xb1, 0x2c, 0xd2, 0x94, + 0xdc, 0x9b, 0xb1, 0xfb, 0x28, 0x5a, 0x69, 0x79, 0xc0, 0xda, 0x12, 0x58, 0x97, 0xc9, 0x52, 0x79, + 0xac, 0xe4, 0x3b, 0x84, 0x67, 0x12, 0xa3, 0x32, 0x59, 0x96, 0x5d, 0x9a, 0x5e, 0x48, 0x94, 0x95, + 0x92, 0xd2, 0x00, 0xf0, 0x92, 0x00, 0x78, 0x8e, 0x9c, 0x2d, 0x04, 0x98, 0x9c, 0xf3, 0x21, 0x9e, + 0x3f, 0x20, 0x7c, 0x38, 0x81, 0x34, 0x88, 0xe8, 0xaa, 0x3c, 0x42, 0xe3, 0xab, 0x8a, 0xb2, 0x56, + 0x41, 0x03, 0x40, 0x9f, 0x13, 0xa0, 0x35, 0xb2, 0x52, 0x09, 0x34, 0xf9, 0x1a, 0xe1, 0x7a, 0x3c, + 0xdf, 0x4a, 0xf9, 0x99, 0xda, 0x1c, 0xa4, 0xfc, 0x4c, 0xef, 0x0c, 0xea, 0x65, 0x81, 0xee, 0x3c, + 0x59, 0x2f, 0xae, 0x9b, 0x08, 0x8c, 0x76, 0x1f, 0x5a, 0x45, 0xc8, 0xd1, 0x18, 0x64, 0x09, 0x8e, + 0xa6, 0x37, 0x8a, 0x22, 0x8e, 0x8e, 0x2d, 0x07, 0x15, 0x38, 0x3a, 0xdc, 0x05, 0xbe, 0x45, 0xb8, + 0x1e, 0xcf, 0xe2, 0x44, 0x16, 0x9e, 0xf4, 0x90, 0xaf, 0x2c, 0x97, 0x13, 0xae, 0x1c, 0xcc, 0x6e, + 0xa4, 0x9b, 0x08, 0xe6, 0x03, 0x84, 0x0f, 0x46, 0x83, 0xbd, 0x34, 0xe1, 0xa9, 0x3d, 0x41, 0x9a, + 0xf0, 0xf4, 0xa6, 0x50, 0xa1, 0x21, 0x75, 0xb9, 0x6d, 0xea, 0x5d, 0x6e, 0x31, 0xed, 0x7e, 0x37, + 0x28, 0xa0, 0xcf, 0x10, 0x9e, 0x0e, 0x07, 0x65, 0xb2, 0x20, 0xb9, 0x31, 0xb9, 0x5f, 0x28, 0x8b, + 0xc5, 0x82, 0x95, 0xcb, 0x24, 0x1c, 0xcf, 0xa1, 0xaa, 0xbf, 0x44, 0xb8, 0x1e, 0x82, 0x0a, 0xe8, + 0x77, 0x46, 0x4e, 0xa7, 0x91, 0xf5, 0x43, 0x9a, 0xdb, 0xb1, 0x4d, 0xa2, 0xc2, 0x03, 0x03, 0xeb, + 0xc3, 0xaf, 0x08, 0x93, 0xeb, 0xcc, 0x4f, 0xcd, 0xee, 0x44, 0xd6, 0x41, 0xb2, 0x17, 0x04, 0xa5, + 0x55, 0x45, 0x05, 0xe0, 0xbe, 0x29, 0xe0, 0x5e, 0x25, 0x6f, 0x14, 0xc2, 0xed, 0x31, 0x5f, 0x37, + 0x84, 0x15, 0x3d, 0x60, 0xa5, 0x9e, 0xa6, 0xe5, 0x17, 0x08, 0x4f, 0x87, 0xa3, 0xb2, 0xf4, 0xe5, + 0x1e, 0x19, 0xf3, 0xa5, 0x2f, 0xf7, 0xe8, 0xb8, 0xae, 0x9e, 0x17, 0x48, 0x57, 0x49, 0xb3, 0x04, + 0x21, 0xc5, 0x54, 0x0f, 0x74, 0xfc, 0x2a, 0xa8, 0x6a, 0x61, 0xaa, 0x44, 0xe6, 0x47, 0xd1, 0x2d, + 0x97, 0x13, 0x06, 0x80, 0xab, 0x02, 0xe0, 0x12, 0x59, 0x2c, 0x0b, 0x30, 0x68, 0x38, 0xf8, 0x3a, + 0xf3, 0x61, 0x92, 0x27, 0xf2, 0x31, 0x26, 0xb9, 0x1e, 0x28, 0x4b, 0x65, 0x44, 0x01, 0xd7, 0xeb, + 0x02, 0xd7, 0x6b, 0xe4, 0x42, 0xa9, 0x14, 0xbb, 0x74, 0xa0, 0x9b, 0xd4, 0xa7, 0x89, 0xcc, 0xfe, + 0x82, 0x30, 0x19, 0x9f, 0x4a, 0xc9, 0xba, 0xb4, 0x66, 0x73, 0x46, 0x70, 0xe5, 0x5c, 0x45, 0xad, + 0xca, 0x4e, 0x24, 0x27, 0xed, 0x84, 0x13, 0x3f, 0x23, 0x7c, 0x64, 0xdc, 0x7e, 0x40, 0x89, 0x0b, + 0x45, 0xf5, 0x9d, 0xe7, 0xca, 0xc5, 0xea, 0x8a, 0x95, 0x9b, 0x58, 0xd2, 0x1b, 0xf2, 0x23, 0xc2, + 0xcf, 0xa5, 0x07, 0x74, 0xf9, 0x03, 0x30, 0x22, 0x2b, 0x6d, 0x10, 0x39, 0x03, 0xbb, 0xba, 0x21, + 0xa0, 0xae, 0x93, 0x56, 0x09, 0x56, 0x5b, 0x4c, 0xdf, 0x15, 0x26, 0x74, 0x23, 0xb0, 0x71, 0xf5, + 0xe6, 0xa3, 0x27, 0x0d, 0xf4, 0xf8, 0x49, 0x03, 0xfd, 0xfd, 0xa4, 0x81, 0x3e, 0x7d, 0xda, 0x98, + 0x7a, 0xfc, 0xb4, 0x31, 0xf5, 0xe7, 0xd3, 0xc6, 0xd4, 0x3b, 0xad, 0x1e, 0xf7, 0xef, 0xec, 0x76, + 0x9a, 0x86, 0xb3, 0x03, 0x76, 0x6f, 0xd2, 0x8e, 0x37, 0x6a, 0xf7, 0x83, 0xd8, 0xb2, 0x3f, 0x70, + 0x99, 0xd7, 0x99, 0x16, 0xff, 0xb7, 0x38, 0xfb, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x25, + 0x42, 0x8a, 0x59, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1933,14 +1842,6 @@ type QueryClient interface { Freespace(ctx context.Context, in *QueryFreespaceRequest, opts ...grpc.CallOption) (*QueryFreespaceResponse, error) // Queries a list of FindFile items. FindFile(ctx context.Context, in *QueryFindFileRequest, opts ...grpc.CallOption) (*QueryFindFileResponse, error) - // Queries a PayBlocks by index. - PayBlocks(ctx context.Context, in *QueryPayBlockRequest, opts ...grpc.CallOption) (*QueryPayBlockResponse, error) - // Queries a list of PayBlocks items. - PayBlocksAll(ctx context.Context, in *QueryAllPayBlocksRequest, opts ...grpc.CallOption) (*QueryAllPayBlocksResponse, error) - // Queries a ClientUsage by index. - ClientUsage(ctx context.Context, in *QueryClientUsageRequest, opts ...grpc.CallOption) (*QueryClientUsageResponse, error) - // Queries a list of ClientUsage items. - ClientUsageAll(ctx context.Context, in *QueryAllClientUsageRequest, opts ...grpc.CallOption) (*QueryAllClientUsageResponse, error) // Queries a Strays by index. Strays(ctx context.Context, in *QueryStrayRequest, opts ...grpc.CallOption) (*QueryStrayResponse, error) // Queries a list of Strays items. @@ -1953,6 +1854,12 @@ type QueryClient interface { FidCidAll(ctx context.Context, in *QueryAllFidCidRequest, opts ...grpc.CallOption) (*QueryAllFidCidResponse, error) // Queries a list of GetPayData items. GetPayData(ctx context.Context, in *QueryPayDataRequest, opts ...grpc.CallOption) (*QueryPayDataResponse, error) + // Queries a StoragePaymentInfo by address. + StoragePaymentInfo(ctx context.Context, in *QueryStoragePaymentInfoRequest, opts ...grpc.CallOption) (*QueryStoragePaymentInfoResponse, error) + // Queries a list of StoragePaymentInfo items. + StoragePaymentInfoAll(ctx context.Context, in *QueryAllStoragePaymentInfoRequest, opts ...grpc.CallOption) (*QueryAllStoragePaymentInfoResponse, error) + // Queries whether user can upload a file based on size + FileUploadCheck(ctx context.Context, in *QueryFileUploadCheck, opts ...grpc.CallOption) (*QueryFileUploadCheckResponse, error) } type queryClient struct { @@ -2044,42 +1951,6 @@ func (c *queryClient) FindFile(ctx context.Context, in *QueryFindFileRequest, op return out, nil } -func (c *queryClient) PayBlocks(ctx context.Context, in *QueryPayBlockRequest, opts ...grpc.CallOption) (*QueryPayBlockResponse, error) { - out := new(QueryPayBlockResponse) - err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/PayBlocks", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) PayBlocksAll(ctx context.Context, in *QueryAllPayBlocksRequest, opts ...grpc.CallOption) (*QueryAllPayBlocksResponse, error) { - out := new(QueryAllPayBlocksResponse) - err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/PayBlocksAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ClientUsage(ctx context.Context, in *QueryClientUsageRequest, opts ...grpc.CallOption) (*QueryClientUsageResponse, error) { - out := new(QueryClientUsageResponse) - err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/ClientUsage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ClientUsageAll(ctx context.Context, in *QueryAllClientUsageRequest, opts ...grpc.CallOption) (*QueryAllClientUsageResponse, error) { - out := new(QueryAllClientUsageResponse) - err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/ClientUsageAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Strays(ctx context.Context, in *QueryStrayRequest, opts ...grpc.CallOption) (*QueryStrayResponse, error) { out := new(QueryStrayResponse) err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/Strays", in, out, opts...) @@ -2134,6 +2005,33 @@ func (c *queryClient) GetPayData(ctx context.Context, in *QueryPayDataRequest, o return out, nil } +func (c *queryClient) StoragePaymentInfo(ctx context.Context, in *QueryStoragePaymentInfoRequest, opts ...grpc.CallOption) (*QueryStoragePaymentInfoResponse, error) { + out := new(QueryStoragePaymentInfoResponse) + err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/StoragePaymentInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StoragePaymentInfoAll(ctx context.Context, in *QueryAllStoragePaymentInfoRequest, opts ...grpc.CallOption) (*QueryAllStoragePaymentInfoResponse, error) { + out := new(QueryAllStoragePaymentInfoResponse) + err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/StoragePaymentInfoAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) FileUploadCheck(ctx context.Context, in *QueryFileUploadCheck, opts ...grpc.CallOption) (*QueryFileUploadCheckResponse, error) { + out := new(QueryFileUploadCheckResponse) + err := c.cc.Invoke(ctx, "/canine_chain.storage.Query/FileUploadCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -2154,14 +2052,6 @@ type QueryServer interface { Freespace(context.Context, *QueryFreespaceRequest) (*QueryFreespaceResponse, error) // Queries a list of FindFile items. FindFile(context.Context, *QueryFindFileRequest) (*QueryFindFileResponse, error) - // Queries a PayBlocks by index. - PayBlocks(context.Context, *QueryPayBlockRequest) (*QueryPayBlockResponse, error) - // Queries a list of PayBlocks items. - PayBlocksAll(context.Context, *QueryAllPayBlocksRequest) (*QueryAllPayBlocksResponse, error) - // Queries a ClientUsage by index. - ClientUsage(context.Context, *QueryClientUsageRequest) (*QueryClientUsageResponse, error) - // Queries a list of ClientUsage items. - ClientUsageAll(context.Context, *QueryAllClientUsageRequest) (*QueryAllClientUsageResponse, error) // Queries a Strays by index. Strays(context.Context, *QueryStrayRequest) (*QueryStrayResponse, error) // Queries a list of Strays items. @@ -2174,6 +2064,12 @@ type QueryServer interface { FidCidAll(context.Context, *QueryAllFidCidRequest) (*QueryAllFidCidResponse, error) // Queries a list of GetPayData items. GetPayData(context.Context, *QueryPayDataRequest) (*QueryPayDataResponse, error) + // Queries a StoragePaymentInfo by address. + StoragePaymentInfo(context.Context, *QueryStoragePaymentInfoRequest) (*QueryStoragePaymentInfoResponse, error) + // Queries a list of StoragePaymentInfo items. + StoragePaymentInfoAll(context.Context, *QueryAllStoragePaymentInfoRequest) (*QueryAllStoragePaymentInfoResponse, error) + // Queries whether user can upload a file based on size + FileUploadCheck(context.Context, *QueryFileUploadCheck) (*QueryFileUploadCheckResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -2207,18 +2103,6 @@ func (*UnimplementedQueryServer) Freespace(ctx context.Context, req *QueryFreesp func (*UnimplementedQueryServer) FindFile(ctx context.Context, req *QueryFindFileRequest) (*QueryFindFileResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FindFile not implemented") } -func (*UnimplementedQueryServer) PayBlocks(ctx context.Context, req *QueryPayBlockRequest) (*QueryPayBlockResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PayBlocks not implemented") -} -func (*UnimplementedQueryServer) PayBlocksAll(ctx context.Context, req *QueryAllPayBlocksRequest) (*QueryAllPayBlocksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PayBlocksAll not implemented") -} -func (*UnimplementedQueryServer) ClientUsage(ctx context.Context, req *QueryClientUsageRequest) (*QueryClientUsageResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClientUsage not implemented") -} -func (*UnimplementedQueryServer) ClientUsageAll(ctx context.Context, req *QueryAllClientUsageRequest) (*QueryAllClientUsageResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClientUsageAll not implemented") -} func (*UnimplementedQueryServer) Strays(ctx context.Context, req *QueryStrayRequest) (*QueryStrayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Strays not implemented") } @@ -2237,6 +2121,15 @@ func (*UnimplementedQueryServer) FidCidAll(ctx context.Context, req *QueryAllFid func (*UnimplementedQueryServer) GetPayData(ctx context.Context, req *QueryPayDataRequest) (*QueryPayDataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPayData not implemented") } +func (*UnimplementedQueryServer) StoragePaymentInfo(ctx context.Context, req *QueryStoragePaymentInfoRequest) (*QueryStoragePaymentInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StoragePaymentInfo not implemented") +} +func (*UnimplementedQueryServer) StoragePaymentInfoAll(ctx context.Context, req *QueryAllStoragePaymentInfoRequest) (*QueryAllStoragePaymentInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StoragePaymentInfoAll not implemented") +} +func (*UnimplementedQueryServer) FileUploadCheck(ctx context.Context, req *QueryFileUploadCheck) (*QueryFileUploadCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FileUploadCheck not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2404,182 +2297,164 @@ func _Query_FindFile_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } -func _Query_PayBlocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPayBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).PayBlocks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/canine_chain.storage.Query/PayBlocks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PayBlocks(ctx, req.(*QueryPayBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_PayBlocksAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllPayBlocksRequest) +func _Query_Strays_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStrayRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).PayBlocksAll(ctx, in) + return srv.(QueryServer).Strays(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/PayBlocksAll", + FullMethod: "/canine_chain.storage.Query/Strays", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PayBlocksAll(ctx, req.(*QueryAllPayBlocksRequest)) + return srv.(QueryServer).Strays(ctx, req.(*QueryStrayRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ClientUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClientUsageRequest) +func _Query_StraysAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllStraysRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ClientUsage(ctx, in) + return srv.(QueryServer).StraysAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/ClientUsage", + FullMethod: "/canine_chain.storage.Query/StraysAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClientUsage(ctx, req.(*QueryClientUsageRequest)) + return srv.(QueryServer).StraysAll(ctx, req.(*QueryAllStraysRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ClientUsageAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllClientUsageRequest) +func _Query_GetClientFreeSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClientFreeSpaceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ClientUsageAll(ctx, in) + return srv.(QueryServer).GetClientFreeSpace(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/ClientUsageAll", + FullMethod: "/canine_chain.storage.Query/GetClientFreeSpace", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClientUsageAll(ctx, req.(*QueryAllClientUsageRequest)) + return srv.(QueryServer).GetClientFreeSpace(ctx, req.(*QueryClientFreeSpaceRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_Strays_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryStrayRequest) +func _Query_FidCid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFidCidRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Strays(ctx, in) + return srv.(QueryServer).FidCid(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/Strays", + FullMethod: "/canine_chain.storage.Query/FidCid", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Strays(ctx, req.(*QueryStrayRequest)) + return srv.(QueryServer).FidCid(ctx, req.(*QueryFidCidRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_StraysAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllStraysRequest) +func _Query_FidCidAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllFidCidRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).StraysAll(ctx, in) + return srv.(QueryServer).FidCidAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/StraysAll", + FullMethod: "/canine_chain.storage.Query/FidCidAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).StraysAll(ctx, req.(*QueryAllStraysRequest)) + return srv.(QueryServer).FidCidAll(ctx, req.(*QueryAllFidCidRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_GetClientFreeSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClientFreeSpaceRequest) +func _Query_GetPayData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPayDataRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetClientFreeSpace(ctx, in) + return srv.(QueryServer).GetPayData(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/GetClientFreeSpace", + FullMethod: "/canine_chain.storage.Query/GetPayData", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetClientFreeSpace(ctx, req.(*QueryClientFreeSpaceRequest)) + return srv.(QueryServer).GetPayData(ctx, req.(*QueryPayDataRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_FidCid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFidCidRequest) +func _Query_StoragePaymentInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStoragePaymentInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).FidCid(ctx, in) + return srv.(QueryServer).StoragePaymentInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/FidCid", + FullMethod: "/canine_chain.storage.Query/StoragePaymentInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FidCid(ctx, req.(*QueryFidCidRequest)) + return srv.(QueryServer).StoragePaymentInfo(ctx, req.(*QueryStoragePaymentInfoRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_FidCidAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllFidCidRequest) +func _Query_StoragePaymentInfoAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllStoragePaymentInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).FidCidAll(ctx, in) + return srv.(QueryServer).StoragePaymentInfoAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/FidCidAll", + FullMethod: "/canine_chain.storage.Query/StoragePaymentInfoAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FidCidAll(ctx, req.(*QueryAllFidCidRequest)) + return srv.(QueryServer).StoragePaymentInfoAll(ctx, req.(*QueryAllStoragePaymentInfoRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_GetPayData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPayDataRequest) +func _Query_FileUploadCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFileUploadCheck) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetPayData(ctx, in) + return srv.(QueryServer).FileUploadCheck(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/canine_chain.storage.Query/GetPayData", + FullMethod: "/canine_chain.storage.Query/FileUploadCheck", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetPayData(ctx, req.(*QueryPayDataRequest)) + return srv.(QueryServer).FileUploadCheck(ctx, req.(*QueryFileUploadCheck)) } return interceptor(ctx, in, info, handler) } @@ -2624,22 +2499,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "FindFile", Handler: _Query_FindFile_Handler, }, - { - MethodName: "PayBlocks", - Handler: _Query_PayBlocks_Handler, - }, - { - MethodName: "PayBlocksAll", - Handler: _Query_PayBlocksAll_Handler, - }, - { - MethodName: "ClientUsage", - Handler: _Query_ClientUsage_Handler, - }, - { - MethodName: "ClientUsageAll", - Handler: _Query_ClientUsageAll_Handler, - }, { MethodName: "Strays", Handler: _Query_Strays_Handler, @@ -2664,6 +2523,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetPayData", Handler: _Query_GetPayData_Handler, }, + { + MethodName: "StoragePaymentInfo", + Handler: _Query_StoragePaymentInfo_Handler, + }, + { + MethodName: "StoragePaymentInfoAll", + Handler: _Query_StoragePaymentInfoAll_Handler, + }, + { + MethodName: "FileUploadCheck", + Handler: _Query_FileUploadCheck_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "canine_chain/storage/query.proto", @@ -3286,7 +3157,7 @@ func (m *QueryFindFileResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryPayBlockRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryStrayRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3296,27 +3167,27 @@ func (m *QueryPayBlockRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPayBlockRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryStrayRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPayBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryStrayRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Blockid) > 0 { - i -= len(m.Blockid) - copy(dAtA[i:], m.Blockid) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Blockid))) + if len(m.Cid) > 0 { + i -= len(m.Cid) + copy(dAtA[i:], m.Cid) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Cid))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPayBlockResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryStrayResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3326,18 +3197,18 @@ func (m *QueryPayBlockResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPayBlockResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryStrayResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPayBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryStrayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.PayBlocks.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Strays.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3349,7 +3220,7 @@ func (m *QueryPayBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllPayBlocksRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllStraysRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3359,12 +3230,12 @@ func (m *QueryAllPayBlocksRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllPayBlocksRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllStraysRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPayBlocksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllStraysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3384,7 +3255,7 @@ func (m *QueryAllPayBlocksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryAllPayBlocksResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllStraysResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3394,12 +3265,12 @@ func (m *QueryAllPayBlocksResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllPayBlocksResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllStraysResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPayBlocksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllStraysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3416,10 +3287,10 @@ func (m *QueryAllPayBlocksResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro i-- dAtA[i] = 0x12 } - if len(m.PayBlocks) > 0 { - for iNdEx := len(m.PayBlocks) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Strays) > 0 { + for iNdEx := len(m.Strays) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.PayBlocks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Strays[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3433,7 +3304,7 @@ func (m *QueryAllPayBlocksResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryClientUsageRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryClientFreeSpaceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3443,12 +3314,12 @@ func (m *QueryClientUsageRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClientUsageRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClientFreeSpaceRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClientUsageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClientFreeSpaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3463,75 +3334,7 @@ func (m *QueryClientUsageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryClientUsageResponse) 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 *QueryClientUsageResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClientUsageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ClientUsage.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 *QueryAllClientUsageRequest) 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 *QueryAllClientUsageRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllClientUsageRequest) 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 *QueryAllClientUsageResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryClientFreeSpaceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3541,46 +3344,25 @@ func (m *QueryAllClientUsageResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllClientUsageResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClientFreeSpaceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllClientUsageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClientFreeSpaceResponse) 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)) - } + if m.Bytesfree != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Bytesfree)) i-- - dAtA[i] = 0x12 - } - if len(m.ClientUsage) > 0 { - for iNdEx := len(m.ClientUsage) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ClientUsage[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryStrayRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryFidCidRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3590,27 +3372,27 @@ func (m *QueryStrayRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryStrayRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFidCidRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryStrayRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFidCidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Cid) > 0 { - i -= len(m.Cid) - copy(dAtA[i:], m.Cid) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Cid))) + if len(m.Fid) > 0 { + i -= len(m.Fid) + copy(dAtA[i:], m.Fid) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Fid))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryStrayResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryFidCidResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3620,18 +3402,18 @@ func (m *QueryStrayResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryStrayResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFidCidResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryStrayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Strays.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FidCid.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3643,7 +3425,7 @@ func (m *QueryStrayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllStraysRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllFidCidRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3653,12 +3435,12 @@ func (m *QueryAllStraysRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllStraysRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllFidCidRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllStraysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllFidCidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3678,7 +3460,7 @@ func (m *QueryAllStraysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllStraysResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllFidCidResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3688,12 +3470,12 @@ func (m *QueryAllStraysResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllStraysResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllFidCidResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllStraysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3710,10 +3492,10 @@ func (m *QueryAllStraysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.Strays) > 0 { - for iNdEx := len(m.Strays) - 1; iNdEx >= 0; iNdEx-- { + if len(m.FidCid) > 0 { + for iNdEx := len(m.FidCid) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Strays[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FidCid[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3727,7 +3509,7 @@ func (m *QueryAllStraysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryClientFreeSpaceRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPayDataRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3737,12 +3519,12 @@ func (m *QueryClientFreeSpaceRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClientFreeSpaceRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPayDataRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClientFreeSpaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPayDataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3757,7 +3539,7 @@ func (m *QueryClientFreeSpaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryClientFreeSpaceResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPayDataResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3767,27 +3549,30 @@ func (m *QueryClientFreeSpaceResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClientFreeSpaceResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPayDataResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClientFreeSpaceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPayDataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Bytesfree) > 0 { - i -= len(m.Bytesfree) - copy(dAtA[i:], m.Bytesfree) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Bytesfree))) + if m.Bytes != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Bytes)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x10 + } + if m.TimeRemaining != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TimeRemaining)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryFidCidRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryStoragePaymentInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3797,27 +3582,27 @@ func (m *QueryFidCidRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFidCidRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryStoragePaymentInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFidCidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryStoragePaymentInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Fid) > 0 { - i -= len(m.Fid) - copy(dAtA[i:], m.Fid) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Fid))) + 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 *QueryFidCidResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryStoragePaymentInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3827,18 +3612,18 @@ func (m *QueryFidCidResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFidCidResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryStoragePaymentInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryStoragePaymentInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.FidCid.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.StoragePaymentInfo.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3850,7 +3635,7 @@ func (m *QueryFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllFidCidRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllStoragePaymentInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3860,12 +3645,12 @@ func (m *QueryAllFidCidRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllFidCidRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllStoragePaymentInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllFidCidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllStoragePaymentInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3885,7 +3670,7 @@ func (m *QueryAllFidCidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllFidCidResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllStoragePaymentInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3895,12 +3680,12 @@ func (m *QueryAllFidCidResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllFidCidResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllStoragePaymentInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllStoragePaymentInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3917,10 +3702,10 @@ func (m *QueryAllFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.FidCid) > 0 { - for iNdEx := len(m.FidCid) - 1; iNdEx >= 0; iNdEx-- { + if len(m.StoragePaymentInfo) > 0 { + for iNdEx := len(m.StoragePaymentInfo) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.FidCid[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.StoragePaymentInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3934,7 +3719,7 @@ func (m *QueryAllFidCidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryPayDataRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryFileUploadCheck) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3944,16 +3729,21 @@ func (m *QueryPayDataRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPayDataRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFileUploadCheck) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPayDataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFileUploadCheck) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.Bytes != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Bytes)) + i-- + dAtA[i] = 0x10 + } if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -3964,7 +3754,7 @@ func (m *QueryPayDataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryPayDataResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryFileUploadCheckResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3974,23 +3764,23 @@ func (m *QueryPayDataResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPayDataResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFileUploadCheckResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPayDataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFileUploadCheckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Bytes != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Bytes)) + if m.Valid { i-- - dAtA[i] = 0x10 - } - if m.BlocksRemaining != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlocksRemaining)) + if m.Valid { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } i-- dAtA[i] = 0x8 } @@ -4248,31 +4038,31 @@ func (m *QueryFindFileResponse) Size() (n int) { return n } -func (m *QueryPayBlockRequest) Size() (n int) { +func (m *QueryStrayRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Blockid) + l = len(m.Cid) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryPayBlockResponse) Size() (n int) { +func (m *QueryStrayResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.PayBlocks.Size() + l = m.Strays.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllPayBlocksRequest) Size() (n int) { +func (m *QueryAllStraysRequest) Size() (n int) { if m == nil { return 0 } @@ -4285,14 +4075,14 @@ func (m *QueryAllPayBlocksRequest) Size() (n int) { return n } -func (m *QueryAllPayBlocksResponse) Size() (n int) { +func (m *QueryAllStraysResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.PayBlocks) > 0 { - for _, e := range m.PayBlocks { + if len(m.Strays) > 0 { + for _, e := range m.Strays { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -4304,7 +4094,7 @@ func (m *QueryAllPayBlocksResponse) Size() (n int) { return n } -func (m *QueryClientUsageRequest) Size() (n int) { +func (m *QueryClientFreeSpaceRequest) Size() (n int) { if m == nil { return 0 } @@ -4317,74 +4107,43 @@ func (m *QueryClientUsageRequest) Size() (n int) { return n } -func (m *QueryClientUsageResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ClientUsage.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAllClientUsageRequest) 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 *QueryAllClientUsageResponse) Size() (n int) { +func (m *QueryClientFreeSpaceResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.ClientUsage) > 0 { - for _, e := range m.ClientUsage { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Bytesfree != 0 { + n += 1 + sovQuery(uint64(m.Bytesfree)) } return n } -func (m *QueryStrayRequest) Size() (n int) { +func (m *QueryFidCidRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Cid) + l = len(m.Fid) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryStrayResponse) Size() (n int) { +func (m *QueryFidCidResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Strays.Size() + l = m.FidCid.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllStraysRequest) Size() (n int) { +func (m *QueryAllFidCidRequest) Size() (n int) { if m == nil { return 0 } @@ -4397,14 +4156,14 @@ func (m *QueryAllStraysRequest) Size() (n int) { return n } -func (m *QueryAllStraysResponse) Size() (n int) { +func (m *QueryAllFidCidResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Strays) > 0 { - for _, e := range m.Strays { + if len(m.FidCid) > 0 { + for _, e := range m.FidCid { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -4416,7 +4175,7 @@ func (m *QueryAllStraysResponse) Size() (n int) { return n } -func (m *QueryClientFreeSpaceRequest) Size() (n int) { +func (m *QueryPayDataRequest) Size() (n int) { if m == nil { return 0 } @@ -4429,44 +4188,46 @@ func (m *QueryClientFreeSpaceRequest) Size() (n int) { return n } -func (m *QueryClientFreeSpaceResponse) Size() (n int) { +func (m *QueryPayDataResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Bytesfree) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.TimeRemaining != 0 { + n += 1 + sovQuery(uint64(m.TimeRemaining)) + } + if m.Bytes != 0 { + n += 1 + sovQuery(uint64(m.Bytes)) } return n } -func (m *QueryFidCidRequest) Size() (n int) { +func (m *QueryStoragePaymentInfoRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Fid) + l = len(m.Address) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryFidCidResponse) Size() (n int) { +func (m *QueryStoragePaymentInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.FidCid.Size() + l = m.StoragePaymentInfo.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllFidCidRequest) Size() (n int) { +func (m *QueryAllStoragePaymentInfoRequest) Size() (n int) { if m == nil { return 0 } @@ -4479,14 +4240,14 @@ func (m *QueryAllFidCidRequest) Size() (n int) { return n } -func (m *QueryAllFidCidResponse) Size() (n int) { +func (m *QueryAllStoragePaymentInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.FidCid) > 0 { - for _, e := range m.FidCid { + if len(m.StoragePaymentInfo) > 0 { + for _, e := range m.StoragePaymentInfo { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -4498,7 +4259,7 @@ func (m *QueryAllFidCidResponse) Size() (n int) { return n } -func (m *QueryPayDataRequest) Size() (n int) { +func (m *QueryFileUploadCheck) Size() (n int) { if m == nil { return 0 } @@ -4508,20 +4269,20 @@ func (m *QueryPayDataRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Bytes != 0 { + n += 1 + sovQuery(uint64(m.Bytes)) + } return n } -func (m *QueryPayDataResponse) Size() (n int) { +func (m *QueryFileUploadCheckResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.BlocksRemaining != 0 { - n += 1 + sovQuery(uint64(m.BlocksRemaining)) - } - if m.Bytes != 0 { - n += 1 + sovQuery(uint64(m.Bytes)) + if m.Valid { + n += 2 } return n } @@ -6106,7 +5867,7 @@ func (m *QueryFindFileResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPayBlockRequest) Unmarshal(dAtA []byte) error { +func (m *QueryStrayRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6129,15 +5890,15 @@ func (m *QueryPayBlockRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPayBlockRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStrayRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPayBlockRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStrayRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blockid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6165,7 +5926,7 @@ func (m *QueryPayBlockRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Blockid = string(dAtA[iNdEx:postIndex]) + m.Cid = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6188,7 +5949,7 @@ func (m *QueryPayBlockRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPayBlockResponse) Unmarshal(dAtA []byte) error { +func (m *QueryStrayResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6211,15 +5972,15 @@ func (m *QueryPayBlockResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPayBlockResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStrayResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPayBlockResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStrayResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayBlocks", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Strays", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6246,7 +6007,7 @@ func (m *QueryPayBlockResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PayBlocks.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Strays.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6271,7 +6032,7 @@ func (m *QueryPayBlockResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPayBlocksRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllStraysRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6294,10 +6055,10 @@ func (m *QueryAllPayBlocksRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPayBlocksRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllStraysRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPayBlocksRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllStraysRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6357,7 +6118,7 @@ func (m *QueryAllPayBlocksRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPayBlocksResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllStraysResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6380,49 +6141,15 @@ func (m *QueryAllPayBlocksResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPayBlocksResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllStraysResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPayBlocksResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllStraysResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayBlocks", 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.PayBlocks = append(m.PayBlocks, PayBlocks{}) - if err := m.PayBlocks[len(m.PayBlocks)-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) + return fmt.Errorf("proto: wrong wireType = %d for field Strays", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6440,157 +6167,23 @@ func (m *QueryAllPayBlocksResponse) Unmarshal(dAtA []byte) error { } } 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 *QueryClientUsageRequest) 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: QueryClientUsageRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClientUsageRequest: 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 *QueryClientUsageResponse) 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 + return ErrInvalidLengthQuery } - if iNdEx >= l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.Strays = append(m.Strays, Strays{}) + if err := m.Strays[len(m.Strays)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryClientUsageResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClientUsageResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientUsage", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6617,7 +6210,10 @@ func (m *QueryClientUsageResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ClientUsage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6642,7 +6238,7 @@ func (m *QueryClientUsageResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllClientUsageRequest) Unmarshal(dAtA []byte) error { +func (m *QueryClientFreeSpaceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6665,17 +6261,17 @@ func (m *QueryAllClientUsageRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllClientUsageRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClientFreeSpaceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllClientUsageRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClientFreeSpaceRequest: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6685,27 +6281,23 @@ func (m *QueryAllClientUsageRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen 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 - } + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6728,7 +6320,7 @@ func (m *QueryAllClientUsageRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllClientUsageResponse) Unmarshal(dAtA []byte) error { +func (m *QueryClientFreeSpaceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6751,51 +6343,17 @@ func (m *QueryAllClientUsageResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllClientUsageResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClientFreeSpaceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllClientUsageResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClientFreeSpaceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientUsage", 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.ClientUsage = append(m.ClientUsage, ClientUsage{}) - if err := m.ClientUsage[len(m.ClientUsage)-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) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Bytesfree", wireType) } - var msglen int + m.Bytesfree = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6805,28 +6363,11 @@ func (m *QueryAllClientUsageResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Bytesfree |= int64(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:]) @@ -6848,7 +6389,7 @@ func (m *QueryAllClientUsageResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryStrayRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFidCidRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6871,15 +6412,15 @@ func (m *QueryStrayRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryStrayRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFidCidRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryStrayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFidCidRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Fid", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6907,7 +6448,7 @@ func (m *QueryStrayRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Cid = string(dAtA[iNdEx:postIndex]) + m.Fid = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6930,7 +6471,7 @@ func (m *QueryStrayRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryStrayResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFidCidResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6953,15 +6494,15 @@ func (m *QueryStrayResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryStrayResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFidCidResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryStrayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFidCidResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Strays", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FidCid", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6988,7 +6529,7 @@ func (m *QueryStrayResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Strays.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FidCid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7013,7 +6554,7 @@ func (m *QueryStrayResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllStraysRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllFidCidRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7036,10 +6577,10 @@ func (m *QueryAllStraysRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllStraysRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllFidCidRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllStraysRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllFidCidRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7099,7 +6640,7 @@ func (m *QueryAllStraysRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllStraysResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllFidCidResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7122,15 +6663,15 @@ func (m *QueryAllStraysResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllStraysResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllFidCidResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllStraysResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllFidCidResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Strays", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FidCid", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7157,8 +6698,8 @@ func (m *QueryAllStraysResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Strays = append(m.Strays, Strays{}) - if err := m.Strays[len(m.Strays)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FidCid = append(m.FidCid, FidCid{}) + if err := m.FidCid[len(m.FidCid)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7219,7 +6760,7 @@ func (m *QueryAllStraysResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClientFreeSpaceRequest) Unmarshal(dAtA []byte) error { +func (m *QueryPayDataRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7242,10 +6783,10 @@ func (m *QueryClientFreeSpaceRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClientFreeSpaceRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPayDataRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClientFreeSpaceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPayDataRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7301,7 +6842,7 @@ func (m *QueryClientFreeSpaceRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClientFreeSpaceResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPayDataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7324,17 +6865,17 @@ func (m *QueryClientFreeSpaceResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClientFreeSpaceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPayDataResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClientFreeSpaceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPayDataResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bytesfree", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeRemaining", wireType) } - var stringLen uint64 + m.TimeRemaining = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -7344,24 +6885,30 @@ func (m *QueryClientFreeSpaceResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TimeRemaining |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + m.Bytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Bytes |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Bytesfree = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7383,7 +6930,7 @@ func (m *QueryClientFreeSpaceResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFidCidRequest) Unmarshal(dAtA []byte) error { +func (m *QueryStoragePaymentInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7406,15 +6953,15 @@ func (m *QueryFidCidRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFidCidRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStoragePaymentInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFidCidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStoragePaymentInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7442,7 +6989,7 @@ func (m *QueryFidCidRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Fid = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -7465,7 +7012,7 @@ func (m *QueryFidCidRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFidCidResponse) Unmarshal(dAtA []byte) error { +func (m *QueryStoragePaymentInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7488,15 +7035,15 @@ func (m *QueryFidCidResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFidCidResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStoragePaymentInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFidCidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStoragePaymentInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FidCid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StoragePaymentInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7523,7 +7070,7 @@ func (m *QueryFidCidResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.FidCid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.StoragePaymentInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7548,7 +7095,7 @@ func (m *QueryFidCidResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllFidCidRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllStoragePaymentInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7571,10 +7118,10 @@ func (m *QueryAllFidCidRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllFidCidRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllStoragePaymentInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllFidCidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllStoragePaymentInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7634,7 +7181,7 @@ func (m *QueryAllFidCidRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllFidCidResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllStoragePaymentInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7657,15 +7204,15 @@ func (m *QueryAllFidCidResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllFidCidResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllStoragePaymentInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllFidCidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllStoragePaymentInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FidCid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StoragePaymentInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7692,8 +7239,8 @@ func (m *QueryAllFidCidResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FidCid = append(m.FidCid, FidCid{}) - if err := m.FidCid[len(m.FidCid)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.StoragePaymentInfo = append(m.StoragePaymentInfo, StoragePaymentInfo{}) + if err := m.StoragePaymentInfo[len(m.StoragePaymentInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7754,7 +7301,7 @@ func (m *QueryAllFidCidResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPayDataRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFileUploadCheck) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7777,10 +7324,10 @@ func (m *QueryPayDataRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPayDataRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFileUploadCheck: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPayDataRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFileUploadCheck: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7815,6 +7362,25 @@ func (m *QueryPayDataRequest) Unmarshal(dAtA []byte) error { } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) + } + m.Bytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Bytes |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7836,7 +7402,7 @@ func (m *QueryPayDataRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPayDataResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFileUploadCheckResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7859,36 +7425,17 @@ func (m *QueryPayDataResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPayDataResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFileUploadCheckResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPayDataResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFileUploadCheckResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksRemaining", wireType) - } - m.BlocksRemaining = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlocksRemaining |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType) } - m.Bytes = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -7898,11 +7445,12 @@ func (m *QueryPayDataResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Bytes |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.Valid = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/storage/types/query.pb.gw.go b/x/storage/types/query.pb.gw.go index 72c98e584..625390940 100644 --- a/x/storage/types/query.pb.gw.go +++ b/x/storage/types/query.pb.gw.go @@ -429,8 +429,8 @@ func local_request_Query_FindFile_0(ctx context.Context, marshaler runtime.Marsh } -func request_Query_PayBlocks_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPayBlockRequest +func request_Query_Strays_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStrayRequest var metadata runtime.ServerMetadata var ( @@ -440,24 +440,24 @@ func request_Query_PayBlocks_0(ctx context.Context, marshaler runtime.Marshaler, _ = err ) - val, ok = pathParams["blockid"] + val, ok = pathParams["cid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blockid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cid") } - protoReq.Blockid, err = runtime.String(val) + protoReq.Cid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blockid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cid", err) } - msg, err := client.PayBlocks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Strays(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_PayBlocks_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPayBlockRequest +func local_request_Query_Strays_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStrayRequest var metadata runtime.ServerMetadata var ( @@ -467,60 +467,60 @@ func local_request_Query_PayBlocks_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["blockid"] + val, ok = pathParams["cid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blockid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cid") } - protoReq.Blockid, err = runtime.String(val) + protoReq.Cid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blockid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cid", err) } - msg, err := server.PayBlocks(ctx, &protoReq) + msg, err := server.Strays(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_PayBlocksAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_StraysAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_PayBlocksAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPayBlocksRequest +func request_Query_StraysAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllStraysRequest 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_PayBlocksAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StraysAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.PayBlocksAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.StraysAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_PayBlocksAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPayBlocksRequest +func local_request_Query_StraysAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllStraysRequest 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_PayBlocksAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StraysAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.PayBlocksAll(ctx, &protoReq) + msg, err := server.StraysAll(ctx, &protoReq) return msg, metadata, err } -func request_Query_ClientUsage_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClientUsageRequest +func request_Query_GetClientFreeSpace_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClientFreeSpaceRequest var metadata runtime.ServerMetadata var ( @@ -541,13 +541,13 @@ func request_Query_ClientUsage_0(ctx context.Context, marshaler runtime.Marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := client.ClientUsage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetClientFreeSpace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ClientUsage_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClientUsageRequest +func local_request_Query_GetClientFreeSpace_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClientFreeSpaceRequest var metadata runtime.ServerMetadata var ( @@ -568,49 +568,13 @@ func local_request_Query_ClientUsage_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := server.ClientUsage(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ClientUsageAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ClientUsageAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllClientUsageRequest - 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_ClientUsageAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ClientUsageAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClientUsageAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllClientUsageRequest - 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_ClientUsageAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ClientUsageAll(ctx, &protoReq) + msg, err := server.GetClientFreeSpace(ctx, &protoReq) return msg, metadata, err } -func request_Query_Strays_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryStrayRequest +func request_Query_FidCid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFidCidRequest var metadata runtime.ServerMetadata var ( @@ -620,24 +584,24 @@ func request_Query_Strays_0(ctx context.Context, marshaler runtime.Marshaler, cl _ = err ) - val, ok = pathParams["cid"] + val, ok = pathParams["fid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fid") } - protoReq.Cid, err = runtime.String(val) + protoReq.Fid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fid", err) } - msg, err := client.Strays(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.FidCid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_Strays_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryStrayRequest +func local_request_Query_FidCid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFidCidRequest var metadata runtime.ServerMetadata var ( @@ -647,60 +611,60 @@ func local_request_Query_Strays_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["cid"] + val, ok = pathParams["fid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fid") } - protoReq.Cid, err = runtime.String(val) + protoReq.Fid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fid", err) } - msg, err := server.Strays(ctx, &protoReq) + msg, err := server.FidCid(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_StraysAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_FidCidAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_StraysAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllStraysRequest +func request_Query_FidCidAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllFidCidRequest 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_StraysAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FidCidAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.StraysAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.FidCidAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_StraysAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllStraysRequest +func local_request_Query_FidCidAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllFidCidRequest 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_StraysAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FidCidAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.StraysAll(ctx, &protoReq) + msg, err := server.FidCidAll(ctx, &protoReq) return msg, metadata, err } -func request_Query_GetClientFreeSpace_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClientFreeSpaceRequest +func request_Query_GetPayData_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPayDataRequest var metadata runtime.ServerMetadata var ( @@ -721,13 +685,13 @@ func request_Query_GetClientFreeSpace_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := client.GetClientFreeSpace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetPayData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetClientFreeSpace_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClientFreeSpaceRequest +func local_request_Query_GetPayData_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPayDataRequest var metadata runtime.ServerMetadata var ( @@ -748,13 +712,13 @@ func local_request_Query_GetClientFreeSpace_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := server.GetClientFreeSpace(ctx, &protoReq) + msg, err := server.GetPayData(ctx, &protoReq) return msg, metadata, err } -func request_Query_FidCid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFidCidRequest +func request_Query_StoragePaymentInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStoragePaymentInfoRequest var metadata runtime.ServerMetadata var ( @@ -764,24 +728,24 @@ func request_Query_FidCid_0(ctx context.Context, marshaler runtime.Marshaler, cl _ = err ) - val, ok = pathParams["fid"] + val, ok = pathParams["address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") } - protoReq.Fid, err = runtime.String(val) + protoReq.Address, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := client.FidCid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.StoragePaymentInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_FidCid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFidCidRequest +func local_request_Query_StoragePaymentInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStoragePaymentInfoRequest var metadata runtime.ServerMetadata var ( @@ -791,108 +755,90 @@ func local_request_Query_FidCid_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["fid"] + val, ok = pathParams["address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") } - protoReq.Fid, err = runtime.String(val) + protoReq.Address, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := server.FidCid(ctx, &protoReq) + msg, err := server.StoragePaymentInfo(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_FidCidAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_StoragePaymentInfoAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_FidCidAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllFidCidRequest +func request_Query_StoragePaymentInfoAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllStoragePaymentInfoRequest 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_FidCidAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StoragePaymentInfoAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.FidCidAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.StoragePaymentInfoAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_FidCidAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllFidCidRequest +func local_request_Query_StoragePaymentInfoAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllStoragePaymentInfoRequest 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_FidCidAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StoragePaymentInfoAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.FidCidAll(ctx, &protoReq) + msg, err := server.StoragePaymentInfoAll(ctx, &protoReq) return msg, metadata, err } -func request_Query_GetPayData_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPayDataRequest - var metadata runtime.ServerMetadata +var ( + filter_Query_FileUploadCheck_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) - var ( - val string - ok bool - err error - _ = err - ) +func request_Query_FileUploadCheck_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFileUploadCheck + var metadata runtime.ServerMetadata - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FileUploadCheck_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetPayData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.FileUploadCheck(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetPayData_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPayDataRequest +func local_request_Query_FileUploadCheck_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFileUploadCheck var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FileUploadCheck_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetPayData(ctx, &protoReq) + msg, err := server.FileUploadCheck(ctx, &protoReq) return msg, metadata, err } @@ -1110,30 +1056,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_PayBlocks_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_PayBlocks_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_PayBlocks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_PayBlocksAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Strays_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1144,7 +1067,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_PayBlocksAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Strays_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 { @@ -1152,11 +1075,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PayBlocksAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Strays_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClientUsage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_StraysAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1167,7 +1090,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ClientUsage_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_StraysAll_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 { @@ -1175,11 +1098,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ClientUsage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_StraysAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClientUsageAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetClientFreeSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1190,7 +1113,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ClientUsageAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetClientFreeSpace_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 { @@ -1198,11 +1121,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ClientUsageAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetClientFreeSpace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Strays_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FidCid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1213,7 +1136,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Strays_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_FidCid_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 { @@ -1221,11 +1144,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Strays_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FidCid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_StraysAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FidCidAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1236,7 +1159,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_StraysAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_FidCidAll_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 { @@ -1244,11 +1167,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_StraysAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FidCidAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetClientFreeSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetPayData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1259,7 +1182,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetClientFreeSpace_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetPayData_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 { @@ -1267,11 +1190,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetClientFreeSpace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetPayData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_FidCid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_StoragePaymentInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1282,7 +1205,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_FidCid_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_StoragePaymentInfo_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 { @@ -1290,11 +1213,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_FidCid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_StoragePaymentInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_FidCidAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_StoragePaymentInfoAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1305,7 +1228,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_FidCidAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_StoragePaymentInfoAll_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 { @@ -1313,11 +1236,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_FidCidAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_StoragePaymentInfoAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetPayData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FileUploadCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1328,7 +1251,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetPayData_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_FileUploadCheck_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 { @@ -1336,7 +1259,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetPayData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FileUploadCheck_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1561,27 +1484,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_PayBlocks_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_PayBlocks_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_PayBlocks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_PayBlocksAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Strays_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) @@ -1590,18 +1493,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_PayBlocksAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Strays_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_PayBlocksAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Strays_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClientUsage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_StraysAll_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) @@ -1610,18 +1513,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ClientUsage_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_StraysAll_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_ClientUsage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_StraysAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClientUsageAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetClientFreeSpace_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) @@ -1630,18 +1533,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ClientUsageAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetClientFreeSpace_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_ClientUsageAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetClientFreeSpace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Strays_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FidCid_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) @@ -1650,18 +1553,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Strays_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_FidCid_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_Strays_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FidCid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_StraysAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FidCidAll_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) @@ -1670,18 +1573,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_StraysAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_FidCidAll_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_StraysAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FidCidAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetClientFreeSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetPayData_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) @@ -1690,18 +1593,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetClientFreeSpace_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetPayData_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_GetClientFreeSpace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetPayData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_FidCid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_StoragePaymentInfo_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) @@ -1710,18 +1613,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_FidCid_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_StoragePaymentInfo_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_FidCid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_StoragePaymentInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_FidCidAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_StoragePaymentInfoAll_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) @@ -1730,18 +1633,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_FidCidAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_StoragePaymentInfoAll_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_FidCidAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_StoragePaymentInfoAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetPayData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FileUploadCheck_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) @@ -1750,14 +1653,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetPayData_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_FileUploadCheck_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_GetPayData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FileUploadCheck_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1783,14 +1686,6 @@ var ( pattern_Query_FindFile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "storage", "find_file", "fid"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PayBlocks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "storage", "pay_blocks", "blockid"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_PayBlocksAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "storage", "pay_blocks"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ClientUsage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "storage", "client_usage", "address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ClientUsageAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "storage", "client_usage"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Strays_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "storage", "strays", "cid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_StraysAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "storage", "strays"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1802,6 +1697,12 @@ var ( pattern_Query_FidCidAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "storage", "fid_cid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GetPayData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "storage", "get_pay_data", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_StoragePaymentInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"jackal-dao", "canine-chain", "storage", "payment_info", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_StoragePaymentInfoAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "storage", "payment_info"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_FileUploadCheck_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"jackal-dao", "canine-chain", "storage", "file_upload_check"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1823,14 +1724,6 @@ var ( forward_Query_FindFile_0 = runtime.ForwardResponseMessage - forward_Query_PayBlocks_0 = runtime.ForwardResponseMessage - - forward_Query_PayBlocksAll_0 = runtime.ForwardResponseMessage - - forward_Query_ClientUsage_0 = runtime.ForwardResponseMessage - - forward_Query_ClientUsageAll_0 = runtime.ForwardResponseMessage - forward_Query_Strays_0 = runtime.ForwardResponseMessage forward_Query_StraysAll_0 = runtime.ForwardResponseMessage @@ -1842,4 +1735,10 @@ var ( forward_Query_FidCidAll_0 = runtime.ForwardResponseMessage forward_Query_GetPayData_0 = runtime.ForwardResponseMessage + + forward_Query_StoragePaymentInfo_0 = runtime.ForwardResponseMessage + + forward_Query_StoragePaymentInfoAll_0 = runtime.ForwardResponseMessage + + forward_Query_FileUploadCheck_0 = runtime.ForwardResponseMessage )