planetmint-go/x/dao/keeper/msg_server_reissue_rddl_proposal.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

31 lines
1.0 KiB
Go

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)
validatorIdentity, validResult := util.GetValidatorCometBFTIdentity(ctx)
if validResult && msg.Proposer == validatorIdentity {
util.GetAppLogger().Info(ctx, "REISSUE: Asset")
txID, err := util.ReissueAsset(msg.Tx)
if err != nil {
util.GetAppLogger().Error(ctx, "REISSUE: Asset reissuance failed: "+err.Error())
}
// 3. notarize result by notarizing the liquid tx-id
util.SendReissuanceResult(goCtx, msg.GetProposer(), txID, msg.GetBlockHeight())
}
var reissuance types.Reissuance
reissuance.BlockHeight = msg.GetBlockHeight()
reissuance.Proposer = msg.GetProposer()
reissuance.Rawtx = msg.GetTx()
k.StoreReissuance(ctx, reissuance)
return &types.MsgReissueRDDLProposalResponse{}, nil
}