diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml index f318bbdf..1d37bf65 100644 --- a/.github/workflows/audit.yaml +++ b/.github/workflows/audit.yaml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v4 @@ -24,6 +26,13 @@ jobs: - name: Build run: go build -v ./... + - name: Check generated files + run: | + curl https://get.ignite.com/cli | bash + ./ignite chain init --clear-cache --yes + rm ignite + if [ "$(git diff --stat | wc -l)" -gt 0 ]; then exit 1; fi + - name: Run gofmt run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi @@ -47,7 +56,7 @@ jobs: run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - name: Run golangci-lint - run: golangci-lint run --timeout 5m + run: golangci-lint run - name: Run tests run: go test -race -vet=off ./... diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 00000000..f72f3c32 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,24 @@ +--- +run: + timeout: 5m +linters: + enable: + - errcheck + - forbidigo + - gosimple + - govet + - ineffassign + - revive + - staticcheck + - unused +issues: + exclude-rules: + - path: codec\.go + linters: + - nosnakecase + - path: app\/simulation_test\.go + linters: + - nosnakecase + - path: testutil\/rest\.go + linters: + - nosnakecase diff --git a/app/ante/ante.go b/app/ante/ante.go index c3e695a1..951125dc 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -1,10 +1,6 @@ package ante import ( - assettypes "github.com/planetmint/planetmint-go/x/asset/types" - daotypes "github.com/planetmint/planetmint-go/x/dao/types" - machinetypes "github.com/planetmint/planetmint-go/x/machine/types" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -14,57 +10,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) -type CheckMachineDecorator struct { - mk MachineKeeper -} - -func NewCheckMachineDecorator(mk MachineKeeper) CheckMachineDecorator { - return CheckMachineDecorator{ - mk: mk, - } -} - -func (cm CheckMachineDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { - for _, msg := range tx.GetMsgs() { - switch sdk.MsgTypeURL(msg) { - case "/planetmintgo.asset.MsgNotarizeAsset": - notarizeMsg, ok := msg.(*assettypes.MsgNotarizeAsset) - if ok { - _, found := cm.mk.GetMachineIndexByAddress(ctx, notarizeMsg.GetCreator()) - if !found { - return ctx, errorsmod.Wrapf(machinetypes.ErrMachineNotFound, "error during CheckTx or ReCheckTx") - } - } - case "/planetmintgo.machine.MsgAttestMachine": - attestMsg, ok := msg.(*machinetypes.MsgAttestMachine) - if ok { - if attestMsg.GetCreator() != attestMsg.Machine.GetAddress() { - return ctx, errorsmod.Wrapf(machinetypes.ErrMachineIsNotCreator, "error during CheckTx or ReCheckTx") - } - _, activated, found := cm.mk.GetTrustAnchor(ctx, attestMsg.Machine.MachineId) - if !found { - return ctx, errorsmod.Wrapf(machinetypes.ErrTrustAnchorNotFound, "error during CheckTx or ReCheckTx") - } - if activated { - return ctx, errorsmod.Wrapf(machinetypes.ErrTrustAnchorAlreadyInUse, "error during CheckTx or ReCheckTx") - } - } - case "planetmintgo.dao.MsgReportPoPResult": - popMsg, ok := msg.(*daotypes.MsgReportPopResult) - if ok { - _, found := cm.mk.GetMachineIndexByAddress(ctx, popMsg.GetCreator()) - if !found { - return ctx, errorsmod.Wrapf(machinetypes.ErrMachineNotFound, "error during CheckTx or ReCheckTx") - } - } - default: - continue - } - } - - return next(ctx, tx, simulate) -} - // HandlerOptions are the options required for constructing a default SDK AnteHandler. type HandlerOptions struct { AccountKeeper AccountKeeper @@ -73,8 +18,9 @@ type HandlerOptions struct { FeegrantKeeper FeegrantKeeper SignModeHandler authsigning.SignModeHandler SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error - TxFeeChecker ante.TxFeeChecker + TxFeeChecker TxFeeChecker MachineKeeper MachineKeeper + DaoKeeper DaoKeeper } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -96,6 +42,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.MachineKeeper == nil { return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "machine keeper is required for ante builder") } + if options.DaoKeeper == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "dao keeper is required for ante builder") + } anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first @@ -104,8 +53,10 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), NewCheckMachineDecorator(options.MachineKeeper), + NewCheckMintAddressDecorator(options.DaoKeeper), + NewCheckReissuanceDecorator(), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), - ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), + NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators ante.NewValidateSigCountDecorator(options.AccountKeeper), ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), diff --git a/app/ante/check_machine_decorator.go b/app/ante/check_machine_decorator.go new file mode 100644 index 00000000..2717abca --- /dev/null +++ b/app/ante/check_machine_decorator.go @@ -0,0 +1,60 @@ +package ante + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + assettypes "github.com/planetmint/planetmint-go/x/asset/types" + daotypes "github.com/planetmint/planetmint-go/x/dao/types" + machinetypes "github.com/planetmint/planetmint-go/x/machine/types" +) + +type CheckMachineDecorator struct { + mk MachineKeeper +} + +func NewCheckMachineDecorator(mk MachineKeeper) CheckMachineDecorator { + return CheckMachineDecorator{ + mk: mk, + } +} + +func (cm CheckMachineDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + for _, msg := range tx.GetMsgs() { + switch sdk.MsgTypeURL(msg) { + case "/planetmintgo.asset.MsgNotarizeAsset": + notarizeMsg, ok := msg.(*assettypes.MsgNotarizeAsset) + if ok { + _, found := cm.mk.GetMachineIndexByAddress(ctx, notarizeMsg.GetCreator()) + if !found { + return ctx, errorsmod.Wrapf(machinetypes.ErrMachineNotFound, "error during CheckTx or ReCheckTx") + } + } + case "/planetmintgo.machine.MsgAttestMachine": + attestMsg, ok := msg.(*machinetypes.MsgAttestMachine) + if ok { + if attestMsg.GetCreator() != attestMsg.Machine.GetAddress() { + return ctx, errorsmod.Wrapf(machinetypes.ErrMachineIsNotCreator, "error during CheckTx or ReCheckTx") + } + _, activated, found := cm.mk.GetTrustAnchor(ctx, attestMsg.Machine.MachineId) + if !found { + return ctx, errorsmod.Wrapf(machinetypes.ErrTrustAnchorNotFound, "error during CheckTx or ReCheckTx") + } + if activated { + return ctx, errorsmod.Wrapf(machinetypes.ErrTrustAnchorAlreadyInUse, "error during CheckTx or ReCheckTx") + } + } + case "planetmintgo.dao.MsgReportPoPResult": + popMsg, ok := msg.(*daotypes.MsgReportPopResult) + if ok { + _, found := cm.mk.GetMachineIndexByAddress(ctx, popMsg.GetCreator()) + if !found { + return ctx, errorsmod.Wrapf(machinetypes.ErrMachineNotFound, "error during CheckTx or ReCheckTx") + } + } + default: + continue + } + } + + return next(ctx, tx, simulate) +} diff --git a/app/ante/check_mint_address_decorator.go b/app/ante/check_mint_address_decorator.go new file mode 100644 index 00000000..8e273f4a --- /dev/null +++ b/app/ante/check_mint_address_decorator.go @@ -0,0 +1,38 @@ +package ante + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/config" + daotypes "github.com/planetmint/planetmint-go/x/dao/types" +) + +type CheckMintAddressDecorator struct { + dk DaoKeeper +} + +func NewCheckMintAddressDecorator(dk DaoKeeper) CheckMintAddressDecorator { + return CheckMintAddressDecorator{ + dk: dk, + } +} + +func (cmad CheckMintAddressDecorator) 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.MsgMintToken" { + mintMsg, ok := msg.(*daotypes.MsgMintToken) + if ok { + cfg := config.GetConfig() + if mintMsg.Creator != cfg.MintAddress { + return ctx, errorsmod.Wrapf(daotypes.ErrInvalidMintAddress, "expected: %s; got: %s", cfg.MintAddress, mintMsg.Creator) + } + _, found := cmad.dk.GetMintRequestByHash(ctx, mintMsg.GetMintRequest().GetLiquidTxHash()) + if found { + return ctx, errorsmod.Wrapf(daotypes.ErrAlreadyMinted, "liquid tx hash %s has already been minted", mintMsg.GetMintRequest().GetLiquidTxHash()) + } + } + } + } + + return next(ctx, tx, simulate) +} diff --git a/app/ante/check_reissuance_decorator.go b/app/ante/check_reissuance_decorator.go new file mode 100644 index 00000000..c1361d9c --- /dev/null +++ b/app/ante/check_reissuance_decorator.go @@ -0,0 +1,35 @@ +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) { + logger := ctx.Logger() + for _, msg := range tx.GetMsgs() { + if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" { + MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal) + if ok { + logger.Debug("REISSUE: receive Proposal") + conf := config.GetConfig() + isValid := dao.IsValidReissuanceCommand(MsgProposal.GetTx(), conf.ReissuanceAsset, MsgProposal.GetBlockHeight()) + if !isValid { + logger.Debug("REISSUE: Invalid Proposal") + return ctx, errorsmod.Wrapf(daotypes.ErrReissuanceProposal, "error during CheckTx or ReCheckTx") + } + } + } + } + + return next(ctx, tx, simulate) +} diff --git a/app/ante/deduct_fee_decorator.go b/app/ante/deduct_fee_decorator.go new file mode 100644 index 00000000..3b85dad9 --- /dev/null +++ b/app/ante/deduct_fee_decorator.go @@ -0,0 +1,167 @@ +package ante + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// TxFeeChecker check if the provided fee is enough and returns the effective fee and tx priority, +// the effective fee should be deducted later, and the priority should be returned in abci response. +type TxFeeChecker func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, error) + +// DeductFeeDecorator deducts fees from the fee payer. The fee payer is the fee granter (if specified) or first signer of the tx. +// If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. +// Call next AnteHandler if fees successfully deducted. +// CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator +type DeductFeeDecorator struct { + accountKeeper AccountKeeper + bankKeeper authtypes.BankKeeper + feegrantKeeper FeegrantKeeper + txFeeChecker TxFeeChecker +} + +func NewDeductFeeDecorator(ak AccountKeeper, bk authtypes.BankKeeper, fk FeegrantKeeper, tfc TxFeeChecker) DeductFeeDecorator { + if tfc == nil { + tfc = checkTxFee + } + + return DeductFeeDecorator{ + accountKeeper: ak, + bankKeeper: bk, + feegrantKeeper: fk, + txFeeChecker: tfc, + } +} + +func checkTxFee(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, error) { + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return nil, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + feeCoins := feeTx.GetFee() + + if ctx.IsCheckTx() { + minGasPrices := ctx.MinGasPrices() + if !minGasPrices.IsZero() { + feeDenoms := feeCoins.Denoms() + if len(feeDenoms) != 1 { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "fee must be exactly one coin; got: %s", feeDenoms) + } + + gasDenom := minGasPrices.GetDenomByIndex(0) + if !sdk.SliceContains[string](feeDenoms, gasDenom) { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "received wrong fee denom; got: %s required: %s", feeDenoms[0], gasDenom) + } + + requiredFees := sdk.Coins{sdk.NewCoin(gasDenom, sdk.OneInt())} + + if !feeCoins.IsAnyGTE(requiredFees) { + return nil, errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %s required: %s", feeCoins, requiredFees) + } + } + } + + return feeCoins, nil +} + +func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + if !simulate && ctx.BlockHeight() > 0 && feeTx.GetGas() == 0 { + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidGasLimit, "must provide positive gas") + } + + var ( + err error + ) + + fee := feeTx.GetFee() + if !simulate { + fee, err = dfd.txFeeChecker(ctx, tx) + if err != nil { + return ctx, err + } + } + if err := dfd.checkDeductFee(ctx, tx, fee); err != nil { + return ctx, err + } + + return next(ctx, tx, simulate) +} + +func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee sdk.Coins) error { + feeTx, ok := sdkTx.(sdk.FeeTx) + if !ok { + return errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + if addr := dfd.accountKeeper.GetModuleAddress(authtypes.FeeCollectorName); addr == nil { + return fmt.Errorf("fee collector module account (%s) has not been set", authtypes.FeeCollectorName) + } + + feePayer := feeTx.FeePayer() + feeGranter := feeTx.FeeGranter() + deductFeesFrom := feePayer + + // if feegranter set deduct fee from feegranter account. + // this works with only when feegrant enabled. + if feeGranter != nil { + if dfd.feegrantKeeper == nil { + return sdkerrors.ErrInvalidRequest.Wrap("fee grants are not enabled") + } else if !feeGranter.Equals(feePayer) { + err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, sdkTx.GetMsgs()) + if err != nil { + return errorsmod.Wrapf(err, "%s does not allow to pay fees for %s", feeGranter, feePayer) + } + } + + deductFeesFrom = feeGranter + } + + deductFeesFromAcc := dfd.accountKeeper.GetAccount(ctx, deductFeesFrom) + if deductFeesFromAcc == nil { + return sdkerrors.ErrUnknownAddress.Wrapf("fee payer address: %s does not exist", deductFeesFrom) + } + + // deduct the fees + if !fee.IsZero() { + err := dfd.deductFees(dfd.bankKeeper, ctx, deductFeesFromAcc, fee) + if err != nil { + return err + } + } + + events := sdk.Events{ + sdk.NewEvent( + sdk.EventTypeTx, + sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), + sdk.NewAttribute(sdk.AttributeKeyFeePayer, deductFeesFrom.String()), + ), + } + ctx.EventManager().EmitEvents(events) + + return nil +} + +// DeductFees deducts fees from the given account. +func (dfd DeductFeeDecorator) deductFees(bankKeeper authtypes.BankKeeper, ctx sdk.Context, acc authtypes.AccountI, fees sdk.Coins) error { + // check if exactly one fee is provided and is greater than 0 + if !fees.IsValid() && len(fees) == 1 { + return errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees) + } + + err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), authtypes.FeeCollectorName, fees) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error()) + } + + return nil +} diff --git a/app/ante/expected_keepers.go b/app/ante/expected_keepers.go index da8e4152..5c2a2ad6 100644 --- a/app/ante/expected_keepers.go +++ b/app/ante/expected_keepers.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + daotypes "github.com/planetmint/planetmint-go/x/dao/types" ) type MachineKeeper interface { @@ -32,3 +33,7 @@ type BankKeeper interface { SendCoins(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } + +type DaoKeeper interface { + GetMintRequestByHash(ctx sdk.Context, hash string) (val daotypes.MintRequest, found bool) +} diff --git a/app/app.go b/app/app.go index f7204895..ba27d32e 100644 --- a/app/app.go +++ b/app/app.go @@ -315,7 +315,7 @@ func New( machinemoduletypes.StoreKey, machinemoduletypes.TAIndexKey, machinemoduletypes.IssuerPlanetmintIndexKey, machinemoduletypes.IssuerLiquidIndexKey, machinemoduletypes.TrustAnchorKey, machinemoduletypes.AddressIndexKey, assetmoduletypes.StoreKey, - daomoduletypes.StoreKey, daomoduletypes.ChallengeKey, + daomoduletypes.StoreKey, daomoduletypes.ChallengeKey, daomoduletypes.MintRequestHashKey, daomoduletypes.MintRequestAddressKey, // this line is used by starport scaffolding # stargate/app/storeKey ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -550,7 +550,6 @@ func New( app.GetSubspace(machinemoduletypes.ModuleName), ) machineModule := machinemodule.NewAppModule(appCodec, app.MachineKeeper, app.AccountKeeper, app.BankKeeper) - go app.MachineKeeper.IssueResponseHandler(logger) app.AssetKeeper = *assetmodulekeeper.NewKeeper( appCodec, @@ -567,6 +566,8 @@ func New( keys[daomoduletypes.StoreKey], keys[daomoduletypes.MemStoreKey], keys[daomoduletypes.ChallengeKey], + keys[daomoduletypes.MintRequestHashKey], + keys[daomoduletypes.MintRequestAddressKey], app.GetSubspace(daomoduletypes.ModuleName), app.BankKeeper, @@ -774,6 +775,7 @@ func New( FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, MachineKeeper: app.MachineKeeper, + DaoKeeper: app.DaoKeeper, }, ) if err != nil { @@ -907,7 +909,7 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) { clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) diff --git a/app/simulation_test.go b/app/simulation_test.go index 9e6aba57..53d43b65 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -39,7 +39,7 @@ import ( "github.com/planetmint/planetmint-go/app" ) -const SIMULATION_SETUP_FAILED = "simulation setup failed" +const SimulationSetupFailed = "simulation setup failed" type storeKeysPrefixes struct { A storetypes.StoreKey @@ -78,7 +78,7 @@ func BenchmarkSimulation(b *testing.B) { simcli.FlagVerboseValue, simcli.FlagEnabledValue, ) - require.NoError(b, err, SIMULATION_SETUP_FAILED) + require.NoError(b, err, SimulationSetupFailed) b.Cleanup(func() { require.NoError(b, db.Close()) @@ -179,7 +179,7 @@ func TestAppStateDeterminism(t *testing.T) { baseapp.SetChainID(chainID), ) - fmt.Printf( + logger.Info( "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, ) @@ -232,7 +232,7 @@ func TestAppImportExport(t *testing.T) { if skip { t.Skip("skipping application import/export simulation") } - require.NoError(t, err, SIMULATION_SETUP_FAILED) + require.NoError(t, err, SimulationSetupFailed) defer func() { require.NoError(t, db.Close()) @@ -283,12 +283,12 @@ func TestAppImportExport(t *testing.T) { simtestutil.PrintStats(db) } - fmt.Printf("exporting genesis...\n") + logger.Info("exporting genesis...\n") exported, err := bApp.ExportAppStateAndValidators(false, []string{}, []string{}) require.NoError(t, err) - fmt.Printf("importing genesis...\n") + logger.Info("importing genesis...\n") newDB, newDir, _, _, err := simtestutil.SetupSimulation( config, @@ -297,7 +297,7 @@ func TestAppImportExport(t *testing.T) { simcli.FlagVerboseValue, simcli.FlagEnabledValue, ) - require.NoError(t, err, SIMULATION_SETUP_FAILED) + require.NoError(t, err, SimulationSetupFailed) defer func() { require.NoError(t, newDB.Close()) @@ -338,7 +338,7 @@ func TestAppImportExport(t *testing.T) { newApp.ModuleManager().InitGenesis(ctxB, bApp.AppCodec(), genesisState) newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) - fmt.Printf("comparing stores...\n") + logger.Info("comparing stores...\n") storeKeysPrefixes := []storeKeysPrefixes{ {bApp.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, @@ -367,7 +367,7 @@ func TestAppImportExport(t *testing.T) { failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") - fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) + logger.Info("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) } } @@ -386,7 +386,7 @@ func TestAppSimulationAfterImport(t *testing.T) { if skip { t.Skip("skipping application simulation after import") } - require.NoError(t, err, SIMULATION_SETUP_FAILED) + require.NoError(t, err, SimulationSetupFailed) defer func() { require.NoError(t, db.Close()) @@ -439,16 +439,16 @@ func TestAppSimulationAfterImport(t *testing.T) { } if stopEarly { - fmt.Println("can't export or import a zero-validator genesis, exiting test...") + logger.Info("can't export or import a zero-validator genesis, exiting test...") return } - fmt.Printf("exporting genesis...\n") + logger.Info("exporting genesis...\n") exported, err := bApp.ExportAppStateAndValidators(true, []string{}, []string{}) require.NoError(t, err) - fmt.Printf("importing genesis...\n") + logger.Info("importing genesis...\n") newDB, newDir, _, _, err := simtestutil.SetupSimulation( config, @@ -457,7 +457,7 @@ func TestAppSimulationAfterImport(t *testing.T) { simcli.FlagVerboseValue, simcli.FlagEnabledValue, ) - require.NoError(t, err, SIMULATION_SETUP_FAILED) + require.NoError(t, err, SimulationSetupFailed) defer func() { require.NoError(t, newDB.Close()) diff --git a/cmd/planetmint-god/cmd/root.go b/cmd/planetmint-god/cmd/root.go index 716492c2..056c12ce 100644 --- a/cmd/planetmint-god/cmd/root.go +++ b/cmd/planetmint-god/cmd/root.go @@ -77,7 +77,7 @@ func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { return err } - customAppTemplate, customAppConfig := initAppConfig() + customAppTemplate, customAppConfig := initAppConfig(initClientCtx) customTMConfig := initTendermintConfig() return server.InterceptConfigsPreRunHandler( cmd, customAppTemplate, customAppConfig, customTMConfig, @@ -345,7 +345,7 @@ func (a appCreator) appExport( // initAppConfig helps to override default appConfig template and configs. // return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { +func initAppConfig(clientCtx client.Context) (string, interface{}) { // The following code snippet is just for reference. type CustomAppConfig struct { @@ -370,7 +370,8 @@ func initAppConfig() (string, interface{}) { // In simapp, we set the min gas prices to 0. srvCfg.MinGasPrices = "0stake" - plmntCfg := planetmintconfig.DefaultConfig() + plmntCfg := planetmintconfig.GetConfig() + plmntCfg.SetRoot(clientCtx.HomeDir) customAppConfig := CustomAppConfig{ Config: *srvCfg, diff --git a/config.yml b/config.yml index 4aaf78e1..a62036e4 100644 --- a/config.yml +++ b/config.yml @@ -1,5 +1,7 @@ --- version: 1 +build: + main: cmd/planetmint-god accounts: - name: alice coins: diff --git a/config/config.go b/config/config.go index 14046dde..ad969663 100644 --- a/config/config.go +++ b/config/config.go @@ -2,8 +2,6 @@ package config import ( "encoding/json" - "os/user" - "path/filepath" "sync" ) @@ -13,24 +11,38 @@ const DefaultConfigTemplate = ` ############################################################################### [planetmint] -osc-service-port = {{ .PlmntConfig.OSCServicePort }} -watchmen-endpoint = "{{ .PlmntConfig.WatchmenEndpoint }}" -watchmen-port = {{ .PlmntConfig.WatchmenPort }} + +asset-registry-endpoint = "{{ .PlmntConfig.AssetRegistryEndpoint }}" token-denom = "{{ .PlmntConfig.TokenDenom }}" stake-denom = "{{ .PlmntConfig.StakeDenom }}" fee-denom = "{{ .PlmntConfig.FeeDenom }}" -config-root-dir = "{{ .PlmntConfig.ConfigRootDir }}" +pop-epochs = {{ .PlmntConfig.PoPEpochs }} +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.ValidatorAddress }}" ` // Config defines Planetmint's top level configuration type Config struct { - OSCServicePort int `mapstructure:"osc-service-port" json:"osc-service-port"` - WatchmenEndpoint string `mapstructure:"watchmen-endpoint" json:"watchmen-endpoint"` - WatchmenPort int `mapstructure:"watchmen-port" json:"watchmen-port"` - TokenDenom string `mapstructure:"token-denom" json:"token-denom"` - StakeDenom string `mapstructure:"stake-denom" json:"stake-denom"` - FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"` - ConfigRootDir string `mapstructure:"config-root-dir" json:"config-root-dir"` + AssetRegistryEndpoint string `mapstructure:"asset-registry-endpoint " json:"asset-registry-endpoint "` + TokenDenom string `mapstructure:"token-denom" json:"token-denom"` + StakeDenom string `mapstructure:"stake-denom" json:"stake-denom"` + FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"` + ConfigRootDir string + PoPEpochs int `mapstructure:"pop-epochs" json:"pop-epochs"` + 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 @@ -41,19 +53,21 @@ var ( // DefaultConfig returns planetmint's default configuration. func DefaultConfig() *Config { - currentUser, err := user.Current() - if err != nil { - panic(err) - } - return &Config{ - OSCServicePort: 8766, - WatchmenEndpoint: "lab.r3c.network", - WatchmenPort: 7401, - TokenDenom: "plmnt", - StakeDenom: "plmntstake", - FeeDenom: "plmnt", - ConfigRootDir: filepath.Join(currentUser.HomeDir, ".planetmint-go"), + AssetRegistryEndpoint: "https://assets.rddl.io/register_asset", + TokenDenom: "plmnt", + StakeDenom: "plmntstake", + FeeDenom: "plmnt", + ConfigRootDir: "", + PoPEpochs: 24, // 24 CometBFT epochs of 5s equate 120s + RPCHost: "localhost", + RPCPort: 18884, + RPCUser: "user", + RPCPassword: "passwor", + IssuanceServiceDir: "/opt/issuer_service", + MintAddress: "default", + ReissuanceAsset: "asset-id-or-name", + ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx", } } @@ -65,6 +79,11 @@ func GetConfig() *Config { return plmntConfig } +func (config *Config) SetRoot(root string) *Config { + config.ConfigRootDir = root + return config +} + // SetWatchmenConfig sets Planetmint's configuration func (config *Config) SetPlanetmintConfig(planetmintconfig interface{}) { jsonConfig, err := json.Marshal(planetmintconfig) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index e95bc939..88ac5f3a 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -46437,43 +46437,7 @@ paths: } tags: - Query - /github.com/planetmint/planetmint-go/asset/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PlanetmintgoAssetParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - 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: {} - tags: - - Query - /planetmint/planetmint-go/asset/get_cids_by_address/{address}/{lookupPeriodInMin}: + /planetmint/asset/get_cids_by_address/{address}/{lookupPeriodInMin}: get: summary: Queries a list of GetCIDsByAddress items. operationId: PlanetmintgoAssetGetCIDsByAddress @@ -46601,7 +46565,7 @@ paths: type: boolean tags: - Query - /planetmint/planetmint-go/asset/get_notarized_asset/{cid}: + /planetmint/asset/get_notarized_asset/{cid}: get: summary: Queries a list of GetNotarizedAsset items. operationId: PlanetmintgoAssetGetNotarizedAsset @@ -46613,9 +46577,7 @@ paths: properties: cid: type: string - signature: - type: string - pubkey: + address: type: string default: description: An unexpected error response. @@ -46642,10 +46604,10 @@ paths: type: string tags: - Query - /github.com/planetmint/planetmint-go/dao/params: + /planetmint/asset/params: get: summary: Parameters queries the parameters of the module. - operationId: PlanetmintgoDaoParams + operationId: PlanetmintgoAssetParams responses: '200': description: A successful response. @@ -46678,57 +46640,73 @@ paths: additionalProperties: {} tags: - Query - /github.com/planetmint/planetmint-go/machine/get_machine_by_public_key/{publicKey}: + /planetmint/dao/get_mint_requests_by_hash/{hash}: get: - summary: Queries a list of GetMachineByPublicKey items. - operationId: PlanetmintgoMachineGetMachineByPublicKey + summary: Queries a list of GetMintRequestsByHash items. + operationId: PlanetmintgoDaoGetMintRequestsByHash responses: '200': description: A successful response. schema: type: object properties: - machine: + mintRequest: type: object properties: - name: - type: string - ticker: - type: string - domain: + beneficiary: type: string - reissue: - type: boolean amount: type: string format: uint64 - precision: - type: string - format: uint64 - issuerPlanetmint: + liquidTxHash: type: string - issuerLiquid: + 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: hash + in: path + required: true + type: string + tags: + - Query + /planetmint/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 - machineId: + rawtx: type: string - metadata: - type: object - properties: - gps: - type: string - device: - type: string - assetDefinition: - type: string - additionalDataCID: - type: string - type: - type: integer - format: int64 - machineIdSignature: + txId: type: string - address: + blockHeight: type: string + format: int64 default: description: An unexpected error response. schema: @@ -46748,26 +46726,165 @@ paths: type: string additionalProperties: {} parameters: - - name: publicKey + - name: blockHeight in: path required: true type: string + format: int64 tags: - Query - /github.com/planetmint/planetmint-go/machine/get_trust_anchor_status/{machineid}: + /planetmint/dao/get_reissuances: get: - summary: Queries a list of GetTrustAnchorStatus items. - operationId: PlanetmintgoMachineGetTrustAnchorStatus + summary: Queries a list of GetReissuances items. + operationId: PlanetmintgoDaoGetReissuances responses: '200': description: A successful response. schema: type: object properties: - machineid: + reissuance: + type: object + properties: + proposer: + type: string + rawtx: + type: string + txId: + type: string + blockHeight: + type: string + format: int64 + 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 - isactivated: - type: boolean + 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/dao/mint_requests_by_address/{address}: + get: + summary: Queries a list of MintRequestsByAddress items. + operationId: PlanetmintgoDaoMintRequestsByAddress + responses: + '200': + description: A successful response. + schema: + type: object + properties: + mintRequests: + type: object + properties: + Requests: + type: array + items: + type: object + properties: + beneficiary: + type: string + amount: + type: string + format: uint64 + liquidTxHash: + type: string default: description: An unexpected error response. schema: @@ -46787,16 +46904,16 @@ paths: type: string additionalProperties: {} parameters: - - name: machineid + - name: address in: path required: true type: string tags: - Query - /github.com/planetmint/planetmint-go/machine/params: + /planetmint/dao/params: get: summary: Parameters queries the parameters of the module. - operationId: PlanetmintgoMachineParams + operationId: PlanetmintgoDaoParams responses: '200': description: A successful response. @@ -46829,7 +46946,7 @@ paths: additionalProperties: {} tags: - Query - /planetmint-go/machine/get_machine_by_address/{address}: + /planetmint/machine/get_machine_by_address/{address}: get: summary: Queries a list of GetMachineByAddress items. operationId: PlanetmintgoMachineGetMachineByAddress @@ -46905,6 +47022,157 @@ paths: type: string tags: - Query + /planetmint/machine/get_machine_by_public_key/{publicKey}: + get: + summary: Queries a list of GetMachineByPublicKey items. + operationId: PlanetmintgoMachineGetMachineByPublicKey + responses: + '200': + description: A successful response. + schema: + type: object + properties: + machine: + type: object + properties: + name: + type: string + ticker: + type: string + domain: + type: string + reissue: + type: boolean + amount: + type: string + format: uint64 + precision: + type: string + format: uint64 + issuerPlanetmint: + type: string + issuerLiquid: + type: string + machineId: + type: string + metadata: + type: object + properties: + gps: + type: string + device: + type: string + assetDefinition: + type: string + additionalDataCID: + type: string + type: + type: integer + format: int64 + machineIdSignature: + type: string + address: + type: string + 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: publicKey + in: path + required: true + type: string + tags: + - Query + /planetmint/machine/get_trust_anchor_status/{machineid}: + get: + summary: Queries a list of GetTrustAnchorStatus items. + operationId: PlanetmintgoMachineGetTrustAnchorStatus + responses: + '200': + description: A successful response. + schema: + type: object + properties: + machineid: + type: string + isactivated: + 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 + /planetmint/machine/params: + get: + summary: Parameters queries the parameters of the module. + operationId: PlanetmintgoMachineParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + 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: {} + tags: + - Query definitions: cosmos.auth.v1beta1.AddressBytesToStringResponse: type: object @@ -75687,9 +75955,7 @@ definitions: properties: cid: type: string - signature: - type: string - pubkey: + address: type: string planetmintgo.asset.QueryParamsResponse: type: object @@ -75705,7 +75971,7 @@ definitions: type: string challenger: type: string - challangee: + challengee: type: string height: type: string @@ -75714,11 +75980,129 @@ definitions: type: boolean description: type: string + planetmintgo.dao.MintRequest: + type: object + properties: + beneficiary: + type: string + amount: + type: string + format: uint64 + liquidTxHash: + type: string + planetmintgo.dao.MintRequests: + type: object + properties: + Requests: + type: array + items: + type: object + properties: + beneficiary: + type: string + amount: + type: string + format: uint64 + liquidTxHash: + type: string + planetmintgo.dao.MsgMintTokenResponse: + type: object + planetmintgo.dao.MsgReissueRDDLProposalResponse: + type: object + planetmintgo.dao.MsgReissueRDDLResultResponse: + type: object planetmintgo.dao.MsgReportPopResultResponse: type: object planetmintgo.dao.Params: type: object description: Params defines the parameters for the module. + planetmintgo.dao.QueryGetMintRequestsByHashResponse: + type: object + properties: + mintRequest: + type: object + properties: + beneficiary: + type: string + amount: + type: string + 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: int64 + planetmintgo.dao.QueryGetReissuancesResponse: + type: object + properties: + reissuance: + type: object + properties: + proposer: + type: string + rawtx: + type: string + txId: + type: string + blockHeight: + type: string + format: int64 + 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: + mintRequests: + type: object + properties: + Requests: + type: array + items: + type: object + properties: + beneficiary: + type: string + amount: + type: string + format: uint64 + liquidTxHash: + type: string planetmintgo.dao.QueryParamsResponse: type: object properties: @@ -75726,6 +76110,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: int64 planetmintgo.machine.Machine: type: object properties: diff --git a/go.mod b/go.mod index 83d8e25d..16eb2750 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cosmossdk.io/api v0.3.1 cosmossdk.io/errors v1.0.0 cosmossdk.io/math v1.1.2 - github.com/btcsuite/btcd v0.23.0 + github.com/btcsuite/btcd v0.23.2 github.com/btcsuite/btcd/btcutil v1.1.2 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 @@ -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 @@ -26,7 +25,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.56.3 gopkg.in/yaml.v2 v2.4.0 sigs.k8s.io/yaml v1.3.0 ) @@ -161,13 +160,13 @@ require ( github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index c64303a3..50ee3c48 100644 --- a/go.sum +++ b/go.sum @@ -258,8 +258,9 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2 github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= -github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd v0.23.2 h1:/YOgUp25sdCnP5ho6Hl3s0E438zlX+Kak7E6TgBgoT0= +github.com/btcsuite/btcd v0.23.2/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= @@ -372,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= @@ -1038,8 +1037,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1142,8 +1141,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1284,13 +1283,13 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1302,8 +1301,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1595,8 +1594,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/proto/planetmintgo/asset/query.proto b/proto/planetmintgo/asset/query.proto index 0d210c26..3782e895 100644 --- a/proto/planetmintgo/asset/query.proto +++ b/proto/planetmintgo/asset/query.proto @@ -14,19 +14,19 @@ service Query { // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/github.com/planetmint/planetmint-go/asset/params"; + option (google.api.http).get = "/planetmint/asset/params"; } // Queries a list of GetCIDsByAddress items. rpc GetCIDsByAddress (QueryGetCIDsByAddressRequest) returns (QueryGetCIDsByAddressResponse) { - option (google.api.http).get = "/planetmint/planetmint-go/asset/get_cids_by_address/{address}/{lookupPeriodInMin}"; + option (google.api.http).get = "/planetmint/asset/get_cids_by_address/{address}/{lookupPeriodInMin}"; } // Queries a list of GetNotarizedAsset items. rpc GetNotarizedAsset (QueryGetNotarizedAssetRequest) returns (QueryGetNotarizedAssetResponse) { - option (google.api.http).get = "/planetmint/planetmint-go/asset/get_notarized_asset/{cid}"; + option (google.api.http).get = "/planetmint/asset/get_notarized_asset/{cid}"; } } diff --git a/proto/planetmintgo/dao/mint_request.proto b/proto/planetmintgo/dao/mint_request.proto new file mode 100644 index 00000000..85a53eef --- /dev/null +++ b/proto/planetmintgo/dao/mint_request.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package planetmintgo.dao; + +option go_package = "github.com/planetmint/planetmint-go/x/dao/types"; + +message MintRequest { + + string beneficiary = 1; + uint64 amount = 2; + string liquidTxHash = 3; +} diff --git a/proto/planetmintgo/dao/mint_requests.proto b/proto/planetmintgo/dao/mint_requests.proto new file mode 100644 index 00000000..7ec5d09a --- /dev/null +++ b/proto/planetmintgo/dao/mint_requests.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package planetmintgo.dao; + +import "planetmintgo/dao/mint_request.proto"; + +option go_package = "github.com/planetmint/planetmint-go/x/dao/types"; + +message MintRequests { + repeated MintRequest Requests = 1; +} \ No newline at end of file diff --git a/proto/planetmintgo/dao/query.proto b/proto/planetmintgo/dao/query.proto index f27bb69a..e80e31bc 100644 --- a/proto/planetmintgo/dao/query.proto +++ b/proto/planetmintgo/dao/query.proto @@ -1,26 +1,90 @@ syntax = "proto3"; + package planetmintgo.dao; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; 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"; // Query defines the gRPC querier service. service Query { + // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/github.com/planetmint/planetmint-go/dao/params"; + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/planetmint/dao/params"; + + } + + // Queries a list of GetMintRequestsByHash items. + rpc GetMintRequestsByHash (QueryGetMintRequestsByHashRequest) returns (QueryGetMintRequestsByHashResponse) { + option (google.api.http).get = "/planetmint/dao/get_mint_requests_by_hash/{hash}"; + + } + + // Queries a list of MintRequestsByAddress items. + rpc MintRequestsByAddress (QueryMintRequestsByAddressRequest) returns (QueryMintRequestsByAddressResponse) { + option (google.api.http).get = "/planetmint/dao/mint_requests_by_address/{address}"; + + } + + // Queries a list of GetReissuance items. + rpc GetReissuance (QueryGetReissuanceRequest) returns (QueryGetReissuanceResponse) { + option (google.api.http).get = "/planetmint/dao/get_reissuance/{blockHeight}"; + + } + + // Queries a list of GetReissuances items. + rpc GetReissuances (QueryGetReissuancesRequest) returns (QueryGetReissuancesResponse) { + option (google.api.http).get = "/planetmint/dao/get_reissuances"; + } } - // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { + // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file +} + +message QueryGetMintRequestsByHashRequest { + string hash = 1; +} + +message QueryGetMintRequestsByHashResponse { + MintRequest mintRequest = 1; +} + +message QueryMintRequestsByAddressRequest { + string address = 1; +} + +message QueryMintRequestsByAddressResponse { + MintRequests mintRequests = 1; +} + +message QueryGetReissuanceRequest { + int64 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; +} + diff --git a/proto/planetmintgo/dao/reissuance.proto b/proto/planetmintgo/dao/reissuance.proto new file mode 100644 index 00000000..eae3c413 --- /dev/null +++ b/proto/planetmintgo/dao/reissuance.proto @@ -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; + int64 blockHeight = 4; +} diff --git a/proto/planetmintgo/dao/tx.proto b/proto/planetmintgo/dao/tx.proto index 83ef8e5c..d8e74a5e 100644 --- a/proto/planetmintgo/dao/tx.proto +++ b/proto/planetmintgo/dao/tx.proto @@ -3,11 +3,15 @@ syntax = "proto3"; package planetmintgo.dao; import "planetmintgo/dao/challenge.proto"; +import "planetmintgo/dao/mint_request.proto"; option go_package = "github.com/planetmint/planetmint-go/x/dao/types"; // Msg defines the Msg service. service Msg { + rpc ReissueRDDLProposal (MsgReissueRDDLProposal) returns (MsgReissueRDDLProposalResponse); + rpc MintToken (MsgMintToken ) returns (MsgMintTokenResponse ); + rpc ReissueRDDLResult (MsgReissueRDDLResult ) returns (MsgReissueRDDLResultResponse ); rpc ReportPopResult (MsgReportPopResult) returns (MsgReportPopResultResponse); } message MsgReportPopResult { @@ -17,3 +21,28 @@ message MsgReportPopResult { message MsgReportPopResultResponse {} +message MsgReissueRDDLProposal { + string creator = 1; + string proposer = 2; + string tx = 3; + int64 blockHeight = 4; +} + +message MsgReissueRDDLProposalResponse {} + +message MsgMintToken { + string creator = 1; + MintRequest mintRequest = 2; +} + +message MsgMintTokenResponse {} + +message MsgReissueRDDLResult { + string creator = 1; + string proposer = 2; + string txId = 3; + int64 blockHeight = 4; +} + +message MsgReissueRDDLResultResponse {} + diff --git a/proto/planetmintgo/machine/query.proto b/proto/planetmintgo/machine/query.proto index 9c32c578..d4deed8f 100644 --- a/proto/planetmintgo/machine/query.proto +++ b/proto/planetmintgo/machine/query.proto @@ -15,25 +15,25 @@ service Query { // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/github.com/planetmint/planetmint-go/machine/params"; + option (google.api.http).get = "/planetmint/machine/params"; } // Queries a list of GetMachineByPublicKey items. rpc GetMachineByPublicKey (QueryGetMachineByPublicKeyRequest) returns (QueryGetMachineByPublicKeyResponse) { - option (google.api.http).get = "/github.com/planetmint/planetmint-go/machine/get_machine_by_public_key/{publicKey}"; + option (google.api.http).get = "/planetmint/machine/get_machine_by_public_key/{publicKey}"; } // Queries a list of GetTrustAnchorStatus items. rpc GetTrustAnchorStatus (QueryGetTrustAnchorStatusRequest) returns (QueryGetTrustAnchorStatusResponse) { - option (google.api.http).get = "/github.com/planetmint/planetmint-go/machine/get_trust_anchor_status/{machineid}"; + option (google.api.http).get = "/planetmint/machine/get_trust_anchor_status/{machineid}"; } // Queries a list of GetMachineByAddress items. rpc GetMachineByAddress (QueryGetMachineByAddressRequest) returns (QueryGetMachineByAddressResponse) { - option (google.api.http).get = "/planetmint-go/machine/get_machine_by_address/{address}"; + option (google.api.http).get = "/planetmint/machine/get_machine_by_address/{address}"; } } diff --git a/tests/e2e/dao/suite.go b/tests/e2e/dao/suite.go index 7dc59001..b73f5d05 100644 --- a/tests/e2e/dao/suite.go +++ b/tests/e2e/dao/suite.go @@ -1,7 +1,9 @@ package dao import ( + "encoding/json" "fmt" + "github.com/planetmint/planetmint-go/config" "github.com/planetmint/planetmint-go/testutil/network" "github.com/planetmint/planetmint-go/testutil/sample" @@ -17,6 +19,8 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" + + daocli "github.com/planetmint/planetmint-go/x/dao/client/cli" ) var ( @@ -123,6 +127,7 @@ func (s *E2ETestSuite) TestDistributeCollectedFees() { out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{ aliceAddr.String(), }) + assert.Contains(s.T(), out.String(), "node0token") assert.Contains(s.T(), out.String(), "6") s.Require().NoError(err) @@ -130,6 +135,66 @@ func (s *E2ETestSuite) TestDistributeCollectedFees() { out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{ bobAddr.String(), }) + assert.Contains(s.T(), out.String(), "node0token") assert.Contains(s.T(), out.String(), "13") s.Require().NoError(err) } + +func (s *E2ETestSuite) TestMintToken() { + conf := config.GetConfig() + val := s.network.Validators[0] + + // val.Address.String() + + mintRequest := sample.MintRequest(aliceAddr.String(), 1000, "hash") + mrJSON, err := json.Marshal(&mintRequest) + s.Require().NoError(err) + + // send mint token request from non mint address + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)), + "--yes", + string(mrJSON), + } + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdMintToken(), args) + s.Require().NoError(err) + + txResponse, err := clitestutil.GetTxResponseFromOut(out) + s.Require().NoError(err) + s.Require().Equal(int(txResponse.Code), int(2)) + + // set mint address to val.address + conf.MintAddress = val.Address.String() + conf.SetPlanetmintConfig(conf) + + // send mint token request from mint address + args = []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)), + "--yes", + string(mrJSON), + } + + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdMintToken(), args) + s.Require().NoError(err) + + txResponse, err = clitestutil.GetTxResponseFromOut(out) + s.Require().NoError(err) + s.Require().Equal(int(txResponse.Code), int(0)) + + s.Require().NoError(s.network.WaitForNextBlock()) + rawLog, err := clitestutil.GetRawLogFromTxResponse(val, txResponse) + s.Require().NoError(err) + + assert.Contains(s.T(), rawLog, "planetmintgo.dao.MsgMintToken") + + // assert that alice has actually received the minted tokens 10000 (initial supply) + 1000 (minted) = 11000 (total) + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{ + aliceAddr.String(), + }) + assert.Contains(s.T(), out.String(), "plmnt") + assert.Contains(s.T(), out.String(), "11000") + s.Require().NoError(err) +} diff --git a/tests/e2e/machine/rest.go b/tests/e2e/machine/rest.go index 7a31a469..cbe28f3f 100644 --- a/tests/e2e/machine/rest.go +++ b/tests/e2e/machine/rest.go @@ -59,8 +59,8 @@ func (s *E2ETestSuite) TestAttestMachineREST() { s.Require().NoError(err) s.Require().Equal(uint32(0), txRes.TxResponse.Code) - queryMachineUrl := fmt.Sprintf("%s/github.com/planetmint/planetmint-go/machine/get_machine_by_public_key/%s", baseURL, pubKey) - queryMachineRes, err := testutil.GetRequest(queryMachineUrl) + queryMachineURL := fmt.Sprintf("%s/planetmint/machine/get_machine_by_public_key/%s", baseURL, pubKey) + queryMachineRes, err := testutil.GetRequest(queryMachineURL) s.Require().NoError(err) var qmRes machinetypes.QueryGetMachineByPublicKeyResponse diff --git a/tests/e2e/machine/suite.go b/tests/e2e/machine/suite.go index c59900d7..337997b7 100644 --- a/tests/e2e/machine/suite.go +++ b/tests/e2e/machine/suite.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli" + feegrant "github.com/cosmos/cosmos-sdk/x/feegrant/client/cli" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) @@ -133,3 +134,124 @@ func (s *E2ETestSuite) TestAttestMachine() { _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdGetMachineByPublicKey(), args) s.Require().NoError(err) } + +func (s *E2ETestSuite) TestInvalidAttestMachine() { + val := s.network.Validators[0] + + // already used in REST test case + prvKey, pubKey := sample.KeyPair(1) + + k, err := val.ClientCtx.Keyring.Key(sample.Name) + s.Require().NoError(err) + addr, _ := k.GetAddress() + + machine := sample.Machine(sample.Name, pubKey, prvKey, addr.String()) + machineJSON, err := json.Marshal(&machine) + s.Require().NoError(err) + + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name), + fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees), + "--yes", + string(machineJSON), + } + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdAttestMachine(), args) + s.Require().NoError(err) + + txResponse, err := clitestutil.GetTxResponseFromOut(out) + s.Require().NoError(err) + s.Require().Equal(int(txResponse.Code), int(4)) + + unregisteredPubKey, unregisteredPrivKey := sample.KeyPair(2) + machine = sample.Machine(sample.Name, unregisteredPubKey, unregisteredPrivKey, addr.String()) + machineJSON, err = json.Marshal(&machine) + s.Require().NoError(err) + + args = []string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagFrom, sample.Name), + fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees), + "--yes", + string(machineJSON), + } + + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdAttestMachine(), args) + s.Require().NoError(err) + + txResponse, err = clitestutil.GetTxResponseFromOut(out) + s.Require().NoError(err) + s.Require().Equal(int(txResponse.Code), int(3)) +} + +func (s *E2ETestSuite) TestMachineAllowanceAttestation() { + // create address for machine + val := s.network.Validators[0] + kb := val.ClientCtx.Keyring + + account, _, err := kb.NewMnemonic("AllowanceMachine", keyring.English, sample.DefaultDerivationPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + s.Require().NoError(err) + + addr, err := account.GetAddress() + s.Require().NoError(err) + + // register TA + prvKey, pubKey := sample.KeyPair(3) + + ta := sample.TrustAnchor(pubKey) + taJSON, err := json.Marshal(&ta) + s.Require().NoError(err) + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker), + fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees), + "--yes", + string(taJSON), + } + _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdRegisterTrustAnchor(), args) + s.Require().NoError(err) + + s.Require().NoError(s.network.WaitForNextBlock()) + + // create allowance for machine + args = []string{ + val.Moniker, // granter + addr.String(), // grantee + fmt.Sprintf("--%s=%s", feegrant.FlagAllowedMsgs, "/planetmintgo.machine.MsgAttestMachine"), + fmt.Sprintf("--%s=%s", feegrant.FlagSpendLimit, "2stake"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees), + "--yes", + } + + _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, feegrant.NewCmdFeeGrant(), args) + s.Require().NoError(err) + + s.Require().NoError(s.network.WaitForNextBlock()) + + // attest machine with fee granter without funding the machine account first + machine := sample.Machine(sample.Name, pubKey, prvKey, addr.String()) + machineJSON, err := json.Marshal(&machine) + s.Require().NoError(err) + + args = []string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagFrom, addr.String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sample.Fees), + fmt.Sprintf("--%s=%s", flags.FlagFeeGranter, val.Address.String()), + "--yes", + string(machineJSON), + } + + _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdAttestMachine(), args) + s.Require().NoError(err) + + s.Require().NoError(s.network.WaitForNextBlock()) + + args = []string{ + pubKey, + } + + _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdGetMachineByPublicKey(), args) + s.Require().NoError(err) +} diff --git a/testutil/keeper/dao.go b/testutil/keeper/dao.go index 916fa789..fde75871 100644 --- a/testutil/keeper/dao.go +++ b/testutil/keeper/dao.go @@ -12,21 +12,32 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/golang/mock/gomock" + "github.com/planetmint/planetmint-go/config" + "github.com/planetmint/planetmint-go/testutil/sample" "github.com/planetmint/planetmint-go/x/dao/keeper" "github.com/planetmint/planetmint-go/x/dao/types" "github.com/stretchr/testify/require" + + daotestutil "github.com/planetmint/planetmint-go/x/dao/testutil" ) func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + cfg := config.GetConfig() + storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) challengeStoreKey := storetypes.NewMemoryStoreKey(types.ChallengeKey) + mintRequestHashStoreKey := storetypes.NewMemoryStoreKey(types.MintRequestHashKey) + mintRequestAddressStoreKey := storetypes.NewMemoryStoreKey(types.MintRequestAddressKey) db := tmdb.NewMemDB() stateStore := store.NewCommitMultiStore(db) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) stateStore.MountStoreWithDB(challengeStoreKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(mintRequestHashStoreKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(mintRequestAddressStoreKey, storetypes.StoreTypeIAVL, db) require.NoError(t, stateStore.LoadLatestVersion()) @@ -39,18 +50,30 @@ func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { memStoreKey, "DaoParams", ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + ctrl := gomock.NewController(t) + bk := daotestutil.NewMockBankKeeper(ctrl) + + amt := sdk.NewCoins(sdk.NewCoin(cfg.TokenDenom, sdk.NewIntFromUint64(1000))) + beneficiaryAddr, _ := sdk.AccAddressFromBech32(sample.ConstBech32Addr) + + bk.EXPECT().MintCoins(ctx, types.ModuleName, amt).Return(nil).AnyTimes() + bk.EXPECT().SendCoinsFromModuleToAccount(ctx, types.ModuleName, beneficiaryAddr, amt).Return(nil).AnyTimes() + k := keeper.NewKeeper( cdc, storeKey, memStoreKey, challengeStoreKey, + mintRequestHashStoreKey, + mintRequestAddressStoreKey, paramsSubspace, - nil, + bk, nil, ) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - // Initialize params k.SetParams(ctx, types.DefaultParams()) diff --git a/testutil/network/network.go b/testutil/network/network.go index 4374c36b..46b72b2c 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -79,7 +79,7 @@ func DefaultConfig() network.Config { ChainID: chainID, NumValidators: 1, BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), + MinGasPrices: fmt.Sprintf("0.000003%s", sdk.DefaultBondDenom), AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), diff --git a/testutil/rest.go b/testutil/rest.go index ee26e8d5..03d56b4b 100644 --- a/testutil/rest.go +++ b/testutil/rest.go @@ -142,7 +142,7 @@ func PrepareTx(val *network.Validator, msg sdk.Msg, signer string) ([]byte, erro } func BroadcastTx(val *network.Validator, txBytes []byte) (*txtypes.BroadcastTxResponse, error) { - broadcastTxUrl := fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress) + broadcastTxURL := fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress) req := txtypes.BroadcastTxRequest{ TxBytes: txBytes, Mode: txtypes.BroadcastMode_BROADCAST_MODE_SYNC, @@ -152,7 +152,7 @@ func BroadcastTx(val *network.Validator, txBytes []byte) (*txtypes.BroadcastTxRe if err != nil { return nil, err } - broadCastTxResponse, err := PostRequest(broadcastTxUrl, "application/json", broadCastTxBody) + broadCastTxResponse, err := PostRequest(broadcastTxURL, "application/json", broadCastTxBody) if err != nil { return nil, err } diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 37792c78..5cdad5f8 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/planetmint/planetmint-go/config" + daotypes "github.com/planetmint/planetmint-go/x/dao/types" machinetypes "github.com/planetmint/planetmint-go/x/machine/types" "github.com/btcsuite/btcd/btcutil/hdkeychain" @@ -29,11 +30,14 @@ const Name = "machine" const Amount = "1000stake" // Fees is the amount of fees to use in tests -const Fees = "2stake" +const Fees = "1stake" // DefaultDerivationPath is the BIP44Prefix for PLMNT (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md) const DefaultDerivationPath = "m/44'/8680'/0'/0/0" +// ConstantBech32Addr for mocks +const ConstBech32Addr = "cosmos1fkmmfvjf39hurp2ls3whtv73266jhh2n49202g" + // KeyPair returns a sample private / public keypair func KeyPair(optional ...int) (string, string) { secret := "Don't tell anybody" @@ -136,3 +140,11 @@ func TrustAnchor(pubkey string) machinetypes.TrustAnchor { Pubkey: pubkey, } } + +func MintRequest(beneficiaryAddr string, amount uint64, txhash string) daotypes.MintRequest { + return daotypes.MintRequest{ + Beneficiary: beneficiaryAddr, + Amount: amount, + LiquidTxHash: txhash, + } +} diff --git a/util/determine_block_proposer.go b/util/determine_block_proposer.go new file mode 100644 index 00000000..bb79ec53 --- /dev/null +++ b/util/determine_block_proposer.go @@ -0,0 +1,61 @@ +package util + +import ( + "encoding/hex" + "encoding/json" + "io" + "os" + "path/filepath" + "strings" + + cometcfg "github.com/cometbft/cometbft/config" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/config" +) + +type Key struct { + Type string `json:"type"` + Value string `json:"value"` +} + +type KeyFile struct { + Address string `json:"address"` + PubKey Key `json:"pub_key"` + PrivKey Key `json:"priv_key"` +} + +func GetValidatorCometBFTIdentity(ctx sdk.Context) (string, bool) { + logger := ctx.Logger() + conf := config.GetConfig() + + cfg := cometcfg.DefaultConfig() + jsonFilePath := filepath.Join(conf.ConfigRootDir, cfg.PrivValidatorKey) + + jsonFile, err := os.Open(jsonFilePath) + if err != nil { + logger.Error("error while opening config", err) + return "", false + } + jsonBytes, err := io.ReadAll(jsonFile) + if err != nil { + logger.Error("error while reading file", err) + 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 { + validatorIdentity, validResult := GetValidatorCometBFTIdentity(ctx) + if !validResult { + return false + } + hexProposerAddress := hex.EncodeToString(proposerAddress) + return hexProposerAddress == validatorIdentity +} diff --git a/util/elementsd_connector.go b/util/elementsd_connector.go new file mode 100644 index 00000000..0c2f4829 --- /dev/null +++ b/util/elementsd_connector.go @@ -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(reissueTx string) (txid string, err error) { + conf := config.GetConfig() + cmdArgs := strings.Split(reissueTx, " ") + cmd := exec.Command("/usr/local/bin/elements-cli", "-rpcpassword="+conf.RPCPassword, + "-rpcuser="+conf.RPCUser, "-rpcport="+strconv.Itoa(conf.RPCPort), "-rpcconnect="+conf.RPCHost, + cmdArgs[0], cmdArgs[1], cmdArgs[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 +} diff --git a/util/issue_commands.go b/util/issue_commands.go new file mode 100644 index 00000000..f4c41fac --- /dev/null +++ b/util/issue_commands.go @@ -0,0 +1,59 @@ +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, txUnsigned string, blockHeight int64) error { + //get_last_PoPBlockHeight() // TODO: to be read form the upcoming PoP-store + logger := ctx.Logger() + // Construct the command + sendingValidatorAddress := config.GetConfig().ValidatorAddress + logger.Debug("REISSUE: create Proposal") + cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-proposal", + "--from", sendingValidatorAddress, "-y", + proposerAddress, txUnsigned, strconv.FormatInt(blockHeight, 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, blockHeight int64) error { + logger := ctx.Logger() + // Construct the command + sendingValidatorAddress := config.GetConfig().ValidatorAddress + logger.Debug("REISSUE: create Result") + cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-result", + "--from", sendingValidatorAddress, "-y", + proposerAddress, txID, strconv.FormatInt(blockHeight, 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 +} diff --git a/util/validate_signature.go b/util/validate_signature.go index 91f0ad8f..e72d8075 100644 --- a/util/validate_signature.go +++ b/util/validate_signature.go @@ -35,13 +35,12 @@ func ValidateSignatureByteMsg(message []byte, signature string, publicKey string isValid := pubKey.VerifySignature(message, signatureBytes) if !isValid { return false, errors.New("invalid signature") - } else { - return isValid, nil } + return isValid, nil } -func GetHexPubKey(ext_pub_key string) (string, error) { - xpubKey, err := hdkeychain.NewKeyFromString(ext_pub_key) +func GetHexPubKey(extPubKey string) (string, error) { + xpubKey, err := hdkeychain.NewKeyFromString(extPubKey) if err != nil { return "", err } @@ -49,6 +48,6 @@ func GetHexPubKey(ext_pub_key string) (string, error) { if err != nil { return "", err } - byte_key := pubKey.SerializeCompressed() - return hex.EncodeToString(byte_key), nil + byteKey := pubKey.SerializeCompressed() + return hex.EncodeToString(byteKey), nil } diff --git a/x/asset/client/cli/query.go b/x/asset/client/cli/query.go index 2636682c..bc33e352 100644 --- a/x/asset/client/cli/query.go +++ b/x/asset/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group asset queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/asset/keeper/asset.go b/x/asset/keeper/asset.go index 1ba7bb9d..4d92349a 100644 --- a/x/asset/keeper/asset.go +++ b/x/asset/keeper/asset.go @@ -14,12 +14,12 @@ func (k Keeper) StoreAsset(ctx sdk.Context, msg types.MsgNotarizeAsset) { func (k Keeper) GetAsset(ctx sdk.Context, cid string) (msg types.MsgNotarizeAsset, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey)) - creator_bytes := store.Get(GetAssetCIDBytes(cid)) - if creator_bytes == nil { + creatorBytes := store.Get(GetAssetCIDBytes(cid)) + if creatorBytes == nil { return msg, false } msg.Cid = cid - msg.Creator = string(creator_bytes) + msg.Creator = string(creatorBytes) return msg, true } @@ -29,11 +29,11 @@ func (k Keeper) GetCidsByAddress(ctx sdk.Context, address string) (cids []string reverseIterator := store.ReverseIterator(nil, nil) defer reverseIterator.Close() for ; reverseIterator.Valid(); reverseIterator.Next() { - address_bytes := reverseIterator.Value() - cid_bytes := reverseIterator.Key() + addressBytes := reverseIterator.Value() + cidBytes := reverseIterator.Key() - if string(address_bytes) == address { - cids = append(cids, string(cid_bytes)) + if string(addressBytes) == address { + cids = append(cids, string(cidBytes)) } } return cids, len(cids) > 0 diff --git a/x/asset/keeper/msg_server_test.go b/x/asset/keeper/msg_server_test.go index a50846ae..c002df19 100644 --- a/x/asset/keeper/msg_server_test.go +++ b/x/asset/keeper/msg_server_test.go @@ -29,11 +29,11 @@ func TestMsgServer(t *testing.T) { } func TestMsgServerNotarizeAsset(t *testing.T) { - ext_sk, _ := sample.ExtendedKeyPair(config.PlmntNetParams) - xskKey, _ := hdkeychain.NewKeyFromString(ext_sk) + extSk, _ := sample.ExtendedKeyPair(config.PlmntNetParams) + xskKey, _ := hdkeychain.NewKeyFromString(extSk) privKey, _ := xskKey.ECPrivKey() - byte_key := privKey.Serialize() - sk := hex.EncodeToString(byte_key) + byteKey := privKey.Serialize() + sk := hex.EncodeToString(byteKey) cid := sample.Asset() msg := types.NewMsgNotarizeAsset(sk, cid) diff --git a/x/asset/keeper/params.go b/x/asset/keeper/params.go index 71fefb2d..c42bce28 100644 --- a/x/asset/keeper/params.go +++ b/x/asset/keeper/params.go @@ -6,7 +6,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/asset/module.go b/x/asset/module.go index c3ab8236..b79e8070 100644 --- a/x/asset/module.go +++ b/x/asset/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -60,7 +61,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) diff --git a/x/asset/module_simulation.go b/x/asset/module_simulation.go index 106359e5..5bdc4084 100644 --- a/x/asset/module_simulation.go +++ b/x/asset/module_simulation.go @@ -74,7 +74,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp } // ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { +func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ simulation.NewWeightedProposalMsg( opWeightMsgNotarizeAsset, diff --git a/x/asset/simulation/notarize_asset.go b/x/asset/simulation/notarize_asset.go index 31891113..2583d1b9 100644 --- a/x/asset/simulation/notarize_asset.go +++ b/x/asset/simulation/notarize_asset.go @@ -11,9 +11,9 @@ import ( ) func SimulateMsgNotarizeAsset( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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) { diff --git a/x/asset/types/query.pb.go b/x/asset/types/query.pb.go index 1122ea75..a0ff9935 100644 --- a/x/asset/types/query.pb.go +++ b/x/asset/types/query.pb.go @@ -333,43 +333,42 @@ func init() { func init() { proto.RegisterFile("planetmintgo/asset/query.proto", fileDescriptor_5832a953a81817c0) } var fileDescriptor_5832a953a81817c0 = []byte{ - // 562 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0x93, 0x10, 0xd4, 0x63, 0x69, 0x8f, 0x0e, 0x91, 0x55, 0xdc, 0xca, 0x43, 0x1b, 0x21, - 0xf0, 0xe1, 0x74, 0xa1, 0x62, 0x4a, 0x40, 0x54, 0x15, 0xbf, 0x52, 0x33, 0xc1, 0x12, 0x5d, 0xe2, - 0x93, 0x39, 0x91, 0xdc, 0xb9, 0xbe, 0x0b, 0x22, 0x84, 0x2c, 0xfc, 0x05, 0x48, 0xf0, 0x77, 0xb0, - 0x30, 0xb3, 0x77, 0xac, 0x60, 0x61, 0x42, 0x28, 0xe1, 0x0f, 0x41, 0xbe, 0xbb, 0x28, 0x49, 0x9d, - 0x34, 0xed, 0xf6, 0x7c, 0xef, 0x7d, 0xef, 0xfb, 0xde, 0xf7, 0x9e, 0x0c, 0x9c, 0xb8, 0x83, 0x19, - 0x91, 0x5d, 0xca, 0x64, 0xc4, 0x11, 0x16, 0x82, 0x48, 0x74, 0xd2, 0x23, 0x49, 0xdf, 0x8b, 0x13, - 0x2e, 0x39, 0x84, 0xb3, 0x79, 0x4f, 0xe5, 0xed, 0xcd, 0x88, 0x47, 0x5c, 0xa5, 0x51, 0x1a, 0xe9, - 0x4a, 0x7b, 0x2b, 0xe2, 0x3c, 0xea, 0x10, 0x84, 0x63, 0x8a, 0x30, 0x63, 0x5c, 0x62, 0x49, 0x39, - 0x13, 0x26, 0x7b, 0xbb, 0xcd, 0x45, 0x97, 0x0b, 0xd4, 0xc2, 0x82, 0x68, 0x02, 0xf4, 0xce, 0x6f, - 0x11, 0x89, 0x7d, 0x14, 0xe3, 0x88, 0x32, 0x55, 0x6c, 0x6a, 0xb7, 0x17, 0x68, 0x8a, 0x71, 0x82, - 0xbb, 0xa6, 0x99, 0xbb, 0x09, 0xe0, 0x71, 0xda, 0xa2, 0xa1, 0x1e, 0x03, 0x72, 0xd2, 0x23, 0x42, - 0xba, 0x2f, 0xc0, 0xcd, 0xb9, 0x57, 0x11, 0x73, 0x26, 0x08, 0xbc, 0x0f, 0x4a, 0x1a, 0x5c, 0xb6, - 0x76, 0xac, 0xca, 0x8d, 0xaa, 0xed, 0x65, 0x47, 0xf2, 0x34, 0xa6, 0x5e, 0x3c, 0xfd, 0xb3, 0x9d, - 0x0b, 0x4c, 0xbd, 0xfb, 0xcd, 0x02, 0x5b, 0xaa, 0xe3, 0x21, 0x91, 0x0f, 0x8f, 0x1e, 0x89, 0x7a, - 0xbf, 0x16, 0x86, 0x09, 0x11, 0x13, 0x46, 0x58, 0x06, 0xd7, 0xb1, 0x7e, 0x51, 0xbd, 0xd7, 0x82, - 0xc9, 0x27, 0xbc, 0x03, 0x36, 0x3a, 0x9c, 0xbf, 0xed, 0xc5, 0x0d, 0x92, 0x50, 0x1e, 0x1e, 0xb1, - 0x67, 0x94, 0x95, 0xf3, 0x3b, 0x56, 0xa5, 0x18, 0x64, 0x13, 0xf0, 0x31, 0x00, 0x53, 0x13, 0xca, - 0x05, 0x25, 0x73, 0xd7, 0xd3, 0x8e, 0x79, 0xa9, 0x63, 0x9e, 0x5e, 0x89, 0x71, 0xcc, 0x6b, 0xe0, - 0x88, 0x18, 0x0d, 0xc1, 0x0c, 0xd2, 0xfd, 0x08, 0x6e, 0x2d, 0xd1, 0x6b, 0xbc, 0x80, 0xa0, 0xd8, - 0xa6, 0x61, 0xaa, 0xb6, 0x50, 0x59, 0x0b, 0x54, 0x0c, 0x0f, 0xe7, 0xc8, 0xf3, 0x8a, 0x7c, 0x6f, - 0x25, 0xb9, 0x6e, 0x38, 0xc7, 0xee, 0x4f, 0xd9, 0x9f, 0x73, 0x89, 0x13, 0xfa, 0x81, 0x84, 0xb5, - 0xd4, 0xdd, 0x89, 0x5d, 0xeb, 0xa0, 0xd0, 0xa6, 0xa1, 0xb1, 0x2a, 0x0d, 0xdd, 0xa7, 0xc0, 0x59, - 0x06, 0x31, 0x8a, 0x33, 0x98, 0x59, 0xd3, 0xf3, 0x73, 0xa6, 0x57, 0xbf, 0x17, 0xc1, 0x35, 0xd5, - 0x0e, 0x7e, 0xb5, 0x40, 0x49, 0xaf, 0x14, 0xee, 0x2e, 0x5a, 0x77, 0xf6, 0x7a, 0xec, 0xbd, 0x95, - 0x75, 0x5a, 0x91, 0x7b, 0xf0, 0xe9, 0xd7, 0xbf, 0x2f, 0xf9, 0x7d, 0xe8, 0xa3, 0x88, 0xca, 0x37, - 0xbd, 0x96, 0xd7, 0xe6, 0x5d, 0x34, 0xc5, 0xce, 0x84, 0x77, 0xcf, 0x5d, 0x2f, 0xfc, 0x69, 0x81, - 0xf5, 0xf3, 0xbb, 0x81, 0xf7, 0x96, 0x12, 0x2f, 0x39, 0x3b, 0xdb, 0xbf, 0x02, 0xc2, 0x88, 0x7e, - 0xa5, 0x44, 0xbf, 0x84, 0xc7, 0xab, 0x94, 0x46, 0x44, 0x36, 0xd3, 0xb3, 0x68, 0xb6, 0xfa, 0x4d, - 0xe3, 0x2b, 0x1a, 0x98, 0x60, 0x88, 0x06, 0x99, 0xdb, 0x1d, 0xc2, 0x1f, 0x16, 0xd8, 0xc8, 0xec, - 0x0f, 0x5e, 0xa8, 0x71, 0xe1, 0x79, 0xd8, 0xd5, 0xab, 0x40, 0xcc, 0x5c, 0x35, 0x35, 0xd7, 0x03, - 0x78, 0x70, 0x99, 0xb9, 0xd8, 0xa4, 0x47, 0x53, 0xbf, 0x0d, 0xda, 0x34, 0x1c, 0xd6, 0x9f, 0x9c, - 0x8e, 0x1c, 0xeb, 0x6c, 0xe4, 0x58, 0x7f, 0x47, 0x8e, 0xf5, 0x79, 0xec, 0xe4, 0xce, 0xc6, 0x4e, - 0xee, 0xf7, 0xd8, 0xc9, 0xbd, 0xf6, 0x2f, 0xb3, 0xe0, 0xf7, 0x86, 0x40, 0xf6, 0x63, 0x22, 0x5a, - 0x25, 0xf5, 0x83, 0xda, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x21, 0x7d, 0xdb, 0xca, 0x57, 0x05, - 0x00, 0x00, + // 557 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6e, 0xd3, 0x30, + 0x18, 0x6f, 0xda, 0x52, 0x34, 0x73, 0xd9, 0xcc, 0x0e, 0x55, 0x34, 0xb2, 0x2a, 0x87, 0xad, 0x02, + 0x16, 0xd3, 0xee, 0xc2, 0x75, 0x1d, 0x30, 0x4d, 0xe3, 0x4f, 0xc9, 0x91, 0x4b, 0xe5, 0x36, 0x96, + 0xb1, 0x68, 0xed, 0x2c, 0x76, 0x11, 0xa5, 0xf4, 0xc2, 0x13, 0x20, 0xf1, 0x1e, 0xf0, 0x12, 0x1c, + 0x76, 0x9c, 0xc4, 0x85, 0x13, 0x42, 0x2d, 0xaf, 0x81, 0x84, 0x62, 0xbb, 0x6a, 0x43, 0x5a, 0xa6, + 0xdd, 0xbe, 0xf8, 0xfb, 0x7e, 0x7f, 0xfc, 0xfb, 0xac, 0x00, 0x2f, 0xee, 0x63, 0x4e, 0xd4, 0x80, + 0x71, 0x45, 0x05, 0xc2, 0x52, 0x12, 0x85, 0xce, 0x87, 0x24, 0x19, 0x05, 0x71, 0x22, 0x94, 0x80, + 0x70, 0xb9, 0x1f, 0xe8, 0xbe, 0xbb, 0x4d, 0x05, 0x15, 0xba, 0x8d, 0xd2, 0xca, 0x4c, 0xba, 0x3b, + 0x54, 0x08, 0xda, 0x27, 0x08, 0xc7, 0x0c, 0x61, 0xce, 0x85, 0xc2, 0x8a, 0x09, 0x2e, 0x6d, 0xf7, + 0x6e, 0x4f, 0xc8, 0x81, 0x90, 0xa8, 0x8b, 0x25, 0x31, 0x02, 0xe8, 0x6d, 0xa3, 0x4b, 0x14, 0x6e, + 0xa0, 0x18, 0x53, 0xc6, 0xf5, 0xb0, 0x9d, 0xdd, 0x5d, 0xe1, 0x29, 0xc6, 0x09, 0x1e, 0x58, 0x32, + 0x7f, 0x1b, 0xc0, 0x97, 0x29, 0x45, 0x5b, 0x1f, 0x86, 0xe4, 0x7c, 0x48, 0xa4, 0xf2, 0x5f, 0x80, + 0xdb, 0x99, 0x53, 0x19, 0x0b, 0x2e, 0x09, 0x7c, 0x08, 0x2a, 0x06, 0x5c, 0x75, 0x6a, 0x4e, 0xfd, + 0x56, 0xd3, 0x0d, 0xf2, 0x57, 0x0a, 0x0c, 0xa6, 0x55, 0xbe, 0xf8, 0xb9, 0x5b, 0x08, 0xed, 0xbc, + 0xff, 0xc5, 0x01, 0x3b, 0x9a, 0xf1, 0x84, 0xa8, 0xe3, 0xd3, 0x47, 0xb2, 0x35, 0x3a, 0x8a, 0xa2, + 0x84, 0xc8, 0xb9, 0x22, 0xac, 0x82, 0x9b, 0xd8, 0x9c, 0x68, 0xee, 0x8d, 0x70, 0xfe, 0x09, 0xef, + 0x83, 0xad, 0xbe, 0x10, 0x6f, 0x86, 0x71, 0x9b, 0x24, 0x4c, 0x44, 0xa7, 0xfc, 0x19, 0xe3, 0xd5, + 0x62, 0xcd, 0xa9, 0x97, 0xc3, 0x7c, 0x03, 0x3e, 0x01, 0x60, 0x11, 0x42, 0xb5, 0xa4, 0x6d, 0xee, + 0x05, 0x26, 0xb1, 0x20, 0x4d, 0x2c, 0x30, 0x2b, 0xb1, 0x89, 0x05, 0x6d, 0x4c, 0x89, 0xf5, 0x10, + 0x2e, 0x21, 0xfd, 0x0f, 0xe0, 0xce, 0x1a, 0xbf, 0x36, 0x0b, 0x08, 0xca, 0x3d, 0x16, 0xa5, 0x6e, + 0x4b, 0xf5, 0x8d, 0x50, 0xd7, 0xf0, 0x24, 0x23, 0x5e, 0xd4, 0xe2, 0xfb, 0x57, 0x8a, 0x1b, 0xc2, + 0x8c, 0x7a, 0x63, 0xa1, 0xfe, 0x5c, 0x28, 0x9c, 0xb0, 0xf7, 0x24, 0x3a, 0x4a, 0xd3, 0x9d, 0xc7, + 0xb5, 0x09, 0x4a, 0x3d, 0x16, 0xd9, 0xa8, 0xd2, 0xd2, 0x7f, 0x0a, 0xbc, 0x75, 0x10, 0xeb, 0x38, + 0x87, 0x59, 0x0e, 0xbd, 0x98, 0x09, 0xbd, 0xf9, 0xa7, 0x04, 0x6e, 0x68, 0x3a, 0x38, 0x06, 0x15, + 0xb3, 0x51, 0xb8, 0xb7, 0x6a, 0xdb, 0xf9, 0xc7, 0xe3, 0xee, 0x5f, 0x39, 0x67, 0x0c, 0xf9, 0xb5, + 0x8f, 0xdf, 0x7f, 0x7f, 0x2e, 0xba, 0xb0, 0x8a, 0x16, 0x80, 0xcc, 0x1b, 0x85, 0xdf, 0x1c, 0xb0, + 0xf9, 0xef, 0x06, 0xe0, 0x83, 0xb5, 0xfc, 0x6b, 0x1e, 0x97, 0xdb, 0xb8, 0x06, 0xc2, 0x7a, 0x3b, + 0xd3, 0xde, 0x1e, 0xc3, 0xe3, 0xbc, 0x37, 0x4a, 0x54, 0x27, 0x5d, 0x77, 0xa7, 0x3b, 0xea, 0xd8, + 0xbc, 0xd0, 0xd8, 0x16, 0x13, 0x34, 0xce, 0xbd, 0xc9, 0x09, 0xfc, 0xea, 0x80, 0xad, 0xdc, 0x5e, + 0xe0, 0x7f, 0x5d, 0xad, 0x5c, 0xbb, 0xdb, 0xbc, 0x0e, 0xc4, 0xde, 0xe4, 0x50, 0xdf, 0xe4, 0x00, + 0xde, 0x5b, 0x7d, 0x13, 0x3e, 0x47, 0x75, 0xcc, 0xd9, 0xb8, 0xc7, 0xa2, 0x49, 0xeb, 0xec, 0x62, + 0xea, 0x39, 0x97, 0x53, 0xcf, 0xf9, 0x35, 0xf5, 0x9c, 0x4f, 0x33, 0xaf, 0x70, 0x39, 0xf3, 0x0a, + 0x3f, 0x66, 0x5e, 0xe1, 0x55, 0x83, 0x32, 0xf5, 0x7a, 0xd8, 0x0d, 0x7a, 0x62, 0xb0, 0x4c, 0xb8, + 0x28, 0x0f, 0xa8, 0x40, 0xef, 0xac, 0x80, 0x1a, 0xc5, 0x44, 0x76, 0x2b, 0xfa, 0x57, 0x73, 0xf8, + 0x37, 0x00, 0x00, 0xff, 0xff, 0x18, 0x24, 0x55, 0x75, 0x21, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/asset/types/query.pb.gw.go b/x/asset/types/query.pb.gw.go index 46968d5a..8a462fb5 100644 --- a/x/asset/types/query.pb.gw.go +++ b/x/asset/types/query.pb.gw.go @@ -379,11 +379,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"github.com", "planetmint", "planetmint-go", "asset", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "asset", "params"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetCIDsByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"planetmint", "planetmint-go", "asset", "get_cids_by_address", "address", "lookupPeriodInMin"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetCIDsByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "asset", "get_cids_by_address", "address", "lookupPeriodInMin"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetNotarizedAsset_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", "asset", "get_notarized_asset", "cid"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetNotarizedAsset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "asset", "get_notarized_asset", "cid"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/x/dao/abci.go b/x/dao/abci.go index 223fd0a4..002c850c 100644 --- a/x/dao/abci.go +++ b/x/dao/abci.go @@ -2,69 +2,40 @@ package dao import ( "encoding/hex" - "encoding/json" - "fmt" - "io" - "os" - "path/filepath" - "strings" "github.com/planetmint/planetmint-go/config" + "github.com/planetmint/planetmint-go/util" "github.com/planetmint/planetmint-go/x/dao/keeper" abci "github.com/cometbft/cometbft/abci/types" - cometcfg "github.com/cometbft/cometbft/config" sdk "github.com/cosmos/cosmos-sdk/types" ) -type Key struct { - Type string `json:"type"` - Value string `json:"value"` -} - -type KeyFile struct { - Address string `json:"address"` - PubKey Key `json:"pub_key"` - PrivKey Key `json:"priv_key"` -} - -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, _ keeper.Keeper) { + logger := ctx.Logger() proposerAddress := req.Header.GetProposerAddress() // Check if node is block proposer - if isValidatorBlockProposer(ctx, proposerAddress) { + + if isPoPHeight(req.Header.GetHeight()) && util.IsValidatorBlockProposer(ctx, proposerAddress) { + blockHeight := req.Header.GetHeight() // TODO: implement PoP trigger - fmt.Println("TODO: implement PoP trigger") + logger.Info("TODO: implement PoP trigger") + hexProposerAddress := hex.EncodeToString(proposerAddress) + conf := config.GetConfig() + txUnsigned := GetReissuanceCommand(conf.ReissuanceAsset, blockHeight) + err := util.InitRDDLReissuanceProcess(ctx, hexProposerAddress, txUnsigned, blockHeight) + if err != nil { + logger.Error("error while initializing RDDL issuance", err) + } } } -func isValidatorBlockProposer(ctx sdk.Context, proposerAddress []byte) 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) - } - jsonBytes, err := io.ReadAll(jsonFile) - if err != nil { - logger.Error("error while reading file", err) - } - - var keyFile KeyFile - err = json.Unmarshal(jsonBytes, &keyFile) - if err != nil { - logger.Error("error while unmarshaling key file", err) - } - - return hexProposerAddress == strings.ToLower(keyFile.Address) +func isPoPHeight(height int64) bool { + cfg := config.GetConfig() + return height%int64(cfg.PoPEpochs) == 0 } -func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, k keeper.Keeper) { +func EndBlocker(ctx sdk.Context, _ abci.RequestEndBlock, k keeper.Keeper) { k.DistributeCollectedFees(ctx) } diff --git a/x/dao/client/cli/query.go b/x/dao/client/cli/query.go index d19c29d2..c5bf6c3b 100644 --- a/x/dao/client/cli/query.go +++ b/x/dao/client/cli/query.go @@ -11,7 +11,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group dao queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, @@ -22,6 +22,14 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdGetMintRequestsByHash()) + + cmd.AddCommand(CmdMintRequestsByAddress()) + + cmd.AddCommand(CmdGetReissuance()) + + cmd.AddCommand(CmdGetReissuances()) + // this line is used by starport scaffolding # 1 return cmd diff --git a/x/dao/client/cli/query_get_mint_requests_by_hash.go b/x/dao/client/cli/query_get_mint_requests_by_hash.go new file mode 100644 index 00000000..2d908694 --- /dev/null +++ b/x/dao/client/cli/query_get_mint_requests_by_hash.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/dao/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdGetMintRequestsByHash() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-mint-requests-by-hash [hash]", + Short: "Query get-mint-requests-by-hash", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqHash := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetMintRequestsByHashRequest{ + + Hash: reqHash, + } + + res, err := queryClient.GetMintRequestsByHash(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dao/client/cli/query_get_reissuance.go b/x/dao/client/cli/query_get_reissuance.go new file mode 100644 index 00000000..7e18ebdb --- /dev/null +++ b/x/dao/client/cli/query_get_reissuance.go @@ -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.ToInt64E(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 +} diff --git a/x/dao/client/cli/query_get_reissuances.go b/x/dao/client/cli/query_get_reissuances.go new file mode 100644 index 00000000..87a0cf27 --- /dev/null +++ b/x/dao/client/cli/query_get_reissuances.go @@ -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 +} diff --git a/x/dao/client/cli/query_mint_requests_by_address.go b/x/dao/client/cli/query_mint_requests_by_address.go new file mode 100644 index 00000000..bbc2ad6c --- /dev/null +++ b/x/dao/client/cli/query_mint_requests_by_address.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/dao/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdMintRequestsByAddress() *cobra.Command { + cmd := &cobra.Command{ + Use: "mint-requests-by-address [address]", + Short: "Query mint-requests-by-address", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqAddress := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryMintRequestsByAddressRequest{ + + Address: reqAddress, + } + + res, err := queryClient.MintRequestsByAddress(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dao/client/cli/tx.go b/x/dao/client/cli/tx.go index a35ad7be..4e238c30 100644 --- a/x/dao/client/cli/tx.go +++ b/x/dao/client/cli/tx.go @@ -26,6 +26,9 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand(CmdReportPopResult()) + cmd.AddCommand(CmdReissueRDDLProposal()) + cmd.AddCommand(CmdMintToken()) + // this line is used by starport scaffolding # 1 return cmd diff --git a/x/dao/client/cli/tx_mint_token.go b/x/dao/client/cli/tx_mint_token.go new file mode 100644 index 00000000..27c2c431 --- /dev/null +++ b/x/dao/client/cli/tx_mint_token.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/dao/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdMintToken() *cobra.Command { + cmd := &cobra.Command{ + Use: "mint-token [mint-request]", + Short: "Broadcast message mint-token", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argMintRequest := new(types.MintRequest) + err = json.Unmarshal([]byte(args[0]), argMintRequest) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgMintToken( + clientCtx.GetFromAddress().String(), + argMintRequest, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dao/client/cli/tx_reissue_rddl_proposal.go b/x/dao/client/cli/tx_reissue_rddl_proposal.go new file mode 100644 index 00000000..b2860a55 --- /dev/null +++ b/x/dao/client/cli/tx_reissue_rddl_proposal.go @@ -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.ToInt64E(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 +} diff --git a/x/dao/client/cli/tx_reissue_rddl_result.go b/x/dao/client/cli/tx_reissue_rddl_result.go new file mode 100644 index 00000000..ece931ef --- /dev/null +++ b/x/dao/client/cli/tx_reissue_rddl_result.go @@ -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.ToInt64E(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 +} diff --git a/x/dao/keeper/keeper.go b/x/dao/keeper/keeper.go index e62255ed..0866633a 100644 --- a/x/dao/keeper/keeper.go +++ b/x/dao/keeper/keeper.go @@ -18,11 +18,13 @@ import ( type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - challengeKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + challengeKey storetypes.StoreKey + mintRequestHashKey storetypes.StoreKey + mintRequestAddressKey storetypes.StoreKey + paramstore paramtypes.Subspace bankKeeper types.BankKeeper accountKeeper types.AccountKeeper @@ -34,6 +36,8 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, challengeKey storetypes.StoreKey, + mintRequestHashKey storetypes.StoreKey, + mintRequestAddressKey storetypes.StoreKey, ps paramtypes.Subspace, bankKeeper types.BankKeeper, @@ -45,11 +49,13 @@ func NewKeeper( } return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - challengeKey: challengeKey, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + challengeKey: challengeKey, + mintRequestHashKey: mintRequestHashKey, + mintRequestAddressKey: mintRequestAddressKey, + paramstore: ps, bankKeeper: bankKeeper, accountKeeper: accountKeeper, diff --git a/x/dao/keeper/mint_request.go b/x/dao/keeper/mint_request.go new file mode 100644 index 00000000..d876ca4b --- /dev/null +++ b/x/dao/keeper/mint_request.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "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) StoreMintRequest(ctx sdk.Context, mintRequest types.MintRequest) { + hashStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestHashKey)) + hashAppendValue := k.cdc.MustMarshal(&mintRequest) + hashStore.Set(getMintRequestKeyBytes(mintRequest.LiquidTxHash), hashAppendValue) + + addressStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestAddressKey)) + mintRequests, _ := k.GetMintRequestsByAddress(ctx, mintRequest.Beneficiary) + mintRequests.Requests = append(mintRequests.Requests, &mintRequest) + addressAppendValue := k.cdc.MustMarshal(&mintRequests) + addressStore.Set(getMintRequestKeyBytes(mintRequest.Beneficiary), addressAppendValue) + +} + +func (k Keeper) GetMintRequestsByAddress(ctx sdk.Context, address string) (val types.MintRequests, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestAddressKey)) + mintRequests := store.Get(getMintRequestKeyBytes(address)) + if mintRequests == nil { + return val, false + } + k.cdc.MustUnmarshal(mintRequests, &val) + return val, true +} + +func (k Keeper) GetMintRequestByHash(ctx sdk.Context, hash string) (val types.MintRequest, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestHashKey)) + mintRequest := store.Get(getMintRequestKeyBytes(hash)) + if mintRequest == nil { + return val, false + } + k.cdc.MustUnmarshal(mintRequest, &val) + return val, true +} + +func getMintRequestKeyBytes(key string) []byte { + bz := []byte(key) + return bz +} diff --git a/x/dao/keeper/mint_request_test.go b/x/dao/keeper/mint_request_test.go new file mode 100644 index 00000000..c38ef845 --- /dev/null +++ b/x/dao/keeper/mint_request_test.go @@ -0,0 +1,51 @@ +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 createNMintRequests(keeper *keeper.Keeper, ctx sdk.Context, beneficiary string, n int) []types.MintRequest { + items := make([]types.MintRequest, n) + for i := range items { + items[i].Amount = uint64(i) + items[i].LiquidTxHash = fmt.Sprintf("hash%v", i) + items[i].Beneficiary = beneficiary + keeper.StoreMintRequest(ctx, items[i]) + } + return items +} + +func TestGetMintRequestByHash(t *testing.T) { + keeper, ctx := keepertest.DaoKeeper(t) + items := createNMintRequests(keeper, ctx, "beneficiary", 10) + for _, item := range items { + mintRequest, found := keeper.GetMintRequestByHash(ctx, item.LiquidTxHash) + assert.True(t, found) + assert.Equal(t, item, mintRequest) + } +} + +func TestGetMintRequestByAddress(t *testing.T) { + keeper, ctx := keepertest.DaoKeeper(t) + items := createNMintRequests(keeper, ctx, "beneficiary", 10) + mintRequests, found := keeper.GetMintRequestsByAddress(ctx, "beneficiary") + assert.True(t, found) + assert.Equal(t, items[0], *mintRequests.Requests[0]) + assert.Equal(t, items[1], *mintRequests.Requests[1]) + assert.Equal(t, items[2], *mintRequests.Requests[2]) + assert.Equal(t, items[3], *mintRequests.Requests[3]) + assert.Equal(t, items[4], *mintRequests.Requests[4]) + assert.Equal(t, items[5], *mintRequests.Requests[5]) + assert.Equal(t, items[6], *mintRequests.Requests[6]) + assert.Equal(t, items[7], *mintRequests.Requests[7]) + assert.Equal(t, items[8], *mintRequests.Requests[8]) + assert.Equal(t, items[9], *mintRequests.Requests[9]) +} diff --git a/x/dao/keeper/msg_server_mint_token.go b/x/dao/keeper/msg_server_mint_token.go new file mode 100644 index 00000000..3fd54ee6 --- /dev/null +++ b/x/dao/keeper/msg_server_mint_token.go @@ -0,0 +1,43 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/config" + "github.com/planetmint/planetmint-go/x/dao/types" +) + +func (k msgServer) MintToken(goCtx context.Context, msg *types.MsgMintToken) (*types.MsgMintTokenResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + cfg := config.GetConfig() + + _, found := k.GetMintRequestByHash(ctx, msg.GetMintRequest().GetLiquidTxHash()) + if found { + return nil, errorsmod.Wrapf(types.ErrAlreadyMinted, "liquid tx hash %s has already been minted", msg.GetMintRequest().GetLiquidTxHash()) + } + + amt := msg.GetMintRequest().GetAmount() + beneficiary := msg.GetMintRequest().GetBeneficiary() + beneficiaryAddr, err := sdk.AccAddressFromBech32(beneficiary) + if err != nil { + return nil, errorsmod.Wrapf(types.ErrInvalidAddress, "for provided address %s", beneficiary) + } + + coin := sdk.NewCoin(cfg.TokenDenom, sdk.NewIntFromUint64(amt)) + coins := sdk.NewCoins(coin) + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins) + if err != nil { + return nil, errorsmod.Wrapf(types.ErrMintFailed, "error while minting %v token for address %s", amt, beneficiary) + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, beneficiaryAddr, coins) + if err != nil { + return nil, errorsmod.Wrapf(types.ErrTransferFailed, "error while transferring %v token to address %s", amt, beneficiary) + } + + k.StoreMintRequest(ctx, *msg.MintRequest) + + return &types.MsgMintTokenResponse{}, nil +} diff --git a/x/dao/keeper/msg_server_reissue_rddl_proposal.go b/x/dao/keeper/msg_server_reissue_rddl_proposal.go new file mode 100644 index 00000000..2e6aaf0c --- /dev/null +++ b/x/dao/keeper/msg_server_reissue_rddl_proposal.go @@ -0,0 +1,38 @@ +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) + logger := ctx.Logger() + + validatorIdentity, validResult := util.GetValidatorCometBFTIdentity(ctx) + if validResult && msg.Proposer == validatorIdentity { + // 1. sign tx + // 2. broadcast tx + logger.Debug("REISSUE: Asset") + 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 + } else { + logger.Debug("REISSUE: Asset reissuance failure") + } + //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 +} diff --git a/x/dao/keeper/msg_server_reissue_rddl_result.go b/x/dao/keeper/msg_server_reissue_rddl_result.go new file mode 100644 index 00000000..3b51c658 --- /dev/null +++ b/x/dao/keeper/msg_server_reissue_rddl_result.go @@ -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.FormatInt(msg.GetBlockHeight(), 10)) + } + if reissuance.GetBlockHeight() != msg.GetBlockHeight() { + return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10)) + } + if reissuance.GetProposer() != msg.GetProposer() { + return nil, errorsmod.Wrapf(types.ErrInvalidProposer, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10)) + } + if reissuance.GetTxId() != "" { + return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10)) + } + reissuance.TxId = msg.GetTxId() + k.StoreReissuance(ctx, reissuance) + + return &types.MsgReissueRDDLResultResponse{}, nil +} diff --git a/x/dao/keeper/msg_server_report_pop_result.go b/x/dao/keeper/msg_server_report_pop_result.go index d683c760..f0c6fd82 100644 --- a/x/dao/keeper/msg_server_report_pop_result.go +++ b/x/dao/keeper/msg_server_report_pop_result.go @@ -6,8 +6,6 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/hypebeast/go-osc/osc" - "github.com/planetmint/planetmint-go/config" "github.com/planetmint/planetmint-go/util" "github.com/planetmint/planetmint-go/x/dao/types" ) @@ -33,20 +31,20 @@ func (k msgServer) ReportPopResult(goCtx context.Context, msg *types.MsgReportPo } // TODO: ensuer issuePoPrewards is only called once per PoP on all validators -func (k msgServer) issuePoPRewards(challenge types.Challenge) error { - cfg := config.GetConfig() - client := osc.NewClient(cfg.WatchmenEndpoint, 1234) +func (k msgServer) issuePoPRewards(_ types.Challenge) (err error) { + //cfg := config.GetConfig() + //client := osc.NewClient(cfg.WatchmenEndpoint, 1234) // TODO: finalize message and endpoint - msg := osc.NewMessage("/rddl/token") - msg.Append(challenge.Challenger) - msg.Append(challenge.Challengee) - err := client.Send(msg) + //msg := osc.NewMessage("/rddl/token") + //msg.Append(challenge.Challenger) + //msg.Append(challenge.Challengee) + //err := client.Send(msg) return err } // TODO: implement check if node is responsible for triggering issuance -func isInitiator(challenge types.Challenge) bool { +func isInitiator(_ types.Challenge) bool { return false } diff --git a/x/dao/keeper/msg_server_test.go b/x/dao/keeper/msg_server_test.go index d9bcb597..f155ad67 100644 --- a/x/dao/keeper/msg_server_test.go +++ b/x/dao/keeper/msg_server_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "context" + "fmt" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -92,3 +93,34 @@ func TestMsgServerReportPoPResult(t *testing.T) { } } } +func TestMsgServerMintToken(t *testing.T) { + minter := sample.AccAddress() + beneficiary := sample.ConstBech32Addr + mintRequest := sample.MintRequest(beneficiary, 1000, "hash") + + msg := types.NewMsgMintToken(minter, &mintRequest) + msgServer, ctx := setupMsgServer(t) + res, err := msgServer.MintToken(ctx, msg) + if assert.NoError(t, err) { + assert.Equal(t, &types.MsgMintTokenResponse{}, res) + } + + // should throw error because hash has already been used + _, err = msgServer.MintToken(ctx, msg) + if assert.Error(t, err) { + assert.EqualError(t, err, fmt.Sprintf("liquid tx hash %s has already been minted: already minted", "hash")) + } +} + +func TestMsgServerMintTokenInvalidAddress(t *testing.T) { + minter := sample.AccAddress() + beneficiary := "invalid address" + mintRequest := sample.MintRequest(beneficiary, 1000, "hash") + + msg := types.NewMsgMintToken(minter, &mintRequest) + msgServer, ctx := setupMsgServer(t) + _, err := msgServer.MintToken(ctx, msg) + if assert.Error(t, err) { + assert.EqualError(t, err, fmt.Sprintf("for provided address %s: invalid address", beneficiary)) + } +} diff --git a/x/dao/keeper/params.go b/x/dao/keeper/params.go index 9bb3d4e7..ddb08cf4 100644 --- a/x/dao/keeper/params.go +++ b/x/dao/keeper/params.go @@ -6,7 +6,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/dao/keeper/query_get_mint_requests_by_hash.go b/x/dao/keeper/query_get_mint_requests_by_hash.go new file mode 100644 index 00000000..9e1c718f --- /dev/null +++ b/x/dao/keeper/query_get_mint_requests_by_hash.go @@ -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) GetMintRequestsByHash(goCtx context.Context, req *types.QueryGetMintRequestsByHashRequest) (*types.QueryGetMintRequestsByHashResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + mintRequest, found := k.GetMintRequestByHash(ctx, req.GetHash()) + if !found { + return nil, status.Error(codes.NotFound, "mint request not found") + } + + return &types.QueryGetMintRequestsByHashResponse{MintRequest: &mintRequest}, nil +} diff --git a/x/dao/keeper/query_get_mint_requests_by_hash_test.go b/x/dao/keeper/query_get_mint_requests_by_hash_test.go new file mode 100644 index 00000000..79ad4d06 --- /dev/null +++ b/x/dao/keeper/query_get_mint_requests_by_hash_test.go @@ -0,0 +1,46 @@ +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/testutil/sample" + "github.com/planetmint/planetmint-go/x/dao/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestQueryGetMintRequestByHash(t *testing.T) { + keeper, ctx := keepertest.DaoKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + items := createNMintRequests(keeper, ctx, sample.ConstBech32Addr, 1) + + for _, tc := range []struct { + desc string + request *types.QueryGetMintRequestsByHashRequest + response *types.QueryGetMintRequestsByHashResponse + err error + }{ + { + desc: "mint request found", + request: &types.QueryGetMintRequestsByHashRequest{Hash: "hash0"}, + response: &types.QueryGetMintRequestsByHashResponse{MintRequest: &items[0]}, + }, + { + desc: "mint request not found", + request: &types.QueryGetMintRequestsByHashRequest{Hash: "invalid hash"}, + err: status.Error(codes.NotFound, "mint request not found"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + res, err := keeper.GetMintRequestsByHash(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.Equal(t, tc.response, res) + } + }) + } +} diff --git a/x/dao/keeper/query_get_reissuance.go b/x/dao/keeper/query_get_reissuance.go new file mode 100644 index 00000000..cb16971e --- /dev/null +++ b/x/dao/keeper/query_get_reissuance.go @@ -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 +} diff --git a/x/dao/keeper/query_get_reissuance_test.go b/x/dao/keeper/query_get_reissuance_test.go new file mode 100644 index 00000000..a379b6d0 --- /dev/null +++ b/x/dao/keeper/query_get_reissuance_test.go @@ -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) + } + }) + } +} diff --git a/x/dao/keeper/query_get_reissuances.go b/x/dao/keeper/query_get_reissuances.go new file mode 100644 index 00000000..7181d78e --- /dev/null +++ b/x/dao/keeper/query_get_reissuances.go @@ -0,0 +1,28 @@ +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 + } + return &types.QueryGetReissuancesResponse{}, nil + +} diff --git a/x/dao/keeper/query_mint_requests_by_address.go b/x/dao/keeper/query_mint_requests_by_address.go new file mode 100644 index 00000000..5c1b294f --- /dev/null +++ b/x/dao/keeper/query_mint_requests_by_address.go @@ -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) MintRequestsByAddress(goCtx context.Context, req *types.QueryMintRequestsByAddressRequest) (*types.QueryMintRequestsByAddressResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + mintRequests, found := k.GetMintRequestsByAddress(ctx, req.GetAddress()) + if !found { + return nil, status.Error(codes.NotFound, "mint requests not found") + } + + return &types.QueryMintRequestsByAddressResponse{MintRequests: &mintRequests}, nil +} diff --git a/x/dao/keeper/query_mint_requests_by_address_test.go b/x/dao/keeper/query_mint_requests_by_address_test.go new file mode 100644 index 00000000..1ccea6c8 --- /dev/null +++ b/x/dao/keeper/query_mint_requests_by_address_test.go @@ -0,0 +1,51 @@ +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/testutil/sample" + "github.com/planetmint/planetmint-go/x/dao/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestQueryMintRequestByAddress(t *testing.T) { + keeper, ctx := keepertest.DaoKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + items := createNMintRequests(keeper, ctx, sample.ConstBech32Addr, 10) + + var mintRequests types.MintRequests + for i := range items { + mintRequests.Requests = append(mintRequests.Requests, &items[i]) + } + + for _, tc := range []struct { + desc string + request *types.QueryMintRequestsByAddressRequest + response *types.QueryMintRequestsByAddressResponse + err error + }{ + { + desc: "mint requests found", + request: &types.QueryMintRequestsByAddressRequest{Address: sample.ConstBech32Addr}, + response: &types.QueryMintRequestsByAddressResponse{MintRequests: &mintRequests}, + }, + { + desc: "mint requests not found", + request: &types.QueryMintRequestsByAddressRequest{Address: "invalid hash"}, + err: status.Error(codes.NotFound, "mint requests not found"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + res, err := keeper.MintRequestsByAddress(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.Equal(t, tc.response, res) + } + }) + } +} diff --git a/x/dao/keeper/reissuance.go b/x/dao/keeper/reissuance.go new file mode 100644 index 00000000..a50d44f0 --- /dev/null +++ b/x/dao/keeper/reissuance.go @@ -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 int64) (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, _ []byte, _ uint64, _ uint64, _ 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 reissuanceOrg types.Reissuance + k.cdc.MustUnmarshal(reissuance, &reissuanceOrg) + reissuances = append(reissuances, reissuanceOrg) + } + return reissuances +} + +func getReissuanceBytes(height int64) []byte { + // Adding 1 because 0 will be interpreted as nil, which is an invalid key + return big.NewInt(height + 1).Bytes() +} diff --git a/x/dao/keeper/reissuance_test.go b/x/dao/keeper/reissuance_test.go new file mode 100644 index 00000000..b946d9cc --- /dev/null +++ b/x/dao/keeper/reissuance_test.go @@ -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 = int64(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) + } +} diff --git a/x/dao/module.go b/x/dao/module.go index e6140f97..40f18c46 100644 --- a/x/dao/module.go +++ b/x/dao/module.go @@ -62,7 +62,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) diff --git a/x/dao/module_simulation.go b/x/dao/module_simulation.go index b77ab92b..556157e8 100644 --- a/x/dao/module_simulation.go +++ b/x/dao/module_simulation.go @@ -27,6 +27,13 @@ const ( opWeightMsgReportPopResult = "op_weight_msg_report_pop_result" // TODO: Determine the simulation weight value defaultWeightMsgReportPopResult int = 100 + opWeightMsgReissueRDDLProposal = "op_weight_msg_reissue_rddl_proposal" + // TODO: Determine the simulation weight value + 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 ) @@ -67,13 +74,35 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp daosimulation.SimulateMsgReportPopResult(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgReissueRDDLProposal int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgReissueRDDLProposal, &weightMsgReissueRDDLProposal, nil, + func(_ *rand.Rand) { + weightMsgReissueRDDLProposal = defaultWeightMsgReissueRDDLProposal + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + 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 return operations } // ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { +func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ simulation.NewWeightedProposalMsg( opWeightMsgReportPopResult, @@ -83,6 +112,22 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgReissueRDDLProposal, + defaultWeightMsgReissueRDDLProposal, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + 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 + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/dao/simulation/mint_token.go b/x/dao/simulation/mint_token.go new file mode 100644 index 00000000..c3ae02eb --- /dev/null +++ b/x/dao/simulation/mint_token.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/dao/keeper" + "github.com/planetmint/planetmint-go/x/dao/types" +) + +func SimulateMsgMintToken( + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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.MsgMintToken{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the MintToken simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "MintToken simulation not implemented"), nil, nil + } +} diff --git a/x/dao/simulation/reissue_rddl_proposal.go b/x/dao/simulation/reissue_rddl_proposal.go new file mode 100644 index 00000000..ccb0bc38 --- /dev/null +++ b/x/dao/simulation/reissue_rddl_proposal.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/dao/keeper" + "github.com/planetmint/planetmint-go/x/dao/types" +) + +func SimulateMsgReissueRDDLProposal( + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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 + } +} diff --git a/x/dao/simulation/reissue_rddl_result.go b/x/dao/simulation/reissue_rddl_result.go new file mode 100644 index 00000000..cfb37dfd --- /dev/null +++ b/x/dao/simulation/reissue_rddl_result.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/dao/keeper" + "github.com/planetmint/planetmint-go/x/dao/types" +) + +func SimulateMsgReissueRDDLResult( + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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 + } +} diff --git a/x/dao/simulation/report_pop_result.go b/x/dao/simulation/report_pop_result.go index 1824e504..995efa2d 100644 --- a/x/dao/simulation/report_pop_result.go +++ b/x/dao/simulation/report_pop_result.go @@ -11,9 +11,9 @@ import ( ) func SimulateMsgReportPopResult( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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) { diff --git a/x/dao/testutil/expected_keepers_mocks.go b/x/dao/testutil/expected_keepers_mocks.go new file mode 100644 index 00000000..ab198a48 --- /dev/null +++ b/x/dao/testutil/expected_keepers_mocks.go @@ -0,0 +1,155 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/dao/types/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// GetModuleAddress mocks base method. +func (m *MockAccountKeeper) GetModuleAddress(module string) types.AccAddress { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAddress", module) + ret0, _ := ret[0].(types.AccAddress) + return ret0 +} + +// GetModuleAddress indicates an expected call of GetModuleAddress. +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(module interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), module) +} + +// IterateAccounts mocks base method. +func (m *MockAccountKeeper) IterateAccounts(arg0 types.Context, arg1 func(types0.AccountI) bool) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IterateAccounts", arg0, arg1) +} + +// IterateAccounts indicates an expected call of IterateAccounts. +func (mr *MockAccountKeeperMockRecorder) IterateAccounts(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).IterateAccounts), arg0, arg1) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// BlockedAddr mocks base method. +func (m *MockBankKeeper) BlockedAddr(addr types.AccAddress) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlockedAddr", addr) + ret0, _ := ret[0].(bool) + return ret0 +} + +// BlockedAddr indicates an expected call of BlockedAddr. +func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockedAddr", reflect.TypeOf((*MockBankKeeper)(nil).BlockedAddr), addr) +} + +// MintCoins mocks base method. +func (m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// MintCoins indicates an expected call of MintCoins. +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) +} + +// SendCoinsFromModuleToAccount mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) +} + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +} diff --git a/x/dao/types/codec.go b/x/dao/types/codec.go index 2ff0c490..6c8a4c57 100644 --- a/x/dao/types/codec.go +++ b/x/dao/types/codec.go @@ -9,12 +9,20 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgReportPopResult{}, "dao/ReportPopResult", nil) + 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), &MsgReportPopResult{}, + &MsgReissueRDDLProposal{}, + &MsgMintToken{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgReissueRDDLResult{}, ) // this line is used by starport scaffolding # 3 diff --git a/x/dao/types/errors.go b/x/dao/types/errors.go index a1201434..6b5760d9 100644 --- a/x/dao/types/errors.go +++ b/x/dao/types/errors.go @@ -8,6 +8,17 @@ import ( // x/dao module sentinel errors var ( - ErrInvalidChallenge = errorsmod.Register(ModuleName, 2, "invalid challenge") - ErrFailedPoPRewardsIssuance = errorsmod.Register(ModuleName, 3, "PoP rewards issuance failed") + ErrInvalidMintAddress = errorsmod.Register(ModuleName, 2, "invalid mint address") + ErrMintFailed = errorsmod.Register(ModuleName, 3, "minting failed") + 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") + ErrInvalidChallenge = errorsmod.Register(ModuleName, 13, "invalid challenge") + ErrFailedPoPRewardsIssuance = errorsmod.Register(ModuleName, 14, "PoP rewards issuance failed") ) diff --git a/x/dao/types/keys.go b/x/dao/types/keys.go index 00989dd3..55d6706c 100644 --- a/x/dao/types/keys.go +++ b/x/dao/types/keys.go @@ -14,6 +14,12 @@ const ( MemStoreKey = "mem_dao" ChallengeKey = "Dao/Challenge" + + MintRequestAddressKey = "Dao/MintRequestAddress" + + MintRequestHashKey = "Dao/MintRequestHash" + + ReissuanceBlockHeightKey = "Dao/ReissuanceBlockHeight" ) func KeyPrefix(p string) []byte { diff --git a/x/dao/types/message_mint_token.go b/x/dao/types/message_mint_token.go new file mode 100644 index 00000000..27b56a06 --- /dev/null +++ b/x/dao/types/message_mint_token.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 TypeMsgMintToken = "mint_token" + +var _ sdk.Msg = &MsgMintToken{} + +func NewMsgMintToken(creator string, mintRequest *MintRequest) *MsgMintToken { + return &MsgMintToken{ + Creator: creator, + MintRequest: mintRequest, + } +} + +func (msg *MsgMintToken) Route() string { + return RouterKey +} + +func (msg *MsgMintToken) Type() string { + return TypeMsgMintToken +} + +func (msg *MsgMintToken) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgMintToken) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgMintToken) 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/dao/types/message_mint_token_test.go b/x/dao/types/message_mint_token_test.go new file mode 100644 index 00000000..58de1d48 --- /dev/null +++ b/x/dao/types/message_mint_token_test.go @@ -0,0 +1,34 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" +) + +func TestMsgMintToken_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgMintToken + err error + }{ + { + name: "invalid address", + msg: MsgMintToken{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, + } + 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) + }) + } +} diff --git a/x/dao/types/message_reissue_rddl_proposal.go b/x/dao/types/message_reissue_rddl_proposal.go new file mode 100644 index 00000000..66e6ef4e --- /dev/null +++ b/x/dao/types/message_reissue_rddl_proposal.go @@ -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 int64) *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 +} diff --git a/x/dao/types/message_reissue_rddl_proposal_test.go b/x/dao/types/message_reissue_rddl_proposal_test.go new file mode 100644 index 00000000..2a39bae2 --- /dev/null +++ b/x/dao/types/message_reissue_rddl_proposal_test.go @@ -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) + }) + } +} diff --git a/x/dao/types/message_reissue_rddl_result.go b/x/dao/types/message_reissue_rddl_result.go new file mode 100644 index 00000000..6f186082 --- /dev/null +++ b/x/dao/types/message_reissue_rddl_result.go @@ -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 int64) *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 +} diff --git a/x/dao/types/message_report_pop_result_test.go b/x/dao/types/message_reissue_rddl_result_test.go similarity index 70% rename from x/dao/types/message_report_pop_result_test.go rename to x/dao/types/message_reissue_rddl_result_test.go index a1aade36..2ad24f66 100644 --- a/x/dao/types/message_report_pop_result_test.go +++ b/x/dao/types/message_reissue_rddl_result_test.go @@ -4,26 +4,25 @@ import ( "testing" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/planetmint/planetmint-go/testutil/sample" "github.com/stretchr/testify/require" ) -func TestMsgReportPopResult_ValidateBasic(t *testing.T) { +func TestMsgReissueRDDLResult_ValidateBasic(t *testing.T) { tests := []struct { name string - msg MsgReportPopResult + msg MsgReissueRDDLResult err error }{ { name: "invalid address", - msg: MsgReportPopResult{ + msg: MsgReissueRDDLResult{ Creator: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: MsgReportPopResult{ - Creator: sample.AccAddress(), + msg: MsgReissueRDDLResult{ + Creator: AccAddress(), }, }, } diff --git a/x/dao/types/mint_request.pb.go b/x/dao/types/mint_request.pb.go new file mode 100644 index 00000000..1e692508 --- /dev/null +++ b/x/dao/types/mint_request.pb.go @@ -0,0 +1,405 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: planetmintgo/dao/mint_request.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 MintRequest struct { + Beneficiary string `protobuf:"bytes,1,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"` + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + LiquidTxHash string `protobuf:"bytes,3,opt,name=liquidTxHash,proto3" json:"liquidTxHash,omitempty"` +} + +func (m *MintRequest) Reset() { *m = MintRequest{} } +func (m *MintRequest) String() string { return proto.CompactTextString(m) } +func (*MintRequest) ProtoMessage() {} +func (*MintRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dc5c152bf52708dc, []int{0} +} +func (m *MintRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MintRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MintRequest.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 *MintRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MintRequest.Merge(m, src) +} +func (m *MintRequest) XXX_Size() int { + return m.Size() +} +func (m *MintRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MintRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MintRequest proto.InternalMessageInfo + +func (m *MintRequest) GetBeneficiary() string { + if m != nil { + return m.Beneficiary + } + return "" +} + +func (m *MintRequest) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *MintRequest) GetLiquidTxHash() string { + if m != nil { + return m.LiquidTxHash + } + return "" +} + +func init() { + proto.RegisterType((*MintRequest)(nil), "planetmintgo.dao.MintRequest") +} + +func init() { + proto.RegisterFile("planetmintgo/dao/mint_request.proto", fileDescriptor_dc5c152bf52708dc) +} + +var fileDescriptor_dc5c152bf52708dc = []byte{ + // 205 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0xc8, 0x49, 0xcc, + 0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x07, 0x31, 0xe3, + 0x8b, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x90, + 0x15, 0xe9, 0xa5, 0x24, 0xe6, 0x2b, 0x65, 0x73, 0x71, 0xfb, 0x66, 0xe6, 0x95, 0x04, 0x41, 0x94, + 0x09, 0x29, 0x70, 0x71, 0x27, 0xa5, 0xe6, 0xa5, 0xa6, 0x65, 0x26, 0x67, 0x26, 0x16, 0x55, 0x4a, + 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x21, 0x0b, 0x09, 0x89, 0x71, 0xb1, 0x25, 0xe6, 0xe6, 0x97, + 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0x41, 0x79, 0x42, 0x4a, 0x5c, 0x3c, 0x39, + 0x99, 0x85, 0xa5, 0x99, 0x29, 0x21, 0x15, 0x1e, 0x89, 0xc5, 0x19, 0x12, 0xcc, 0x60, 0xad, 0x28, + 0x62, 0x4e, 0x9e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, + 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9f, 0x9e, + 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0x70, 0x23, 0x12, 0x53, 0x37, 0x3d, + 0x5f, 0xbf, 0x02, 0xec, 0xad, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x87, 0x8c, 0x01, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xca, 0x8a, 0xc6, 0x1d, 0xf7, 0x00, 0x00, 0x00, +} + +func (m *MintRequest) 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 *MintRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MintRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LiquidTxHash) > 0 { + i -= len(m.LiquidTxHash) + copy(dAtA[i:], m.LiquidTxHash) + i = encodeVarintMintRequest(dAtA, i, uint64(len(m.LiquidTxHash))) + i-- + dAtA[i] = 0x1a + } + if m.Amount != 0 { + i = encodeVarintMintRequest(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Beneficiary) > 0 { + i -= len(m.Beneficiary) + copy(dAtA[i:], m.Beneficiary) + i = encodeVarintMintRequest(dAtA, i, uint64(len(m.Beneficiary))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMintRequest(dAtA []byte, offset int, v uint64) int { + offset -= sovMintRequest(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MintRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Beneficiary) + if l > 0 { + n += 1 + l + sovMintRequest(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovMintRequest(uint64(m.Amount)) + } + l = len(m.LiquidTxHash) + if l > 0 { + n += 1 + l + sovMintRequest(uint64(l)) + } + return n +} + +func sovMintRequest(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMintRequest(x uint64) (n int) { + return sovMintRequest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MintRequest) 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 ErrIntOverflowMintRequest + } + 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: MintRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MintRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMintRequest + } + 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 ErrInvalidLengthMintRequest + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMintRequest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beneficiary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMintRequest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidTxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMintRequest + } + 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 ErrInvalidLengthMintRequest + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMintRequest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LiquidTxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMintRequest(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMintRequest + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMintRequest(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, ErrIntOverflowMintRequest + } + 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, ErrIntOverflowMintRequest + } + 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, ErrIntOverflowMintRequest + } + 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, ErrInvalidLengthMintRequest + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMintRequest + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMintRequest + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMintRequest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMintRequest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMintRequest = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dao/types/mint_requests.pb.go b/x/dao/types/mint_requests.pb.go new file mode 100644 index 00000000..816e9049 --- /dev/null +++ b/x/dao/types/mint_requests.pb.go @@ -0,0 +1,328 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: planetmintgo/dao/mint_requests.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 MintRequests struct { + Requests []*MintRequest `protobuf:"bytes,1,rep,name=Requests,proto3" json:"Requests,omitempty"` +} + +func (m *MintRequests) Reset() { *m = MintRequests{} } +func (m *MintRequests) String() string { return proto.CompactTextString(m) } +func (*MintRequests) ProtoMessage() {} +func (*MintRequests) Descriptor() ([]byte, []int) { + return fileDescriptor_d28f1f28907eeede, []int{0} +} +func (m *MintRequests) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MintRequests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MintRequests.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 *MintRequests) XXX_Merge(src proto.Message) { + xxx_messageInfo_MintRequests.Merge(m, src) +} +func (m *MintRequests) XXX_Size() int { + return m.Size() +} +func (m *MintRequests) XXX_DiscardUnknown() { + xxx_messageInfo_MintRequests.DiscardUnknown(m) +} + +var xxx_messageInfo_MintRequests proto.InternalMessageInfo + +func (m *MintRequests) GetRequests() []*MintRequest { + if m != nil { + return m.Requests + } + return nil +} + +func init() { + proto.RegisterType((*MintRequests)(nil), "planetmintgo.dao.MintRequests") +} + +func init() { + proto.RegisterFile("planetmintgo/dao/mint_requests.proto", fileDescriptor_d28f1f28907eeede) +} + +var fileDescriptor_d28f1f28907eeede = []byte{ + // 170 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x29, 0xc8, 0x49, 0xcc, + 0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x07, 0x31, 0xe3, + 0x8b, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x8a, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, + 0x90, 0x55, 0xe9, 0xa5, 0x24, 0xe6, 0x4b, 0x29, 0xe3, 0xd5, 0x07, 0xd1, 0xa6, 0xe4, 0xc9, 0xc5, + 0xe3, 0x9b, 0x99, 0x57, 0x12, 0x04, 0x35, 0x4c, 0xc8, 0x92, 0x8b, 0x03, 0xc6, 0x96, 0x60, 0x54, + 0x60, 0xd6, 0xe0, 0x36, 0x92, 0xd5, 0x43, 0x37, 0x59, 0x0f, 0x49, 0x47, 0x10, 0x5c, 0xb9, 0x93, + 0xe7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, + 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, + 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x23, 0x0c, 0x43, 0x62, 0xea, 0xa6, 0xe7, 0xeb, 0x57, + 0x80, 0x9d, 0x58, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x9c, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xa8, 0xa9, 0x35, 0x0f, 0xfb, 0x00, 0x00, 0x00, +} + +func (m *MintRequests) 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 *MintRequests) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MintRequests) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Requests) > 0 { + for iNdEx := len(m.Requests) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Requests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMintRequests(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintMintRequests(dAtA []byte, offset int, v uint64) int { + offset -= sovMintRequests(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MintRequests) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Requests) > 0 { + for _, e := range m.Requests { + l = e.Size() + n += 1 + l + sovMintRequests(uint64(l)) + } + } + return n +} + +func sovMintRequests(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMintRequests(x uint64) (n int) { + return sovMintRequests(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MintRequests) 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 ErrIntOverflowMintRequests + } + 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: MintRequests: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MintRequests: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMintRequests + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMintRequests + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMintRequests + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Requests = append(m.Requests, &MintRequest{}) + if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMintRequests(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMintRequests + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMintRequests(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, ErrIntOverflowMintRequests + } + 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, ErrIntOverflowMintRequests + } + 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, ErrIntOverflowMintRequests + } + 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, ErrInvalidLengthMintRequests + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMintRequests + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMintRequests + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMintRequests = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMintRequests = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMintRequests = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/dao/types/query.pb.go b/x/dao/types/query.pb.go index 3b7670ae..7c7fe2b3 100644 --- a/x/dao/types/query.pb.go +++ b/x/dao/types/query.pb.go @@ -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" @@ -113,34 +113,426 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +type QueryGetMintRequestsByHashRequest struct { + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *QueryGetMintRequestsByHashRequest) Reset() { *m = QueryGetMintRequestsByHashRequest{} } +func (m *QueryGetMintRequestsByHashRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetMintRequestsByHashRequest) ProtoMessage() {} +func (*QueryGetMintRequestsByHashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_07bad0eeb5b27724, []int{2} +} +func (m *QueryGetMintRequestsByHashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetMintRequestsByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetMintRequestsByHashRequest.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 *QueryGetMintRequestsByHashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetMintRequestsByHashRequest.Merge(m, src) +} +func (m *QueryGetMintRequestsByHashRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetMintRequestsByHashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetMintRequestsByHashRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetMintRequestsByHashRequest proto.InternalMessageInfo + +func (m *QueryGetMintRequestsByHashRequest) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +type QueryGetMintRequestsByHashResponse struct { + MintRequest *MintRequest `protobuf:"bytes,1,opt,name=mintRequest,proto3" json:"mintRequest,omitempty"` +} + +func (m *QueryGetMintRequestsByHashResponse) Reset() { *m = QueryGetMintRequestsByHashResponse{} } +func (m *QueryGetMintRequestsByHashResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetMintRequestsByHashResponse) ProtoMessage() {} +func (*QueryGetMintRequestsByHashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07bad0eeb5b27724, []int{3} +} +func (m *QueryGetMintRequestsByHashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetMintRequestsByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetMintRequestsByHashResponse.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 *QueryGetMintRequestsByHashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetMintRequestsByHashResponse.Merge(m, src) +} +func (m *QueryGetMintRequestsByHashResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetMintRequestsByHashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetMintRequestsByHashResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetMintRequestsByHashResponse proto.InternalMessageInfo + +func (m *QueryGetMintRequestsByHashResponse) GetMintRequest() *MintRequest { + if m != nil { + return m.MintRequest + } + return nil +} + +type QueryMintRequestsByAddressRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryMintRequestsByAddressRequest) Reset() { *m = QueryMintRequestsByAddressRequest{} } +func (m *QueryMintRequestsByAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMintRequestsByAddressRequest) ProtoMessage() {} +func (*QueryMintRequestsByAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_07bad0eeb5b27724, []int{4} +} +func (m *QueryMintRequestsByAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMintRequestsByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMintRequestsByAddressRequest.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 *QueryMintRequestsByAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMintRequestsByAddressRequest.Merge(m, src) +} +func (m *QueryMintRequestsByAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryMintRequestsByAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMintRequestsByAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMintRequestsByAddressRequest proto.InternalMessageInfo + +func (m *QueryMintRequestsByAddressRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +type QueryMintRequestsByAddressResponse struct { + MintRequests *MintRequests `protobuf:"bytes,1,opt,name=mintRequests,proto3" json:"mintRequests,omitempty"` +} + +func (m *QueryMintRequestsByAddressResponse) Reset() { *m = QueryMintRequestsByAddressResponse{} } +func (m *QueryMintRequestsByAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMintRequestsByAddressResponse) ProtoMessage() {} +func (*QueryMintRequestsByAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07bad0eeb5b27724, []int{5} +} +func (m *QueryMintRequestsByAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMintRequestsByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMintRequestsByAddressResponse.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 *QueryMintRequestsByAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMintRequestsByAddressResponse.Merge(m, src) +} +func (m *QueryMintRequestsByAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMintRequestsByAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMintRequestsByAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMintRequestsByAddressResponse proto.InternalMessageInfo + +func (m *QueryMintRequestsByAddressResponse) GetMintRequests() *MintRequests { + if m != nil { + return m.MintRequests + } + return nil +} + +type QueryGetReissuanceRequest struct { + BlockHeight int64 `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() int64 { + 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") + proto.RegisterType((*QueryGetMintRequestsByHashRequest)(nil), "planetmintgo.dao.QueryGetMintRequestsByHashRequest") + 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{ - // 301 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x31, 0x4b, 0x03, 0x31, - 0x14, 0xc7, 0x2f, 0xa2, 0x1d, 0xe2, 0x22, 0xb1, 0x43, 0x29, 0x35, 0xca, 0xa1, 0x20, 0x82, 0x17, - 0xae, 0x82, 0xee, 0xdd, 0x1c, 0x04, 0xed, 0xe8, 0x96, 0x6b, 0x43, 0x3c, 0xe8, 0xe5, 0xa5, 0x97, - 0x9c, 0xd8, 0xd5, 0x0f, 0x20, 0x82, 0x8b, 0x1f, 0xa9, 0x63, 0xc1, 0xc5, 0x49, 0xe4, 0xce, 0x0f, - 0x22, 0x4d, 0x0e, 0x6c, 0xbd, 0x41, 0xb7, 0xf0, 0xde, 0xef, 0xff, 0xe3, 0x9f, 0x87, 0x7b, 0x7a, - 0xc2, 0x95, 0xb0, 0x59, 0xaa, 0xac, 0x04, 0x36, 0xe6, 0xc0, 0xa6, 0x85, 0xc8, 0x67, 0x91, 0xce, - 0xc1, 0x02, 0xd9, 0x59, 0xdd, 0x46, 0x63, 0x0e, 0xdd, 0xb6, 0x04, 0x09, 0x6e, 0xc9, 0x96, 0x2f, - 0xcf, 0x75, 0x7b, 0x12, 0x40, 0x4e, 0x04, 0xe3, 0x3a, 0x65, 0x5c, 0x29, 0xb0, 0xdc, 0xa6, 0xa0, - 0x4c, 0xbd, 0x3d, 0x19, 0x81, 0xc9, 0xc0, 0xb0, 0x84, 0x1b, 0xe1, 0xf5, 0xec, 0x3e, 0x4e, 0x84, - 0xe5, 0x31, 0xd3, 0x5c, 0xa6, 0xca, 0xc1, 0x35, 0xbb, 0xd7, 0xe8, 0xa3, 0x79, 0xce, 0xb3, 0x5a, - 0x15, 0xb6, 0x31, 0xb9, 0x59, 0x0a, 0xae, 0xdd, 0x70, 0x28, 0xa6, 0x85, 0x30, 0x36, 0xbc, 0xc2, - 0xbb, 0x6b, 0x53, 0xa3, 0x41, 0x19, 0x41, 0xce, 0x71, 0xcb, 0x87, 0x3b, 0xe8, 0x00, 0x1d, 0x6f, - 0xf7, 0x3b, 0xd1, 0xef, 0xef, 0x44, 0x3e, 0x31, 0xd8, 0x9c, 0x7f, 0xec, 0x07, 0xc3, 0x9a, 0xee, - 0xbf, 0x22, 0xbc, 0xe5, 0x7c, 0xe4, 0x09, 0xe1, 0x96, 0x47, 0xc8, 0x61, 0x33, 0xdc, 0x6c, 0xd2, - 0x3d, 0xfa, 0x83, 0xf2, 0xcd, 0xc2, 0x8b, 0xc7, 0xb7, 0xaf, 0x97, 0x8d, 0x98, 0x30, 0x26, 0x53, - 0x7b, 0x57, 0x24, 0xd1, 0x08, 0x32, 0xf6, 0x93, 0x5c, 0x79, 0x9e, 0xae, 0x5d, 0x61, 0x70, 0x39, - 0x2f, 0x29, 0x5a, 0x94, 0x14, 0x7d, 0x96, 0x14, 0x3d, 0x57, 0x34, 0x58, 0x54, 0x34, 0x78, 0xaf, - 0x68, 0x70, 0xfb, 0x2f, 0xd3, 0x83, 0x73, 0xd9, 0x99, 0x16, 0x26, 0x69, 0xb9, 0x8b, 0x9e, 0x7d, - 0x07, 0x00, 0x00, 0xff, 0xff, 0x20, 0xd5, 0xef, 0x17, 0x02, 0x02, 0x00, 0x00, + // 688 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x41, 0x4f, 0x13, 0x4f, + 0x18, 0xc6, 0xbb, 0xfc, 0xf9, 0xd7, 0xf8, 0xa2, 0xc6, 0x8c, 0x60, 0x6a, 0x85, 0x05, 0x46, 0x14, + 0xa3, 0xb0, 0x23, 0x85, 0xa8, 0x31, 0x12, 0x63, 0x0f, 0x82, 0x07, 0x12, 0xdc, 0x23, 0x97, 0x66, + 0xda, 0x4e, 0xb6, 0x1b, 0xe9, 0xce, 0xd2, 0xd9, 0x1a, 0x1b, 0xc2, 0xc5, 0x4f, 0x60, 0x62, 0xe2, + 0xd9, 0x83, 0x9f, 0xc2, 0x18, 0xcf, 0x1c, 0x49, 0xbc, 0x78, 0x32, 0x06, 0xfc, 0x20, 0xa6, 0x33, + 0xb3, 0x74, 0x96, 0xdd, 0x2e, 0x35, 0xf1, 0x42, 0x66, 0x77, 0x9e, 0xe7, 0x7d, 0x7f, 0xfb, 0x32, + 0xcf, 0x14, 0xa6, 0xc3, 0x5d, 0x1a, 0xb0, 0xa8, 0xed, 0x07, 0x91, 0xc7, 0x49, 0x93, 0x72, 0xb2, + 0xd7, 0x65, 0x9d, 0x9e, 0x13, 0x76, 0x78, 0xc4, 0xd1, 0x55, 0x73, 0xd7, 0x69, 0x52, 0x5e, 0x9e, + 0xf4, 0xb8, 0xc7, 0xe5, 0x26, 0xe9, 0xaf, 0x94, 0xae, 0x3c, 0xed, 0x71, 0xee, 0xed, 0x32, 0x42, + 0x43, 0x9f, 0xd0, 0x20, 0xe0, 0x11, 0x8d, 0x7c, 0x1e, 0x08, 0xbd, 0x7b, 0xaf, 0xc1, 0x45, 0x9b, + 0x0b, 0x52, 0xa7, 0x82, 0xa9, 0xf2, 0xe4, 0xcd, 0x4a, 0x9d, 0x45, 0x74, 0x85, 0x84, 0xd4, 0xf3, + 0x03, 0x29, 0xd6, 0xda, 0x99, 0x14, 0x4f, 0x48, 0x3b, 0xb4, 0x1d, 0x97, 0xba, 0x95, 0xda, 0xee, + 0x2f, 0x6b, 0x1d, 0xb6, 0xd7, 0x65, 0x22, 0xd2, 0xa2, 0x85, 0x5c, 0x51, 0x5c, 0x6a, 0x3e, 0xa5, + 0xea, 0x30, 0x5f, 0x88, 0x2e, 0x0d, 0x1a, 0x4c, 0x49, 0xf0, 0x24, 0xa0, 0x57, 0x7d, 0xdc, 0x6d, + 0x89, 0xe0, 0x2a, 0x3f, 0xde, 0x82, 0x6b, 0x89, 0xb7, 0x22, 0xe4, 0x81, 0x60, 0xe8, 0x21, 0x14, + 0x15, 0x6a, 0xc9, 0x9a, 0xb3, 0xee, 0x4e, 0x54, 0x4a, 0xce, 0xd9, 0xe1, 0x39, 0xca, 0x51, 0x1d, + 0x3f, 0xfc, 0x39, 0x5b, 0x70, 0xb5, 0x1a, 0x3f, 0x82, 0x79, 0x59, 0x6e, 0x83, 0x45, 0x5b, 0x7e, + 0x10, 0xe9, 0x2e, 0xa2, 0xda, 0xdb, 0xa4, 0xa2, 0xa5, 0x9f, 0x10, 0x82, 0xf1, 0x16, 0x15, 0x2d, + 0x59, 0xfa, 0xa2, 0x2b, 0xd7, 0x98, 0x01, 0xce, 0x33, 0x6a, 0xac, 0x67, 0x30, 0xd1, 0x1e, 0xec, + 0x6a, 0xb6, 0x99, 0x34, 0x9b, 0x51, 0xc2, 0x35, 0x1d, 0x78, 0x5d, 0xf3, 0x25, 0x7b, 0x3c, 0x6f, + 0x36, 0x3b, 0x4c, 0xc4, 0x33, 0x41, 0x25, 0xb8, 0x40, 0xd5, 0x1b, 0x8d, 0x18, 0x3f, 0xe2, 0x96, + 0xa6, 0x1c, 0x62, 0xd7, 0x94, 0x55, 0xb8, 0x64, 0xf4, 0x8c, 0x47, 0x68, 0xe7, 0x62, 0x0a, 0x37, + 0xe1, 0xc1, 0xeb, 0x70, 0x23, 0x9e, 0x87, 0x7b, 0xfa, 0x9f, 0x8c, 0x01, 0xe7, 0x60, 0xa2, 0xbe, + 0xcb, 0x1b, 0xaf, 0x37, 0x99, 0xef, 0xb5, 0xd4, 0x18, 0xfe, 0x73, 0xcd, 0x57, 0x78, 0x07, 0xca, + 0x59, 0x76, 0x0d, 0xf8, 0x14, 0x60, 0x70, 0x3c, 0x34, 0xde, 0x74, 0x1a, 0xcf, 0x70, 0x1a, 0x7a, + 0xdc, 0xcc, 0xaa, 0x7d, 0x3a, 0xbc, 0x17, 0x00, 0x83, 0x1c, 0xe8, 0xda, 0x77, 0x1c, 0x15, 0x1a, + 0xa7, 0x1f, 0x1a, 0x47, 0x65, 0x52, 0x87, 0xc6, 0xd9, 0xa6, 0x5e, 0xfc, 0x5d, 0xae, 0xe1, 0xc4, + 0x9f, 0x2d, 0xb8, 0x99, 0xd9, 0xe6, 0x5f, 0x7c, 0x03, 0xda, 0x48, 0x50, 0x8e, 0x49, 0xf7, 0xe2, + 0xb9, 0x94, 0xaa, 0xb5, 0x89, 0x59, 0xf9, 0x52, 0x84, 0xff, 0x25, 0x26, 0xea, 0x42, 0x51, 0x45, + 0x02, 0x2d, 0xa4, 0x31, 0xd2, 0xc9, 0x2b, 0xdf, 0x3e, 0x47, 0xa5, 0x9a, 0x61, 0xfb, 0xdd, 0xf7, + 0xdf, 0x1f, 0xc6, 0x4a, 0xe8, 0x3a, 0x19, 0xc8, 0x8d, 0xab, 0x04, 0x7d, 0xb5, 0x60, 0x2a, 0x33, + 0x34, 0x68, 0x75, 0x48, 0x83, 0xbc, 0x6c, 0x96, 0xd7, 0xfe, 0xce, 0xa4, 0x21, 0x1f, 0x4b, 0xc8, + 0x0a, 0x7a, 0x70, 0x16, 0xd2, 0x63, 0x51, 0x2d, 0x71, 0x5f, 0xd5, 0xea, 0xbd, 0x5a, 0x3f, 0xf0, + 0x64, 0xbf, 0xff, 0xf7, 0x00, 0x7d, 0xb3, 0x60, 0x2a, 0x33, 0x4d, 0x43, 0xf1, 0xf3, 0xa2, 0x3b, + 0x14, 0x3f, 0x37, 0xb0, 0xf8, 0x89, 0xc4, 0x5f, 0x43, 0x95, 0xb3, 0xf8, 0x29, 0x74, 0x7d, 0x11, + 0x90, 0x7d, 0xbd, 0x38, 0x40, 0x9f, 0x2c, 0xb8, 0x9c, 0x38, 0xa2, 0xe8, 0xfe, 0xf0, 0x11, 0xa6, + 0xa2, 0x5c, 0x5e, 0x1a, 0x4d, 0xac, 0x41, 0xd7, 0x24, 0xa8, 0x83, 0x96, 0xb2, 0xe6, 0x3c, 0x38, + 0xde, 0x64, 0xdf, 0xb8, 0x0b, 0x0e, 0xd0, 0x47, 0x0b, 0xae, 0x24, 0x53, 0x84, 0x46, 0x6a, 0x7b, + 0x3a, 0xd5, 0xe5, 0x11, 0xd5, 0x9a, 0x72, 0x51, 0x52, 0xce, 0xa3, 0xd9, 0x7c, 0x4a, 0x51, 0x7d, + 0x79, 0x78, 0x6c, 0x5b, 0x47, 0xc7, 0xb6, 0xf5, 0xeb, 0xd8, 0xb6, 0xde, 0x9f, 0xd8, 0x85, 0xa3, + 0x13, 0xbb, 0xf0, 0xe3, 0xc4, 0x2e, 0xec, 0x10, 0xcf, 0x8f, 0x5a, 0xdd, 0xba, 0xd3, 0xe0, 0x6d, + 0xb3, 0xc8, 0x60, 0xb9, 0xec, 0x71, 0xf2, 0x56, 0x16, 0x8d, 0x7a, 0x21, 0x13, 0xf5, 0xa2, 0xfc, + 0x91, 0x5b, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x67, 0x9b, 0xdb, 0x03, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -157,6 +549,14 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a list of GetMintRequestsByHash items. + 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 { @@ -176,10 +576,54 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) GetMintRequestsByHash(ctx context.Context, in *QueryGetMintRequestsByHashRequest, opts ...grpc.CallOption) (*QueryGetMintRequestsByHashResponse, error) { + out := new(QueryGetMintRequestsByHashResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/GetMintRequestsByHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) MintRequestsByAddress(ctx context.Context, in *QueryMintRequestsByAddressRequest, opts ...grpc.CallOption) (*QueryMintRequestsByAddressResponse, error) { + out := new(QueryMintRequestsByAddressResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/MintRequestsByAddress", in, out, opts...) + if err != nil { + return nil, err + } + 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. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a list of GetMintRequestsByHash items. + 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. @@ -189,6 +633,18 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) GetMintRequestsByHash(ctx context.Context, req *QueryGetMintRequestsByHashRequest) (*QueryGetMintRequestsByHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMintRequestsByHash not implemented") +} +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) @@ -212,24 +668,112 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "planetmintgo.dao.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "planetmintgo/dao/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_GetMintRequestsByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetMintRequestsByHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetMintRequestsByHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.dao.Query/GetMintRequestsByHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetMintRequestsByHash(ctx, req.(*QueryGetMintRequestsByHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_MintRequestsByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMintRequestsByAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MintRequestsByAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.dao.Query/MintRequestsByAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MintRequestsByAddress(ctx, req.(*QueryMintRequestsByAddressRequest)) + } + 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), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "GetMintRequestsByHash", + Handler: _Query_GetMintRequestsByHash_Handler, + }, + { + 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", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } return dAtA[:n], nil @@ -273,52 +817,1058 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { if err != nil { return 0, err } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetMintRequestsByHashRequest) 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 *QueryGetMintRequestsByHashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetMintRequestsByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetMintRequestsByHashResponse) 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 *QueryGetMintRequestsByHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetMintRequestsByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MintRequest != nil { + { + size, err := m.MintRequest.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 *QueryMintRequestsByAddressRequest) 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 *QueryMintRequestsByAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMintRequestsByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryMintRequestsByAddressResponse) 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 *QueryMintRequestsByAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMintRequestsByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MintRequests != nil { + { + size, err := m.MintRequests.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 *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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetMintRequestsByHashRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetMintRequestsByHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MintRequest != nil { + l = m.MintRequest.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryMintRequestsByAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryMintRequestsByAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MintRequests != nil { + l = m.MintRequests.Size() + n += 1 + l + sovQuery(uint64(l)) + } + 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 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetMintRequestsByHashRequest) 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: QueryGetMintRequestsByHashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetMintRequestsByHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = 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 *QueryGetMintRequestsByHashResponse) 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: QueryGetMintRequestsByHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetMintRequestsByHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintRequest", 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.MintRequest == nil { + m.MintRequest = &MintRequest{} + } + if err := m.MintRequest.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 *QueryMintRequestsByAddressRequest) 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: QueryMintRequestsByAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMintRequestsByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMintRequestsByAddressResponse) 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: QueryMintRequestsByAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMintRequestsByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintRequests", 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.MintRequests == nil { + m.MintRequests = &MintRequests{} + } + if err := m.MintRequests.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 + } } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ + if iNdEx > l { + return io.ErrUnexpectedEOF } - dAtA[offset] = uint8(v) - return base + return nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +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 |= int64(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 + } } - var l int - _ = l - return n -} -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + 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 + } + } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetReissuancesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -341,12 +1891,48 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetReissuancesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + 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:]) @@ -368,7 +1954,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetReissuancesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -391,15 +1977,15 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetReissuancesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Reissuance", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -426,7 +2012,46 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 diff --git a/x/dao/types/query.pb.gw.go b/x/dao/types/query.pb.gw.go index e8405817..997adca7 100644 --- a/x/dao/types/query.pb.gw.go +++ b/x/dao/types/query.pb.gw.go @@ -51,6 +51,204 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_GetMintRequestsByHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetMintRequestsByHashRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + msg, err := client.GetMintRequestsByHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetMintRequestsByHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetMintRequestsByHashRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + msg, err := server.GetMintRequestsByHash(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_MintRequestsByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMintRequestsByAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.MintRequestsByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MintRequestsByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMintRequestsByAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.MintRequestsByAddress(ctx, &protoReq) + return msg, metadata, err + +} + +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.Int64(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.Int64(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. @@ -80,6 +278,98 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetMintRequestsByHash_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_GetMintRequestsByHash_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_GetMintRequestsByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_MintRequestsByAddress_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_MintRequestsByAddress_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_MintRequestsByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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 } @@ -141,13 +431,109 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetMintRequestsByHash_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_GetMintRequestsByHash_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_GetMintRequestsByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_MintRequestsByAddress_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_MintRequestsByAddress_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_MintRequestsByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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 } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"github.com", "planetmint", "planetmint-go", "dao", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "dao", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetMintRequestsByHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "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, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "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, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "dao", "get_reissuance", "blockHeight"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetReissuances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "dao", "get_reissuances"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_GetMintRequestsByHash_0 = runtime.ForwardResponseMessage + + forward_Query_MintRequestsByAddress_0 = runtime.ForwardResponseMessage + + forward_Query_GetReissuance_0 = runtime.ForwardResponseMessage + + forward_Query_GetReissuances_0 = runtime.ForwardResponseMessage ) diff --git a/x/dao/types/reissuance.pb.go b/x/dao/types/reissuance.pb.go new file mode 100644 index 00000000..0ee80bbd --- /dev/null +++ b/x/dao/types/reissuance.pb.go @@ -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 int64 `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() int64 { + 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, 0x1c, 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, 0xb7, 0xaf, 0x8f, 0xce, 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 |= int64(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") +) diff --git a/x/dao/types/tx.pb.go b/x/dao/types/tx.pb.go index 42f1ea27..5ec55361 100644 --- a/x/dao/types/tx.pb.go +++ b/x/dao/types/tx.pb.go @@ -115,31 +115,346 @@ func (m *MsgReportPopResultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgReportPopResultResponse proto.InternalMessageInfo +type MsgReissueRDDLProposal struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` + Tx string `protobuf:"bytes,3,opt,name=tx,proto3" json:"tx,omitempty"` + BlockHeight int64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"` +} + +func (m *MsgReissueRDDLProposal) Reset() { *m = MsgReissueRDDLProposal{} } +func (m *MsgReissueRDDLProposal) String() string { return proto.CompactTextString(m) } +func (*MsgReissueRDDLProposal) ProtoMessage() {} +func (*MsgReissueRDDLProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_7117c47dbc1828c7, []int{2} +} +func (m *MsgReissueRDDLProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReissueRDDLProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReissueRDDLProposal.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 *MsgReissueRDDLProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReissueRDDLProposal.Merge(m, src) +} +func (m *MsgReissueRDDLProposal) XXX_Size() int { + return m.Size() +} +func (m *MsgReissueRDDLProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReissueRDDLProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReissueRDDLProposal proto.InternalMessageInfo + +func (m *MsgReissueRDDLProposal) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgReissueRDDLProposal) GetProposer() string { + if m != nil { + return m.Proposer + } + return "" +} + +func (m *MsgReissueRDDLProposal) GetTx() string { + if m != nil { + return m.Tx + } + return "" +} + +func (m *MsgReissueRDDLProposal) GetBlockHeight() int64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +type MsgReissueRDDLProposalResponse struct { +} + +func (m *MsgReissueRDDLProposalResponse) Reset() { *m = MsgReissueRDDLProposalResponse{} } +func (m *MsgReissueRDDLProposalResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReissueRDDLProposalResponse) ProtoMessage() {} +func (*MsgReissueRDDLProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7117c47dbc1828c7, []int{3} +} +func (m *MsgReissueRDDLProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReissueRDDLProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReissueRDDLProposalResponse.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 *MsgReissueRDDLProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReissueRDDLProposalResponse.Merge(m, src) +} +func (m *MsgReissueRDDLProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReissueRDDLProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReissueRDDLProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReissueRDDLProposalResponse proto.InternalMessageInfo + +type MsgMintToken struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + MintRequest *MintRequest `protobuf:"bytes,2,opt,name=mintRequest,proto3" json:"mintRequest,omitempty"` +} + +func (m *MsgMintToken) Reset() { *m = MsgMintToken{} } +func (m *MsgMintToken) String() string { return proto.CompactTextString(m) } +func (*MsgMintToken) ProtoMessage() {} +func (*MsgMintToken) Descriptor() ([]byte, []int) { + return fileDescriptor_7117c47dbc1828c7, []int{4} +} +func (m *MsgMintToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintToken.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 *MsgMintToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintToken.Merge(m, src) +} +func (m *MsgMintToken) XXX_Size() int { + return m.Size() +} +func (m *MsgMintToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintToken proto.InternalMessageInfo + +func (m *MsgMintToken) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgMintToken) GetMintRequest() *MintRequest { + if m != nil { + return m.MintRequest + } + return nil +} + +type MsgMintTokenResponse struct { +} + +func (m *MsgMintTokenResponse) Reset() { *m = MsgMintTokenResponse{} } +func (m *MsgMintTokenResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintTokenResponse) ProtoMessage() {} +func (*MsgMintTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7117c47dbc1828c7, []int{5} +} +func (m *MsgMintTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintTokenResponse.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 *MsgMintTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintTokenResponse.Merge(m, src) +} +func (m *MsgMintTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMintTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintTokenResponse proto.InternalMessageInfo + +type MsgReissueRDDLResult struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` + TxId string `protobuf:"bytes,3,opt,name=txId,proto3" json:"txId,omitempty"` + BlockHeight int64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"` +} + +func (m *MsgReissueRDDLResult) Reset() { *m = MsgReissueRDDLResult{} } +func (m *MsgReissueRDDLResult) String() string { return proto.CompactTextString(m) } +func (*MsgReissueRDDLResult) ProtoMessage() {} +func (*MsgReissueRDDLResult) Descriptor() ([]byte, []int) { + return fileDescriptor_7117c47dbc1828c7, []int{6} +} +func (m *MsgReissueRDDLResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReissueRDDLResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReissueRDDLResult.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 *MsgReissueRDDLResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReissueRDDLResult.Merge(m, src) +} +func (m *MsgReissueRDDLResult) XXX_Size() int { + return m.Size() +} +func (m *MsgReissueRDDLResult) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReissueRDDLResult.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReissueRDDLResult proto.InternalMessageInfo + +func (m *MsgReissueRDDLResult) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgReissueRDDLResult) GetProposer() string { + if m != nil { + return m.Proposer + } + return "" +} + +func (m *MsgReissueRDDLResult) GetTxId() string { + if m != nil { + return m.TxId + } + return "" +} + +func (m *MsgReissueRDDLResult) GetBlockHeight() int64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +type MsgReissueRDDLResultResponse struct { +} + +func (m *MsgReissueRDDLResultResponse) Reset() { *m = MsgReissueRDDLResultResponse{} } +func (m *MsgReissueRDDLResultResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReissueRDDLResultResponse) ProtoMessage() {} +func (*MsgReissueRDDLResultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7117c47dbc1828c7, []int{7} +} +func (m *MsgReissueRDDLResultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReissueRDDLResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReissueRDDLResultResponse.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 *MsgReissueRDDLResultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReissueRDDLResultResponse.Merge(m, src) +} +func (m *MsgReissueRDDLResultResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReissueRDDLResultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReissueRDDLResultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReissueRDDLResultResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgReportPopResult)(nil), "planetmintgo.dao.MsgReportPopResult") proto.RegisterType((*MsgReportPopResultResponse)(nil), "planetmintgo.dao.MsgReportPopResultResponse") + proto.RegisterType((*MsgReissueRDDLProposal)(nil), "planetmintgo.dao.MsgReissueRDDLProposal") + proto.RegisterType((*MsgReissueRDDLProposalResponse)(nil), "planetmintgo.dao.MsgReissueRDDLProposalResponse") + proto.RegisterType((*MsgMintToken)(nil), "planetmintgo.dao.MsgMintToken") + proto.RegisterType((*MsgMintTokenResponse)(nil), "planetmintgo.dao.MsgMintTokenResponse") + proto.RegisterType((*MsgReissueRDDLResult)(nil), "planetmintgo.dao.MsgReissueRDDLResult") + proto.RegisterType((*MsgReissueRDDLResultResponse)(nil), "planetmintgo.dao.MsgReissueRDDLResultResponse") } func init() { proto.RegisterFile("planetmintgo/dao/tx.proto", fileDescriptor_7117c47dbc1828c7) } var fileDescriptor_7117c47dbc1828c7 = []byte{ - // 241 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0xc8, 0x49, 0xcc, - 0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x2f, 0xa9, 0xd0, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x40, 0x96, 0xd2, 0x4b, 0x49, 0xcc, 0x97, 0x52, 0xc0, - 0x50, 0x9c, 0x9c, 0x91, 0x98, 0x93, 0x93, 0x9a, 0x97, 0x9e, 0x0a, 0xd1, 0xa3, 0x94, 0xc9, 0x25, - 0xe4, 0x5b, 0x9c, 0x1e, 0x94, 0x5a, 0x90, 0x5f, 0x54, 0x12, 0x90, 0x5f, 0x10, 0x94, 0x5a, 0x5c, - 0x9a, 0x53, 0x22, 0x24, 0xc1, 0xc5, 0x9e, 0x5c, 0x94, 0x9a, 0x58, 0x92, 0x5f, 0x24, 0xc1, 0xa8, - 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe3, 0x0a, 0x59, 0x72, 0x71, 0xc2, 0x8d, 0x90, 0x60, 0x52, 0x60, - 0xd4, 0xe0, 0x36, 0x92, 0xd6, 0x43, 0xb7, 0x57, 0xcf, 0x19, 0xa6, 0x24, 0x08, 0xa1, 0x5a, 0x49, - 0x86, 0x4b, 0x0a, 0xd3, 0xaa, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x1c, 0x2e, - 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0x54, 0x2e, 0x7e, 0x74, 0xc7, 0xa8, 0x60, 0x9a, 0x8f, 0x69, 0x8e, - 0x94, 0x0e, 0x31, 0xaa, 0x60, 0xb6, 0x39, 0x79, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, - 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc2, - 0x44, 0x24, 0xa6, 0x6e, 0x7a, 0xbe, 0x7e, 0x05, 0x24, 0xe0, 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, - 0xc0, 0x01, 0x69, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x68, 0x2f, 0x2d, 0xc8, 0x99, 0x01, 0x00, - 0x00, + // 463 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xb3, 0x49, 0x05, 0x64, 0x82, 0xf8, 0xb3, 0xa0, 0xca, 0x98, 0xb2, 0xb2, 0x0c, 0xaa, + 0x72, 0x00, 0x1b, 0x95, 0x13, 0x27, 0x24, 0xe8, 0x81, 0x4a, 0x58, 0xaa, 0x16, 0x4e, 0x5c, 0x90, + 0x93, 0x8c, 0x36, 0x56, 0x5c, 0xef, 0xd6, 0xbb, 0x91, 0xcc, 0x0d, 0xf1, 0x04, 0xbc, 0x02, 0x6f, + 0xc3, 0xb1, 0x47, 0x8e, 0x28, 0x79, 0x11, 0x54, 0xbb, 0x76, 0x4c, 0x6d, 0x12, 0xdf, 0xd6, 0x3b, + 0xbf, 0x99, 0xef, 0xd3, 0x37, 0xf2, 0xc2, 0x23, 0x15, 0x87, 0x09, 0x9a, 0xb3, 0x28, 0x31, 0x42, + 0xfa, 0xb3, 0x50, 0xfa, 0x26, 0xf3, 0x54, 0x2a, 0x8d, 0xa4, 0xf7, 0xea, 0x25, 0x6f, 0x16, 0x4a, + 0xdb, 0x69, 0xc0, 0xd3, 0x79, 0x18, 0xc7, 0x98, 0x08, 0x2c, 0x7a, 0xec, 0xa7, 0x0d, 0xe2, 0xf2, + 0xf8, 0x25, 0xc5, 0xf3, 0x25, 0x6a, 0x53, 0x40, 0x6e, 0x04, 0x34, 0xd0, 0x82, 0xa3, 0x92, 0xa9, + 0x39, 0x95, 0x8a, 0xa3, 0x5e, 0xc6, 0x86, 0x5a, 0x70, 0x73, 0x9a, 0x62, 0x68, 0x64, 0x6a, 0x11, + 0x87, 0x8c, 0x87, 0xbc, 0xfc, 0xa4, 0xaf, 0x61, 0x58, 0xe9, 0x58, 0x7d, 0x87, 0x8c, 0x47, 0x47, + 0x8f, 0xbd, 0xeb, 0xe6, 0xbc, 0x77, 0x25, 0xc2, 0x37, 0xb4, 0x7b, 0x00, 0x76, 0x53, 0x8a, 0xa3, + 0x56, 0x32, 0xd1, 0xe8, 0x7e, 0x23, 0xb0, 0x9f, 0x97, 0x23, 0xad, 0x97, 0xc8, 0x8f, 0x8f, 0x3f, + 0x9c, 0xa6, 0x52, 0x49, 0x1d, 0xc6, 0x5b, 0xdc, 0xd8, 0x70, 0x4b, 0xe5, 0x14, 0xa6, 0xb9, 0x99, + 0x21, 0xaf, 0xbe, 0xe9, 0x1d, 0xe8, 0x9b, 0xcc, 0x1a, 0xe4, 0xb7, 0x7d, 0x93, 0x51, 0x07, 0x46, + 0x93, 0x58, 0x4e, 0x17, 0xef, 0x31, 0x12, 0x73, 0x63, 0xed, 0x39, 0x64, 0x3c, 0xe0, 0xf5, 0x2b, + 0xd7, 0x01, 0xd6, 0xee, 0xa0, 0x32, 0x19, 0xc1, 0xed, 0x40, 0x8b, 0x20, 0x4a, 0xcc, 0x27, 0xb9, + 0xc0, 0x64, 0x8b, 0xb3, 0x37, 0x30, 0xba, 0xcc, 0x83, 0x17, 0x61, 0x5f, 0x25, 0xf5, 0xa4, 0x99, + 0x54, 0xb0, 0x81, 0x78, 0xbd, 0xc3, 0xdd, 0x87, 0x87, 0x75, 0xa9, 0xca, 0xc2, 0x77, 0x92, 0x17, + 0x6a, 0x2e, 0x77, 0xee, 0x6c, 0x5b, 0x4a, 0x14, 0xf6, 0x4c, 0x76, 0x32, 0xbb, 0xca, 0x29, 0x3f, + 0x77, 0x48, 0x8a, 0xc1, 0x41, 0x9b, 0x87, 0xd2, 0xe4, 0xd1, 0xcf, 0x01, 0x0c, 0x02, 0x2d, 0xe8, + 0x39, 0x3c, 0x68, 0x5b, 0xe8, 0xb8, 0x25, 0x87, 0xd6, 0xe0, 0xed, 0x97, 0x5d, 0xc9, 0x52, 0x9a, + 0x7e, 0x84, 0xe1, 0x66, 0x3f, 0xac, 0xb5, 0xbd, 0xaa, 0xdb, 0x87, 0xdb, 0xeb, 0xd5, 0xd0, 0x05, + 0xdc, 0x6f, 0x06, 0x7e, 0xb8, 0xcb, 0x5b, 0xc1, 0xd9, 0x5e, 0x37, 0xae, 0x12, 0x43, 0xb8, 0x7b, + 0xfd, 0x7f, 0x7c, 0xf6, 0x9f, 0x11, 0xff, 0x50, 0xf6, 0xf3, 0x2e, 0x54, 0x29, 0xf3, 0xf6, 0xe4, + 0xd7, 0x8a, 0x91, 0x8b, 0x15, 0x23, 0x7f, 0x56, 0x8c, 0xfc, 0x58, 0xb3, 0xde, 0xc5, 0x9a, 0xf5, + 0x7e, 0xaf, 0x59, 0xef, 0xb3, 0x2f, 0x22, 0x33, 0x5f, 0x4e, 0xbc, 0xa9, 0x3c, 0xf3, 0x37, 0x13, + 0x6b, 0xc7, 0x17, 0x42, 0xfa, 0x59, 0xf1, 0x40, 0x7d, 0x55, 0xa8, 0x27, 0x37, 0xf2, 0xb7, 0xe4, + 0xd5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x86, 0x9e, 0x9f, 0xca, 0xc1, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -154,6 +469,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + ReissueRDDLProposal(ctx context.Context, in *MsgReissueRDDLProposal, opts ...grpc.CallOption) (*MsgReissueRDDLProposalResponse, error) + MintToken(ctx context.Context, in *MsgMintToken, opts ...grpc.CallOption) (*MsgMintTokenResponse, error) + ReissueRDDLResult(ctx context.Context, in *MsgReissueRDDLResult, opts ...grpc.CallOption) (*MsgReissueRDDLResultResponse, error) ReportPopResult(ctx context.Context, in *MsgReportPopResult, opts ...grpc.CallOption) (*MsgReportPopResultResponse, error) } @@ -165,6 +483,33 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) ReissueRDDLProposal(ctx context.Context, in *MsgReissueRDDLProposal, opts ...grpc.CallOption) (*MsgReissueRDDLProposalResponse, error) { + out := new(MsgReissueRDDLProposalResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.dao.Msg/ReissueRDDLProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) MintToken(ctx context.Context, in *MsgMintToken, opts ...grpc.CallOption) (*MsgMintTokenResponse, error) { + out := new(MsgMintTokenResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.dao.Msg/MintToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReissueRDDLResult(ctx context.Context, in *MsgReissueRDDLResult, opts ...grpc.CallOption) (*MsgReissueRDDLResultResponse, error) { + out := new(MsgReissueRDDLResultResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.dao.Msg/ReissueRDDLResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) ReportPopResult(ctx context.Context, in *MsgReportPopResult, opts ...grpc.CallOption) (*MsgReportPopResultResponse, error) { out := new(MsgReportPopResultResponse) err := c.cc.Invoke(ctx, "/planetmintgo.dao.Msg/ReportPopResult", in, out, opts...) @@ -176,6 +521,9 @@ func (c *msgClient) ReportPopResult(ctx context.Context, in *MsgReportPopResult, // MsgServer is the server API for Msg service. type MsgServer interface { + ReissueRDDLProposal(context.Context, *MsgReissueRDDLProposal) (*MsgReissueRDDLProposalResponse, error) + MintToken(context.Context, *MsgMintToken) (*MsgMintTokenResponse, error) + ReissueRDDLResult(context.Context, *MsgReissueRDDLResult) (*MsgReissueRDDLResultResponse, error) ReportPopResult(context.Context, *MsgReportPopResult) (*MsgReportPopResultResponse, error) } @@ -183,6 +531,15 @@ type MsgServer interface { type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) ReissueRDDLProposal(ctx context.Context, req *MsgReissueRDDLProposal) (*MsgReissueRDDLProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReissueRDDLProposal not implemented") +} +func (*UnimplementedMsgServer) MintToken(ctx context.Context, req *MsgMintToken) (*MsgMintTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MintToken not implemented") +} +func (*UnimplementedMsgServer) ReissueRDDLResult(ctx context.Context, req *MsgReissueRDDLResult) (*MsgReissueRDDLResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReissueRDDLResult not implemented") +} func (*UnimplementedMsgServer) ReportPopResult(ctx context.Context, req *MsgReportPopResult) (*MsgReportPopResultResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportPopResult not implemented") } @@ -191,6 +548,60 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_ReissueRDDLProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReissueRDDLProposal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReissueRDDLProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.dao.Msg/ReissueRDDLProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReissueRDDLProposal(ctx, req.(*MsgReissueRDDLProposal)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_MintToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintToken) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MintToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.dao.Msg/MintToken", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MintToken(ctx, req.(*MsgMintToken)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReissueRDDLResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReissueRDDLResult) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReissueRDDLResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.dao.Msg/ReissueRDDLResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReissueRDDLResult(ctx, req.(*MsgReissueRDDLResult)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_ReportPopResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgReportPopResult) if err := dec(in); err != nil { @@ -213,6 +624,18 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "planetmintgo.dao.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "ReissueRDDLProposal", + Handler: _Msg_ReissueRDDLProposal_Handler, + }, + { + MethodName: "MintToken", + Handler: _Msg_MintToken_Handler, + }, + { + MethodName: "ReissueRDDLResult", + Handler: _Msg_ReissueRDDLResult_Handler, + }, { MethodName: "ReportPopResult", Handler: _Msg_ReportPopResult_Handler, @@ -287,15 +710,224 @@ func (m *MsgReportPopResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgReissueRDDLProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) + return dAtA[:n], nil +} + +func (m *MsgReissueRDDLProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReissueRDDLProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x20 + } + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintTx(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0x1a + } + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) + 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 *MsgReissueRDDLProposalResponse) 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 *MsgReissueRDDLProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReissueRDDLProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgMintToken) 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 *MsgMintToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MintRequest != nil { + { + size, err := m.MintRequest.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 *MsgMintTokenResponse) 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 *MsgMintTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgReissueRDDLResult) 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 *MsgReissueRDDLResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReissueRDDLResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x20 + } + if len(m.TxId) > 0 { + i -= len(m.TxId) + copy(dAtA[i:], m.TxId) + i = encodeVarintTx(dAtA, i, uint64(len(m.TxId))) + i-- + dAtA[i] = 0x1a + } + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) + 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 *MsgReissueRDDLResultResponse) 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 *MsgReissueRDDLResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReissueRDDLResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) return base } func (m *MsgReportPopResult) Size() (n int) { @@ -324,6 +956,98 @@ func (m *MsgReportPopResultResponse) Size() (n int) { return n } +func (m *MsgReissueRDDLProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Tx) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BlockHeight != 0 { + n += 1 + sovTx(uint64(m.BlockHeight)) + } + return n +} + +func (m *MsgReissueRDDLProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgMintToken) 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.MintRequest != nil { + l = m.MintRequest.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMintTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReissueRDDLResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TxId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BlockHeight != 0 { + n += 1 + sovTx(uint64(m.BlockHeight)) + } + return n +} + +func (m *MsgReissueRDDLResultResponse) 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 } @@ -498,6 +1222,604 @@ func (m *MsgReportPopResultResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgReissueRDDLProposal) 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: MsgReissueRDDLProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReissueRDDLProposal: 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 Proposer", 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.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", 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.Tx = 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReissueRDDLProposalResponse) 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: MsgReissueRDDLProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReissueRDDLProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgMintToken) 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: MsgMintToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintToken: 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 MintRequest", 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.MintRequest == nil { + m.MintRequest = &MintRequest{} + } + if err := m.MintRequest.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 *MsgMintTokenResponse) 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: MsgMintTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReissueRDDLResult) 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: MsgReissueRDDLResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReissueRDDLResult: 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 Proposer", 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.Proposer = 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 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.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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReissueRDDLResultResponse) 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: MsgReissueRDDLResultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReissueRDDLResultResponse: 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 diff --git a/x/dao/util.go b/x/dao/util.go new file mode 100644 index 00000000..14a82d23 --- /dev/null +++ b/x/dao/util.go @@ -0,0 +1,10 @@ +package dao + +func GetReissuanceCommand(assetID string, _ int64) string { + return "reissueasset " + assetID + " 99869000000" +} + +func IsValidReissuanceCommand(reissuanceStr string, assetID string, _ int64) bool { + expected := "reissueasset " + assetID + " 99869000000" + return reissuanceStr == expected +} diff --git a/x/machine/client/cli/query.go b/x/machine/client/cli/query.go index c3975ee5..548a2df9 100644 --- a/x/machine/client/cli/query.go +++ b/x/machine/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group machine queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/machine/keeper/issue_response.go b/x/machine/keeper/issue_response.go deleted file mode 100644 index 66a9ae85..00000000 --- a/x/machine/keeper/issue_response.go +++ /dev/null @@ -1,29 +0,0 @@ -package keeper - -import ( - config "github.com/planetmint/planetmint-go/config" - "strconv" - - "github.com/cometbft/cometbft/libs/log" - "github.com/hypebeast/go-osc/osc" -) - -func (k Keeper) IssueResponseHandler(logger log.Logger) { - conf := config.GetConfig() - addr := "0.0.0.0:" + strconv.FormatInt(int64(conf.OSCServicePort), 10) - d := osc.NewStandardDispatcher() - err := d.AddMsgHandler("/rddl/resp", func(msg *osc.Message) { - logger.Info("Issue Response: " + msg.String()) - }) - if err != nil { - logger.Error("Unable to add handler to OSC service.") - } - server := &osc.Server{ - Addr: addr, - Dispatcher: d, - } - err = server.ListenAndServe() - if err != nil { - logger.Error("Unable to start the OSC service.") - } -} diff --git a/x/machine/keeper/machine.go b/x/machine/keeper/machine.go index e0271059..a77ab2f1 100644 --- a/x/machine/keeper/machine.go +++ b/x/machine/keeper/machine.go @@ -39,13 +39,13 @@ func (k Keeper) StoreMachineIndex(ctx sdk.Context, machine types.Machine) { Address: machine.Address, } - machineIdIndexKey := GetMachineBytes(machine.MachineId) + machineIDIndexKey := GetMachineBytes(machine.MachineId) issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint) issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid) addressIndexKey := GetMachineBytes(machine.Address) indexAppendValue := k.cdc.MustMarshal(&index) - taIndexStore.Set(machineIdIndexKey, indexAppendValue) + taIndexStore.Set(machineIDIndexKey, indexAppendValue) issuerPlanetmintIndexStore.Set(issuerPlanetmintIndexKey, indexAppendValue) issuerLiquidIndexStore.Set(issuerLiquidIndexKey, indexAppendValue) addressIndexStore.Set(addressIndexKey, indexAppendValue) diff --git a/x/machine/keeper/machine_test.go b/x/machine/keeper/machine_test.go index d09df017..c418d2e1 100644 --- a/x/machine/keeper/machine_test.go +++ b/x/machine/keeper/machine_test.go @@ -35,9 +35,9 @@ func TestGetMachine(t *testing.T) { IssuerLiquid: item.IssuerLiquid, Address: item.Address, } - machineById, found := keeper.GetMachine(ctx, index) + machineByID, found := keeper.GetMachine(ctx, index) assert.True(t, found) - assert.Equal(t, item, machineById) + assert.Equal(t, item, machineByID) } } diff --git a/x/machine/keeper/msg_server_attest_machine.go b/x/machine/keeper/msg_server_attest_machine.go index 10e05f9c..404a9e49 100644 --- a/x/machine/keeper/msg_server_attest_machine.go +++ b/x/machine/keeper/msg_server_attest_machine.go @@ -1,9 +1,10 @@ package keeper import ( + "bytes" "context" - "errors" - "strconv" + "os/exec" + "strings" config "github.com/planetmint/planetmint-go/config" "github.com/planetmint/planetmint-go/util" @@ -11,8 +12,8 @@ import ( "github.com/btcsuite/btcd/btcutil/hdkeychain" "github.com/btcsuite/btcd/chaincfg" - "github.com/crgimenes/go-osc" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -25,36 +26,34 @@ func (k msgServer) isNFTCreationRequest(machine *types.Machine) bool { func (k msgServer) AttestMachine(goCtx context.Context, msg *types.MsgAttestMachine) (*types.MsgAttestMachineResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - ta, activated, found := k.GetTrustAnchor(ctx, msg.Machine.MachineId) - if !found { - return nil, errors.New("no preregistered trust anchor found for machine id") - } - if activated { - return nil, errors.New("trust anchor has already been used for attestation") - } + // the ante handler verifies that the MachineID exists. Additional result checks got moved to the ante-handler + // and removed from here due to inconsistency or checking the same thing over and over again. + ta, _, _ := k.GetTrustAnchor(ctx, msg.Machine.MachineId) - isValidMachineId, err := util.ValidateSignature(msg.Machine.MachineId, msg.Machine.MachineIdSignature, msg.Machine.MachineId) - if !isValidMachineId { + isValidMachineID, err := util.ValidateSignature(msg.Machine.MachineId, msg.Machine.MachineIdSignature, msg.Machine.MachineId) + if !isValidMachineID { return nil, err } isValidIssuerPlanetmint := validateExtendedPublicKey(msg.Machine.IssuerPlanetmint, config.PlmntNetParams) if !isValidIssuerPlanetmint { - return nil, errors.New("invalid planetmint key") + return nil, errorsmod.Wrap(types.ErrInvalidKey, "planetmint") } isValidIssuerLiquid := validateExtendedPublicKey(msg.Machine.IssuerLiquid, config.LiquidNetParams) if !isValidIssuerLiquid { - return nil, errors.New("invalid liquid key") + return nil, errorsmod.Wrap(types.ErrInvalidKey, "liquid") } - if k.isNFTCreationRequest(msg.Machine) { - err := k.issueMachineNFT(msg.Machine) - if err != nil { - return nil, errors.New("an error occurred while issuing the machine NFT") - } + + 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, errors.New("the machine type has to be defined") + return nil, types.ErrMachineTypeUndefined } k.StoreMachine(ctx, *msg.Machine) @@ -75,24 +74,48 @@ func validateExtendedPublicKey(issuer string, cfg chaincfg.Params) bool { return isValidExtendedPublicKey } -func (k msgServer) issueMachineNFT(machine *types.Machine) error { +func (k msgServer) issueNFTAsset(ctx sdk.Context, name string, machineAddress string) (assetID string, contract string, err error) { conf := config.GetConfig() - client := osc.NewClient(conf.WatchmenEndpoint, conf.WatchmenPort) - machine_precision := strconv.FormatInt(int64(machine.Precision), 10) - machine_amount := strconv.FormatInt(int64(machine.Amount), 10) - machine_type := strconv.FormatUint(uint64(machine.GetType()), 10) - - msg := osc.NewMessage("/rddl/issue") - msg.Append(machine.Name) - msg.Append(machine.Ticker) - msg.Append(machine.Domain) - msg.Append(machine_amount) - msg.Append("1") - msg.Append(machine_precision) - msg.Append(machine.Metadata.GetAdditionalDataCID()) - msg.Append(machine.GetIssuerPlanetmint()) - msg.Append(machine_type) - err := client.Send(msg) + logger := ctx.Logger() + + cmdName := "poetry" + cmdArgs := []string{"run", "python", "issuer_service/issue2liquid.py", name, machineAddress} + + // Create a new command + cmd := exec.Command(cmdName, cmdArgs...) + + // If you want to set the working directory + cmd.Dir = conf.IssuanceServiceDir + + // Capture the output + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + + // Execute the command + err = cmd.Run() + if err != nil { + logger.Error("cmd.Run() failed with %s\n", err) + err = errorsmod.Wrap(types.ErrMachineNFTIssuance, stderr.String()) + } else { + lines := strings.Split(stdout.String(), "\n") + if len(lines) == 3 { + assetID = lines[0] + contract = lines[1] + } else { + err = errorsmod.Wrap(types.ErrMachineNFTIssuanceNoOutput, stderr.String()) + } + } + 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) } diff --git a/x/machine/keeper/msg_server_register_trust_anchor.go b/x/machine/keeper/msg_server_register_trust_anchor.go index 1b686e67..b71d6c2b 100644 --- a/x/machine/keeper/msg_server_register_trust_anchor.go +++ b/x/machine/keeper/msg_server_register_trust_anchor.go @@ -3,7 +3,6 @@ package keeper import ( "context" "encoding/hex" - "errors" "github.com/planetmint/planetmint-go/x/machine/types" @@ -15,12 +14,12 @@ func (k msgServer) RegisterTrustAnchor(goCtx context.Context, msg *types.MsgRegi isValidTrustAnchorPubkey := validatePublicKey(msg.TrustAnchor.Pubkey) if !isValidTrustAnchorPubkey { - return nil, errors.New("invalid trust anchor pubkey") + return nil, types.ErrInvalidTrustAnchorKey } _, _, found := k.GetTrustAnchor(ctx, msg.TrustAnchor.Pubkey) if found { - return nil, errors.New("trust anchor is already registered") + return nil, types.ErrTrustAnchorAlreadyRegistered } err := k.StoreTrustAnchor(ctx, *msg.TrustAnchor, false) diff --git a/x/machine/keeper/msg_server_test.go b/x/machine/keeper/msg_server_test.go index 417f1e98..cddae717 100644 --- a/x/machine/keeper/msg_server_test.go +++ b/x/machine/keeper/msg_server_test.go @@ -52,7 +52,7 @@ func TestMsgServerAttestMachineInvalidLiquidKey(t *testing.T) { _, err := msgServer.RegisterTrustAnchor(ctx, taMsg) assert.NoError(t, err) _, err = msgServer.AttestMachine(ctx, msg) - assert.EqualError(t, err, "invalid liquid key") + assert.EqualError(t, err, "liquid: invalid key") } func TestMsgServerRegisterTrustAnchor(t *testing.T) { diff --git a/x/machine/keeper/params.go b/x/machine/keeper/params.go index 3b8d724b..5ace3064 100644 --- a/x/machine/keeper/params.go +++ b/x/machine/keeper/params.go @@ -6,7 +6,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/machine/keeper/trust_anchor.go b/x/machine/keeper/trust_anchor.go index 691088a0..da0cb8e5 100644 --- a/x/machine/keeper/trust_anchor.go +++ b/x/machine/keeper/trust_anchor.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/hex" "errors" + "github.com/planetmint/planetmint-go/x/machine/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -18,21 +19,21 @@ func (k Keeper) StoreTrustAnchor(ctx sdk.Context, ta types.TrustAnchor, activate } else { appendValue = []byte{0} } - pubKey_bytes, err := getTrustAnchorBytes(ta.Pubkey) + pubKeyBytes, err := getTrustAnchorBytes(ta.Pubkey) if err != nil { return errors.New("the given public key could not be decoded (malformed string)") } - store.Set(pubKey_bytes, appendValue) + store.Set(pubKeyBytes, appendValue) return nil } func (k Keeper) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustAnchor, activated bool, found bool) { store := prefix.NewStore(ctx.KVStore(k.taStoreKey), types.KeyPrefix(types.TrustAnchorKey)) - pubKey_bytes, err := getTrustAnchorBytes(pubKey) + pubKeyBytes, err := getTrustAnchorBytes(pubKey) if err != nil { return val, false, false } - trustAnchorActivated := store.Get(pubKey_bytes) + trustAnchorActivated := store.Get(pubKeyBytes) if trustAnchorActivated == nil { return val, false, false @@ -42,9 +43,8 @@ func (k Keeper) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustA val.Pubkey = pubKey if trustAnchorActivated[0] == 1 { return val, true, true - } else { - return val, false, true } + return val, false, true } func getTrustAnchorBytes(pubKey string) ([]byte, error) { diff --git a/x/machine/module.go b/x/machine/module.go index 8e574d92..f6c21123 100644 --- a/x/machine/module.go +++ b/x/machine/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -60,7 +61,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) diff --git a/x/machine/module_simulation.go b/x/machine/module_simulation.go index 1330ef98..171b1f29 100644 --- a/x/machine/module_simulation.go +++ b/x/machine/module_simulation.go @@ -89,7 +89,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp } // ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { +func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ simulation.NewWeightedProposalMsg( opWeightMsgAttestMachine, diff --git a/x/machine/simulation/attest_machine.go b/x/machine/simulation/attest_machine.go index 1fccdeb9..500b7587 100644 --- a/x/machine/simulation/attest_machine.go +++ b/x/machine/simulation/attest_machine.go @@ -11,9 +11,9 @@ import ( ) func SimulateMsgAttestMachine( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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) { diff --git a/x/machine/simulation/register_trust_anchor.go b/x/machine/simulation/register_trust_anchor.go index d341128e..00fb60ca 100644 --- a/x/machine/simulation/register_trust_anchor.go +++ b/x/machine/simulation/register_trust_anchor.go @@ -11,9 +11,9 @@ import ( ) func SimulateMsgRegisterTrustAnchor( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, + _ types.AccountKeeper, + _ types.BankKeeper, + _ 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) { diff --git a/x/machine/types/errors.go b/x/machine/types/errors.go index 74533e28..3dea164a 100644 --- a/x/machine/types/errors.go +++ b/x/machine/types/errors.go @@ -8,8 +8,18 @@ import ( // x/machine module sentinel errors var ( - ErrMachineNotFound = errorsmod.Register(ModuleName, 2, "machine not found") - ErrTrustAnchorNotFound = errorsmod.Register(ModuleName, 3, "trust anchor not found") - ErrTrustAnchorAlreadyInUse = errorsmod.Register(ModuleName, 4, "trust anchor already in use") - ErrMachineIsNotCreator = errorsmod.Register(ModuleName, 5, "the machine.address is no the message creator address") + ErrMachineNotFound = errorsmod.Register(ModuleName, 2, "machine not found") + ErrTrustAnchorNotFound = errorsmod.Register(ModuleName, 3, "trust anchor not found") + ErrTrustAnchorAlreadyInUse = errorsmod.Register(ModuleName, 4, "trust anchor already in use") + ErrMachineIsNotCreator = errorsmod.Register(ModuleName, 5, "the machine.address is no the message creator address") + ErrInvalidKey = errorsmod.Register(ModuleName, 6, "invalid key") + ErrNFTIssuanceFailed = errorsmod.Register(ModuleName, 7, "an error occurred while issuing the machine NFT") + ErrMachineTypeUndefined = errorsmod.Register(ModuleName, 8, "the machine type has to be defined") + ErrInvalidTrustAnchorKey = errorsmod.Register(ModuleName, 9, "invalid trust anchor pubkey") + ErrTrustAnchorAlreadyRegistered = errorsmod.Register(ModuleName, 10, "trust anchor is already registered") + ErrMachineNFTIssuance = errorsmod.Register(ModuleName, 11, "the machine NFT could not be issued") + ErrMachineNFTIssuanceNoOutput = errorsmod.Register(ModuleName, 12, "the machine NFT issuing process derivated") + ErrAssetRegistryReqFailure = errorsmod.Register(ModuleName, 13, "request to asset registry could not be created") + ErrAssetRegistryReqSending = errorsmod.Register(ModuleName, 14, "request to asset registry could not be sent") + ErrAssetRegistryRepsonse = errorsmod.Register(ModuleName, 15, "request response issue") ) diff --git a/x/machine/types/query.pb.go b/x/machine/types/query.pb.go index 4fb3ef81..3d8dfb83 100644 --- a/x/machine/types/query.pb.go +++ b/x/machine/types/query.pb.go @@ -399,45 +399,44 @@ func init() { func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) } var fileDescriptor_bf7841d43d757203 = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x6b, 0x13, 0x41, - 0x18, 0xcd, 0x16, 0x4d, 0xed, 0xf4, 0x36, 0x8d, 0x10, 0x96, 0xb8, 0x4d, 0xe7, 0x14, 0x05, 0x33, - 0xb4, 0xa1, 0x8d, 0xda, 0x83, 0x26, 0x17, 0x0f, 0x52, 0x48, 0xd7, 0x1e, 0xa4, 0x22, 0xcb, 0xec, - 0x66, 0xd8, 0x2c, 0x26, 0x3b, 0xdb, 0x9d, 0xd9, 0xe2, 0x12, 0x72, 0xf1, 0x17, 0x08, 0xde, 0xfc, - 0x27, 0xfe, 0x00, 0xa1, 0xc7, 0x82, 0x17, 0x4f, 0xa2, 0x89, 0xf8, 0x3b, 0x24, 0xb3, 0xb3, 0x49, - 0x4a, 0xd6, 0x90, 0xa5, 0xa7, 0x4c, 0xbe, 0xbc, 0xf7, 0xbe, 0xf7, 0x66, 0xbe, 0x2f, 0xa0, 0x1a, - 0xf4, 0x89, 0x4f, 0xc5, 0xc0, 0xf3, 0x85, 0xcb, 0xf0, 0x80, 0x38, 0x3d, 0xcf, 0xa7, 0xf8, 0x22, - 0xa2, 0x61, 0x5c, 0x0f, 0x42, 0x26, 0x18, 0x2c, 0x2d, 0x22, 0xea, 0x0a, 0xa1, 0x97, 0x5c, 0xe6, - 0x32, 0x09, 0xc0, 0xd3, 0x53, 0x82, 0xd5, 0x2b, 0x2e, 0x63, 0x6e, 0x9f, 0x62, 0x12, 0x78, 0x98, - 0xf8, 0x3e, 0x13, 0x44, 0x78, 0xcc, 0xe7, 0xea, 0xd7, 0x47, 0x0e, 0xe3, 0x03, 0xc6, 0xb1, 0x4d, - 0xb8, 0x6a, 0x81, 0x2f, 0xf7, 0x6d, 0x2a, 0xc8, 0x3e, 0x0e, 0x88, 0xeb, 0xf9, 0x12, 0xac, 0xb0, - 0x7b, 0x99, 0xbe, 0x02, 0x12, 0x92, 0x41, 0x2a, 0x87, 0x32, 0x21, 0xea, 0x33, 0xc1, 0xa0, 0x12, - 0x80, 0xa7, 0xd3, 0x46, 0x1d, 0x49, 0x34, 0xe9, 0x45, 0x44, 0xb9, 0x40, 0xa7, 0x60, 0xe7, 0x46, - 0x95, 0x07, 0xcc, 0xe7, 0x14, 0x3e, 0x03, 0xc5, 0xa4, 0x41, 0x59, 0xab, 0x6a, 0xb5, 0xed, 0x83, - 0x4a, 0x3d, 0x2b, 0x7a, 0x3d, 0x61, 0xb5, 0xef, 0x5c, 0xfd, 0xdc, 0x2d, 0x98, 0x8a, 0x81, 0x5a, - 0x60, 0x4f, 0x4a, 0xbe, 0xa4, 0xe2, 0x24, 0xc1, 0xb5, 0xe3, 0x4e, 0x64, 0xf7, 0x3d, 0xe7, 0x15, - 0x8d, 0x55, 0x5f, 0x58, 0x01, 0x5b, 0x41, 0x5a, 0x93, 0x3d, 0xb6, 0xcc, 0x79, 0x01, 0xbd, 0x03, - 0x68, 0x95, 0x84, 0x32, 0xd9, 0x04, 0x9b, 0xca, 0x88, 0x72, 0xf9, 0x20, 0xdb, 0xa5, 0x92, 0x30, - 0x53, 0x34, 0x7a, 0x01, 0xaa, 0xa9, 0xfc, 0x59, 0x18, 0x71, 0xd1, 0xf2, 0x9d, 0x1e, 0x0b, 0x5f, - 0x0b, 0x22, 0x22, 0xbe, 0x60, 0x50, 0xc1, 0xbd, 0x6e, 0x6a, 0x70, 0x56, 0x40, 0xce, 0x3c, 0x63, - 0x86, 0x82, 0xf2, 0xb7, 0x52, 0x02, 0x56, 0xc1, 0xb6, 0xc7, 0x89, 0x23, 0xbc, 0x4b, 0x22, 0x68, - 0xb7, 0xbc, 0x51, 0xd5, 0x6a, 0xf7, 0xcc, 0xc5, 0x12, 0x3a, 0x06, 0xbb, 0x4b, 0xb7, 0xd0, 0xea, - 0x76, 0x43, 0xca, 0x67, 0x2e, 0xcb, 0x60, 0x93, 0x24, 0x15, 0xd5, 0x20, 0xfd, 0x8a, 0xde, 0xce, - 0x33, 0x2e, 0x93, 0x6f, 0x79, 0x81, 0x07, 0x5f, 0x8b, 0xe0, 0xae, 0x54, 0x87, 0x5f, 0x34, 0x50, - 0x4c, 0xa6, 0x00, 0xd6, 0xb2, 0xc9, 0xcb, 0x43, 0xa7, 0x3f, 0x5c, 0x03, 0x99, 0x58, 0x44, 0xc7, - 0x1f, 0xbf, 0xff, 0xf9, 0xbc, 0x71, 0x08, 0x1b, 0xd8, 0xf5, 0x44, 0x2f, 0xb2, 0xeb, 0x0e, 0x1b, - 0xe0, 0x39, 0x7b, 0xe1, 0xf8, 0x78, 0x69, 0x39, 0xe0, 0x5f, 0x0d, 0xdc, 0xcf, 0x1c, 0x21, 0xd8, - 0x5c, 0xe1, 0x60, 0xd5, 0xdc, 0xea, 0x4f, 0xf2, 0x13, 0x55, 0x92, 0x73, 0x99, 0xe4, 0x0c, 0x9a, - 0xb9, 0x92, 0xb8, 0x54, 0x58, 0xea, 0x6c, 0xd9, 0xb1, 0x95, 0xac, 0x88, 0xf5, 0x9e, 0xc6, 0x78, - 0x38, 0x5b, 0x97, 0x11, 0xfc, 0xad, 0x81, 0x52, 0xd6, 0x28, 0xc2, 0xa3, 0xd5, 0x76, 0xff, 0x37, - 0xfd, 0x7a, 0x33, 0x37, 0x4f, 0xa5, 0x7c, 0x23, 0x53, 0x9a, 0xb0, 0x93, 0x3b, 0xa5, 0x98, 0x6a, - 0x5a, 0x44, 0x8a, 0x5a, 0x5c, 0xaa, 0xe2, 0xe1, 0x6c, 0x5d, 0x46, 0xf0, 0x9b, 0x06, 0x76, 0x32, - 0x86, 0x19, 0x1e, 0xae, 0xf9, 0x22, 0x37, 0x37, 0x47, 0x3f, 0xca, 0x4b, 0x53, 0x01, 0x9f, 0xcb, - 0x80, 0x4f, 0x61, 0x73, 0xbd, 0x07, 0x53, 0xeb, 0x88, 0x87, 0xea, 0x30, 0x6a, 0x9f, 0x5c, 0x8d, - 0x0d, 0xed, 0x7a, 0x6c, 0x68, 0xbf, 0xc6, 0x86, 0xf6, 0x69, 0x62, 0x14, 0xae, 0x27, 0x46, 0xe1, - 0xc7, 0xc4, 0x28, 0x9c, 0x37, 0xd6, 0xb9, 0xb2, 0x0f, 0xb3, 0x4e, 0x22, 0x0e, 0x28, 0xb7, 0x8b, - 0xf2, 0xdf, 0xbd, 0xf1, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x26, 0xcc, 0xd3, 0xe4, 0xbe, 0x06, 0x00, - 0x00, + // 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, 0xf3, 0xba, 0x14, 0x93, 0xd0, 0xc7, 0x24, 0x08, 0x98, + 0x20, 0xc2, 0x67, 0x01, 0x57, 0xbf, 0xde, 0x77, 0x19, 0xef, 0x31, 0x8e, 0x1d, 0xc2, 0xd5, 0x0a, + 0x7c, 0x79, 0xe0, 0x50, 0x41, 0x0e, 0x70, 0x48, 0x3c, 0x3f, 0x90, 0x60, 0x85, 0xdd, 0xd7, 0xfa, + 0x0a, 0x49, 0x44, 0x7a, 0x99, 0x1c, 0xd2, 0x42, 0xd4, 0x67, 0x8a, 0x41, 0x05, 0x00, 0xcf, 0x27, + 0x8b, 0xce, 0x24, 0xb1, 0x45, 0x2f, 0x62, 0xca, 0x05, 0x3a, 0x07, 0xbb, 0xd7, 0xa6, 0x3c, 0x64, + 0x01, 0xa7, 0xf0, 0x09, 0xc8, 0xa7, 0x0b, 0x8a, 0x46, 0xd9, 0xa8, 0xec, 0x1c, 0x96, 0xaa, 0xba, + 0xe8, 0xd5, 0x94, 0xd5, 0xbc, 0x35, 0xfc, 0xb9, 0x97, 0x6b, 0x29, 0x06, 0x6a, 0x80, 0x7d, 0x29, + 0xf9, 0x82, 0x8a, 0xd3, 0x14, 0xd7, 0x4c, 0xce, 0x62, 0xa7, 0xeb, 0xbb, 0x2f, 0x69, 0xa2, 0xf6, + 0xc2, 0x12, 0xd8, 0x0e, 0xb3, 0x99, 0xdc, 0xb1, 0xdd, 0x9a, 0x0d, 0xd0, 0x3b, 0x80, 0x96, 0x49, + 0x28, 0x93, 0x75, 0xb0, 0xa5, 0x8c, 0x28, 0x97, 0x77, 0xf5, 0x2e, 0x95, 0x44, 0x2b, 0x43, 0xa3, + 0xe7, 0xa0, 0x9c, 0xc9, 0xbf, 0x8e, 0x62, 0x2e, 0x1a, 0x81, 0xdb, 0x61, 0xd1, 0x2b, 0x41, 0x44, + 0xcc, 0xe7, 0x0c, 0x2a, 0xb8, 0xdf, 0xce, 0x0c, 0x4e, 0x07, 0xc8, 0x9d, 0x65, 0xd4, 0x28, 0x28, + 0x7f, 0x4b, 0x25, 0x60, 0x19, 0xec, 0xf8, 0x9c, 0xb8, 0xc2, 0xbf, 0x24, 0x82, 0xb6, 0x8b, 0x1b, + 0x65, 0xa3, 0x72, 0xbb, 0x35, 0x3f, 0x42, 0x27, 0x60, 0x6f, 0xe1, 0x16, 0x1a, 0xed, 0x76, 0x44, + 0xf9, 0xd4, 0x65, 0x11, 0x6c, 0x91, 0x74, 0xa2, 0x16, 0x64, 0x5f, 0xd1, 0xdb, 0x59, 0xc6, 0x45, + 0xf2, 0x7f, 0x5e, 0xe0, 0xe1, 0x9f, 0x4d, 0xb0, 0x29, 0xd5, 0xe1, 0x47, 0x03, 0xe4, 0xd3, 0x16, + 0xc0, 0x8a, 0x9e, 0xbc, 0x58, 0x3a, 0xf3, 0xde, 0x0a, 0xc8, 0xd4, 0x22, 0x42, 0x9f, 0xbe, 0xff, + 0xfe, 0xb2, 0x51, 0x82, 0x26, 0x9e, 0x51, 0xfe, 0x79, 0x06, 0xe0, 0x37, 0x03, 0xdc, 0xd1, 0x36, + 0x05, 0xd6, 0x97, 0x2c, 0x5a, 0x56, 0x4f, 0xf3, 0xf1, 0xfa, 0x44, 0x65, 0xb8, 0x21, 0x0d, 0x9f, + 0xc0, 0x63, 0x9d, 0x61, 0x8f, 0x0a, 0x5b, 0x9d, 0x6d, 0x27, 0xb1, 0xd3, 0xc2, 0xdb, 0xef, 0x69, + 0x82, 0xfb, 0xd3, 0xf2, 0x0f, 0xe0, 0xd0, 0x00, 0x05, 0x5d, 0xb1, 0x60, 0x6d, 0xb9, 0xab, 0x9b, + 0xba, 0x6c, 0xd6, 0xd7, 0xe6, 0xa9, 0x30, 0xcf, 0x64, 0x98, 0x63, 0x58, 0xbf, 0x29, 0x8c, 0x98, + 0x50, 0x6d, 0x22, 0xb9, 0x36, 0x97, 0x64, 0xdc, 0x9f, 0x76, 0x7c, 0x00, 0xbf, 0x1a, 0x60, 0x57, + 0xd3, 0x40, 0xf8, 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, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/machine/types/query.pb.gw.go b/x/machine/types/query.pb.gw.go index 73a943eb..abf6b4e0 100644 --- a/x/machine/types/query.pb.gw.go +++ b/x/machine/types/query.pb.gw.go @@ -436,13 +436,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"github.com", "planetmint", "planetmint-go", "machine", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "machine", "params"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetMachineByPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"github.com", "planetmint", "planetmint-go", "machine", "get_machine_by_public_key", "publicKey"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetMachineByPublicKey_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_public_key", "publicKey"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetTrustAnchorStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"github.com", "planetmint", "planetmint-go", "machine", "get_trust_anchor_status", "machineid"}, "", runtime.AssumeColonVerbOpt(true))) + 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-go", "machine", "get_machine_by_address", "address"}, "", 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))) ) var (