keeper

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SendToIbcEventName         = "__OKCSendToIbc"
	SendNative20ToIbcEventName = "__OKCSendNative20ToIbc"
	SendToWasmEventName        = "__OKCSendToWasm"
)

Variables

View Source
var SendNative20ToIbcEvent abi.Event

SendNative20ToIbcEvent represent the signature of `event __OKCSendNative20ToIbc(string recipient, uint256 amount, string portID, string channelID)`

View Source
var SendToIbcEvent abi.Event

SendToIbcEvent represent the signature of `event __OKCSendToIbc(string recipient, uint256 amount)`

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the erc20 module invariants

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
	SetAccount(ctx sdk.Context, acc authexported.Account)
	NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
}

AccountKeeper defines the expected account keeper interface

type BankKeeper

type BankKeeper interface {
	BlacklistedAddr(addr sdk.AccAddress) bool
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
}

type EvmKeeper

type EvmKeeper interface {
	GetChainConfig(ctx sdk.Context) (evmtypes.ChainConfig, bool)
	GenerateCSDBParams() evmtypes.CommitStateDBParams
	GetParams(ctx sdk.Context) evmtypes.Params
	AddInnerTx(...interface{})
	AddContract(...interface{})
}

type GovKeeper

type GovKeeper interface {
	GetDepositParams(ctx sdk.Context) govtypes.DepositParams
	GetVotingParams(ctx sdk.Context) govtypes.VotingParams
}

GovKeeper defines the expected gov Keeper

type IBCTransferHooks

type IBCTransferHooks struct {
	Keeper
}

func NewIBCTransferHooks

func NewIBCTransferHooks(k Keeper) IBCTransferHooks

func (IBCTransferHooks) AfterRecvTransfer

func (iths IBCTransferHooks) AfterRecvTransfer(
	ctx sdk.Context,
	destPort, destChannel string,
	token sdk.SysCoin,
	receiver string,
	isSource bool) error

func (IBCTransferHooks) AfterRefundTransfer

func (iths IBCTransferHooks) AfterRefundTransfer(
	ctx sdk.Context,
	sourcePort, sourceChannel string,
	token sdk.SysCoin,
	sender string,
	isSource bool) error

func (IBCTransferHooks) AfterSendTransfer

func (iths IBCTransferHooks) AfterSendTransfer(
	ctx sdk.Context,
	sourcePort, sourceChannel string,
	token sdk.SysCoin,
	sender sdk.AccAddress,
	receiver string,
	isSource bool) error

type Keeper

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

Keeper wraps the CommitStateDB, allowing us to pass in SDK context while adhering to the StateDB interface.

func NewKeeper

func NewKeeper(
	cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace params.Subspace,
	ak AccountKeeper, sk SupplyKeeper, bk BankKeeper,
	ek EvmKeeper, tk TransferKeeper) Keeper

NewKeeper generates new erc20 module keeper

func (Keeper) AfterDepositPeriodPassed

func (k Keeper) AfterDepositPeriodPassed(_ sdk.Context, _ govTypes.Proposal)

func (Keeper) AfterSubmitProposalHandler

func (k Keeper) AfterSubmitProposalHandler(_ sdk.Context, _ govTypes.Proposal)

nolint

func (Keeper) CallModuleERC20

func (k Keeper) CallModuleERC20(ctx sdk.Context, contract common.Address, method string, args ...interface{}) ([]byte, error)

CallModuleERC20 call a method of ModuleERC20 contract

func (Keeper) CallModuleERC20Proxy added in v1.5.4

func (k Keeper) CallModuleERC20Proxy(ctx sdk.Context, contract common.Address, method string, args ...interface{}) ([]byte, error)

func (Keeper) CheckMsgSubmitProposal

func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) sdk.Error

CheckMsgSubmitProposal validates MsgSubmitProposal

func (Keeper) ConvertNativeToERC20 added in v1.5.4

func (k Keeper) ConvertNativeToERC20(ctx sdk.Context, from sdk.AccAddress, native sdk.SysCoin, contract common.Address) error

ConvertNativeToERC20 convert native into evm token.

func (Keeper) ConvertNatives added in v1.5.4

func (k Keeper) ConvertNatives(ctx sdk.Context, from string, vouchers sdk.SysCoins) error

ConvertNatives convert natives into evm tokens.

func (Keeper) ConvertVoucherToERC20

func (k Keeper) ConvertVoucherToERC20(ctx sdk.Context, from sdk.AccAddress, voucher sdk.SysCoin, autoDeploy bool) error

ConvertVoucherToERC20 convert voucher into evm token.

func (Keeper) ConvertVouchers

func (k Keeper) ConvertVouchers(ctx sdk.Context, from string, vouchers sdk.SysCoins) error

ConvertVouchers convert vouchers into evm tokens.

func (Keeper) DeleteContractForDenom added in v1.5.4

func (k Keeper) DeleteContractForDenom(ctx sdk.Context, denom string) bool

DeleteContractForDenom delete the contract mapping for native denom, returns false if mapping not exists.

func (Keeper) DeployModuleERC20 added in v1.5.4

func (k Keeper) DeployModuleERC20(ctx sdk.Context, denom string) (common.Address, error)

DeployModuleERC20 deploy an embed erc20 contract

func (Keeper) GetContractByDenom

func (k Keeper) GetContractByDenom(ctx sdk.Context, denom string) (contract common.Address, found bool)

GetContractByDenom find the corresponding contract for the denom

func (Keeper) GetContracts added in v1.5.4

func (k Keeper) GetContracts(ctx sdk.Context) (out []types.TokenMapping)

GetContracts returns all contract mappings

func (Keeper) GetDenomByContract

func (k Keeper) GetDenomByContract(ctx sdk.Context, contract common.Address) (denom string, found bool)

