ante

package
v3.0.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IBCRegexp = regexp.MustCompile("^ibc/[a-fA-F0-9]{64}$")

Functions

func DeductFees

func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins) error

DeductFees deducts fees from the given account.

func FilterMsgAndComputeTax

func FilterMsgAndComputeTax(ctx sdk.Context, tk TreasuryKeeper, msgs ...sdk.Msg) sdk.Coins

FilterMsgAndComputeTax computes the stability tax on messages.

func HandleCheckMinInitialDeposit

func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper govkeeper.Keeper, treasuryKeeper TreasuryKeeper) (err error)

HandleCheckMinInitialDeposit

func IsMsgSubmitProposal

func IsMsgSubmitProposal(msg sdk.Msg) bool

IsMsgSubmitProposal checks whether the input msg is a MsgSubmitProposal

func NewAnteHandler

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)

NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.

Types

type BankKeeper

type BankKeeper interface {
	IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error
	SendCoins(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the contract needed for supply related APIs (noalias)

type DistrKeeper

type DistrKeeper interface {
	FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
	GetFeePool(ctx sdk.Context) distributiontypes.FeePool
}

type FeeDecorator

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

FeeDecorator deducts fees from the first signer of the tx If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error Call next AnteHandler if fees successfully deducted CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator

func (FeeDecorator) AnteHandle

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

func (FeeDecorator) BurnTaxSplit

func (fd FeeDecorator) BurnTaxSplit(ctx sdk.Context, taxes sdk.Coins) (err error)

BurnTaxSplit splits

type GovKeeper

type GovKeeper interface {
	GetDepositParams(ctx sdk.Context) govv1.DepositParams
}

type HandlerOptions

type HandlerOptions struct {
	AccountKeeper          ante.AccountKeeper
	BankKeeper             BankKeeper
	ExtensionOptionChecker ante.ExtensionOptionChecker
	FeegrantKeeper         ante.FeegrantKeeper
	OracleKeeper           OracleKeeper
	TreasuryKeeper         TreasuryKeeper
	SignModeHandler        signing.SignModeHandler
	SigGasConsumer         ante.SignatureVerificationGasConsumer
	TxFeeChecker           ante.TxFeeChecker
	IBCKeeper              ibckeeper.Keeper
	DistributionKeeper     distributionkeeper.Keeper
	GovKeeper              govkeeper.Keeper
	WasmConfig             *wasmtypes.WasmConfig
	TXCounterStoreKey      storetypes.StoreKey
	DyncommKeeper          dyncommkeeper.Keeper
	StakingKeeper          *stakingkeeper.Keeper
	Cdc                    codec.BinaryCodec
}

HandlerOptions are the options required for constructing a default SDK AnteHandler.

type MinInitialDepositDecorator

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

MinInitialDeposit Decorator will check Initial Deposits for MsgSubmitProposal

func NewMinInitialDepositDecorator

func NewMinInitialDepositDecorator(govKeeper govkeeper.Keeper, treasuryKeeper TreasuryKeeper) MinInitialDepositDecorator

NewMinInitialDeposit returns new min initial deposit decorator instance

func (MinInitialDepositDecorator) AnteHandle

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

AnteHandle handles checking MsgSubmitProposal

type OracleKeeper

type OracleKeeper interface {
	ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, validatorAddr sdk.ValAddress) error
}

OracleKeeper for feeder validation

type SpammingPreventionDecorator

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

SpammingPreventionDecorator will check if the transaction's gas is smaller than configured hard cap

func NewSpammingPreventionDecorator

func NewSpammingPreventionDecorator(oracleKeeper OracleKeeper) SpammingPreventionDecorator

NewSpammingPreventionDecorator returns new spamming prevention decorator instance

func (SpammingPreventionDecorator) AnteHandle

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

AnteHandle handles msg tax fee checking

func (SpammingPreventionDecorator) CheckOracleSpamming

func (spd SpammingPreventionDecorator) CheckOracleSpamming(ctx sdk.Context, msgs []sdk.Msg) error

CheckOracleSpamming check whether the msgs are spamming purpose or not

type TreasuryKeeper

type TreasuryKeeper interface {
	RecordEpochTaxProceeds(ctx sdk.Context, delta sdk.Coins)
	GetTaxRate(ctx sdk.Context) (taxRate sdk.Dec)
	GetTaxCap(ctx sdk.Context, denom string) (taxCap sdk.Int)
	GetBurnSplitRate(ctx sdk.Context) sdk.Dec
	HasBurnTaxExemptionAddress(ctx sdk.Context, addresses ...string) bool
	HasBurnTaxExemptionContract(ctx sdk.Context, address string) bool
	GetMinInitialDepositRatio(ctx sdk.Context) sdk.Dec
}

TreasuryKeeper for tax charging & recording

Jump to

Keyboard shortcuts

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