Documentation
¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func BalancedFractionalTotalInvariant(k Keeper) sdk.Invariant
- func FractionalDenomNotInBankInvariant(k Keeper) sdk.Invariant
- func NewQueryServerImpl(k Keeper) types.QueryServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func ReserveBacksFractionsInvariant(k Keeper) sdk.Invariant
- func TotalSupplyInvariant(k Keeper) sdk.Invariant
- func ValidFractionalAmountsInvariant(k Keeper) sdk.Invariant
- func ValidRemainderAmountInvariant(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) BurnCoins(goCtx context.Context, moduleName string, amt sdk.Coins) error
- func (k *Keeper) DeleteFractionalBalance(ctx sdk.Context, address sdk.AccAddress)
- func (k *Keeper) DeleteRemainderAmount(ctx sdk.Context)
- func (k Keeper) GetBalance(goCtx context.Context, addr sdk.AccAddress, denom string) sdk.Coin
- func (k *Keeper) GetFractionalBalance(ctx sdk.Context, address sdk.AccAddress) sdkmath.Int
- func (k *Keeper) GetRemainderAmount(ctx sdk.Context) sdkmath.Int
- func (k Keeper) GetSupply(ctx context.Context, denom string) sdk.Coin
- func (k *Keeper) GetTotalSumFractionalBalances(ctx sdk.Context) sdkmath.Int
- func (k Keeper) IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error
- func (k Keeper) IterateAccountBalances(ctx context.Context, account sdk.AccAddress, cb func(coin sdk.Coin) bool)
- func (k *Keeper) IterateFractionalBalances(ctx sdk.Context, ...)
- func (k Keeper) IterateTotalSupply(ctx context.Context, cb func(coin sdk.Coin) bool)
- func (k Keeper) MintCoins(goCtx context.Context, moduleName string, amt sdk.Coins) error
- func (k Keeper) SendCoins(goCtx context.Context, from, to sdk.AccAddress, amt sdk.Coins) error
- func (k Keeper) SendCoinsFromAccountToModule(goCtx context.Context, senderAddr sdk.AccAddress, recipientModule string, ...) error
- func (k Keeper) SendCoinsFromModuleToAccount(goCtx context.Context, senderModule string, recipientAddr sdk.AccAddress, ...) error
- func (k Keeper) SendCoinsFromModuleToModule(goCtx context.Context, senderModule string, recipientModule string, ...) error
- func (k *Keeper) SetFractionalBalance(ctx sdk.Context, address sdk.AccAddress, amount sdkmath.Int)
- func (k *Keeper) SetRemainderAmount(ctx sdk.Context, amount sdkmath.Int)
- func (k Keeper) SpendableCoin(goCtx context.Context, addr sdk.AccAddress, denom string) sdk.Coin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the X/precisebank module.
func BalancedFractionalTotalInvariant ¶
BalancedFractionalTotalInvariant checks that the sum of fractional balances and the remainder amount is divisible by the conversion factor without any leftover amount.
func FractionalDenomNotInBankInvariant ¶
FractionalDenomNotInBankInvariant checks that the bank does not hold any fractional denoms. These assets, e.g. aatom, should only exist in the x/precisebank module as this is a decimal extension of uatom that shares the same total supply and is effectively the same asset. uatom held by this module in x/bank backs all fractional balances in x/precisebank. If aatom somehow ends up in x/bank, then it would both break all expectations of this module as well as be double-counted in the total supply.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) types.QueryServer
NewQueryServerImpl creates a new server for handling gRPC queries.
func RegisterInvariants ¶
func RegisterInvariants( ir sdk.InvariantRegistry, k Keeper, )
RegisterInvariants registers the x/precisebank module invariants
func ReserveBacksFractionsInvariant ¶
ReserveBacksFractionsInvariant checks that the total amount of backing coins in the reserve is equal to the total amount of fractional balances, such that the backing is always available to redeem all fractional balances and there are no extra coins in the reserve that are not backing any fractional balances.
func TotalSupplyInvariant ¶
TotalSupplyInvariant checks that the total supply of the asset is equal to the sum of the fractional balances and the remainder amount.
func ValidFractionalAmountsInvariant ¶
ValidFractionalAmountsInvariant checks that all individual fractional balances are valid.
func ValidRemainderAmountInvariant ¶
ValidRemainderAmountInvariant checks that the remainder amount is valid.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper defines the precisebank module's keeper
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, bk types.BankKeeper, ak types.AccountKeeper, ) Keeper
NewKeeper creates a new keeper
func (Keeper) BurnCoins ¶
BurnCoins burns coins deletes coins from the balance of the module account. It will panic if the module account does not exist or is unauthorized.
func (*Keeper) DeleteFractionalBalance ¶
func (k *Keeper) DeleteFractionalBalance( ctx sdk.Context, address sdk.AccAddress, )
DeleteFractionalBalance deletes the fractional balance for an address.
func (*Keeper) DeleteRemainderAmount ¶
DeleteRemainderAmount deletes the internal remainder amount.
func (Keeper) GetBalance ¶
GetBalance returns the balance of a specific denom for an address. This will return the extended balance for the ExtendedCoinDenom, and the regular balance for all other denoms.
func (*Keeper) GetFractionalBalance ¶
GetFractionalBalance returns the fractional balance for an address.
func (*Keeper) GetRemainderAmount ¶
GetRemainderAmount returns the internal remainder amount.
func (*Keeper) GetTotalSumFractionalBalances ¶
GetTotalSumFractionalBalances returns the sum of all fractional balances.
func (Keeper) IsSendEnabledCoins ¶
IsSendEnabledCoins uses the parent x/bank keeper to check the coins provided and returns an ErrSendDisabled if any of the coins are not configured for sending. Returns nil if sending is enabled for all provided coin. Note: This method is not used directly by x/evm, but is still required as part of authtypes.BankKeeper. x/evm uses auth methods that require this interface.
func (Keeper) IterateAccountBalances ¶
func (*Keeper) IterateFractionalBalances ¶
func (k *Keeper) IterateFractionalBalances( ctx sdk.Context, cb func(address sdk.AccAddress, amount sdkmath.Int) (stop bool), )
IterateFractionalBalances iterates over all fractional balances in the store and performs a callback function.
func (Keeper) IterateTotalSupply ¶
func (Keeper) MintCoins ¶
MintCoins creates new coins from thin air and adds it to the module account. If ExtendedCoinDenom is provided, the corresponding fractional amount is added to the module state. It will panic if the module account does not exist or is unauthorized.
func (Keeper) SendCoins ¶
SendCoins transfers amt coins from a sending account to a receiving account. An error is returned upon failure. This handles transfers including ExtendedCoinDenom and supports non-ExtendedCoinDenom transfers by passing through to x/bank.
func (Keeper) SendCoinsFromAccountToModule ¶
func (k Keeper) SendCoinsFromAccountToModule( goCtx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error
SendCoinsFromModuleToModule transfers coins from a ModuleAccount to another. It will panic if either module account does not exist. An error is returned if the recipient module is the x/precisebank module account or if sending the tokens fails.
func (Keeper) SendCoinsFromModuleToAccount ¶
func (k Keeper) SendCoinsFromModuleToAccount( goCtx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, ) error
SendCoinsFromModuleToAccount transfers coins from a ModuleAccount to an AccAddress. It will panic if the module account does not exist. An error is returned if the recipient address is blocked, if the sender is the x/precisebank module account, or if sending the tokens fails.
func (Keeper) SendCoinsFromModuleToModule ¶
func (k Keeper) SendCoinsFromModuleToModule( goCtx context.Context, senderModule string, recipientModule string, amt sdk.Coins, ) error
SendCoinsFromModuleToModule transfers coins from a ModuleAccount to another. It will panic if either module account does not exist. An error is returned if the recipient module is the x/precisebank module account or if sending the tokens fails.
func (*Keeper) SetFractionalBalance ¶
func (k *Keeper) SetFractionalBalance( ctx sdk.Context, address sdk.AccAddress, amount sdkmath.Int, )
SetFractionalBalance sets the fractional balance for an address.
func (*Keeper) SetRemainderAmount ¶
SetRemainderAmount sets the internal remainder amount.
func (Keeper) SpendableCoin ¶
SpendableCoins returns the total balances of spendable coins for an account by address. If the account has no spendable coins, an empty Coins slice is returned.