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

* updated planetmint-go dependency in lib/tx * added two additional distribution addresses. splitted up the previous investor pool of 31% into three pools: * early investors 19% * investors 10% * strategic 2% * adjusted distribution request message * adjusted distribution result * adjusted distribution order * refactored reissuance and distribution msg methods to be more readable * fixed token distribution test case Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
41 lines
1.4 KiB
Go
41 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)
|
|
|
|
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)
|
|
|
|
validatorIdentity, validResult := util.GetValidatorCometBFTIdentity(ctx)
|
|
if !validResult || msg.Proposer != validatorIdentity {
|
|
util.GetAppLogger().Info(ctx, reissueTag+"Not the proposer. valid result: %t proposer: %s validator identity: %s", validResult, msg.Proposer, validatorIdentity)
|
|
return &types.MsgReissueRDDLProposalResponse{}, nil
|
|
}
|
|
|
|
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())
|
|
}
|
|
util.SendReissuanceResult(goCtx, msg.GetProposer(), txID, msg.GetBlockHeight())
|
|
|
|
return &types.MsgReissueRDDLProposalResponse{}, nil
|
|
}
|