keeper

package
v1.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SendToIbcEventName = "__OkcSendToIbc"
)

Variables

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
}

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
}

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)

func (IBCTransferHooks) AfterRefundTransfer

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

func (IBCTransferHooks) AfterSendTransfer

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

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) CheckMsgSubmitProposal

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

CheckMsgSubmitProposal validates MsgSubmitProposal

func (Keeper) ConvertVoucherToERC20

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

ConvertVoucherToERC20 convert vouchers into evm token.

func (Keeper) ConvertVouchers

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

ConvertVouchers convert vouchers into native coins or evm tokens.

func (Keeper) DeleteExternalContractForDenom

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

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

func (Keeper) GetAutoContracts

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

GetAutoContracts returns all auto-deployed contract mappings

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, external contract is taken in preference to auto-deployed one

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) GetExternalContracts

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

GetExternalContracts returns all external contract mappings

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) 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) 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) 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)

OnMintVouchers after minting vouchers on this chain, convert these vouchers into evm tokens.

func (Keeper) RejectedHandler

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

func (Keeper) SetAutoContractForDenom

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

SetAutoContractForDenom set the auto deployed contract for native denom

func (Keeper) SetExternalContractForDenom

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

SetExternalContractForDenom set the external 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) VoteHandler

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

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
	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)
}

Jump to

Keyboard shortcuts

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