ante

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BurnFeePortion int = iota
	RewardsFeePortion

	FeePortionCount
)
View Source
const (
	MsgCreateDidDoc int = iota
	MsgUpdateDidDoc
	MsgDeactivateDidDoc
	MsgCreateResourceDefault
	MsgCreateResourceImage
	MsgCreateResourceJSON

	TaxableMsgFeeCount
)
View Source
const (
	BurnFactorDid int = iota
	BurnFactorResource

	BurnFactorCount
)

Variables

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 GetBurnFeePortion

func GetBurnFeePortion(burnFactor sdk.Dec, fee sdk.Coins) sdk.Coins

func GetResourceTaxableMsgFee

func GetResourceTaxableMsgFee(ctx sdk.Context, msg *resourcetypes.MsgCreateResource) (sdk.Coins, sdk.Coins, bool)

func GetRewardPortion

func GetRewardPortion(total sdk.Coins, burnPortion sdk.Coins) sdk.Coins

func GetTaxableMsg

func GetTaxableMsg(msg interface{}) bool

func GetTaxableMsgFeeWithBurnPortion

func GetTaxableMsgFeeWithBurnPortion(ctx sdk.Context, msg interface{}) (sdk.Coins, sdk.Coins, bool)

func IsSufficientFee

func IsSufficientFee(ctx sdk.Context, tax, reward, burn, feeProvided sdk.Coins, gasRequested int64) (bool, int64, error)

func IsTaxableTx

func IsTaxableTx(ctx sdk.Context, didKeeper DidKeeper, resourceKeeper ResourceKeeper, tx sdk.Tx) (bool, sdk.Coins, sdk.Coins)

func IsTaxableTxLite

func IsTaxableTxLite(tx sdk.Tx) bool

func SumDistributionFee

func SumDistributionFee(distrFeeAlloc DistributionFeeAllocation) sdk.Coins

func ValidateDistributionFee

func ValidateDistributionFee(fee sdk.Coins, distrFeeAlloc DistributionFeeAllocation) error

Types

type BankKeeper

type BankKeeper interface {
	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, recipientModule string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

type BurnFactor

type BurnFactor = [BurnFactorCount]sdk.Dec

type DeductFeeDecorator

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

DeductFeeDecorator 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 (DeductFeeDecorator) AnteHandle

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

type DidKeeper

type DidKeeper interface {
	GetParams(ctx sdk.Context) (params didtypes.FeeParams)
}

type DistributionFeeAllocation

type DistributionFeeAllocation = [FeePortionCount]sdk.Coins

func GetDistributionFee

func GetDistributionFee(ctx sdk.Context, fee sdk.Coins, burnFeePortion sdk.Coins) (DistributionFeeAllocation, error)

type ResourceKeeper

type ResourceKeeper interface {
	GetParams(ctx sdk.Context) (params resourcetypes.FeeParams)
}

type TaxableMsgFee

type TaxableMsgFee = [TaxableMsgFeeCount]sdk.Coins

type TxFeeChecker

type TxFeeChecker func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error)

Jump to

Keyboard shortcuts

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