mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-14 10:06:38 +00:00

In the beginning we wanted to send the raw transaction to elements, but what we ended up doing is to send the command like: ``` "reissueasset assetID amount" ``` to elements-cli/elements-rpc. Closes #226 Signed-off-by: Julian Strobl <jmastr@mailbox.org>
39 lines
1.4 KiB
Go
39 lines
1.4 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"
|
|
)
|
|
|
|
var (
|
|
reissueTag = "reissue: "
|
|
)
|
|
|
|
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, reissueTag+"asset: "+msg.GetCommand())
|
|
txID, err := util.ReissueAsset(msg.Command)
|
|
if err != nil {
|
|
util.GetAppLogger().Error(ctx, reissueTag+"asset reissuance failed: "+err.Error())
|
|
}
|
|
// 3. notarize result by notarizing the liquid tx-id
|
|
util.SendReissuanceResult(goCtx, msg.GetProposer(), txID, msg.GetBlockHeight())
|
|
} else {
|
|
util.GetAppLogger().Error(ctx, reissueTag+"failed. valid result: %v proposer: %s validator identity: %s", validResult, msg.Proposer, validatorIdentity)
|
|
}
|
|
|
|
var reissuance types.Reissuance
|
|
reissuance.BlockHeight = msg.GetBlockHeight()
|
|
reissuance.Proposer = msg.GetProposer()
|
|
reissuance.Command = msg.GetCommand()
|
|
reissuance.FirstIncludedPop = msg.GetFirstIncludedPop()
|
|
reissuance.LastIncludedPop = msg.GetLastIncludedPop()
|
|
k.StoreReissuance(ctx, reissuance)
|
|
return &types.MsgReissueRDDLProposalResponse{}, nil
|
|
}
|