mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-03 20:56:38 +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 (
|
||||
"context"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/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) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
// TODO: Handling the message
|
||||
_ = ctx
|
||||
reissuance, found := k.GetReissuance(ctx, msg.GetBlockHeight())
|
||||
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
|
||||
}
|
||||
|
@ -13,4 +13,8 @@ var (
|
||||
ErrTransferFailed = errorsmod.Register(ModuleName, 4, "transfer failed")
|
||||
ErrInvalidAddress = errorsmod.Register(ModuleName, 5, "invalid address")
|
||||
ErrAlreadyMinted = errorsmod.Register(ModuleName, 6, "already minted")
|
||||
ErrWrongBlockHeight = errorsmod.Register(ModuleName, 7, "wrong block height")
|
||||
ErrReissuanceNotFound = errorsmod.Register(ModuleName, 8, "reissuance not found")
|
||||
ErrInvalidProposer = errorsmod.Register(ModuleName, 9, "invalid proposer")
|
||||
ErrTXAlreadySet = errorsmod.Register(ModuleName, 10, "tx already set")
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user