mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-07 06:36:42 +00:00
added MsgReissueRDDLResult handling
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
87641aefe8
commit
8f76199214
@ -3,6 +3,7 @@ package keeper
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
errorsmod "cosmossdk.io/errors"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
)
|
)
|
||||||
@ -10,8 +11,21 @@ import (
|
|||||||
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
|
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
// TODO: Handling the message
|
reissuance, found := k.GetReissuance(ctx, msg.GetBlockHeight())
|
||||||
_ = ctx
|
if found != true {
|
||||||
|
return nil, errorsmod.Wrapf(types.ErrReissuanceNotFound, " for provided block height %u", msg.GetBlockHeight())
|
||||||
|
}
|
||||||
|
if reissuance.GetBlockHeight() != msg.GetBlockHeight() {
|
||||||
|
return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, " for provided block height %u", msg.GetBlockHeight())
|
||||||
|
}
|
||||||
|
if reissuance.GetProposer() != msg.GetProposer() {
|
||||||
|
return nil, errorsmod.Wrapf(types.ErrInvalidProposer, " for provided block height %u", msg.GetBlockHeight())
|
||||||
|
}
|
||||||
|
if reissuance.GetTxId() != "" {
|
||||||
|
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %u", msg.GetBlockHeight())
|
||||||
|
}
|
||||||
|
reissuance.TxId = msg.GetTxId()
|
||||||
|
k.StoreReissuance(ctx, reissuance)
|
||||||
|
|
||||||
return &types.MsgReissueRDDLResultResponse{}, nil
|
return &types.MsgReissueRDDLResultResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,8 @@ var (
|
|||||||
ErrTransferFailed = errorsmod.Register(ModuleName, 4, "transfer failed")
|
ErrTransferFailed = errorsmod.Register(ModuleName, 4, "transfer failed")
|
||||||
ErrInvalidAddress = errorsmod.Register(ModuleName, 5, "invalid address")
|
ErrInvalidAddress = errorsmod.Register(ModuleName, 5, "invalid address")
|
||||||
ErrAlreadyMinted = errorsmod.Register(ModuleName, 6, "already minted")
|
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")
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user