Documentation ¶
Index ¶
- Constants
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func EVMToSDKAddress(addr common.Address) sdk.AccAddress
- func ExampleInvariant(k Keeper) sdk.Invariant
- func ExportGenesis(ctx sdk.Context, k Keeper) microtxtypes.GenesisState
- func InitGenesis(ctx sdk.Context, k Keeper, data microtxtypes.GenesisState)
- func IsEthermintAccount(account authtypes.AccountI) bool
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func SDKToEVMAddress(addr sdk.AccAddress) common.Address
- func ToMethodArgs(args ...interface{}) []interface{}
- type Keeper
- func (k Keeper) CallEVM(ctx sdk.Context, from common.Address, to *common.Address, amount *big.Int, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallMethod(ctx sdk.Context, method string, contract evmtypes.CompiledContract, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CollectLiquidAccounts(ctx sdk.Context) ([]*types.LiquidInfrastructureAccount, error)
- func (k Keeper) DeductMicrotxFee(ctx sdk.Context, sender sdk.AccAddress, sendAmount sdk.Coin) (feeCollected *sdk.Coin, err error)
- func (k Keeper) DeductMsgMicrotxFee(ctx sdk.Context, msg *types.MsgMicrotx) (feeCollected *sdk.Coin, err error)
- func (k Keeper) DeployContract(ctx sdk.Context, deployer sdk.AccAddress, contract evmtypes.CompiledContract, ...) (common.Address, error)
- func (k Keeper) DoLiquify(ctx sdk.Context, account sdk.AccAddress) (common.Address, error)
- func (k Keeper) GetLiquidAccount(ctx sdk.Context, accAddress sdk.AccAddress) (*types.LiquidInfrastructureAccount, error)
- func (k Keeper) GetLiquidAccountByNFTAddress(ctx sdk.Context, nftAddress common.Address) (*types.LiquidInfrastructureAccount, error)
- func (k Keeper) GetLiquidAccountEntry(ctx sdk.Context, accAddress sdk.AccAddress) (*common.Address, error)
- func (k Keeper) GetLiquidAccountsByCosmosOwner(ctx sdk.Context, ownerAddress sdk.AccAddress) ([]*types.LiquidInfrastructureAccount, error)
- func (k Keeper) GetLiquidAccountsByEVMOwner(ctx sdk.Context, ownerAddress common.Address) ([]*types.LiquidInfrastructureAccount, error)
- func (k Keeper) GetMicrotxFeeBasisPoints(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetParamsIfSet(ctx sdk.Context) (params types.Params, err error)
- func (k Keeper) IsLiquidAccount(ctx sdk.Context, account sdk.AccAddress) bool
- func (k Keeper) IsLiquidAccountWithValue(ctx sdk.Context, account sdk.AccAddress) (bool, *common.Address)
- func (k Keeper) IterateLiquidAccounts(ctx sdk.Context, ...)
- func (k Keeper) LiquidAccount(c context.Context, req *types.QueryLiquidAccountRequest) (*types.QueryLiquidAccountResponse, error)
- func (k Keeper) LiquidAccounts(c context.Context, req *types.QueryLiquidAccountsRequest) (*types.QueryLiquidAccountsResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Microtx(ctx sdk.Context, sender sdk.AccAddress, receiver sdk.AccAddress, ...) error
- func (k Keeper) MicrotxFee(c context.Context, req *types.QueryMicrotxFeeRequest) (*types.QueryMicrotxFeeResponse, error)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) QueryEVM(ctx sdk.Context, method string, contract evmtypes.CompiledContract, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) RedirectBalanceToToken(ctx sdk.Context, account sdk.AccAddress, nft common.Address, ...) (*sdk.Coin, error)
- func (k Keeper) RedirectLiquidAccountExcessBalance(ctx sdk.Context, account sdk.AccAddress, changedErc20 common.Address) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) ValidateAndGetERC20Address(ctx sdk.Context, amount sdk.Coin) (common.Address, error)
- func (k Keeper) ValidateMembers()
Constants ¶
const BasisPointDivisor uint64 = 10000
BasisPointDivisor used in calculating the MsgMicrotx fee amount to deduct
Variables ¶
var AccountId *big.Int = big.NewInt(1)
The ID for the Account token, the only token controlled by a LiquidInfrastructureNFT Note when using this value as an argument, the EVM requires it to be a *big.Int, the non-pointer type will cause execution failure
var CurrentNFTVersion *big.Int = big.NewInt(1)
var DefaultGasLimit uint64 = 30000000
Default gas limit for eth txs from the module account
Functions ¶
func AllInvariants ¶
AllInvariants collects any defined invariants below
func EVMToSDKAddress ¶
func EVMToSDKAddress(addr common.Address) sdk.AccAddress
func ExampleInvariant ¶
ExampleInvariant checks for incorrect things
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, k Keeper) microtxtypes.GenesisState
ExportGenesis exports all the state needed to restart the chain from the current state of the chain
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data microtxtypes.GenesisState)
InitGenesis starts a chain from a genesis state
func IsEthermintAccount ¶
IsEthermintAccount indicates the given account has a registered Ethermint public key
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.
func SDKToEVMAddress ¶
func SDKToEVMAddress(addr sdk.AccAddress) common.Address
SDKToEVMAddress converts `addr` to its EVM equivalent
func ToMethodArgs ¶
func ToMethodArgs(args ...interface{}) []interface{}
ToMethodArgs conveniently converts EVM method call args to an array
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine
func NewKeeper ¶
func NewKeeper( storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, cdc codec.BinaryCodec, bankKeeper *bankkeeper.BaseKeeper, accKeeper *authkeeper.AccountKeeper, evmKeeper *evmkeeper.Keeper, erc20Keeper *erc20keeper.Keeper, gasfreeKeeper *gasfreekeeper.Keeper, ) Keeper
NewKeeper returns a new instance of the microtx keeper
func (Keeper) CallEVM ¶
func (k Keeper) CallEVM( ctx sdk.Context, from common.Address, to *common.Address, amount *big.Int, data []byte, commit bool, ) (*evmtypes.MsgEthereumTxResponse, error)
CallEVM performs a EVM transaction given the from address, the to address, amount to be sent, data and whether to commit the tx in the EVM keeper.
func (Keeper) CallMethod ¶
func (k Keeper) CallMethod( ctx sdk.Context, method string, contract evmtypes.CompiledContract, from common.Address, contractAddr *common.Address, amount *big.Int, args ...interface{}, ) (*evmtypes.MsgEthereumTxResponse, error)
CallMethod is a function to interact with a contract once it is deployed. It inputs the method name on the smart contract, the compiled smart contract, the address from which the tx will be made, the contract address, the amount to be supplied in msg.value, and finally an arbitrary number of arguments that should be supplied to the function method.
func (Keeper) CollectLiquidAccounts ¶
func (k Keeper) CollectLiquidAccounts(ctx sdk.Context) ([]*types.LiquidInfrastructureAccount, error)
GetLiquidAccountByNFTAddress fetches info about a Liquid Infrastructure Account given the address of the LiquidInfrastructureNFT in the EVM
func (Keeper) DeductMicrotxFee ¶
func (k Keeper) DeductMicrotxFee(ctx sdk.Context, sender sdk.AccAddress, sendAmount sdk.Coin) (feeCollected *sdk.Coin, err error)
DeductMicrotxFee will check and deduct the MsgMicrotx fee for the given sendAmount, based on the MicrotxFeeBasisPoints param value
func (Keeper) DeductMsgMicrotxFee ¶
func (k Keeper) DeductMsgMicrotxFee(ctx sdk.Context, msg *types.MsgMicrotx) (feeCollected *sdk.Coin, err error)
DeductMsgMicrotxFee is expected to be called from the AnteHandler to deduct the fee for the Msg It is possible for MsgMicrotx to not be a gasfree message type, since governance controls the list, in that case the fee should be deducted in the Msg handler
WARNING: Do **NOT** call this from the MsgMicrotx handler, as it will result in bad event logs, call DeductMicrotxFee instead
func (Keeper) DeployContract ¶
func (k Keeper) DeployContract( ctx sdk.Context, deployer sdk.AccAddress, contract evmtypes.CompiledContract, args ...interface{}, ) (common.Address, error)
DeployContract will deploy an arbitrary smart-contract. It takes the compiled contract object as well as an arbitrary number of arguments which will be supplied to the contructor. All contracts deployed are deployed by the deployer account.
func (Keeper) DoLiquify ¶
DoLiquify will deploy a LiquidInfrastructureNFT smart contract for the given account. The token will then be transferred to the given account and live under its control. Transfer to another owner requires interacting with the EVM
func (Keeper) GetLiquidAccount ¶
func (k Keeper) GetLiquidAccount(ctx sdk.Context, accAddress sdk.AccAddress) (*types.LiquidInfrastructureAccount, error)
GetLiquidAccount fetches info about a Liquid Infrastructure Account returns nil, ErrNoLiquidAccount if `accAddress` has not been liquified (no record found)
func (Keeper) GetLiquidAccountByNFTAddress ¶
func (k Keeper) GetLiquidAccountByNFTAddress(ctx sdk.Context, nftAddress common.Address) (*types.LiquidInfrastructureAccount, error)
GetLiquidAccountByNFTAddress fetches info about a LiquidAccount given the address of the LiquidInfrastructureNFT in the EVM returns nil, ErrNoLiquidAccount if `nftAddress` is not a record for any Liquid Infrastructure Account
func (Keeper) GetLiquidAccountEntry ¶
func (k Keeper) GetLiquidAccountEntry(ctx sdk.Context, accAddress sdk.AccAddress) (*common.Address, error)
GetLiquidAccountEntry fetches the LiquidInfrastructureNFT contract address for the given `accAddress` returns nil, ErrNoLiquidAccount if `accAddress` has not been liquified (no record found)
func (Keeper) GetLiquidAccountsByCosmosOwner ¶
func (k Keeper) GetLiquidAccountsByCosmosOwner(ctx sdk.Context, ownerAddress sdk.AccAddress) ([]*types.LiquidInfrastructureAccount, error)
GetLiquidAccountsByCosmosOwner fetches info about a Liquid Infrastructure Account given the bech32 address of the LiquidInfrastructureNFT holder returns nil, ErrNoLiquidAccount if `ownerAddress` has no LiquidInfrastructureNFTs (no record found)
func (Keeper) GetLiquidAccountsByEVMOwner ¶
func (k Keeper) GetLiquidAccountsByEVMOwner(ctx sdk.Context, ownerAddress common.Address) ([]*types.LiquidInfrastructureAccount, error)
GetLiquidAccountsByEVMOwner fetches info about a Liquid Infrastructure Account given the EVM address of the LiquidInfrastructureNFT holder returns nil, ErrNoLiquidAccount if `ownerAddress` has no LiquidInfrastructureNFTs (no record found)
func (Keeper) GetMicrotxFeeBasisPoints ¶
GetMicrotxFeeBasisPoints will get the MicrotxFeeBasisPoints, if the params have been set
func (Keeper) GetParams ¶
GetParams will return the current Params Note that if this function is called before the chain has been initalized, a panic will occur. Use GetParamsIfSet instead e.g. in an AnteHandler which may run for creating genesis transactions
func (Keeper) GetParamsIfSet ¶
GetParamsIfSet will return the current params, but will return an error if the chain is still initializing. By error checking this function is safe to use in handling genesis transactions.
func (Keeper) IsLiquidAccount ¶
IsLiquidAccount checks if the input account is a Liquid Infrastructure Account
func (Keeper) IsLiquidAccountWithValue ¶
func (k Keeper) IsLiquidAccountWithValue(ctx sdk.Context, account sdk.AccAddress) (bool, *common.Address)
IsLiquidAccountWithValue checks if the input account is a Liquid Infrastructure Account and returns the account's nft contract
func (Keeper) IterateLiquidAccounts ¶
func (k Keeper) IterateLiquidAccounts(ctx sdk.Context, cb func(key []byte, accAddress sdk.AccAddress, owner common.Address, nftAddress common.Address) (stop bool))
IterateLiquidAccounts calls the provided callback `cb` on every discovered Liquid Infrastructure Account entry. Return stop=true to end iteration early.
func (Keeper) LiquidAccount ¶
func (k Keeper) LiquidAccount(c context.Context, req *types.QueryLiquidAccountRequest) (*types.QueryLiquidAccountResponse, error)
LiquidAccount implements types.QueryServer.
func (Keeper) LiquidAccounts ¶
func (k Keeper) LiquidAccounts(c context.Context, req *types.QueryLiquidAccountsRequest) (*types.QueryLiquidAccountsResponse, error)
LiquidAccounts fetches all of the known liquid infrastructure accounts TODO: Implement pagination
func (Keeper) Microtx ¶
func (k Keeper) Microtx(ctx sdk.Context, sender sdk.AccAddress, receiver sdk.AccAddress, amount sdk.Coin) error
Microtx implements the transfer of funds from sender to receiver Due to the function of Liquid Infrastructure Accounts, any Microtx must transfer only EVM compatible bank coins
func (Keeper) MicrotxFee ¶
func (k Keeper) MicrotxFee(c context.Context, req *types.QueryMicrotxFeeRequest) (*types.QueryMicrotxFeeResponse, error)
MicrotxFee computes the amount which will be charged in fees for a given Microtx amount
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the params of the microtx module
func (Keeper) RedirectBalanceToToken ¶
func (k Keeper) RedirectBalanceToToken( ctx sdk.Context, account sdk.AccAddress, nft common.Address, currBalance sdk.Coin, thresholdAmount big.Int, ) (*sdk.Coin, error)
RedirectBalanceToToken will funnel all excess amounts of `currBalance` (based on `thresholdAmount`) to `nft` it creates a MsgConvertCoin and uses the erc20Keeper to execute it
func (Keeper) RedirectLiquidAccountExcessBalance ¶
func (k Keeper) RedirectLiquidAccountExcessBalance(ctx sdk.Context, account sdk.AccAddress, changedErc20 common.Address) error
RedirectLiquidAccountExcessBalance will check if this account is a Liquid Infrastructure Account, then may funnel any excess balance to the registered LiquidInfrastructureNFT depending on the set thresholds If no threshold is set for `changedErc20`, its balance WILL NOT be sent to the NFT