Documentation ¶
Overview ¶
Package keeper specifies the keeper for the cvm module.
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func RegisterGlobalPermissionAcc(ctx sdk.Context, k Keeper)
- func WrapLogger(l log.Logger) *logging.Logger
- type Blockchain
- type CertificateCallable
- type EventSink
- type Keeper
- func (k Keeper) Call(ctx sdk.Context, msg *types.MsgCall, view bool) ([]byte, error)
- func (k Keeper) Deploy(ctx sdk.Context, msg *types.MsgDeploy) ([]byte, error)
- func (k Keeper) GetAbi(ctx sdk.Context, address crypto.Address) []byte
- func (k Keeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
- func (k Keeper) GetAccountSeqNum(ctx sdk.Context, address sdk.AccAddress) []byte
- func (k Keeper) GetAllContracts(ctx sdk.Context) []types.Contract
- func (k Keeper) GetAllMetas(ctx sdk.Context) []types.Metadata
- func (k Keeper) GetCode(ctx sdk.Context, addr crypto.Address) ([]byte, error)
- func (k *Keeper) GetGasRate(ctx sdk.Context) uint64
- func (k Keeper) GetStorage(ctx sdk.Context, address crypto.Address, key binary.Word256) ([]byte, error)
- func (k Keeper) NewState(ctx sdk.Context) *State
- func (k Keeper) Send(ctx sdk.Context, caller, callee sdk.AccAddress, coins sdk.Coins) error
- func (k Keeper) SetAbi(ctx sdk.Context, address crypto.Address, abi []byte)
- func (k Keeper) SetGasRate(ctx sdk.Context, gasRate uint64)
- func (k Keeper) StoreLastBlockHash(ctx sdk.Context)
- func (k Keeper) Tx(ctx sdk.Context, caller, callee sdk.AccAddress, value uint64, data []byte, ...) ([]byte, error)
- type Querier
- func (q Querier) Abi(c context.Context, request *types.QueryAbiRequest) (*types.QueryAbiResponse, error)
- func (q Querier) Account(c context.Context, request *types.QueryAccountRequest) (*acm.Account, error)
- func (q Querier) AddressMeta(c context.Context, request *types.QueryAddressMetaRequest) (*types.QueryAddressMetaResponse, error)
- func (q Querier) Code(c context.Context, request *types.QueryCodeRequest) (*types.QueryCodeResponse, error)
- func (q Querier) Meta(c context.Context, request *types.QueryMetaRequest) (*types.QueryMetaResponse, error)
- func (q Querier) Storage(c context.Context, request *types.QueryStorageRequest) (*types.QueryStorageResponse, error)
- func (q Querier) View(c context.Context, request *types.QueryViewRequest) (*types.QueryViewResponse, error)
- type State
- func (s *State) GetAccount(address crypto.Address) (*acm.Account, error)
- func (s *State) GetAddressMeta(address crypto.Address) ([]*acm.ContractMeta, error)
- func (s *State) GetMetadata(metahash acmstate.MetadataHash) (string, error)
- func (s *State) GetStorage(address crypto.Address, key binary.Word256) (value []byte, err error)
- func (s *State) RemoveAccount(address crypto.Address) error
- func (s *State) SetAddressMeta(address crypto.Address, contMeta []*acm.ContractMeta) error
- func (s *State) SetMetadata(metahash acmstate.MetadataHash, metadata string) error
- func (s *State) SetStorage(address crypto.Address, key binary.Word256, value []byte) error
- func (s *State) UpdateAccount(updatedAccount *acm.Account) error
Constants ¶
const ( // TODO: consolidate native contract gas consumption GasBase int64 = 1000 )
const TransactionGasLimit = uint64(5000000)
TransactionGasLimit is the gas limit of the block.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier is the module level router for state queries.
func RegisterGlobalPermissionAcc ¶
RegisterGlobalPermissionAcc registers the zero address as the global permission account.
Types ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
Blockchain implements the blockchain interface from burrow to make state queries.
func NewBlockChain ¶
func NewBlockChain(ctx sdk.Context, k Keeper) Blockchain
NewBlockChain returns the pointer to a new BlockChain type data.
func (Blockchain) BlockHash ¶
func (bc Blockchain) BlockHash(height uint64) ([]byte, error)
BlockHash returns the block's hash at the provided height.
func (Blockchain) ChainID ¶
func (bc Blockchain) ChainID() string
BlockHash returns the block's hash at the provided height.
func (Blockchain) LastBlockHeight ¶
func (bc Blockchain) LastBlockHeight() uint64
LastBlockHeight returns the last block height of the chain.
func (Blockchain) LastBlockTime ¶
func (bc Blockchain) LastBlockTime() time.Time
LastBlockTime return the unix Time type for the last block.
type CertificateCallable ¶
type CertificateCallable struct {
// contains filtered or unexported fields
}
type EventSink ¶
type EventSink struct {
// contains filtered or unexported fields
}
func NewEventSink ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper implements SDK Keeper.
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key sdk.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, dk types.DistributionKeeper, ck types.CertKeeper, sk types.StakingKeeper, paramSpace types.ParamSubspace) Keeper
NewKeeper creates a new instance of the CVM keeper.
func (Keeper) GetAccount ¶
AuthKeeper returns keeper's AccountKeeper.
func (Keeper) GetAccountSeqNum ¶
GetAccountSeqNum returns the account sequence number.
func (Keeper) GetAllContracts ¶
GetAllContracts gets all contracts for genesis export.
func (Keeper) GetAllMetas ¶
GetAllMetas gets all metadata for genesis export.
func (*Keeper) GetGasRate ¶
GetGasRate returns the gas rate in parameters subspace.
func (Keeper) GetStorage ¶
func (k Keeper) GetStorage(ctx sdk.Context, address crypto.Address, key binary.Word256) ([]byte, error)
GetStorage returns the value stored given the address and key.
func (Keeper) Send ¶
Send executes the send transaction from caller to callee with the given amount of tokens.
func (Keeper) SetGasRate ¶
SetGasRate sets parameters subspace for gas rate.
func (Keeper) StoreLastBlockHash ¶
StoreLastBlockHash stores the last block hash.
type Querier ¶
type Querier struct {
Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper
func (Querier) Abi ¶
func (q Querier) Abi(c context.Context, request *types.QueryAbiRequest) (*types.QueryAbiResponse, error)
func (Querier) AddressMeta ¶
func (q Querier) AddressMeta(c context.Context, request *types.QueryAddressMetaRequest) (*types.QueryAddressMetaResponse, error)
func (Querier) Code ¶
func (q Querier) Code(c context.Context, request *types.QueryCodeRequest) (*types.QueryCodeResponse, error)
func (Querier) Meta ¶
func (q Querier) Meta(c context.Context, request *types.QueryMetaRequest) (*types.QueryMetaResponse, error)
func (Querier) Storage ¶
func (q Querier) Storage(c context.Context, request *types.QueryStorageRequest) (*types.QueryStorageResponse, error)
func (Querier) View ¶
func (q Querier) View(c context.Context, request *types.QueryViewRequest) (*types.QueryViewResponse, error)
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the CVM state object. It implements acmstate.ReaderWriter.
func (*State) GetAccount ¶
GetAccount gets an account by its address and returns nil if it does not exist (which should not be an error).
func (*State) GetAddressMeta ¶
GetAddressMeta returns the metadata hash of an address
func (*State) GetMetadata ¶
func (s *State) GetMetadata(metahash acmstate.MetadataHash) (string, error)
GetMetadata returns the metadata of the cvm module.
func (*State) GetStorage ¶
GetStorage retrieves a 32-byte value stored at the key for the account at the address and returns Zero256 if the key does not exist or if the address does not exist.
Note: burrow/acm/acmstate.StorageGetter claims that an error should be thrown upon non-existing address. However, when being embedded in acmstate.Cache, which is the case here, we cannot do that because the contract creation code might load from the new contract's storage, while the cache layer caches the account creation action hence the embedded storage getter will not be aware of it. Returning error in this case would fail the contract deployment.
func (*State) RemoveAccount ¶
RemoveAccount removes the account at the address.
func (*State) SetAddressMeta ¶
SetAddressMeta sets the metadata hash for an address
func (*State) SetMetadata ¶
func (s *State) SetMetadata(metahash acmstate.MetadataHash, metadata string) error
SetMetadata sets the metadata of the cvm module.
func (*State) SetStorage ¶
SetStorage stores a 32-byte value at the key for the account at the address. Setting to Zero256 removes the key.