mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
added the ante hanlder pattern
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
b81cdb6dc9
commit
fa1b16ba58
@ -50,6 +50,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
|
||||
ante.NewValidateMemoDecorator(options.AccountKeeper),
|
||||
NewCheckMachineDecorator(options.MachineKeeper),
|
||||
NewCheckMintAddressDecorator(),
|
||||
NewCheckReissuanceDecorator(),
|
||||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
|
||||
NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
|
||||
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
|
||||
|
29
app/ante/check_reissuance_decorator.go
Normal file
29
app/ante/check_reissuance_decorator.go
Normal file
@ -0,0 +1,29 @@
|
||||
package ante
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
type CheckReissuanceDecorator struct {
|
||||
MintAddress string
|
||||
}
|
||||
|
||||
func NewCheckReissuanceDecorator() CheckReissuanceDecorator {
|
||||
return CheckReissuanceDecorator{}
|
||||
}
|
||||
|
||||
func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
|
||||
for _, msg := range tx.GetMsgs() {
|
||||
if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.NewMsgReissueRDDLProposal" {
|
||||
_, ok := msg.(*daotypes.MsgReissueRDDLProposal)
|
||||
//reissueMsg, ok := msg.(*daotypes.NewMsgReissueRDDLProposal)
|
||||
if ok {
|
||||
// TODO: verify if the messages related PoP (BlockHeight) reflects
|
||||
// what is actually traded within the raw transaction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return next(ctx, tx, simulate)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user