From 79dba6296f684804392532fd21c84a4b416e8dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Wed, 22 Nov 2023 14:28:13 +0100 Subject: [PATCH] Fix liuqid notarization (#191) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * registerAsset * added new command and new query Signed-off-by: Jürgen Eckel --- docs/static/openapi.yml | 73 +++ proto/planetmintgo/machine/liquid_asset.proto | 12 + proto/planetmintgo/machine/query.proto | 15 + proto/planetmintgo/machine/tx.proto | 9 + util/issue_commands.go | 26 + x/machine/client/cli/query.go | 2 + .../query_get_liquid_assets_by_machineid.go | 46 ++ x/machine/client/cli/tx.go | 1 + .../client/cli/tx_notarize_liquid_asset.go | 47 ++ x/machine/keeper/liquid_asset.go | 31 ++ x/machine/keeper/msg_server_attest_machine.go | 95 +++- .../msg_server_notarize_liquid_asset.go | 16 + .../query_get_liquid_assets_by_machineid.go | 24 + x/machine/module_simulation.go | 23 + x/machine/simulation/notarize_liquid_asset.go | 29 ++ x/machine/types/codec.go | 4 + x/machine/types/keys.go | 2 + x/machine/types/liquid_asset.pb.go | 463 +++++++++++++++++ .../types/message_notarize_liquid_asset.go | 47 ++ x/machine/types/query.pb.go | 475 ++++++++++++++++-- x/machine/types/query.pb.gw.go | 101 ++++ x/machine/types/tx.pb.go | 431 +++++++++++++++- 22 files changed, 1896 insertions(+), 76 deletions(-) create mode 100644 proto/planetmintgo/machine/liquid_asset.proto create mode 100644 x/machine/client/cli/query_get_liquid_assets_by_machineid.go create mode 100644 x/machine/client/cli/tx_notarize_liquid_asset.go create mode 100644 x/machine/keeper/liquid_asset.go create mode 100644 x/machine/keeper/msg_server_notarize_liquid_asset.go create mode 100644 x/machine/keeper/query_get_liquid_assets_by_machineid.go create mode 100644 x/machine/simulation/notarize_liquid_asset.go create mode 100644 x/machine/types/liquid_asset.pb.go create mode 100644 x/machine/types/message_notarize_liquid_asset.go diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 5719ccf..bddbd70 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -47173,6 +47173,52 @@ paths: additionalProperties: {} tags: - Query + /planetmint/planetmint-go/machine/get_liquid_assets_by_machineid/{machineID}: + get: + summary: Queries a list of GetLiquidAssetsByMachineid items. + operationId: PlanetmintgoMachineGetLiquidAssetsByMachineid + responses: + '200': + description: A successful response. + schema: + type: object + properties: + liquidAssetEntry: + type: object + properties: + machineID: + type: string + machineAddress: + type: string + assetID: + type: string + registered: + type: boolean + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: machineID + in: path + required: true + type: string + tags: + - Query definitions: cosmos.auth.v1beta1.AddressBytesToStringResponse: type: object @@ -76104,6 +76150,17 @@ definitions: blockHeight: type: string format: int64 + planetmintgo.machine.LiquidAsset: + type: object + properties: + machineID: + type: string + machineAddress: + type: string + assetID: + type: string + registered: + type: boolean planetmintgo.machine.Machine: type: object properties: @@ -76158,11 +76215,27 @@ definitions: type: string planetmintgo.machine.MsgAttestMachineResponse: type: object + planetmintgo.machine.MsgNotarizeLiquidAssetResponse: + type: object planetmintgo.machine.MsgRegisterTrustAnchorResponse: type: object planetmintgo.machine.Params: type: object description: Params defines the parameters for the module. + planetmintgo.machine.QueryGetLiquidAssetsByMachineidResponse: + type: object + properties: + liquidAssetEntry: + type: object + properties: + machineID: + type: string + machineAddress: + type: string + assetID: + type: string + registered: + type: boolean planetmintgo.machine.QueryGetMachineByAddressResponse: type: object properties: diff --git a/proto/planetmintgo/machine/liquid_asset.proto b/proto/planetmintgo/machine/liquid_asset.proto new file mode 100644 index 0000000..69f2099 --- /dev/null +++ b/proto/planetmintgo/machine/liquid_asset.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package planetmintgo.machine; + +option go_package = "github.com/planetmint/planetmint-go/x/machine/types"; + +message LiquidAsset { + + string machineID = 1; + string machineAddress = 2; + string assetID = 3; + bool registered = 4; +} diff --git a/proto/planetmintgo/machine/query.proto b/proto/planetmintgo/machine/query.proto index d4deed8..35928c7 100644 --- a/proto/planetmintgo/machine/query.proto +++ b/proto/planetmintgo/machine/query.proto @@ -7,6 +7,7 @@ import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "planetmintgo/machine/params.proto"; import "planetmintgo/machine/machine.proto"; +import "planetmintgo/machine/liquid_asset.proto"; option go_package = "github.com/planetmint/planetmint-go/x/machine/types"; @@ -36,6 +37,12 @@ service Query { option (google.api.http).get = "/planetmint/machine/get_machine_by_address/{address}"; } + + // Queries a list of GetLiquidAssetsByMachineid items. + rpc GetLiquidAssetsByMachineid (QueryGetLiquidAssetsByMachineidRequest) returns (QueryGetLiquidAssetsByMachineidResponse) { + option (google.api.http).get = "/planetmint/planetmint-go/machine/get_liquid_assets_by_machineid/{machineID}"; + + } } // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} @@ -72,3 +79,11 @@ message QueryGetMachineByAddressResponse { Machine machine = 1; } +message QueryGetLiquidAssetsByMachineidRequest { + string machineID = 1; +} + +message QueryGetLiquidAssetsByMachineidResponse { + LiquidAsset liquidAssetEntry = 1; +} + diff --git a/proto/planetmintgo/machine/tx.proto b/proto/planetmintgo/machine/tx.proto index fcc214d..0171977 100644 --- a/proto/planetmintgo/machine/tx.proto +++ b/proto/planetmintgo/machine/tx.proto @@ -4,6 +4,7 @@ package planetmintgo.machine; import "planetmintgo/machine/machine.proto"; import "planetmintgo/machine/trust_anchor.proto"; +import "planetmintgo/machine/liquid_asset.proto"; option go_package = "github.com/planetmint/planetmint-go/x/machine/types"; @@ -11,6 +12,7 @@ option go_package = "github.com/planetmint/planetmint-go/x/machine/types"; service Msg { rpc AttestMachine (MsgAttestMachine ) returns (MsgAttestMachineResponse ); rpc RegisterTrustAnchor (MsgRegisterTrustAnchor) returns (MsgRegisterTrustAnchorResponse); + rpc NotarizeLiquidAsset (MsgNotarizeLiquidAsset) returns (MsgNotarizeLiquidAssetResponse); } message MsgAttestMachine { string creator = 1; @@ -26,3 +28,10 @@ message MsgRegisterTrustAnchor { message MsgRegisterTrustAnchorResponse {} +message MsgNotarizeLiquidAsset { + string creator = 1; + LiquidAsset notarization = 2; +} + +message MsgNotarizeLiquidAssetResponse {} + diff --git a/util/issue_commands.go b/util/issue_commands.go index f4c41fa..502699f 100644 --- a/util/issue_commands.go +++ b/util/issue_commands.go @@ -3,11 +3,13 @@ package util import ( "bytes" "errors" + "fmt" "os/exec" "strconv" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/planetmint/planetmint-go/config" + machinetypes "github.com/planetmint/planetmint-go/x/machine/types" ) func InitRDDLReissuanceProcess(ctx sdk.Context, proposerAddress string, txUnsigned string, blockHeight int64) error { @@ -57,3 +59,27 @@ func SendRDDLReissuanceResult(ctx sdk.Context, proposerAddress string, txID stri } return err } + +func SendLiquidAssetRegistration(ctx sdk.Context, notarizedAsset machinetypes.LiquidAsset) error { + logger := ctx.Logger() + // Construct the command + sendingValidatorAddress := config.GetConfig().ValidatorAddress + logger.Debug("REISSUE: create Result") + obj := fmt.Sprintf("'{ \"MachineID\": \"%s\", \"MachineAddress\": \"%s\", \"AssetID\": \"%s\", \"Registered\": %t }'", + notarizedAsset.MachineID, notarizedAsset.MachineAddress, notarizedAsset.AssetID, notarizedAsset.GetRegistered()) + cmd := exec.Command("planetmint-god", "tx", "machine", "notarize-liquid-asset", + "--from", sendingValidatorAddress, "-y", obj) + + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + // Start the command in a non-blocking way + err := cmd.Start() + errstr := stderr.String() + if err != nil || len(errstr) > 0 { + if err == nil { + err = errors.New(errstr) + } + } + return err +} diff --git a/x/machine/client/cli/query.go b/x/machine/client/cli/query.go index c3975ee..42749fa 100644 --- a/x/machine/client/cli/query.go +++ b/x/machine/client/cli/query.go @@ -30,6 +30,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdGetTrustAnchorStatus()) cmd.AddCommand(CmdGetMachineByAddress()) + cmd.AddCommand(CmdGetLiquidAssetsByMachineid()) + // this line is used by starport scaffolding # 1 return cmd diff --git a/x/machine/client/cli/query_get_liquid_assets_by_machineid.go b/x/machine/client/cli/query_get_liquid_assets_by_machineid.go new file mode 100644 index 0000000..55a6117 --- /dev/null +++ b/x/machine/client/cli/query_get_liquid_assets_by_machineid.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/planetmint/planetmint-go/x/machine/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdGetLiquidAssetsByMachineid() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-liquid-assets-by-machineid [machine-id]", + Short: "Query get_liquid_assets_by_machineid", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqMachineID := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetLiquidAssetsByMachineidRequest{ + + MachineID: reqMachineID, + } + + res, err := queryClient.GetLiquidAssetsByMachineid(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/machine/client/cli/tx.go b/x/machine/client/cli/tx.go index 972942a..31cafd9 100644 --- a/x/machine/client/cli/tx.go +++ b/x/machine/client/cli/tx.go @@ -27,6 +27,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdAttestMachine()) cmd.AddCommand(CmdRegisterTrustAnchor()) + cmd.AddCommand(CmdNotarizeLiquidAsset()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/machine/client/cli/tx_notarize_liquid_asset.go b/x/machine/client/cli/tx_notarize_liquid_asset.go new file mode 100644 index 0000000..b03a2f2 --- /dev/null +++ b/x/machine/client/cli/tx_notarize_liquid_asset.go @@ -0,0 +1,47 @@ +package cli + +import ( + "strconv" + + "encoding/json" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/planetmint/planetmint-go/x/machine/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdNotarizeLiquidAsset() *cobra.Command { + cmd := &cobra.Command{ + Use: "notarize-liquid-asset [notarization]", + Short: "Broadcast message NotarizeLiquidAsset", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argNotarization := new(types.LiquidAsset) + err = json.Unmarshal([]byte(args[0]), argNotarization) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgNotarizeLiquidAsset( + clientCtx.GetFromAddress().String(), + argNotarization, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/machine/keeper/liquid_asset.go b/x/machine/keeper/liquid_asset.go new file mode 100644 index 0000000..0b01769 --- /dev/null +++ b/x/machine/keeper/liquid_asset.go @@ -0,0 +1,31 @@ +package keeper + +import ( + "github.com/planetmint/planetmint-go/x/machine/types" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) StoreLiquidAttest(ctx sdk.Context, asset types.LiquidAsset) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LiquidAssetKey)) + appendValue := k.cdc.MustMarshal(&asset) + store.Set(GetAssetBytes(asset.MachineID), appendValue) +} + +func (k Keeper) LookupLiquidAsset(ctx sdk.Context, machineID string) (val types.LiquidAsset, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LiquidAssetKey)) + liquidAsset := store.Get(GetAssetBytes(machineID)) + + if liquidAsset == nil { + return val, false + } + if err := k.cdc.Unmarshal(liquidAsset, &val); err != nil { + return val, false + } + return val, true +} + +func GetAssetBytes(pubKey string) []byte { + return []byte(pubKey) +} diff --git a/x/machine/keeper/msg_server_attest_machine.go b/x/machine/keeper/msg_server_attest_machine.go index 44f19a8..b6497dc 100644 --- a/x/machine/keeper/msg_server_attest_machine.go +++ b/x/machine/keeper/msg_server_attest_machine.go @@ -3,7 +3,11 @@ package keeper import ( "bytes" "context" + "encoding/json" + "io" + "net/http" "os/exec" + "strconv" "strings" config "github.com/planetmint/planetmint-go/config" @@ -44,18 +48,17 @@ func (k msgServer) AttestMachine(goCtx context.Context, msg *types.MsgAttestMach return nil, errorsmod.Wrap(types.ErrInvalidKey, "liquid") } - if k.isNFTCreationRequest(msg.Machine) && util.IsValidatorBlockProposer(ctx, ctx.BlockHeader().ProposerAddress) { - _ = k.issueMachineNFT(ctx, msg.Machine) - //TODO create NFTCreationMessage to be stored by all nodes - // if err != nil { - // return nil, types.ErrNFTIssuanceFailed - // } - } - if msg.Machine.GetType() == 0 { // 0 == RDDL_MACHINE_UNDEFINED return nil, types.ErrMachineTypeUndefined } + if k.isNFTCreationRequest(msg.Machine) && util.IsValidatorBlockProposer(ctx, ctx.BlockHeader().ProposerAddress) { + err := k.issueMachineNFT(ctx, msg.Machine) + if err != nil { + return nil, types.ErrNFTIssuanceFailed + } + } + k.StoreMachine(ctx, *msg.Machine) k.StoreMachineIndex(ctx, *msg.Machine) err = k.StoreTrustAnchor(ctx, ta, true) @@ -109,13 +112,71 @@ func (k msgServer) issueNFTAsset(ctx sdk.Context, name string, machineAddress st return assetID, contract, err } -func (k msgServer) issueMachineNFT(ctx sdk.Context, machine *types.Machine) error { - _, _, err := k.issueNFTAsset(ctx, machine.Name, machine.Address) - return err - // asset registration is not performed in case of NFT issuance for machines - //assetID, contract, err := k.issueNFTAsset(machine.Name, machine.Address) - // if err != nil { - // return err - // } - //return k.registerAsset(assetID, contract) +func (k msgServer) registerAsset(assetID string, contract string) error { + + conf := config.GetConfig() + + // Create your request payload + data := map[string]interface{}{ + "asset_id": assetID, + "contract": contract, + } + + jsonData, err := json.Marshal(data) + if err != nil { + return errorsmod.Wrap(types.ErrAssetRegistryReqFailure, "Marshall "+err.Error()) + } + + req, err := http.NewRequest("POST", conf.AssetRegistryEndpoint, bytes.NewBuffer(jsonData)) + if err != nil { + return errorsmod.Wrap(types.ErrAssetRegistryReqFailure, "Request creation: "+err.Error()) + } + + // Set headers + req.Header.Set("Content-Type", "application/json") + req.Header.Set("accept", "application/json") + + // Send request + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + return errorsmod.Wrap(types.ErrAssetRegistryReqSending, err.Error()) + } + defer resp.Body.Close() + + // Read response + if resp.StatusCode > 299 { + return errorsmod.Wrap(types.ErrAssetRegistryRepsonse, "Error reading response body:"+strconv.Itoa(resp.StatusCode)) + } + body, err := io.ReadAll(resp.Body) + if err != nil { + return errorsmod.Wrap(types.ErrAssetRegistryRepsonse, "Error reading response body:"+err.Error()) + } + resultObj := string(body) + if strings.Contains(resultObj, assetID) { + return nil + } else { + return errorsmod.Wrap(types.ErrAssetRegistryRepsonse, "does not confirm asset registration") + } +} + +func (k msgServer) issueMachineNFT(ctx sdk.Context, machine *types.Machine) error { + // asset registration is in order to have the contact published + var notarizedAsset types.LiquidAsset + notarizedAsset.Registered = true + assetID, contract, err := k.issueNFTAsset(ctx, machine.Name, machine.Address) + if err != nil { + return err + } + err = k.registerAsset(assetID, contract) + if err != nil { + notarizedAsset.Registered = false + } + // issue message with: + notarizedAsset.AssetID = assetID + notarizedAsset.MachineID = machine.GetMachineId() + notarizedAsset.MachineAddress = machine.Address + + err = util.SendLiquidAssetRegistration(ctx, notarizedAsset) + return err } diff --git a/x/machine/keeper/msg_server_notarize_liquid_asset.go b/x/machine/keeper/msg_server_notarize_liquid_asset.go new file mode 100644 index 0000000..8f1efa3 --- /dev/null +++ b/x/machine/keeper/msg_server_notarize_liquid_asset.go @@ -0,0 +1,16 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/x/machine/types" +) + +func (k msgServer) NotarizeLiquidAsset(goCtx context.Context, msg *types.MsgNotarizeLiquidAsset) (*types.MsgNotarizeLiquidAssetResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + k.StoreLiquidAttest(ctx, *msg.GetNotarization()) + + return &types.MsgNotarizeLiquidAssetResponse{}, nil +} diff --git a/x/machine/keeper/query_get_liquid_assets_by_machineid.go b/x/machine/keeper/query_get_liquid_assets_by_machineid.go new file mode 100644 index 0000000..81ff7c5 --- /dev/null +++ b/x/machine/keeper/query_get_liquid_assets_by_machineid.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/x/machine/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) GetLiquidAssetsByMachineid(goCtx context.Context, req *types.QueryGetLiquidAssetsByMachineidRequest) (*types.QueryGetLiquidAssetsByMachineidResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + liquidAsset, found := k.LookupLiquidAsset(ctx, req.GetMachineID()) + if !found { + return nil, status.Error(codes.InvalidArgument, "no associated asset found") + } + return &types.QueryGetLiquidAssetsByMachineidResponse{LiquidAssetEntry: &liquidAsset}, nil +} diff --git a/x/machine/module_simulation.go b/x/machine/module_simulation.go index 1330ef9..d2dcefc 100644 --- a/x/machine/module_simulation.go +++ b/x/machine/module_simulation.go @@ -31,6 +31,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgRegisterTrustAnchor int = 100 + opWeightMsgNotarizeLiquidAsset = "op_weight_msg_notarize_liquid_asset" + // TODO: Determine the simulation weight value + defaultWeightMsgNotarizeLiquidAsset int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -83,6 +87,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp machinesimulation.SimulateMsgRegisterTrustAnchor(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgNotarizeLiquidAsset int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgNotarizeLiquidAsset, &weightMsgNotarizeLiquidAsset, nil, + func(_ *rand.Rand) { + weightMsgNotarizeLiquidAsset = defaultWeightMsgNotarizeLiquidAsset + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgNotarizeLiquidAsset, + machinesimulation.SimulateMsgNotarizeLiquidAsset(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -107,6 +122,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgNotarizeLiquidAsset, + defaultWeightMsgNotarizeLiquidAsset, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + machinesimulation.SimulateMsgNotarizeLiquidAsset(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/machine/simulation/notarize_liquid_asset.go b/x/machine/simulation/notarize_liquid_asset.go new file mode 100644 index 0000000..9320f5b --- /dev/null +++ b/x/machine/simulation/notarize_liquid_asset.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/planetmint/planetmint-go/x/machine/keeper" + "github.com/planetmint/planetmint-go/x/machine/types" +) + +func SimulateMsgNotarizeLiquidAsset( + 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.MsgNotarizeLiquidAsset{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the NotarizeLiquidAsset simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "NotarizeLiquidAsset simulation not implemented"), nil, nil + } +} diff --git a/x/machine/types/codec.go b/x/machine/types/codec.go index efff526..31f2c2b 100644 --- a/x/machine/types/codec.go +++ b/x/machine/types/codec.go @@ -10,6 +10,7 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgAttestMachine{}, "machine/AttestMachine", nil) cdc.RegisterConcrete(&MsgRegisterTrustAnchor{}, "machine/RegisterTrustAnchor", nil) + cdc.RegisterConcrete(&MsgNotarizeLiquidAsset{}, "machine/NotarizeLiquidAsset", nil) // this line is used by starport scaffolding # 2 } @@ -20,6 +21,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRegisterTrustAnchor{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgNotarizeLiquidAsset{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/machine/types/keys.go b/x/machine/types/keys.go index d249411..bb28b64 100644 --- a/x/machine/types/keys.go +++ b/x/machine/types/keys.go @@ -24,6 +24,8 @@ const ( TrustAnchorKey = "Machine/trustAnchor/" AddressIndexKey = "Machine/address" + + LiquidAssetKey = "Machine/LiquidAsset/" ) func KeyPrefix(p string) []byte { diff --git a/x/machine/types/liquid_asset.pb.go b/x/machine/types/liquid_asset.pb.go new file mode 100644 index 0000000..7af094c --- /dev/null +++ b/x/machine/types/liquid_asset.pb.go @@ -0,0 +1,463 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: planetmintgo/machine/liquid_asset.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type LiquidAsset struct { + MachineID string `protobuf:"bytes,1,opt,name=machineID,proto3" json:"machineID,omitempty"` + MachineAddress string `protobuf:"bytes,2,opt,name=machineAddress,proto3" json:"machineAddress,omitempty"` + AssetID string `protobuf:"bytes,3,opt,name=assetID,proto3" json:"assetID,omitempty"` + Registered bool `protobuf:"varint,4,opt,name=registered,proto3" json:"registered,omitempty"` +} + +func (m *LiquidAsset) Reset() { *m = LiquidAsset{} } +func (m *LiquidAsset) String() string { return proto.CompactTextString(m) } +func (*LiquidAsset) ProtoMessage() {} +func (*LiquidAsset) Descriptor() ([]byte, []int) { + return fileDescriptor_fae3c910c6dc0f57, []int{0} +} +func (m *LiquidAsset) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LiquidAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LiquidAsset.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 *LiquidAsset) XXX_Merge(src proto.Message) { + xxx_messageInfo_LiquidAsset.Merge(m, src) +} +func (m *LiquidAsset) XXX_Size() int { + return m.Size() +} +func (m *LiquidAsset) XXX_DiscardUnknown() { + xxx_messageInfo_LiquidAsset.DiscardUnknown(m) +} + +var xxx_messageInfo_LiquidAsset proto.InternalMessageInfo + +func (m *LiquidAsset) GetMachineID() string { + if m != nil { + return m.MachineID + } + return "" +} + +func (m *LiquidAsset) GetMachineAddress() string { + if m != nil { + return m.MachineAddress + } + return "" +} + +func (m *LiquidAsset) GetAssetID() string { + if m != nil { + return m.AssetID + } + return "" +} + +func (m *LiquidAsset) GetRegistered() bool { + if m != nil { + return m.Registered + } + return false +} + +func init() { + proto.RegisterType((*LiquidAsset)(nil), "planetmintgo.machine.LiquidAsset") +} + +func init() { + proto.RegisterFile("planetmintgo/machine/liquid_asset.proto", fileDescriptor_fae3c910c6dc0f57) +} + +var fileDescriptor_fae3c910c6dc0f57 = []byte{ + // 218 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0xc8, 0x49, 0xcc, + 0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0xcf, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b, + 0xd5, 0xcf, 0xc9, 0x2c, 0x2c, 0xcd, 0x4c, 0x89, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0xd1, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x41, 0x56, 0xa8, 0x07, 0x55, 0xa8, 0xd4, 0xcb, 0xc8, 0xc5, 0xed, + 0x03, 0x56, 0xec, 0x08, 0x52, 0x2b, 0x24, 0xc3, 0xc5, 0x09, 0x95, 0xf2, 0x74, 0x91, 0x60, 0x54, + 0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x08, 0x08, 0xa9, 0x71, 0xf1, 0x41, 0x39, 0x8e, 0x29, 0x29, 0x45, + 0xa9, 0xc5, 0xc5, 0x12, 0x4c, 0x60, 0x25, 0x68, 0xa2, 0x42, 0x12, 0x5c, 0xec, 0x60, 0xab, 0x3d, + 0x5d, 0x24, 0x98, 0xc1, 0x0a, 0x60, 0x5c, 0x21, 0x39, 0x2e, 0xae, 0xa2, 0xd4, 0xf4, 0xcc, 0xe2, + 0x92, 0xd4, 0xa2, 0xd4, 0x14, 0x09, 0x16, 0x05, 0x46, 0x0d, 0x8e, 0x20, 0x24, 0x11, 0x27, 0xdf, + 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, + 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, + 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x47, 0x78, 0x05, 0x89, 0xa9, 0x9b, 0x9e, 0xaf, 0x5f, 0x01, + 0x0f, 0x81, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xdf, 0x8d, 0x01, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xed, 0xa6, 0xca, 0xe0, 0x26, 0x01, 0x00, 0x00, +} + +func (m *LiquidAsset) 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 *LiquidAsset) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LiquidAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Registered { + i-- + if m.Registered { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintLiquidAsset(dAtA, i, uint64(len(m.AssetID))) + i-- + dAtA[i] = 0x1a + } + if len(m.MachineAddress) > 0 { + i -= len(m.MachineAddress) + copy(dAtA[i:], m.MachineAddress) + i = encodeVarintLiquidAsset(dAtA, i, uint64(len(m.MachineAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.MachineID) > 0 { + i -= len(m.MachineID) + copy(dAtA[i:], m.MachineID) + i = encodeVarintLiquidAsset(dAtA, i, uint64(len(m.MachineID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintLiquidAsset(dAtA []byte, offset int, v uint64) int { + offset -= sovLiquidAsset(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LiquidAsset) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MachineID) + if l > 0 { + n += 1 + l + sovLiquidAsset(uint64(l)) + } + l = len(m.MachineAddress) + if l > 0 { + n += 1 + l + sovLiquidAsset(uint64(l)) + } + l = len(m.AssetID) + if l > 0 { + n += 1 + l + sovLiquidAsset(uint64(l)) + } + if m.Registered { + n += 2 + } + return n +} + +func sovLiquidAsset(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLiquidAsset(x uint64) (n int) { + return sovLiquidAsset(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LiquidAsset) 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 ErrIntOverflowLiquidAsset + } + 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: LiquidAsset: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LiquidAsset: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MachineID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidAsset + } + 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 ErrInvalidLengthLiquidAsset + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidAsset + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MachineID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MachineAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidAsset + } + 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 ErrInvalidLengthLiquidAsset + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidAsset + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MachineAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidAsset + } + 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 ErrInvalidLengthLiquidAsset + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidAsset + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AssetID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Registered", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidAsset + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Registered = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipLiquidAsset(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidAsset + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLiquidAsset(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, ErrIntOverflowLiquidAsset + } + 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, ErrIntOverflowLiquidAsset + } + 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, ErrIntOverflowLiquidAsset + } + 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, ErrInvalidLengthLiquidAsset + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLiquidAsset + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLiquidAsset + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLiquidAsset = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLiquidAsset = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLiquidAsset = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/machine/types/message_notarize_liquid_asset.go b/x/machine/types/message_notarize_liquid_asset.go new file mode 100644 index 0000000..782198b --- /dev/null +++ b/x/machine/types/message_notarize_liquid_asset.go @@ -0,0 +1,47 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgNotarizeLiquidAsset = "notarize_liquid_asset" + +var _ sdk.Msg = &MsgNotarizeLiquidAsset{} + +func NewMsgNotarizeLiquidAsset(creator string, notarization *LiquidAsset) *MsgNotarizeLiquidAsset { + return &MsgNotarizeLiquidAsset{ + Creator: creator, + Notarization: notarization, + } +} + +func (msg *MsgNotarizeLiquidAsset) Route() string { + return RouterKey +} + +func (msg *MsgNotarizeLiquidAsset) Type() string { + return TypeMsgNotarizeLiquidAsset +} + +func (msg *MsgNotarizeLiquidAsset) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgNotarizeLiquidAsset) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgNotarizeLiquidAsset) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/machine/types/query.pb.go b/x/machine/types/query.pb.go index 3d8dfb8..62061e1 100644 --- a/x/machine/types/query.pb.go +++ b/x/machine/types/query.pb.go @@ -385,6 +385,98 @@ func (m *QueryGetMachineByAddressResponse) GetMachine() *Machine { return nil } +type QueryGetLiquidAssetsByMachineidRequest struct { + MachineID string `protobuf:"bytes,1,opt,name=machineID,proto3" json:"machineID,omitempty"` +} + +func (m *QueryGetLiquidAssetsByMachineidRequest) Reset() { + *m = QueryGetLiquidAssetsByMachineidRequest{} +} +func (m *QueryGetLiquidAssetsByMachineidRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLiquidAssetsByMachineidRequest) ProtoMessage() {} +func (*QueryGetLiquidAssetsByMachineidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_bf7841d43d757203, []int{8} +} +func (m *QueryGetLiquidAssetsByMachineidRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLiquidAssetsByMachineidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLiquidAssetsByMachineidRequest.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 *QueryGetLiquidAssetsByMachineidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLiquidAssetsByMachineidRequest.Merge(m, src) +} +func (m *QueryGetLiquidAssetsByMachineidRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLiquidAssetsByMachineidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLiquidAssetsByMachineidRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLiquidAssetsByMachineidRequest proto.InternalMessageInfo + +func (m *QueryGetLiquidAssetsByMachineidRequest) GetMachineID() string { + if m != nil { + return m.MachineID + } + return "" +} + +type QueryGetLiquidAssetsByMachineidResponse struct { + LiquidAssetEntry *LiquidAsset `protobuf:"bytes,1,opt,name=liquidAssetEntry,proto3" json:"liquidAssetEntry,omitempty"` +} + +func (m *QueryGetLiquidAssetsByMachineidResponse) Reset() { + *m = QueryGetLiquidAssetsByMachineidResponse{} +} +func (m *QueryGetLiquidAssetsByMachineidResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLiquidAssetsByMachineidResponse) ProtoMessage() {} +func (*QueryGetLiquidAssetsByMachineidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf7841d43d757203, []int{9} +} +func (m *QueryGetLiquidAssetsByMachineidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLiquidAssetsByMachineidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLiquidAssetsByMachineidResponse.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 *QueryGetLiquidAssetsByMachineidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLiquidAssetsByMachineidResponse.Merge(m, src) +} +func (m *QueryGetLiquidAssetsByMachineidResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLiquidAssetsByMachineidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLiquidAssetsByMachineidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLiquidAssetsByMachineidResponse proto.InternalMessageInfo + +func (m *QueryGetLiquidAssetsByMachineidResponse) GetLiquidAssetEntry() *LiquidAsset { + if m != nil { + return m.LiquidAssetEntry + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.machine.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.machine.QueryParamsResponse") @@ -394,49 +486,59 @@ func init() { proto.RegisterType((*QueryGetTrustAnchorStatusResponse)(nil), "planetmintgo.machine.QueryGetTrustAnchorStatusResponse") proto.RegisterType((*QueryGetMachineByAddressRequest)(nil), "planetmintgo.machine.QueryGetMachineByAddressRequest") proto.RegisterType((*QueryGetMachineByAddressResponse)(nil), "planetmintgo.machine.QueryGetMachineByAddressResponse") + proto.RegisterType((*QueryGetLiquidAssetsByMachineidRequest)(nil), "planetmintgo.machine.QueryGetLiquidAssetsByMachineidRequest") + proto.RegisterType((*QueryGetLiquidAssetsByMachineidResponse)(nil), "planetmintgo.machine.QueryGetLiquidAssetsByMachineidResponse") } func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) } var fileDescriptor_bf7841d43d757203 = []byte{ - // 590 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x6f, 0x12, 0x41, - 0x18, 0x65, 0x1b, 0x4b, 0xed, 0xf4, 0x36, 0xc5, 0x84, 0x6c, 0x70, 0x4b, 0xe7, 0x84, 0x26, 0x32, - 0x69, 0xab, 0x60, 0xad, 0x89, 0xc2, 0xc5, 0x83, 0x69, 0xd2, 0xa2, 0x27, 0x8d, 0xd9, 0xcc, 0x2e, - 0x93, 0x65, 0x23, 0xec, 0x6c, 0x77, 0x66, 0x1b, 0x37, 0x84, 0x83, 0xfe, 0x02, 0x13, 0xff, 0x91, - 0x27, 0x2e, 0x26, 0x4d, 0xbc, 0x78, 0x32, 0x06, 0xbc, 0xf9, 0x27, 0x0c, 0xb3, 0xb3, 0x40, 0x65, - 0x4a, 0x20, 0x9e, 0x18, 0x3e, 0xde, 0x7b, 0xdf, 0x7b, 0xc3, 0xdb, 0x05, 0xe5, 0xb0, 0x4b, 0x02, - 0x2a, 0x7a, 0x7e, 0x20, 0x3c, 0x86, 0x7b, 0xc4, 0xed, 0xf8, 0x01, 0xc5, 0x17, 0x31, 0x8d, 0x92, - 0x6a, 0x18, 0x31, 0xc1, 0x60, 0x61, 0x1e, 0x51, 0x55, 0x08, 0xb3, 0xe0, 0x31, 0x8f, 0x49, 0x00, - 0x9e, 0x9c, 0x52, 0xac, 0x59, 0xf2, 0x18,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, 0x68, 0xc5, 0xfb, 0xbd, 0x5e, 0x77, 0xb3, 0xb6, 0x2e, 0x4d, 0xe5, 0x78, 0x2a, - 0x73, 0xd4, 0xe0, 0xc3, 0x15, 0xfe, 0x14, 0xf5, 0x00, 0xe1, 0xbe, 0x3a, 0x0c, 0x9a, 0xa7, 0xc3, - 0x91, 0x65, 0x5c, 0x8d, 0x2c, 0xe3, 0xd7, 0xc8, 0x32, 0x3e, 0x8f, 0xad, 0xdc, 0xd5, 0xd8, 0xca, - 0xfd, 0x18, 0x5b, 0xb9, 0x37, 0x47, 0x9e, 0x2f, 0x3a, 0xb1, 0x53, 0x75, 0x59, 0x6f, 0x5e, 0x79, - 0x76, 0x7c, 0xe0, 0x31, 0xfc, 0x61, 0xba, 0x49, 0x24, 0x21, 0xe5, 0x4e, 0x5e, 0xbe, 0x8f, 0x8f, - 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x5d, 0x60, 0x9f, 0x70, 0x06, 0x00, 0x00, + // 705 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x41, 0x4f, 0x13, 0x41, + 0x18, 0xed, 0x12, 0x05, 0x19, 0x2e, 0x66, 0xa8, 0x09, 0xd9, 0xd4, 0x52, 0xe6, 0x20, 0x68, 0x62, + 0x37, 0x80, 0x52, 0x11, 0x8c, 0xb6, 0x41, 0x0d, 0x91, 0x1a, 0xa8, 0x9c, 0x34, 0x66, 0x33, 0xdd, + 0x4e, 0x96, 0x8d, 0xed, 0xce, 0xb2, 0x33, 0x4b, 0xd8, 0x90, 0x1e, 0xf4, 0x17, 0x98, 0xf8, 0x8f, + 0x3c, 0x71, 0x31, 0x21, 0xf1, 0xe2, 0x45, 0x63, 0xc0, 0xbb, 0x7f, 0xc1, 0x74, 0x76, 0x76, 0xbb, + 0xd0, 0xe9, 0x4a, 0xf5, 0xd4, 0xe9, 0xd7, 0xf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 0xe7, 0x36, 0x79, 0x56, 0xc9, 0x63, + 0xdb, 0xdc, 0xe8, 0xd6, 0xea, 0xc7, 0xa7, 0x45, 0xed, 0xe4, 0xb4, 0xa8, 0xfd, 0x3c, 0x2d, 0x6a, + 0x1f, 0xcf, 0x8a, 0xb9, 0x93, 0xb3, 0x62, 0xee, 0xdb, 0x59, 0x31, 0xf7, 0x7a, 0xd9, 0x76, 0xf8, + 0x5e, 0xd0, 0x2c, 0x5b, 0xb4, 0x33, 0x7c, 0xe2, 0x61, 0x32, 0x93, 0x87, 0x1e, 0x61, 0xcd, 0x71, + 0xf1, 0x0e, 0x5d, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x49, 0xdc, 0x55, 0xd7, 0x4d, 0x08, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -459,6 +561,8 @@ type QueryClient interface { GetTrustAnchorStatus(ctx context.Context, in *QueryGetTrustAnchorStatusRequest, opts ...grpc.CallOption) (*QueryGetTrustAnchorStatusResponse, error) // Queries a list of GetMachineByAddress items. GetMachineByAddress(ctx context.Context, in *QueryGetMachineByAddressRequest, opts ...grpc.CallOption) (*QueryGetMachineByAddressResponse, error) + // Queries a list of GetLiquidAssetsByMachineid items. + GetLiquidAssetsByMachineid(ctx context.Context, in *QueryGetLiquidAssetsByMachineidRequest, opts ...grpc.CallOption) (*QueryGetLiquidAssetsByMachineidResponse, error) } type queryClient struct { @@ -505,6 +609,15 @@ func (c *queryClient) GetMachineByAddress(ctx context.Context, in *QueryGetMachi return out, nil } +func (c *queryClient) GetLiquidAssetsByMachineid(ctx context.Context, in *QueryGetLiquidAssetsByMachineidRequest, opts ...grpc.CallOption) (*QueryGetLiquidAssetsByMachineidResponse, error) { + out := new(QueryGetLiquidAssetsByMachineidResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.machine.Query/GetLiquidAssetsByMachineid", 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. @@ -515,6 +628,8 @@ type QueryServer interface { GetTrustAnchorStatus(context.Context, *QueryGetTrustAnchorStatusRequest) (*QueryGetTrustAnchorStatusResponse, error) // Queries a list of GetMachineByAddress items. GetMachineByAddress(context.Context, *QueryGetMachineByAddressRequest) (*QueryGetMachineByAddressResponse, error) + // Queries a list of GetLiquidAssetsByMachineid items. + GetLiquidAssetsByMachineid(context.Context, *QueryGetLiquidAssetsByMachineidRequest) (*QueryGetLiquidAssetsByMachineidResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -533,6 +648,9 @@ func (*UnimplementedQueryServer) GetTrustAnchorStatus(ctx context.Context, req * func (*UnimplementedQueryServer) GetMachineByAddress(ctx context.Context, req *QueryGetMachineByAddressRequest) (*QueryGetMachineByAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetMachineByAddress not implemented") } +func (*UnimplementedQueryServer) GetLiquidAssetsByMachineid(ctx context.Context, req *QueryGetLiquidAssetsByMachineidRequest) (*QueryGetLiquidAssetsByMachineidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLiquidAssetsByMachineid not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -610,6 +728,24 @@ func _Query_GetMachineByAddress_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Query_GetLiquidAssetsByMachineid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLiquidAssetsByMachineidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetLiquidAssetsByMachineid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.machine.Query/GetLiquidAssetsByMachineid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetLiquidAssetsByMachineid(ctx, req.(*QueryGetLiquidAssetsByMachineidRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "planetmintgo.machine.Query", HandlerType: (*QueryServer)(nil), @@ -630,6 +766,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetMachineByAddress", Handler: _Query_GetMachineByAddress_Handler, }, + { + MethodName: "GetLiquidAssetsByMachineid", + Handler: _Query_GetLiquidAssetsByMachineid_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "planetmintgo/machine/query.proto", @@ -891,6 +1031,71 @@ func (m *QueryGetMachineByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } +func (m *QueryGetLiquidAssetsByMachineidRequest) 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 *QueryGetLiquidAssetsByMachineidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLiquidAssetsByMachineidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MachineID) > 0 { + i -= len(m.MachineID) + copy(dAtA[i:], m.MachineID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.MachineID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLiquidAssetsByMachineidResponse) 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 *QueryGetLiquidAssetsByMachineidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLiquidAssetsByMachineidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LiquidAssetEntry != nil { + { + size, err := m.LiquidAssetEntry.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 @@ -1003,6 +1208,32 @@ func (m *QueryGetMachineByAddressResponse) Size() (n int) { return n } +func (m *QueryGetLiquidAssetsByMachineidRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MachineID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetLiquidAssetsByMachineidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LiquidAssetEntry != nil { + l = m.LiquidAssetEntry.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1662,6 +1893,174 @@ func (m *QueryGetMachineByAddressResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetLiquidAssetsByMachineidRequest) 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: QueryGetLiquidAssetsByMachineidRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLiquidAssetsByMachineidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MachineID", 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.MachineID = 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 *QueryGetLiquidAssetsByMachineidResponse) 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: QueryGetLiquidAssetsByMachineidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLiquidAssetsByMachineidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidAssetEntry", 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.LiquidAssetEntry == nil { + m.LiquidAssetEntry = &LiquidAsset{} + } + if err := m.LiquidAssetEntry.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 diff --git a/x/machine/types/query.pb.gw.go b/x/machine/types/query.pb.gw.go index abf6b4e..b9b48c2 100644 --- a/x/machine/types/query.pb.gw.go +++ b/x/machine/types/query.pb.gw.go @@ -213,6 +213,60 @@ func local_request_Query_GetMachineByAddress_0(ctx context.Context, marshaler ru } +func request_Query_GetLiquidAssetsByMachineid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLiquidAssetsByMachineidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["machineID"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "machineID") + } + + protoReq.MachineID, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "machineID", err) + } + + msg, err := client.GetLiquidAssetsByMachineid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetLiquidAssetsByMachineid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLiquidAssetsByMachineidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["machineID"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "machineID") + } + + protoReq.MachineID, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "machineID", err) + } + + msg, err := server.GetLiquidAssetsByMachineid(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. @@ -311,6 +365,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetLiquidAssetsByMachineid_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_GetLiquidAssetsByMachineid_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_GetLiquidAssetsByMachineid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -432,6 +509,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetLiquidAssetsByMachineid_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_GetLiquidAssetsByMachineid_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_GetLiquidAssetsByMachineid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -443,6 +540,8 @@ var ( pattern_Query_GetTrustAnchorStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "machine", "get_trust_anchor_status", "machineid"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetMachineByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "machine", "get_machine_by_address", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetLiquidAssetsByMachineid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "machine", "get_liquid_assets_by_machineid", "machineID"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -453,4 +552,6 @@ var ( forward_Query_GetTrustAnchorStatus_0 = runtime.ForwardResponseMessage forward_Query_GetMachineByAddress_0 = runtime.ForwardResponseMessage + + forward_Query_GetLiquidAssetsByMachineid_0 = runtime.ForwardResponseMessage ) diff --git a/x/machine/types/tx.pb.go b/x/machine/types/tx.pb.go index c4b60c6..77b62b6 100644 --- a/x/machine/types/tx.pb.go +++ b/x/machine/types/tx.pb.go @@ -203,37 +203,131 @@ func (m *MsgRegisterTrustAnchorResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRegisterTrustAnchorResponse proto.InternalMessageInfo +type MsgNotarizeLiquidAsset struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Notarization *LiquidAsset `protobuf:"bytes,2,opt,name=notarization,proto3" json:"notarization,omitempty"` +} + +func (m *MsgNotarizeLiquidAsset) Reset() { *m = MsgNotarizeLiquidAsset{} } +func (m *MsgNotarizeLiquidAsset) String() string { return proto.CompactTextString(m) } +func (*MsgNotarizeLiquidAsset) ProtoMessage() {} +func (*MsgNotarizeLiquidAsset) Descriptor() ([]byte, []int) { + return fileDescriptor_85ac37e5c8e5251d, []int{4} +} +func (m *MsgNotarizeLiquidAsset) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgNotarizeLiquidAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgNotarizeLiquidAsset.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 *MsgNotarizeLiquidAsset) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgNotarizeLiquidAsset.Merge(m, src) +} +func (m *MsgNotarizeLiquidAsset) XXX_Size() int { + return m.Size() +} +func (m *MsgNotarizeLiquidAsset) XXX_DiscardUnknown() { + xxx_messageInfo_MsgNotarizeLiquidAsset.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgNotarizeLiquidAsset proto.InternalMessageInfo + +func (m *MsgNotarizeLiquidAsset) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgNotarizeLiquidAsset) GetNotarization() *LiquidAsset { + if m != nil { + return m.Notarization + } + return nil +} + +type MsgNotarizeLiquidAssetResponse struct { +} + +func (m *MsgNotarizeLiquidAssetResponse) Reset() { *m = MsgNotarizeLiquidAssetResponse{} } +func (m *MsgNotarizeLiquidAssetResponse) String() string { return proto.CompactTextString(m) } +func (*MsgNotarizeLiquidAssetResponse) ProtoMessage() {} +func (*MsgNotarizeLiquidAssetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_85ac37e5c8e5251d, []int{5} +} +func (m *MsgNotarizeLiquidAssetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgNotarizeLiquidAssetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgNotarizeLiquidAssetResponse.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 *MsgNotarizeLiquidAssetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgNotarizeLiquidAssetResponse.Merge(m, src) +} +func (m *MsgNotarizeLiquidAssetResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgNotarizeLiquidAssetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgNotarizeLiquidAssetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgNotarizeLiquidAssetResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAttestMachine)(nil), "planetmintgo.machine.MsgAttestMachine") proto.RegisterType((*MsgAttestMachineResponse)(nil), "planetmintgo.machine.MsgAttestMachineResponse") proto.RegisterType((*MsgRegisterTrustAnchor)(nil), "planetmintgo.machine.MsgRegisterTrustAnchor") proto.RegisterType((*MsgRegisterTrustAnchorResponse)(nil), "planetmintgo.machine.MsgRegisterTrustAnchorResponse") + proto.RegisterType((*MsgNotarizeLiquidAsset)(nil), "planetmintgo.machine.MsgNotarizeLiquidAsset") + proto.RegisterType((*MsgNotarizeLiquidAssetResponse)(nil), "planetmintgo.machine.MsgNotarizeLiquidAssetResponse") } func init() { proto.RegisterFile("planetmintgo/machine/tx.proto", fileDescriptor_85ac37e5c8e5251d) } var fileDescriptor_85ac37e5c8e5251d = []byte{ - // 316 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x86, 0xbb, 0x0a, 0x16, 0xa7, 0x08, 0x12, 0x45, 0x42, 0xa0, 0x4b, 0xcd, 0x41, 0x7b, 0xd0, - 0x0d, 0xb4, 0x82, 0xe7, 0xea, 0x39, 0x97, 0xe0, 0xc9, 0x8b, 0xa4, 0x61, 0xd9, 0x04, 0x4c, 0x36, - 0xec, 0x4e, 0xb1, 0x7d, 0x0b, 0x1f, 0xcb, 0x63, 0x8f, 0x1e, 0x25, 0x39, 0xf9, 0x16, 0x62, 0x93, - 0x90, 0x58, 0xb6, 0xa2, 0xa7, 0x64, 0x99, 0x7f, 0xfe, 0xff, 0x9b, 0x61, 0x60, 0x98, 0x3f, 0x87, - 0x19, 0xc7, 0x34, 0xc9, 0x50, 0x48, 0x2f, 0x0d, 0xa3, 0x38, 0xc9, 0xb8, 0x87, 0x4b, 0x96, 0x2b, - 0x89, 0xd2, 0x3a, 0xed, 0x96, 0x59, 0x5d, 0x76, 0x5c, 0x63, 0x53, 0xfd, 0xad, 0x3a, 0x9d, 0x4b, - 0xb3, 0xb1, 0x5a, 0x68, 0x7c, 0x0a, 0xb3, 0x28, 0x96, 0xaa, 0x12, 0xba, 0x1c, 0x8e, 0x7d, 0x2d, - 0x66, 0x88, 0x5c, 0xa3, 0x5f, 0xc9, 0x2c, 0x1b, 0xfa, 0x91, 0xe2, 0x21, 0x4a, 0x65, 0x93, 0x11, - 0x19, 0x1f, 0x06, 0xcd, 0xd3, 0xba, 0x85, 0x7e, 0xed, 0x65, 0xef, 0x8d, 0xc8, 0x78, 0x30, 0x19, - 0x32, 0x13, 0x22, 0xab, 0x9d, 0x82, 0x46, 0xed, 0x3a, 0x60, 0x6f, 0xc7, 0x04, 0x5c, 0xe7, 0x32, - 0xd3, 0xdc, 0x7d, 0x81, 0x33, 0x5f, 0x8b, 0x80, 0x8b, 0x44, 0x23, 0x57, 0x0f, 0xdf, 0x8c, 0xb3, - 0x0d, 0xe2, 0x2f, 0x20, 0xf7, 0x30, 0xc0, 0x56, 0x58, 0xc3, 0x9c, 0x9b, 0x61, 0x3a, 0x8e, 0x41, - 0xb7, 0xcb, 0x1d, 0x01, 0x35, 0x07, 0x37, 0x68, 0x93, 0x4f, 0x02, 0xfb, 0xbe, 0x16, 0x96, 0x80, - 0xa3, 0x9f, 0x2b, 0xba, 0xd8, 0x31, 0xf7, 0xd6, 0x8c, 0x0e, 0xfb, 0x9b, 0xae, 0x09, 0xb4, 0x56, - 0x70, 0x62, 0x5a, 0xc4, 0xd5, 0x4e, 0x1b, 0x83, 0xda, 0xb9, 0xf9, 0x8f, 0xba, 0x89, 0xbe, 0xf3, - 0xdf, 0x0a, 0x4a, 0xd6, 0x05, 0x25, 0x1f, 0x05, 0x25, 0xaf, 0x25, 0xed, 0xad, 0x4b, 0xda, 0x7b, - 0x2f, 0x69, 0xef, 0x71, 0x2a, 0x12, 0x8c, 0x17, 0x73, 0x16, 0xc9, 0xd4, 0x6b, 0x9d, 0x3b, 0xbf, - 0xd7, 0x42, 0x7a, 0xcb, 0xf6, 0xca, 0x56, 0x39, 0xd7, 0xf3, 0x83, 0xcd, 0x7d, 0x4d, 0xbf, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x3d, 0xee, 0xa4, 0x4d, 0xe3, 0x02, 0x00, 0x00, + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x4b, 0xc3, 0x30, + 0x18, 0x5e, 0x27, 0x38, 0xcc, 0x14, 0xa4, 0x8a, 0x94, 0xc2, 0xca, 0xec, 0x41, 0x77, 0xd0, 0x16, + 0x36, 0xc1, 0xf3, 0x14, 0x6f, 0xd6, 0x43, 0xf1, 0xe4, 0x65, 0x64, 0x35, 0x64, 0x81, 0x2d, 0xa9, + 0xc9, 0x3b, 0xdc, 0xfc, 0x15, 0xfe, 0x2c, 0x8f, 0x3b, 0x7a, 0x94, 0xcd, 0x1f, 0x22, 0xeb, 0x87, + 0xeb, 0x46, 0x56, 0xf4, 0xd4, 0x86, 0x3c, 0x5f, 0xef, 0xfb, 0x10, 0xd4, 0x88, 0x87, 0x98, 0x13, + 0x18, 0x31, 0x0e, 0x54, 0xf8, 0x23, 0x1c, 0x0d, 0x18, 0x27, 0x3e, 0x4c, 0xbc, 0x58, 0x0a, 0x10, + 0xe6, 0x71, 0xf1, 0xda, 0xcb, 0xae, 0x6d, 0x57, 0x4b, 0xca, 0xbe, 0x29, 0xd3, 0x3e, 0xd7, 0x0b, + 0xcb, 0xb1, 0x82, 0x1e, 0xe6, 0xd1, 0x40, 0xc8, 0x52, 0xe0, 0x90, 0xbd, 0x8c, 0xd9, 0x73, 0x0f, + 0x2b, 0x45, 0x20, 0x05, 0xba, 0x04, 0x1d, 0x06, 0x8a, 0x76, 0x01, 0x88, 0x82, 0x20, 0x85, 0x99, + 0x16, 0xaa, 0x45, 0x92, 0x60, 0x10, 0xd2, 0x32, 0x9a, 0x46, 0x6b, 0x2f, 0xcc, 0x8f, 0xe6, 0x35, + 0xaa, 0x65, 0x5a, 0x56, 0xb5, 0x69, 0xb4, 0xea, 0xed, 0x86, 0xa7, 0x9b, 0xc5, 0xcb, 0x94, 0xc2, + 0x1c, 0xed, 0xda, 0xc8, 0xda, 0xb4, 0x09, 0x89, 0x8a, 0x05, 0x57, 0xc4, 0x7d, 0x45, 0x27, 0x81, + 0xa2, 0x21, 0xa1, 0x4c, 0x01, 0x91, 0x8f, 0xcb, 0x61, 0xba, 0xc9, 0x2c, 0x25, 0x41, 0x6e, 0x51, + 0x1d, 0x56, 0xc0, 0x2c, 0xcc, 0xa9, 0x3e, 0x4c, 0x41, 0x31, 0x2c, 0xb2, 0xdc, 0x26, 0x72, 0xf4, + 0xc6, 0xbf, 0xd1, 0xa6, 0x49, 0xb4, 0x07, 0x01, 0x58, 0xb2, 0x37, 0x72, 0x9f, 0xac, 0xaf, 0xbb, + 0xdc, 0x5e, 0x49, 0xb4, 0x3b, 0xb4, 0xcf, 0x53, 0x02, 0x06, 0x26, 0x78, 0x79, 0xb6, 0x82, 0x64, + 0xb8, 0x46, 0xcb, 0xc2, 0x69, 0xac, 0xf3, 0x70, 0xed, 0xef, 0x2a, 0xda, 0x09, 0x14, 0x35, 0x29, + 0x3a, 0x58, 0xef, 0xef, 0x6c, 0x4b, 0x29, 0x1b, 0x05, 0xd8, 0xde, 0xdf, 0x70, 0xb9, 0xa1, 0x39, + 0x45, 0x47, 0xba, 0x96, 0x2e, 0xb6, 0xca, 0x68, 0xd0, 0xf6, 0xd5, 0x7f, 0xd0, 0x45, 0x6b, 0x5d, + 0x0b, 0xdb, 0xad, 0x35, 0xe8, 0x12, 0xeb, 0x92, 0x35, 0xdf, 0x04, 0x1f, 0x73, 0xc7, 0x98, 0xcd, + 0x1d, 0xe3, 0x6b, 0xee, 0x18, 0xef, 0x0b, 0xa7, 0x32, 0x5b, 0x38, 0x95, 0xcf, 0x85, 0x53, 0x79, + 0xea, 0x50, 0x06, 0x83, 0x71, 0xdf, 0x8b, 0xc4, 0xc8, 0x5f, 0x29, 0x17, 0x7e, 0x2f, 0xa9, 0xf0, + 0x27, 0xab, 0x67, 0x3a, 0x8d, 0x89, 0xea, 0xef, 0x26, 0xef, 0xae, 0xf3, 0x13, 0x00, 0x00, 0xff, + 0xff, 0x39, 0x1a, 0xee, 0x05, 0x24, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -250,6 +344,7 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { AttestMachine(ctx context.Context, in *MsgAttestMachine, opts ...grpc.CallOption) (*MsgAttestMachineResponse, error) RegisterTrustAnchor(ctx context.Context, in *MsgRegisterTrustAnchor, opts ...grpc.CallOption) (*MsgRegisterTrustAnchorResponse, error) + NotarizeLiquidAsset(ctx context.Context, in *MsgNotarizeLiquidAsset, opts ...grpc.CallOption) (*MsgNotarizeLiquidAssetResponse, error) } type msgClient struct { @@ -278,10 +373,20 @@ func (c *msgClient) RegisterTrustAnchor(ctx context.Context, in *MsgRegisterTrus return out, nil } +func (c *msgClient) NotarizeLiquidAsset(ctx context.Context, in *MsgNotarizeLiquidAsset, opts ...grpc.CallOption) (*MsgNotarizeLiquidAssetResponse, error) { + out := new(MsgNotarizeLiquidAssetResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.machine.Msg/NotarizeLiquidAsset", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AttestMachine(context.Context, *MsgAttestMachine) (*MsgAttestMachineResponse, error) RegisterTrustAnchor(context.Context, *MsgRegisterTrustAnchor) (*MsgRegisterTrustAnchorResponse, error) + NotarizeLiquidAsset(context.Context, *MsgNotarizeLiquidAsset) (*MsgNotarizeLiquidAssetResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -294,6 +399,9 @@ func (*UnimplementedMsgServer) AttestMachine(ctx context.Context, req *MsgAttest func (*UnimplementedMsgServer) RegisterTrustAnchor(ctx context.Context, req *MsgRegisterTrustAnchor) (*MsgRegisterTrustAnchorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterTrustAnchor not implemented") } +func (*UnimplementedMsgServer) NotarizeLiquidAsset(ctx context.Context, req *MsgNotarizeLiquidAsset) (*MsgNotarizeLiquidAssetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NotarizeLiquidAsset not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -335,6 +443,24 @@ func _Msg_RegisterTrustAnchor_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_NotarizeLiquidAsset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgNotarizeLiquidAsset) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).NotarizeLiquidAsset(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.machine.Msg/NotarizeLiquidAsset", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).NotarizeLiquidAsset(ctx, req.(*MsgNotarizeLiquidAsset)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "planetmintgo.machine.Msg", HandlerType: (*MsgServer)(nil), @@ -347,6 +473,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RegisterTrustAnchor", Handler: _Msg_RegisterTrustAnchor_Handler, }, + { + MethodName: "NotarizeLiquidAsset", + Handler: _Msg_NotarizeLiquidAsset_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "planetmintgo/machine/tx.proto", @@ -482,6 +612,71 @@ func (m *MsgRegisterTrustAnchorResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *MsgNotarizeLiquidAsset) 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 *MsgNotarizeLiquidAsset) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgNotarizeLiquidAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Notarization != nil { + { + size, err := m.Notarization.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + 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 *MsgNotarizeLiquidAssetResponse) 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 *MsgNotarizeLiquidAssetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgNotarizeLiquidAssetResponse) 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 @@ -545,6 +740,32 @@ func (m *MsgRegisterTrustAnchorResponse) Size() (n int) { return n } +func (m *MsgNotarizeLiquidAsset) 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)) + } + if m.Notarization != nil { + l = m.Notarization.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgNotarizeLiquidAssetResponse) 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 } @@ -887,6 +1108,174 @@ func (m *MsgRegisterTrustAnchorResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgNotarizeLiquidAsset) 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: MsgNotarizeLiquidAsset: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgNotarizeLiquidAsset: 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 Notarization", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Notarization == nil { + m.Notarization = &LiquidAsset{} + } + if err := m.Notarization.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgNotarizeLiquidAssetResponse) 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: MsgNotarizeLiquidAssetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgNotarizeLiquidAssetResponse: 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