GetDenomByContract find native denom by contract address

func (Keeper) GetEthAccount added in v1.6.6

func (k Keeper) GetEthAccount(ctx sdk.Context, addr common.Address) (*ethermint.EthAccount, bool)

GetEthAccount returns an eth account.

func (Keeper) GetImplementTemplateContract added in v1.5.4

func (k Keeper) GetImplementTemplateContract(ctx sdk.Context) (types.CompiledContract, bool)

func (Keeper) GetMaxDepositPeriod

func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content sdkGov.Content) (maxDepositPeriod time.Duration)

GetMaxDepositPeriod returns max deposit period

func (Keeper) GetMinDeposit

func (k Keeper) GetMinDeposit(ctx sdk.Context, content sdkGov.Content) (minDeposit sdk.SysCoins)

GetMinDeposit returns min deposit

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of erc20 parameters.

func (Keeper) GetProxyTemplateContract added in v1.5.4

func (k Keeper) GetProxyTemplateContract(ctx sdk.Context) (types.CompiledContract, bool)

func (Keeper) GetSourceChannelID

func (k Keeper) GetSourceChannelID(ctx sdk.Context, ibcVoucherDenom string) (channelID string, err error)

GetSourceChannelID returns the channel id for an ibc voucher The voucher has for format ibc/hash(path)

func (Keeper) GetVotingPeriod

func (k Keeper) GetVotingPeriod(ctx sdk.Context, content sdkGov.Content) (votingPeriod time.Duration)

GetVotingPeriod returns voting period

func (Keeper) IbcTransferNative20 added in v1.5.4

func (k Keeper) IbcTransferNative20(ctx sdk.Context, from, to string, native20s sdk.SysCoins, portID, channelID string) error

IbcTransferNative20 transfer native20 to other chain by ibc

func (Keeper) IbcTransferVouchers

func (k Keeper) IbcTransferVouchers(ctx sdk.Context, from, to string, vouchers sdk.SysCoins) error

IbcTransferVouchers transfer vouchers to other chain by ibc

func (Keeper) InitInternalTemplateContract added in v1.5.4

func (k Keeper) InitInternalTemplateContract(ctx sdk.Context)

func (Keeper) IterateMapping

func (k Keeper) IterateMapping(ctx sdk.Context, cb func(denom, contract string) (stop bool))

IterateMapping iterates over all the stored mapping and performs a callback function

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) OnMintVouchers

func (k Keeper) OnMintVouchers(ctx sdk.Context, vouchers sdk.SysCoins, receiver string) error

OnMintVouchers after minting vouchers on this chain

func (Keeper) OnUnescrowNatives added in v1.5.4

func (k Keeper) OnUnescrowNatives(ctx sdk.Context, natives sdk.SysCoins, receiver string) error

OnUnescrowNatives after unescrow natives on this chain

func (Keeper) ProxyContractRedirect added in v1.5.4

func (k Keeper) ProxyContractRedirect(ctx sdk.Context, denom string, tp types.RedirectType, addr common.Address) error

func (Keeper) RejectedHandler

func (k Keeper) RejectedHandler(_ sdk.Context, _ govTypes.Content)

func (Keeper) SetContractForDenom added in v1.5.4

func (k Keeper) SetContractForDenom(ctx sdk.Context, denom string, contract common.Address) error

SetContractForDenom set the contract for native denom, 1. if any existing for denom, replace the old one. 2. if any existing for contract, return error.

func (*Keeper) SetGovKeeper

func (k *Keeper) SetGovKeeper(gk GovKeeper)

SetGovKeeper sets keeper of gov

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the erc20 parameters to the param space.

func (Keeper) SetTemplateContract added in v1.5.4

func (k Keeper) SetTemplateContract(ctx sdk.Context, typeStr string, str string) error

func (Keeper) VoteHandler

func (k Keeper) VoteHandler(_ sdk.Context, _ govTypes.Proposal, _ govTypes.Vote) (string, sdk.Error)

type SendNative20ToIbcEventHandler added in v1.5.4

type SendNative20ToIbcEventHandler struct {
	Keeper
}

func NewSendNative20ToIbcEventHandler added in v1.5.4

func NewSendNative20ToIbcEventHandler(k Keeper) *SendNative20ToIbcEventHandler

func (SendNative20ToIbcEventHandler) EventID added in v1.5.4

EventID Return the id of the log signature it handles

func (SendNative20ToIbcEventHandler) Handle added in v1.5.4

func (h SendNative20ToIbcEventHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error

Handle Process the log

type SendToIbcEventHandler

type SendToIbcEventHandler struct {
	Keeper
}

func NewSendToIbcEventHandler

func NewSendToIbcEventHandler(k Keeper) *SendToIbcEventHandler

func (SendToIbcEventHandler) EventID

func (h SendToIbcEventHandler) EventID() common.Hash

EventID Return the id of the log signature it handles

func (SendToIbcEventHandler) Handle

func (h SendToIbcEventHandler) Handle(ctx sdk.Context, contract common.Address, data []byte) error

Handle Process the log

type Subspace

type Subspace interface {
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
}

type SupplyKeeper

type SupplyKeeper interface {
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
	GetModuleAccount(ctx sdk.Context, moduleName string) exported.ModuleAccountI
}

type TransferKeeper

type TransferKeeper interface {
	SendTransfer(
		ctx sdk.Context,
		sourcePort,
		sourceChannel string,
		token sdk.CoinAdapter,
		sender sdk.AccAddress,
		receiver string,
		timeoutHeight clienttypes.Height,
		timeoutTimestamp uint64,
	) error
	DenomPathFromHash(ctx sdk.Context, denom string) (string, error)
	GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (types.DenomTrace, bool)
}

Jump to

Keyboard shortcuts

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