Merge pull request #133 from planetmint/124-propose-a-liquid-issuance-to-the-network-unsigned-transaction

124 issue liquid tokens
This commit is contained in:
Lorenz Herzberger 2023-10-10 09:18:01 +02:00 committed by GitHub
commit 481f929bdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 3702 additions and 99 deletions

View File

@ -54,6 +54,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewValidateMemoDecorator(options.AccountKeeper),
NewCheckMachineDecorator(options.MachineKeeper),
NewCheckMintAddressDecorator(options.DaoKeeper),
NewCheckReissuanceDecorator(),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators

View File

@ -0,0 +1,32 @@
package ante
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/x/dao"
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
)
type CheckReissuanceDecorator struct{}
func NewCheckReissuanceDecorator() CheckReissuanceDecorator {
return CheckReissuanceDecorator{}
}
func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
for _, msg := range tx.GetMsgs() {
if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" {
MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal)
if ok {
conf := config.GetConfig()
isValid := dao.IsValidReissuanceCommand(MsgProposal.GetTx(), conf.ReissuanceAsset, MsgProposal.GetBlockheight())
if !isValid {
return ctx, errorsmod.Wrapf(daotypes.ErrReissuanceProposal, "error during CheckTx or ReCheckTx")
}
}
}
}
return next(ctx, tx, simulate)
}

View File

@ -20,10 +20,15 @@ stake-denom = "{{ .PlmntConfig.StakeDenom }}"
fee-denom = "{{ .PlmntConfig.FeeDenom }}"
config-root-dir = "{{ .PlmntConfig.ConfigRootDir }}"
pop-epochs = {{ .PlmntConfig.PoPEpochs }}
issuance-endpoint = "{{ .PlmntConfig.IssuanceEndpoint }}"
issuance-port = {{ .PlmntConfig.IssuancePort }}
rpc-host = "{{ .PlmntConfig.RPCHost }}"
rpc-port = {{ .PlmntConfig.RPCPort }}
rpc-user = "{{ .PlmntConfig.RPCUser }}"
rpc-password = "{{ .PlmntConfig.RPCPassword }}"
mint-address = "{{ .PlmntConfig.MintAddress }}"
issuance-service-dir = "{{ .PlmntConfig.IssuanceServiceDir }}"
reissuance-asset = "{{ .PlmntConfig.ReissuanceAsset }}"
validator-address = "{{ .PlmntConfig.ReissuanceAsset }}"
`
// Config defines Planetmint's top level configuration
@ -34,10 +39,14 @@ type Config struct {
FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"`
ConfigRootDir string `mapstructure:"config-root-dir" json:"config-root-dir"`
PoPEpochs int `mapstructure:"pop-epochs" json:"pop-epochs"`
IssuanceEndpoint string `mapstructure:"issuance-endpoint" json:"issuance-endpoint"`
IssuancePort int `mapstructure:"issuance-port" json:"issuance-port"`
RPCHost string `mapstructure:"rpc-host" json:"rpc-host"`
RPCPort int `mapstructure:"rpc-port" json:"rpc-port"`
RPCUser string `mapstructure:"rpc-user" json:"rpc-user"`
RPCPassword string `mapstructure:"rpc-password" json:"rpc-password"`
IssuanceServiceDir string `mapstructure:"issuance-service-dir" json:"issuance-service-dir"`
MintAddress string `mapstructure:"mint-address" json:"mint-address"`
ReissuanceAsset string `mapstructure:"reissuance-asset" json:"reissuance-asset"`
ValidatorAddress string `mapstructure:"validator-address" json:"validator-address"`
}
// cosmos-sdk wide global singleton
@ -60,10 +69,14 @@ func DefaultConfig() *Config {
FeeDenom: "plmnt",
ConfigRootDir: filepath.Join(currentUser.HomeDir, ".planetmint-go"),
PoPEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
IssuanceEndpoint: "lab.r3c.network",
IssuancePort: 7401,
RPCHost: "localhost",
RPCPort: 18884,
RPCUser: "user",
RPCPassword: "passwor",
IssuanceServiceDir: "/opt/issuer_service",
MintAddress: "default",
ReissuanceAsset: "asset-id-or-name",
ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
}
}

View File

@ -46721,6 +46721,181 @@ paths:
type: string
tags:
- Query
/planetmint/planetmint-go/dao/get_reissuance/{blockHeight}:
get:
summary: Queries a list of GetReissuance items.
operationId: PlanetmintgoDaoGetReissuance
responses:
'200':
description: A successful response.
schema:
type: object
properties:
reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
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: blockHeight
in: path
required: true
type: string
format: uint64
tags:
- Query
/planetmint/planetmint-go/dao/get_reissuances:
get:
summary: Queries a list of GetReissuances items.
operationId: PlanetmintgoDaoGetReissuances
responses:
'200':
description: A successful response.
schema:
type: object
properties:
reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total
was set, its value is undefined otherwise
description: >-
PageResponse is to be embedded in gRPC response messages where
the
corresponding request message has used PageRequest.
message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
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: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.
It is less efficient than using key. Only one of offset or key
should
be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.
If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include
a count of the total number of items available for pagination in
UIs.
count_total is only respected when offset is used. It is ignored
when key
is set.
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.
Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
/planetmint/planetmint-go/dao/mint_requests_by_address/{address}:
get:
summary: Queries a list of MintRequestsByAddress items.
@ -75816,6 +75991,10 @@ definitions:
type: string
planetmintgo.dao.MsgMintTokenResponse:
type: object
planetmintgo.dao.MsgReissueRDDLProposalResponse:
type: object
planetmintgo.dao.MsgReissueRDDLResultResponse:
type: object
planetmintgo.dao.Params:
type: object
description: Params defines the parameters for the module.
@ -75832,6 +76011,62 @@ definitions:
format: uint64
liquidTxHash:
type: string
planetmintgo.dao.QueryGetReissuanceResponse:
type: object
properties:
reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
planetmintgo.dao.QueryGetReissuancesResponse:
type: object
properties:
reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total
was set, its value is undefined otherwise
description: |-
PageResponse is to be embedded in gRPC response messages where the
corresponding request message has used PageRequest.
message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
planetmintgo.dao.QueryMintRequestsByAddressResponse:
type: object
properties:
@ -75857,6 +76092,18 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
planetmintgo.dao.Reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
planetmintgo.machine.Machine:
type: object
properties:

1
go.mod
View File

