Documentation ¶
Index ¶
- Constants
- Variables
- func AllInvariants(bankK types.BankKeeper, k Keeper) sdk.Invariant
- func FullyBackedInvariant(bankK types.BankKeeper, k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, bankK types.BankKeeper, k Keeper)
- func SmallBalancesInvariant(_ types.BankKeeper, k Keeper) sdk.Invariant
- func SplitAkavaCoins(coins sdk.Coins) (sdk.Coin, sdk.Int, error)
- func ValidateEvmCoins(coins sdk.Coins) error
- type EvmBankKeeper
- func (k EvmBankKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
- func (k EvmBankKeeper) ConvertAkavaToUkava(ctx sdk.Context, addr sdk.AccAddress) error
- func (k EvmBankKeeper) ConvertOneUkavaToAkavaIfNeeded(ctx sdk.Context, addr sdk.AccAddress, akavaNeeded sdk.Int) error
- func (k EvmBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
- func (k EvmBankKeeper) GetModuleAddress(moduleName string) sdk.AccAddress
- func (k EvmBankKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
- func (k EvmBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, ...) error
- func (k EvmBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, ...) error
- type Keeper
- func (k Keeper) AddBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Int) error
- func (k Keeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) *types.Account
- func (k Keeper) GetAllAccounts(ctx sdk.Context) (accounts []types.Account)
- func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdk.Int
- func (k Keeper) IterateAllAccounts(ctx sdk.Context, cb func(types.Account) bool)
- func (k Keeper) RemoveBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Int) error
- func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, ...) error
- func (k Keeper) SetAccount(ctx sdk.Context, account types.Account) error
- func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdk.Int) error
Constants ¶
const ( // EvmDenom is the gas denom used by the evm EvmDenom = "akava" // CosmosDenom is the gas denom used by the kava app CosmosDenom = "ukava" )
Variables ¶
var ConversionMultiplier = sdk.NewInt(1_000_000_000_000)
ConversionMultiplier is the conversion multiplier between akava and ukava
Functions ¶
func AllInvariants ¶
func AllInvariants(bankK types.BankKeeper, k Keeper) sdk.Invariant
AllInvariants runs all invariants of the swap module
func FullyBackedInvariant ¶
func FullyBackedInvariant(bankK types.BankKeeper, k Keeper) sdk.Invariant
FullyBackedInvariant ensures all minor balances are backed by the coins in the module account.
The module balance can be greater than the sum of all minor balances. This can happen in rare cases where the evm module burns tokens.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, bankK types.BankKeeper, k Keeper)
RegisterInvariants registers the swap module invariants
func SmallBalancesInvariant ¶
func SmallBalancesInvariant(_ types.BankKeeper, k Keeper) sdk.Invariant
SmallBalancesInvariant ensures all minor balances are less than the overflow amount, beyond this they should be converted to the major denom.
func SplitAkavaCoins ¶
SplitAkavaCoins splits akava coins to the equivalent ukava coins and any remaining akava balance. An error will be returned if the coins are not valid or if the coins are not the akava denom.
func ValidateEvmCoins ¶
ValidateEvmCoins validates the coins from evm is valid and is the EvmDenom (akava).
Types ¶
type EvmBankKeeper ¶
type EvmBankKeeper struct {
// contains filtered or unexported fields
}
EvmBankKeeper is a BankKeeper wrapper for the x/evm module to allow the use of the 18 decimal akava coin on the evm. x/evm consumes gas and send coins by minting and burning akava coins in its module account and then sending the funds to the target account. This keeper uses both the ukava coin and a separate akava balance to manage the extra percision needed by the evm.
func NewEvmBankKeeper ¶
func NewEvmBankKeeper(akavaKeeper Keeper, bk types.BankKeeper, ak types.AccountKeeper) EvmBankKeeper
func (EvmBankKeeper) BurnCoins ¶
BurnCoins burns akava coins by burning the equivalent ukava coins and any remaining akava coins. It will panic if the module account does not exist or is unauthorized.
func (EvmBankKeeper) ConvertAkavaToUkava ¶
func (k EvmBankKeeper) ConvertAkavaToUkava(ctx sdk.Context, addr sdk.AccAddress) error
ConvertAkavaToUkava converts all available akava to ukava for a given AccAddress.
func (EvmBankKeeper) ConvertOneUkavaToAkavaIfNeeded ¶
func (k EvmBankKeeper) ConvertOneUkavaToAkavaIfNeeded(ctx sdk.Context, addr sdk.AccAddress, akavaNeeded sdk.Int) error
ConvertOneUkavaToAkavaIfNeeded converts 1 ukava to akava for an address if its akava balance is smaller than the akavaNeeded amount.
func (EvmBankKeeper) GetBalance ¶
func (k EvmBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
GetBalance returns the total **spendable** balance of akava for a given account by address.
func (EvmBankKeeper) GetModuleAddress ¶
func (k EvmBankKeeper) GetModuleAddress(moduleName string) sdk.AccAddress
func (EvmBankKeeper) MintCoins ¶
MintCoins mints akava coins by minting the equivalent ukava coins and any remaining akava coins. It will panic if the module account does not exist or is unauthorized.
func (EvmBankKeeper) SendCoinsFromAccountToModule ¶
func (k EvmBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromAccountToModule transfers akava coins from an AccAddress to a ModuleAccount. It will panic if the module account does not exist.
func (EvmBankKeeper) SendCoinsFromModuleToAccount ¶
func (k EvmBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromModuleToAccount transfers akava 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 black-listed or if sending the tokens fails.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the evmutil store. This keeper stores additional data related to evm accounts.
func (Keeper) AddBalance ¶
AddBalance increments the akava balance of an address.
func (Keeper) GetAccount ¶
GetAccount returns the account for a given address.
func (Keeper) GetAllAccounts ¶
GetAllAccounts returns all accounts.
func (Keeper) GetBalance ¶
GetBalance returns the total balance of akava for a given account by address.
func (Keeper) IterateAllAccounts ¶
IterateAllAccounts iterates over all accounts. If true is returned from the callback, iteration is halted.
func (Keeper) RemoveBalance ¶
RemoveBalance decrements the akava balance of an address.
func (Keeper) SendBalance ¶
func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdk.Int) error
SendBalance transfers the akava balance from sender addr to recipient addr.
func (Keeper) SetAccount ¶
SetAccount sets the account for a given address.
func (Keeper) SetBalance ¶
SetBalance sets the total balance of akava for a given account by address.