mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-27 07:48:29 +00:00
* distributed & result msgs * added DistributionResult * added RDDL token conversion methods * set proper validatoraddress within the testcases for e2e/dao * set proper root dir for test cases * fixed some wordings --------- Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
27 lines
812 B
Go
27 lines
812 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
errorsmod "cosmossdk.io/errors"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
|
)
|
|
|
|
func (k msgServer) DistributionResult(goCtx context.Context, msg *types.MsgDistributionResult) (*types.MsgDistributionResultResponse, error) {
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
|
|
distribution, found := k.LookupDistributionOrder(ctx, msg.GetLastPop())
|
|
if found {
|
|
distribution.DaoTxID = msg.DaoTxID
|
|
distribution.PopTxID = msg.PopTxID
|
|
distribution.InvestorTxID = msg.InvestorTxID
|
|
k.StoreDistributionOrder(ctx, distribution)
|
|
} else {
|
|
return nil, errorsmod.Wrapf(types.ErrDistributionNotFound, " for provided block height %s", strconv.FormatInt(msg.GetLastPop(), 10))
|
|
}
|
|
|
|
return &types.MsgDistributionResultResponse{}, nil
|
|
}
|