@ -14,7 +14,6 @@ require (
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-go/v7 v7.1.0
github.com/crgimenes/go-osc v0.0.0-20230219003551-cc22b44f06a3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0

2
go.sum
View File

@ -373,8 +373,6 @@ github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJF
github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crgimenes/go-osc v0.0.0-20230219003551-cc22b44f06a3 h1:ffNeIlr2uX5jgPWlJq3pveSl9a3B6lftpuX978PMzk8=
github.com/crgimenes/go-osc v0.0.0-20230219003551-cc22b44f06a3/go.mod h1:VgRiOtg6gFJfgCY2fMvfyORGwDM3EQ7Z9s/aO0k6cu8=
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View File

@ -8,6 +8,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "planetmintgo/dao/params.proto";
import "planetmintgo/dao/mint_request.proto";
import "planetmintgo/dao/mint_requests.proto";
import "planetmintgo/dao/reissuance.proto";
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
@ -31,6 +32,18 @@ service Query {
option (google.api.http).get = "/planetmint/planetmint-go/dao/mint_requests_by_address/{address}";
}
// Queries a list of GetReissuance items.
rpc GetReissuance (QueryGetReissuanceRequest) returns (QueryGetReissuanceResponse) {
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_reissuance/{blockHeight}";
}
// Queries a list of GetReissuances items.
rpc GetReissuances (QueryGetReissuancesRequest) returns (QueryGetReissuancesResponse) {
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_reissuances";
}
}
// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}
@ -58,3 +71,20 @@ message QueryMintRequestsByAddressResponse {
MintRequests mintRequests = 1;
}
message QueryGetReissuanceRequest {
uint64 blockHeight = 1;
}
message QueryGetReissuanceResponse {
Reissuance reissuance = 1;
}
message QueryGetReissuancesRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
message QueryGetReissuancesResponse {
Reissuance reissuance = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package planetmintgo.dao;
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
message Reissuance {
string proposer = 1;
string rawtx = 2;
string txId = 3;
uint64 blockHeight = 4;
}

View File

@ -8,8 +8,19 @@ option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
// Msg defines the Msg service.
service Msg {
rpc MintToken (MsgMintToken) returns (MsgMintTokenResponse);
rpc ReissueRDDLProposal (MsgReissueRDDLProposal) returns (MsgReissueRDDLProposalResponse);
rpc MintToken (MsgMintToken ) returns (MsgMintTokenResponse );
rpc ReissueRDDLResult (MsgReissueRDDLResult ) returns (MsgReissueRDDLResultResponse );
}
message MsgReissueRDDLProposal {
string creator = 1;
string proposer = 2;
string tx = 3;
uint64 blockheight = 4;
}
message MsgReissueRDDLProposalResponse {}
message MsgMintToken {
string creator = 1;
MintRequest mintRequest = 2;
@ -17,3 +28,12 @@ message MsgMintToken {
message MsgMintTokenResponse {}
message MsgReissueRDDLResult {
string creator = 1;
string proposer = 2;
string txId = 3;
uint64 blockHeight = 4;
}
message MsgReissueRDDLResultResponse {}

View File

@ -24,32 +24,38 @@ type KeyFile struct {
PrivKey Key `json:"priv_key"`
}
func IsValidatorBlockProposer(ctx sdk.Context, proposerAddress []byte) bool {
func GetValidatorCometBFTIdentity(ctx sdk.Context) (string, bool) {
logger := ctx.Logger()
conf := config.GetConfig()
cfg := cometcfg.DefaultConfig()
jsonFilePath := filepath.Join(conf.ConfigRootDir, cfg.PrivValidatorKey)
hexProposerAddress := hex.EncodeToString(proposerAddress)
jsonFile, err := os.Open(jsonFilePath)
if err != nil {
logger.Error("error while opening config", err)
return false
return "", false
}
jsonBytes, err := io.ReadAll(jsonFile)
if err != nil {
logger.Error("error while reading file", err)
return false
return "", false
}
var keyFile KeyFile
err = json.Unmarshal(jsonBytes, &keyFile)
if err != nil {
logger.Error("error while unmarshaling key file", err)
return "", false
}
return strings.ToLower(keyFile.Address), true
}
func IsValidatorBlockProposer(ctx sdk.Context, proposerAddress []byte) bool {
validator_identity, valid_result := GetValidatorCometBFTIdentity(ctx)
if !valid_result {
return false
}
return hexProposerAddress == strings.ToLower(keyFile.Address)
hexProposerAddress := hex.EncodeToString(proposerAddress)
return hexProposerAddress == validator_identity
}

View File

@ -0,0 +1,43 @@
package util
import (
"bytes"
"encoding/json"
"errors"
"os/exec"
"strconv"
"strings"
"github.com/planetmint/planetmint-go/config"
)
type ReissueResult struct {
Txid string `json:"txid"`
Vin int `json:"vin"`
}
func ReissueAsset(reissue_tx string) (txid string, err error) {
conf := config.GetConfig()
cmd_args := strings.Split(reissue_tx, " ")
cmd := exec.Command("/usr/local/bin/elements-cli", "-rpcpassword="+conf.RPCPassword,
"-rpcuser="+conf.RPCUser, "-rpcport="+strconv.Itoa(conf.RPCPort), "-rpcconnect="+conf.RPCHost,
cmd_args[0], cmd_args[1], cmd_args[2])
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err = cmd.Run()
errstr := stderr.String()
if err != nil || len(errstr) > 0 {
err = errors.New("reissuance of RDDL failed")
} else {
var txobj ReissueResult
err = json.Unmarshal(stdout.Bytes(), &txobj)
if err == nil {
txid = txobj.Txid
}
}
return txid, err
}

53
util/issue_commands.go Normal file
View File

@ -0,0 +1,53 @@
package util
import (
"bytes"
"errors"
"os/exec"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/config"
)
func InitRDDLReissuanceProcess(ctx sdk.Context, proposerAddress string, tx_unsigned string, blk_height int64) error {
//get_last_PoPBlockHeight() // TODO: to be read form the upcoming PoP-store
// Construct the command
sending_validator_address := config.GetConfig().ValidatorAddress
cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-proposal",
"--from", sending_validator_address, "-y",
proposerAddress, tx_unsigned, strconv.FormatInt(blk_height, 10))
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
}
func SendRDDLReissuanceResult(ctx sdk.Context, proposerAddress string, txID string, blk_height uint64) error {
// Construct the command
sending_validator_address := config.GetConfig().ValidatorAddress
cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-result",
"--from", sending_validator_address, "-y",
proposerAddress, txID, strconv.FormatUint(blk_height, 10))
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
}

View File

@ -1,9 +1,9 @@
package dao
import (
"encoding/hex"
"fmt"
"github.com/crgimenes/go-osc"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/util"
"github.com/planetmint/planetmint-go/x/dao/keeper"
@ -17,27 +17,21 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper)
proposerAddress := req.Header.GetProposerAddress()
// Check if node is block proposer
if isPoPHeight(req.Header.GetHeight()) && util.IsValidatorBlockProposer(ctx, proposerAddress) {
blockHeight := req.Header.GetHeight()
// TODO: implement PoP trigger
fmt.Println("TODO: implement PoP trigger")
err := issueRDDL()
hexProposerAddress := hex.EncodeToString(proposerAddress)
conf := config.GetConfig()
tx_unsigned := GetReissuanceCommand(conf.ReissuanceAsset, blockHeight)
err := util.InitRDDLReissuanceProcess(ctx, hexProposerAddress, tx_unsigned, blockHeight)
if err != nil {
logger.Error("error while issuing RDDL", err)
logger.Error("error while initializing RDDL issuance", err)
}
}
}
// TODO: define final message
func issueRDDL() error {
cfg := config.GetConfig()
client := osc.NewClient(cfg.IssuanceEndpoint, cfg.IssuancePort)
msg := osc.NewMessage("/rddl/token")
err := client.Send(msg)
return err
}
func isPoPHeight(height int64) bool {
cfg := config.GetConfig()
return height%int64(cfg.PoPEpochs) == 0

View File

@ -26,6 +26,10 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
cmd.AddCommand(CmdMintRequestsByAddress())
cmd.AddCommand(CmdGetReissuance())
cmd.AddCommand(CmdGetReissuances())
// this line is used by starport scaffolding # 1
return cmd

View File

@ -0,0 +1,50 @@
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdGetReissuance() *cobra.Command {
cmd := &cobra.Command{
Use: "get-reissuance [block-height]",
Short: "Query get_reissuance",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqBlockHeight, err := cast.ToUint64E(args[0])
if err != nil {
return err
}
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetReissuanceRequest{
BlockHeight: reqBlockHeight,
}
res, err := queryClient.GetReissuance(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,48 @@
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdGetReissuances() *cobra.Command {
cmd := &cobra.Command{
Use: "get-reissuances",
Short: "Query get_reissuances",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetReissuancesRequest{}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params.Pagination = pageReq
res, err := queryClient.GetReissuances(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -25,7 +25,9 @@ func GetTxCmd() *cobra.Command {
RunE: client.ValidateCmd,
}
cmd.AddCommand(CmdReissueRDDLProposal())
cmd.AddCommand(CmdMintToken())
cmd.AddCommand(CmdReissueRDDLResult())
// this line is used by starport scaffolding # 1
return cmd

View File

@ -0,0 +1,50 @@
package cli
import (
"strconv"
"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/dao/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdReissueRDDLProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "reissue-rddl-proposal [proposer] [tx] [blockheight]",
Short: "Broadcast message reissueRDDLProposal",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argProposer := args[0]
argTx := args[1]
argBlockheight, err := cast.ToUint64E(args[2])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgReissueRDDLProposal(
clientCtx.GetFromAddress().String(),
argProposer,
argTx,
argBlockheight,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,50 @@
package cli
import (
"strconv"
"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/dao/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdReissueRDDLResult() *cobra.Command {
cmd := &cobra.Command{
Use: "reissue-rddl-result [proposer] [tx-id] [block-height]",
Short: "Broadcast message reissueRDDLResult",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argProposer := args[0]
argTxId := args[1]
argBlockHeight, err := cast.ToUint64E(args[2])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgReissueRDDLResult(
clientCtx.GetFromAddress().String(),
argProposer,
argTxId,
argBlockHeight,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,34 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/util"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func (k msgServer) ReissueRDDLProposal(goCtx context.Context, msg *types.MsgReissueRDDLProposal) (*types.MsgReissueRDDLProposalResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
validator_identity, valid_result := util.GetValidatorCometBFTIdentity(ctx)
if valid_result && msg.Proposer == validator_identity {
// 1. sign tx
// 2. broadcast tx
txID, err := util.ReissueAsset(msg.Tx)
if err == nil {
// 3. notarize result by notarizing the liquid tx-id
_ = util.SendRDDLReissuanceResult(ctx, msg.GetProposer(), txID, msg.GetBlockheight())
//TODO verify and resolve error
}
//TODO: reissuance need to be initiated otherwise
}
var reissuance types.Reissuance
reissuance.BlockHeight = msg.GetBlockheight()
reissuance.Proposer = msg.GetProposer()
reissuance.Rawtx = msg.GetTx()
k.StoreReissuance(ctx, reissuance)
return &types.MsgReissueRDDLProposalResponse{}, nil
}

View File

@ -0,0 +1,32 @@
package keeper
import (
"context"
"strconv"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
reissuance, found := k.LookupReissuance(ctx, msg.GetBlockHeight())
if !found {
return nil, errorsmod.Wrapf(types.ErrReissuanceNotFound, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
if reissuance.GetBlockHeight() != msg.GetBlockHeight() {
return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
if reissuance.GetProposer() != msg.GetProposer() {
return nil, errorsmod.Wrapf(types.ErrInvalidProposer, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
if reissuance.GetTxId() != "" {
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
reissuance.TxId = msg.GetTxId()
k.StoreReissuance(ctx, reissuance)
return &types.MsgReissueRDDLResultResponse{}, nil
}

View File

@ -0,0 +1,25 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) GetReissuance(goCtx context.Context, req *types.QueryGetReissuanceRequest) (*types.QueryGetReissuanceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
reissuance, found := k.LookupReissuance(ctx, req.GetBlockHeight())
if !found {
return nil, status.Error(codes.NotFound, "reissuance not found")
}
return &types.QueryGetReissuanceResponse{Reissuance: &reissuance}, nil
}

View File

@ -0,0 +1,45 @@
package keeper_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func TestQueryGetReissuance(t *testing.T) {
keeper, ctx := keepertest.DaoKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
items := createNReissuances(keeper, ctx, 1)
for _, tc := range []struct {
desc string
request *types.QueryGetReissuanceRequest
response *types.QueryGetReissuanceResponse
err error
}{
{
desc: "reissuance request found",
request: &types.QueryGetReissuanceRequest{BlockHeight: 0},
response: &types.QueryGetReissuanceResponse{Reissuance: &items[0]},
},
{
desc: "reissuance request not found",
request: &types.QueryGetReissuanceRequest{BlockHeight: 100},
err: status.Error(codes.NotFound, "reissuance not found"),
},
} {
t.Run(tc.desc, func(t *testing.T) {
res, err := keeper.GetReissuance(wctx, tc.request)
if tc.err != nil {
require.ErrorIs(t, err, tc.err)
} else {
require.Equal(t, tc.response, res)
}
})
}
}

View File

@ -0,0 +1,29 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) GetReissuances(goCtx context.Context, req *types.QueryGetReissuancesRequest) (*types.QueryGetReissuancesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
reissuances := k.getReissuancesPage(ctx, req.Pagination.GetKey(),
req.Pagination.GetOffset(), req.Pagination.GetLimit(),
req.Pagination.GetCountTotal(), req.Pagination.GetReverse())
if reissuances != nil {
return &types.QueryGetReissuancesResponse{Reissuance: &reissuances[0]}, nil
} else {
return &types.QueryGetReissuancesResponse{}, nil
}
}

View File

@ -0,0 +1,49 @@
package keeper
import (
"math/big"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func (k Keeper) StoreReissuance(ctx sdk.Context, reissuance types.Reissuance) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
appendValue := k.cdc.MustMarshal(&reissuance)
store.Set(getReissuanceBytes(reissuance.BlockHeight), appendValue)
}
func (k Keeper) LookupReissuance(ctx sdk.Context, height uint64) (val types.Reissuance, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
reissuance := store.Get(getReissuanceBytes(height))
if reissuance == nil {
return val, false
}
k.cdc.MustUnmarshal(reissuance, &val)
return val, true
}
func (k Keeper) getReissuancesPage(ctx sdk.Context, key []byte, offset uint64, page_size uint64, all bool, reverse bool) (reissuances []types.Reissuance) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
iterator := store.Iterator(nil, nil)
defer iterator.Close()
if reverse {
iterator = store.ReverseIterator(nil, nil)
defer iterator.Close()
}
for ; iterator.Valid(); iterator.Next() {
reissuance := iterator.Value()
var reissuance_org types.Reissuance
k.cdc.MustUnmarshal(reissuance, &reissuance_org)
reissuances = append(reissuances, reissuance_org)
}
return reissuances
}
func getReissuanceBytes(height uint64) []byte {
// Adding 1 because 0 will be interpreted as nil, which is an invalid key
return big.NewInt(int64(height + 1)).Bytes()
}

View File

@ -0,0 +1,35 @@
package keeper_test
import (
"fmt"
"testing"
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
"github.com/stretchr/testify/assert"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func createNReissuances(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Reissuance {
items := make([]types.Reissuance, n)
for i := range items {
items[i].BlockHeight = uint64(i)
items[i].Proposer = fmt.Sprintf("proposer_%v", i)
items[i].Rawtx = fmt.Sprintf("rawtransaction_%v", i)
items[i].TxId = ""
keeper.StoreReissuance(ctx, items[i])
}
return items
}
func TestGetReissuances(t *testing.T) {
keeper, ctx := keepertest.DaoKeeper(t)
items := createNReissuances(keeper, ctx, 10)
for _, item := range items {
reissuance, found := keeper.LookupReissuance(ctx, item.BlockHeight)
assert.True(t, found)
assert.Equal(t, item, reissuance)
}
}

View File

@ -24,9 +24,13 @@ var (
)
const (
opWeightMsgMintToken = "op_weight_msg_mint_token"
opWeightMsgReissueRDDLProposal = "op_weight_msg_reissue_rddl_proposal"
// TODO: Determine the simulation weight value
defaultWeightMsgMintToken int = 100
defaultWeightMsgReissueRDDLProposal int = 100
opWeightMsgReissueRDDLResult = "op_weight_msg_reissue_rddl_result"
// TODO: Determine the simulation weight value
defaultWeightMsgReissueRDDLResult int = 100
// this line is used by starport scaffolding # simapp/module/const
)
@ -56,15 +60,26 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
operations := make([]simtypes.WeightedOperation, 0)
var weightMsgMintToken int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgMintToken, &weightMsgMintToken, nil,
var weightMsgReissueRDDLProposal int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgReissueRDDLProposal, &weightMsgReissueRDDLProposal, nil,
func(_ *rand.Rand) {
weightMsgMintToken = defaultWeightMsgMintToken
weightMsgReissueRDDLProposal = defaultWeightMsgReissueRDDLProposal
},
)
operations = append(operations, simulation.NewWeightedOperation(
weightMsgMintToken,
daosimulation.SimulateMsgMintToken(am.accountKeeper, am.bankKeeper, am.keeper),
weightMsgReissueRDDLProposal,
daosimulation.SimulateMsgReissueRDDLProposal(am.accountKeeper, am.bankKeeper, am.keeper),
))
var weightMsgReissueRDDLResult int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgReissueRDDLResult, &weightMsgReissueRDDLResult, nil,
func(_ *rand.Rand) {
weightMsgReissueRDDLResult = defaultWeightMsgReissueRDDLResult
},
)
operations = append(operations, simulation.NewWeightedOperation(
weightMsgReissueRDDLResult,
daosimulation.SimulateMsgReissueRDDLResult(am.accountKeeper, am.bankKeeper, am.keeper),
))
// this line is used by starport scaffolding # simapp/module/operation
@ -76,10 +91,18 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
return []simtypes.WeightedProposalMsg{
simulation.NewWeightedProposalMsg(
opWeightMsgMintToken,
defaultWeightMsgMintToken,
opWeightMsgReissueRDDLProposal,
defaultWeightMsgReissueRDDLProposal,
func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg {
daosimulation.SimulateMsgMintToken(am.accountKeeper, am.bankKeeper, am.keeper)
daosimulation.SimulateMsgReissueRDDLProposal(am.accountKeeper, am.bankKeeper, am.keeper)
return nil
},
),
simulation.NewWeightedProposalMsg(
opWeightMsgReissueRDDLResult,
defaultWeightMsgReissueRDDLResult,
func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg {
daosimulation.SimulateMsgReissueRDDLResult(am.accountKeeper, am.bankKeeper, am.keeper)
return nil
},
),

View File

@ -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/dao/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func SimulateMsgReissueRDDLProposal(
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.MsgReissueRDDLProposal{
Creator: simAccount.Address.String(),
}
// TODO: Handling the ReissueRDDLProposal simulation
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "ReissueRDDLProposal simulation not implemented"), nil, nil
}
}

View File

@ -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/dao/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func SimulateMsgReissueRDDLResult(
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.MsgReissueRDDLResult{
Creator: simAccount.Address.String(),
}
// TODO: Handling the ReissueRDDLResult simulation
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "ReissueRDDLResult simulation not implemented"), nil, nil
}
}

View File

@ -8,14 +8,20 @@ import (
)
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgReissueRDDLProposal{}, "dao/ReissueRDDLProposal", nil)
cdc.RegisterConcrete(&MsgMintToken{}, "dao/MintToken", nil)
cdc.RegisterConcrete(&MsgReissueRDDLResult{}, "dao/ReissueRDDLResult", nil)
// this line is used by starport scaffolding # 2
}
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgReissueRDDLProposal{},
&MsgMintToken{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgReissueRDDLResult{},
)
// this line is used by starport scaffolding # 3
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

View File

@ -13,4 +13,10 @@ var (
ErrTransferFailed = errorsmod.Register(ModuleName, 4, "transfer failed")
ErrInvalidAddress = errorsmod.Register(ModuleName, 5, "invalid address")
ErrAlreadyMinted = errorsmod.Register(ModuleName, 6, "already minted")
ErrWrongBlockHeight = errorsmod.Register(ModuleName, 7, "wrong block height")
ErrReissuanceNotFound = errorsmod.Register(ModuleName, 8, "reissuance not found")
ErrInvalidProposer = errorsmod.Register(ModuleName, 9, "invalid proposer")
ErrTXAlreadySet = errorsmod.Register(ModuleName, 10, "tx already set")
ErrReissuanceProposal = errorsmod.Register(ModuleName, 11, "invalid reissuance proposal")
ErrReissuanceFailed = errorsmod.Register(ModuleName, 12, "reissuance of RDDL failed")
)

View File

@ -18,6 +18,8 @@ const (
MintRequestAddressKey = "Dao/MintRequestAddress"
MintRequestHashKey = "Dao/MintRequestHash"
ReissuanceBlockHeightKey = "Dao/ReissuanceBlockHeight"
)
func KeyPrefix(p string) []byte {

View File

@ -0,0 +1,49 @@
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgReissueRDDLProposal = "reissue_rddl_proposal"
var _ sdk.Msg = &MsgReissueRDDLProposal{}
func NewMsgReissueRDDLProposal(creator string, proposer string, tx string, blockheight uint64) *MsgReissueRDDLProposal {
return &MsgReissueRDDLProposal{
Creator: creator,
Proposer: proposer,
Tx: tx,
Blockheight: blockheight,
}
}
func (msg *MsgReissueRDDLProposal) Route() string {
return RouterKey
}
func (msg *MsgReissueRDDLProposal) Type() string {
return TypeMsgReissueRDDLProposal
}
func (msg *MsgReissueRDDLProposal) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgReissueRDDLProposal) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgReissueRDDLProposal) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}

View File

@ -0,0 +1,47 @@
package types
import (
"testing"
"github.com/cometbft/cometbft/crypto/ed25519"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/stretchr/testify/require"
)
func AccAddress() string {
pk := ed25519.GenPrivKey().PubKey()
addr := pk.Address()
return sdk.AccAddress(addr).String()
}
func TestMsgReissueRDDLProposal_ValidateBasic(t *testing.T) {
tests := []struct {
name string
msg MsgReissueRDDLProposal
err error
}{
{
name: "invalid address",
msg: MsgReissueRDDLProposal{
Creator: "invalid_address",
},
err: sdkerrors.ErrInvalidAddress,
}, {
name: "valid address",
msg: MsgReissueRDDLProposal{
Creator: AccAddress(),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.msg.ValidateBasic()
if tt.err != nil {
require.ErrorIs(t, err, tt.err)
return
}
require.NoError(t, err)
})
}
}

View File

@ -0,0 +1,49 @@
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgReissueRDDLResult = "reissue_rddl_result"
var _ sdk.Msg = &MsgReissueRDDLResult{}
func NewMsgReissueRDDLResult(creator string, proposer string, txId string, blockHeight uint64) *MsgReissueRDDLResult {
return &MsgReissueRDDLResult{
Creator: creator,
Proposer: proposer,
TxId: txId,
BlockHeight: blockHeight,
}
}
func (msg *MsgReissueRDDLResult) Route() string {
return RouterKey
}
func (msg *MsgReissueRDDLResult) Type() string {
return TypeMsgReissueRDDLResult
}
func (msg *MsgReissueRDDLResult) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgReissueRDDLResult) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgReissueRDDLResult) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}

View File

@ -0,0 +1,39 @@
package types
import (
"testing"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/stretchr/testify/require"
)
func TestMsgReissueRDDLResult_ValidateBasic(t *testing.T) {
tests := []struct {
name string
msg MsgReissueRDDLResult
err error
}{
{
name: "invalid address",
msg: MsgReissueRDDLResult{
Creator: "invalid_address",
},
err: sdkerrors.ErrInvalidAddress,
}, {
name: "valid address",
msg: MsgReissueRDDLResult{
Creator: AccAddress(),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.msg.ValidateBasic()
if tt.err != nil {
require.ErrorIs(t, err, tt.err)
return
}
require.NoError(t, err)
})
}
}

View File

@ -6,7 +6,7 @@ package types
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/query"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
@ -289,6 +289,190 @@ func (m *QueryMintRequestsByAddressResponse) GetMintRequests() *MintRequests {
return nil
}
type QueryGetReissuanceRequest struct {
BlockHeight uint64 `protobuf:"varint,1,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
}
func (m *QueryGetReissuanceRequest) Reset() { *m = QueryGetReissuanceRequest{} }
func (m *QueryGetReissuanceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetReissuanceRequest) ProtoMessage() {}
func (*QueryGetReissuanceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{6}
}
func (m *QueryGetReissuanceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetReissuanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetReissuanceRequest.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 *QueryGetReissuanceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetReissuanceRequest.Merge(m, src)
}
func (m *QueryGetReissuanceRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetReissuanceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetReissuanceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetReissuanceRequest proto.InternalMessageInfo
func (m *QueryGetReissuanceRequest) GetBlockHeight() uint64 {
if m != nil {
return m.BlockHeight
}
return 0
}
type QueryGetReissuanceResponse struct {
Reissuance *Reissuance `protobuf:"bytes,1,opt,name=reissuance,proto3" json:"reissuance,omitempty"`
}
func (m *QueryGetReissuanceResponse) Reset() { *m = QueryGetReissuanceResponse{} }
func (m *QueryGetReissuanceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetReissuanceResponse) ProtoMessage() {}
func (*QueryGetReissuanceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{7}
}
func (m *QueryGetReissuanceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetReissuanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetReissuanceResponse.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 *QueryGetReissuanceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetReissuanceResponse.Merge(m, src)
}
func (m *QueryGetReissuanceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetReissuanceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetReissuanceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetReissuanceResponse proto.InternalMessageInfo
func (m *QueryGetReissuanceResponse) GetReissuance() *Reissuance {
if m != nil {
return m.Reissuance
}
return nil
}
type QueryGetReissuancesRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryGetReissuancesRequest) Reset() { *m = QueryGetReissuancesRequest{} }
func (m *QueryGetReissuancesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetReissuancesRequest) ProtoMessage() {}
func (*QueryGetReissuancesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{8}
}
func (m *QueryGetReissuancesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetReissuancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetReissuancesRequest.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 *QueryGetReissuancesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetReissuancesRequest.Merge(m, src)
}
func (m *QueryGetReissuancesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetReissuancesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetReissuancesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetReissuancesRequest proto.InternalMessageInfo
func (m *QueryGetReissuancesRequest) GetPagination() *query.PageRequest {
if m != nil {
return m.Pagination
}
return nil
}
type QueryGetReissuancesResponse struct {
Reissuance *Reissuance `protobuf:"bytes,1,opt,name=reissuance,proto3" json:"reissuance,omitempty"`
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryGetReissuancesResponse) Reset() { *m = QueryGetReissuancesResponse{} }
func (m *QueryGetReissuancesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetReissuancesResponse) ProtoMessage() {}
func (*QueryGetReissuancesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{9}
}
func (m *QueryGetReissuancesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetReissuancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetReissuancesResponse.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 *QueryGetReissuancesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetReissuancesResponse.Merge(m, src)
}
func (m *QueryGetReissuancesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetReissuancesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetReissuancesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetReissuancesResponse proto.InternalMessageInfo
func (m *QueryGetReissuancesResponse) GetReissuance() *Reissuance {
if m != nil {
return m.Reissuance
}
return nil
}
func (m *QueryGetReissuancesResponse) GetPagination() *query.PageResponse {
if m != nil {
return m.Pagination
}
return nil
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.dao.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.dao.QueryParamsResponse")
@ -296,44 +480,60 @@ func init() {
proto.RegisterType((*QueryGetMintRequestsByHashResponse)(nil), "planetmintgo.dao.QueryGetMintRequestsByHashResponse")
proto.RegisterType((*QueryMintRequestsByAddressRequest)(nil), "planetmintgo.dao.QueryMintRequestsByAddressRequest")
proto.RegisterType((*QueryMintRequestsByAddressResponse)(nil), "planetmintgo.dao.QueryMintRequestsByAddressResponse")
proto.RegisterType((*QueryGetReissuanceRequest)(nil), "planetmintgo.dao.QueryGetReissuanceRequest")
proto.RegisterType((*QueryGetReissuanceResponse)(nil), "planetmintgo.dao.QueryGetReissuanceResponse")
proto.RegisterType((*QueryGetReissuancesRequest)(nil), "planetmintgo.dao.QueryGetReissuancesRequest")
proto.RegisterType((*QueryGetReissuancesResponse)(nil), "planetmintgo.dao.QueryGetReissuancesResponse")
}
func init() { proto.RegisterFile("planetmintgo/dao/query.proto", fileDescriptor_07bad0eeb5b27724) }
var fileDescriptor_07bad0eeb5b27724 = []byte{
// 508 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0xd4, 0x40,
0x14, 0xc7, 0x37, 0xb2, 0xae, 0x38, 0xf5, 0x20, 0x63, 0x0b, 0xcb, 0xd2, 0x46, 0x1d, 0x2b, 0x88,
0x60, 0x86, 0x6d, 0xc5, 0x9e, 0xd4, 0x9a, 0x83, 0xd6, 0x43, 0x41, 0x73, 0xf4, 0xb2, 0x4c, 0xba,
0x43, 0x12, 0x68, 0x66, 0xd2, 0xcc, 0xac, 0xb8, 0x94, 0x5e, 0xfc, 0x03, 0x44, 0xf0, 0x5f, 0xf1,
0x8f, 0x28,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xce, 0xd2, 0x66, 0x9c, 0x07, 0x43, 0xf6, 0x4c, 0x33, 0x21, 0xde, 0x75, 0x37, 0xd3,
0x6a, 0x04, 0xce, 0x92, 0x1e, 0x83, 0x71, 0x12, 0xbe, 0x3c, 0x9d, 0xf9, 0xde, 0xd9, 0xcc, 0xf7,
0x7e, 0xce, 0x7c, 0xef, 0xe3, 0xdc, 0xef, 0x9c, 0xcd, 0xfd, 0xce, 0xf7, 0xb9, 0xdf, 0x79, 0xf3,
0x4f, 0x5b, 0x7e, 0x67, 0xea, 0xe8, 0x69, 0xc1, 0x55, 0xdc, 0x33, 0x9f, 0x8d, 0xed, 0xdf, 0x01,
0x00, 0x00, 0xff, 0xff, 0x4a, 0x7b, 0x5d, 0xc7, 0x32, 0x05, 0x00, 0x00,
// 689 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcf, 0x4f, 0xd4, 0x40,
0x14, 0xc7, 0xb7, 0x04, 0x21, 0x3e, 0xd4, 0x98, 0x11, 0x12, 0x5c, 0xa1, 0xc2, 0x88, 0x3f, 0xa2,
0xd2, 0x09, 0xa0, 0x92, 0x18, 0x50, 0xdc, 0x03, 0xe0, 0x81, 0x04, 0x7b, 0xe4, 0xb2, 0x99, 0xdd,
0x9d, 0x74, 0x1b, 0xd9, 0x4e, 0xe9, 0xcc, 0x1a, 0x37, 0x84, 0x8b, 0x67, 0x63, 0x4c, 0xfc, 0x17,
0x38, 0xfb, 0x77, 0x10, 0xe3, 0x81, 0xc4, 0x8b, 0x27, 0x63, 0xc0, 0x3f, 0xc4, 0x74, 0x66, 0xca,
0xb6, 0x76, 0xb7, 0x2c, 0x89, 0x97, 0xcd, 0x74, 0xe6, 0x7d, 0xdf, 0xfb, 0xbc, 0xd7, 0x7e, 0x67,
0x61, 0x2a, 0xdc, 0xa5, 0x01, 0x93, 0x2d, 0x3f, 0x90, 0x1e, 0x27, 0x0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76, 0x06, 0x72, 0xcf, 0x7b, 0x95, 0x54, 0x76, 0x42, 0x26, 0x6a, 0x23, 0xea,
0x6f, 0x73, 0xe9, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x73, 0x5c, 0x1c, 0x55, 0x08, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -354,6 +554,10 @@ type QueryClient interface {
GetMintRequestsByHash(ctx context.Context, in *QueryGetMintRequestsByHashRequest, opts ...grpc.CallOption) (*QueryGetMintRequestsByHashResponse, error)
// Queries a list of MintRequestsByAddress items.
MintRequestsByAddress(ctx context.Context, in *QueryMintRequestsByAddressRequest, opts ...grpc.CallOption) (*QueryMintRequestsByAddressResponse, error)
// Queries a list of GetReissuance items.
GetReissuance(ctx context.Context, in *QueryGetReissuanceRequest, opts ...grpc.CallOption) (*QueryGetReissuanceResponse, error)
// Queries a list of GetReissuances items.
GetReissuances(ctx context.Context, in *QueryGetReissuancesRequest, opts ...grpc.CallOption) (*QueryGetReissuancesResponse, error)
}
type queryClient struct {
@ -391,6 +595,24 @@ func (c *queryClient) MintRequestsByAddress(ctx context.Context, in *QueryMintRe
return out, nil
}
func (c *queryClient) GetReissuance(ctx context.Context, in *QueryGetReissuanceRequest, opts ...grpc.CallOption) (*QueryGetReissuanceResponse, error) {
out := new(QueryGetReissuanceResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/GetReissuance", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetReissuances(ctx context.Context, in *QueryGetReissuancesRequest, opts ...grpc.CallOption) (*QueryGetReissuancesResponse, error) {
out := new(QueryGetReissuancesResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/GetReissuances", 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.
@ -399,6 +621,10 @@ type QueryServer interface {
GetMintRequestsByHash(context.Context, *QueryGetMintRequestsByHashRequest) (*QueryGetMintRequestsByHashResponse, error)
// Queries a list of MintRequestsByAddress items.
MintRequestsByAddress(context.Context, *QueryMintRequestsByAddressRequest) (*QueryMintRequestsByAddressResponse, error)
// Queries a list of GetReissuance items.
GetReissuance(context.Context, *QueryGetReissuanceRequest) (*QueryGetReissuanceResponse, error)
// Queries a list of GetReissuances items.
GetReissuances(context.Context, *QueryGetReissuancesRequest) (*QueryGetReissuancesResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -414,6 +640,12 @@ func (*UnimplementedQueryServer) GetMintRequestsByHash(ctx context.Context, req
func (*UnimplementedQueryServer) MintRequestsByAddress(ctx context.Context, req *QueryMintRequestsByAddressRequest) (*QueryMintRequestsByAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MintRequestsByAddress not implemented")
}
func (*UnimplementedQueryServer) GetReissuance(ctx context.Context, req *QueryGetReissuanceRequest) (*QueryGetReissuanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetReissuance not implemented")
}
func (*UnimplementedQueryServer) GetReissuances(ctx context.Context, req *QueryGetReissuancesRequest) (*QueryGetReissuancesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetReissuances not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@ -473,6 +705,42 @@ func _Query_MintRequestsByAddress_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _Query_GetReissuance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetReissuanceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetReissuance(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.dao.Query/GetReissuance",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetReissuance(ctx, req.(*QueryGetReissuanceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetReissuances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetReissuancesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetReissuances(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.dao.Query/GetReissuances",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetReissuances(ctx, req.(*QueryGetReissuancesRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.dao.Query",
HandlerType: (*QueryServer)(nil),
@ -489,6 +757,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "MintRequestsByAddress",
Handler: _Query_MintRequestsByAddress_Handler,
},
{
MethodName: "GetReissuance",
Handler: _Query_GetReissuance_Handler,
},
{
MethodName: "GetReissuances",
Handler: _Query_GetReissuances_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/dao/query.proto",
@ -680,6 +956,151 @@ func (m *QueryMintRequestsByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (
return len(dAtA) - i, nil
}
func (m *QueryGetReissuanceRequest) 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 *QueryGetReissuanceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetReissuanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetReissuanceResponse) 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 *QueryGetReissuanceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetReissuanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Reissuance != nil {
{
size, err := m.Reissuance.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 *QueryGetReissuancesRequest) 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 *QueryGetReissuancesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetReissuancesRequest) 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 *QueryGetReissuancesResponse) 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 *QueryGetReissuancesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetReissuancesResponse) 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 m.Reissuance != nil {
{
size, err := m.Reissuance.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
@ -763,6 +1184,61 @@ func (m *QueryMintRequestsByAddressResponse) Size() (n int) {
return n
}
func (m *QueryGetReissuanceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BlockHeight != 0 {
n += 1 + sovQuery(uint64(m.BlockHeight))
}
return n
}
func (m *QueryGetReissuanceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Reissuance != nil {
l = m.Reissuance.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryGetReissuancesRequest) 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 *QueryGetReissuancesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Reissuance != nil {
l = m.Reissuance.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
}
@ -1238,6 +1714,369 @@ func (m *QueryMintRequestsByAddressResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *QueryGetReissuanceRequest) 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: QueryGetReissuanceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetReissuanceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType)
}
m.BlockHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BlockHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetReissuanceResponse) 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: QueryGetReissuanceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetReissuanceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Reissuance", 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.Reissuance == nil {
m.Reissuance = &Reissuance{}
}
if err := m.Reissuance.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 *QueryGetReissuancesRequest) 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: QueryGetReissuancesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetReissuancesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Pagination == nil {
m.Pagination = &query.PageRequest{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryGetReissuancesResponse) 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: QueryGetReissuancesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetReissuancesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Reissuance", 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.Reissuance == nil {
m.Reissuance = &Reissuance{}
}
if err := m.Reissuance.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

View File

@ -159,6 +159,96 @@ func local_request_Query_MintRequestsByAddress_0(ctx context.Context, marshaler
}
func request_Query_GetReissuance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetReissuanceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["blockHeight"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blockHeight")
}
protoReq.BlockHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blockHeight", err)
}
msg, err := client.GetReissuance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetReissuance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetReissuanceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["blockHeight"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blockHeight")
}
protoReq.BlockHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blockHeight", err)
}
msg, err := server.GetReissuance(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_GetReissuances_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_GetReissuances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetReissuancesRequest
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_GetReissuances_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetReissuances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetReissuances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetReissuancesRequest
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_GetReissuances_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetReissuances(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.
@ -234,6 +324,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("GET", pattern_Query_GetReissuance_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_GetReissuance_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_GetReissuance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetReissuances_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_GetReissuances_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_GetReissuances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -335,6 +471,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("GET", pattern_Query_GetReissuance_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_GetReissuance_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_GetReissuance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetReissuances_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_GetReissuances_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_GetReissuances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -344,6 +520,10 @@ var (
pattern_Query_GetMintRequestsByHash_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", "dao", "get_mint_requests_by_hash", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_MintRequestsByAddress_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", "dao", "mint_requests_by_address", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetReissuance_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", "dao", "get_reissuance", "blockHeight"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetReissuances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"planetmint", "planetmint-go", "dao", "get_reissuances"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@ -352,4 +532,8 @@ var (
forward_Query_GetMintRequestsByHash_0 = runtime.ForwardResponseMessage
forward_Query_MintRequestsByAddress_0 = runtime.ForwardResponseMessage
forward_Query_GetReissuance_0 = runtime.ForwardResponseMessage
forward_Query_GetReissuances_0 = runtime.ForwardResponseMessage
)

View File

@ -0,0 +1,455 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: planetmintgo/dao/reissuance.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 Reissuance struct {
Proposer string `protobuf:"bytes,1,opt,name=proposer,proto3" json:"proposer,omitempty"`
Rawtx string `protobuf:"bytes,2,opt,name=rawtx,proto3" json:"rawtx,omitempty"`
TxId string `protobuf:"bytes,3,opt,name=txId,proto3" json:"txId,omitempty"`
BlockHeight uint64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
}
func (m *Reissuance) Reset() { *m = Reissuance{} }
func (m *Reissuance) String() string { return proto.CompactTextString(m) }
func (*Reissuance) ProtoMessage() {}
func (*Reissuance) Descriptor() ([]byte, []int) {
return fileDescriptor_35cf062bd4436e27, []int{0}
}
func (m *Reissuance) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Reissuance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Reissuance.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 *Reissuance) XXX_Merge(src proto.Message) {
xxx_messageInfo_Reissuance.Merge(m, src)
}
func (m *Reissuance) XXX_Size() int {
return m.Size()
}
func (m *Reissuance) XXX_DiscardUnknown() {
xxx_messageInfo_Reissuance.DiscardUnknown(m)
}
var xxx_messageInfo_Reissuance proto.InternalMessageInfo
func (m *Reissuance) GetProposer() string {
if m != nil {
return m.Proposer
}
return ""
}
func (m *Reissuance) GetRawtx() string {
if m != nil {
return m.Rawtx
}
return ""
}
func (m *Reissuance) GetTxId() string {
if m != nil {
return m.TxId
}
return ""
}
func (m *Reissuance) GetBlockHeight() uint64 {
if m != nil {
return m.BlockHeight
}
return 0
}
func init() {
proto.RegisterType((*Reissuance)(nil), "planetmintgo.dao.Reissuance")
}
func init() { proto.RegisterFile("planetmintgo/dao/reissuance.proto", fileDescriptor_35cf062bd4436e27) }
var fileDescriptor_35cf062bd4436e27 = []byte{
// 209 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0x49, 0xcc,
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x2f, 0x4a, 0xcd,
0x2c, 0x2e, 0x2e, 0x4d, 0xcc, 0x4b, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x40,
0x56, 0xa2, 0x97, 0x92, 0x98, 0xaf, 0x54, 0xc2, 0xc5, 0x15, 0x04, 0x57, 0x25, 0x24, 0xc5, 0xc5,
0x51, 0x50, 0x94, 0x5f, 0x90, 0x5f, 0x9c, 0x5a, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04,
0xe7, 0x0b, 0x89, 0x70, 0xb1, 0x16, 0x25, 0x96, 0x97, 0x54, 0x48, 0x30, 0x81, 0x25, 0x20, 0x1c,
0x21, 0x21, 0x2e, 0x96, 0x92, 0x0a, 0xcf, 0x14, 0x09, 0x66, 0xb0, 0x20, 0x98, 0x2d, 0xa4, 0xc0,
0xc5, 0x9d, 0x94, 0x93, 0x9f, 0x9c, 0xed, 0x91, 0x9a, 0x99, 0x9e, 0x51, 0x22, 0xc1, 0xa2, 0xc0,
0xa8, 0xc1, 0x12, 0x84, 0x2c, 0xe4, 0xe4, 0x79, 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, 0xfa, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x08, 0xc7,
0x22, 0x31, 0x75, 0xd3, 0xf3, 0xf5, 0x2b, 0xc0, 0xbe, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62,
0x03, 0xfb, 0xcc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x81, 0xd2, 0xf6, 0x5d, 0xfe, 0x00, 0x00,
0x00,
}
func (m *Reissuance) 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 *Reissuance) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Reissuance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeight != 0 {
i = encodeVarintReissuance(dAtA, i, uint64(m.BlockHeight))
i--
dAtA[i] = 0x20
}
if len(m.TxId) > 0 {
i -= len(m.TxId)
copy(dAtA[i:], m.TxId)
i = encodeVarintReissuance(dAtA, i, uint64(len(m.TxId)))
i--
dAtA[i] = 0x1a
}
if len(m.Rawtx) > 0 {
i -= len(m.Rawtx)
copy(dAtA[i:], m.Rawtx)
i = encodeVarintReissuance(dAtA, i, uint64(len(m.Rawtx)))
i--
dAtA[i] = 0x12
}
if len(m.Proposer) > 0 {
i -= len(m.Proposer)
copy(dAtA[i:], m.Proposer)
i = encodeVarintReissuance(dAtA, i, uint64(len(m.Proposer)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintReissuance(dAtA []byte, offset int, v uint64) int {
offset -= sovReissuance(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Reissuance) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Proposer)
if l > 0 {
n += 1 + l + sovReissuance(uint64(l))
}
l = len(m.Rawtx)
if l > 0 {
n += 1 + l + sovReissuance(uint64(l))
}
l = len(m.TxId)
if l > 0 {
n += 1 + l + sovReissuance(uint64(l))
}
if m.BlockHeight != 0 {
n += 1 + sovReissuance(uint64(m.BlockHeight))
}
return n
}
func sovReissuance(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozReissuance(x uint64) (n int) {
return sovReissuance(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Reissuance) 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 ErrIntOverflowReissuance
}
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: Reissuance: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Reissuance: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowReissuance
}
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 ErrInvalidLengthReissuance
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthReissuance
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Proposer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Rawtx", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowReissuance
}
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 ErrInvalidLengthReissuance
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthReissuance
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Rawtx = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowReissuance
}
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 ErrInvalidLengthReissuance
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthReissuance
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TxId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType)
}
m.BlockHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowReissuance
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BlockHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipReissuance(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthReissuance
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipReissuance(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, ErrIntOverflowReissuance
}
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, ErrIntOverflowReissuance
}
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, ErrIntOverflowReissuance
}
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, ErrInvalidLengthReissuance
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupReissuance
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthReissuance
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthReissuance = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowReissuance = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupReissuance = fmt.Errorf("proto: unexpected end of group")
)

File diff suppressed because it is too large Load Diff

10
x/dao/util.go Normal file
View File

@ -0,0 +1,10 @@
package dao
func GetReissuanceCommand(asset_id string, BlockHeight int64) string {
return "reissueasset " + asset_id + " 998.69"
}
func IsValidReissuanceCommand(reissuance_str string, asset_id string, BlockHeight uint64) bool {
expected := "reissueasset " + asset_id + " 998.69"
return reissuance_str == expected
}

View File

@ -100,13 +100,14 @@ func (k msgServer) issueNFTAsset(name string, machine_address string) (asset_id
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
err = errorsmod.Wrap(types.ErrMachineNFTIssuance, stderr.String())
}
lines := strings.Split(stdout.String(), "\n")
if len(lines) == 3 {
asset_id = lines[0]
contract = lines[1]
} else {
err = errorsmod.Wrap(types.ErrMachineNFTIssuanceNoOutput, stderr.String())
lines := strings.Split(stdout.String(), "\n")
if len(lines) == 3 {
asset_id = lines[0]
contract = lines[1]
} else {
err = errorsmod.Wrap(types.ErrMachineNFTIssuanceNoOutput, stderr.String())
}
}
return asset_id, contract, err
}