utils

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeductFees

func DeductFees(supplyKeeper supply.Keeper, ctx sdk.Context, acc exported.Account, coinKeeper coin.Keeper, fee sdk.Coin, feeInBaseCoin sdk.Int) error

DeductFees deducts fees from the given account.

NOTE: We could use the BankKeeper (in addition to the AccountKeeper, because the BankKeeper doesn't give us accounts), but it seems easier to do this.

func GetSignerAcc added in v1.2.12

func GetSignerAcc(ctx sdk.Context, ak keeper.AccountKeeper, addr sdk.AccAddress) (exported.Account, error)

GetSignerAcc returns an account for a given address that is expected to sign a transaction.

func NewGasMeter

func NewGasMeter(limit sdk.Gas) sdk.GasMeter

NewGasMeter returns a reference to a new gasMeter.

func SetGasMeter

func SetGasMeter(simulate bool, ctx sdk.Context, gasLimit uint64) sdk.Context

SetGasMeter returns a new context with a gas meter set from a given context.

Types

type CountMsgDecorator

type CountMsgDecorator struct {
}

func NewCountMsgDecorator

func NewCountMsgDecorator() CountMsgDecorator

func (CountMsgDecorator) AnteHandle

func (cd CountMsgDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

type FeeDecorator

type FeeDecorator struct {
	// contains filtered or unexported fields
}

func NewFeeDecorator

func NewFeeDecorator(ck coin.Keeper, sk supply.Keeper, ak auth.AccountKeeper, vk validator.Keeper) FeeDecorator

NewSetUpContextDecorator creates new SetUpContextDecorator.

func (FeeDecorator) AnteHandle

func (fd FeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle implements sdk.AnteHandler function.

type FeeTx

type FeeTx interface {
	sdk.Tx
	GetGas() uint64
	GetFee() sdk.Coins
	FeePayer() sdk.AccAddress
}

FeeTx defines the interface to be implemented by Tx to use the FeeDecorators

type GasTx

type GasTx interface {
	sdk.Tx
	GetGas() uint64
}

GasTx defines a Tx with a GetGas() method which is needed to use SetUpContextDecorator

type PostCreateAccountDecorator

type PostCreateAccountDecorator struct {
	// contains filtered or unexported fields
}

PostCreateAccountDecorator restores account number in case of check redeeming from account unknown for the blockchain.

func NewPostCreateAccountDecorator

func NewPostCreateAccountDecorator(ak auth.AccountKeeper) PostCreateAccountDecorator

NewPostCreateAccountDecorator creates new PostCreateAccountDecorator.

func (PostCreateAccountDecorator) AnteHandle

func (cad PostCreateAccountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle implements sdk.AnteHandler function.

type PreCreateAccountDecorator

type PreCreateAccountDecorator struct {
	// contains filtered or unexported fields
}

PreCreateAccountDecorator creates account in case of check redeeming from account unknown in the blockchain. Such accounts sign their first transaction with account number equal to 0. This is the reason why creating account is divided in two parts (PreCreateAccountDecorator and PostCreateAccountDecorator): it is necessary to create account in the beginning of the Ante chain with account number 0, but just before the end of the Ante chain it is necessary to restore correct account number.

func NewPreCreateAccountDecorator

func NewPreCreateAccountDecorator(ak auth.AccountKeeper) PreCreateAccountDecorator

NewPreCreateAccountDecorator creates new PreCreateAccountDecorator.

func (PreCreateAccountDecorator) AnteHandle

func (cad PreCreateAccountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle implements sdk.AnteHandler function.

type SetUpContextDecorator

type SetUpContextDecorator struct{}

SetUpContextDecorator sets the GasMeter in the Context and wraps the next AnteHandler with a defer clause to recover from any downstream OutOfGas panics in the AnteHandler chain to return an error with information on gas provided and gas used. CONTRACT: Must be first decorator in the chain CONTRACT: Tx must implement GasTx interface

func NewSetUpContextDecorator

func NewSetUpContextDecorator() SetUpContextDecorator

NewSetUpContextDecorator creates new SetUpContextDecorator.

func (SetUpContextDecorator) AnteHandle

func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle implements sdk.AnteHandler function.

type SigVerificationDecorator added in v1.2.12

type SigVerificationDecorator struct {
	// contains filtered or unexported fields
}

Verify all signatures for a tx and return an error if any are invalid. Note, the SigVerificationDecorator decorator will not get executed on ReCheck.

CONTRACT: Pubkeys are set in context for all signers before this decorator runs CONTRACT: Tx must implement SigVerifiableTx interface

func NewSigVerificationDecorator added in v1.2.12

func NewSigVerificationDecorator(ak keeper.AccountKeeper) SigVerificationDecorator

func (SigVerificationDecorator) AnteHandle added in v1.2.12

func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

Directories

Path Synopsis
Package math provides integer math utilities.
Package math provides integer math utilities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL