planetmint-go/x/dao/keeper/msg_server_init_pop.go
Jürgen Eckel 6a60b78b62
Added PoP Initialization and a Challenge Query (#207)
* added InitPoP message
* added getChallenge query to inspect challenges
* adjusted towards a unique block height identification unit: int64, not uint64
* added challenge param finished to identify challenges that weren't completed but will be part of re-issuance.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-29 13:33:25 +01:00

23 lines
556 B
Go

package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func (k msgServer) InitPop(goCtx context.Context, msg *types.MsgInitPop) (*types.MsgInitPopResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
var challenge types.Challenge
challenge.Initiator = msg.GetInitiator()
challenge.Challengee = msg.GetChallengee()
challenge.Challenger = msg.GetChallenger()
challenge.Height = msg.GetHeight()
k.StoreChallenge(ctx, challenge)
return &types.MsgInitPopResponse{}, nil
}