keeper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

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

Hooks wrapper struct for erc20 keeper

func (Hooks) PostTxProcessing

func (h Hooks) PostTxProcessing(
	ctx sdk.Context,
	msg core.Message,
	receipt *ethtypes.Receipt,
) error

PostTxProcessing implements EvmHooks.PostTxProcessing

type Keeper

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

Keeper of this module maintains collections of aggregate.

func NewKeeper

func NewKeeper(
	storeKey sdk.StoreKey,
	cdc codec.BinaryCodec,
	paramSpace paramtypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankkeeper types.BankKeeper,
	evmKeeper types.EVMKeeper,
) *Keeper

NewKeeper creates new instances of the aggregate Keeper

func (Keeper) AddCoin

func (k Keeper) AddCoin(ctx sdk.Context, coinMetadata banktypes.Metadata, contractAddr string) (*types.TokenPair, error)

AddCoin add coin to token pair

func (Keeper) AddERC20TraceToTransferContract

func (k Keeper) AddERC20TraceToTransferContract(
	ctx sdk.Context,
	contract common.Address,
	originToken string,
	originChain string,
	scale uint8,
) (
	*evmtypes.MsgEthereumTxResponse,
	error,
)

func (Keeper) CallEVM

func (k Keeper) CallEVM(
	ctx sdk.Context,
	abi abi.ABI,
	from common.Address,
	contract common.Address,
	method string,
	args ...interface{},
) (
	*evmtypes.MsgEthereumTxResponse, error,
)

CallEVM performs a smart contract method call using given args

func (Keeper) CallEVMWithData

func (k Keeper) CallEVMWithData(
	ctx sdk.Context,
	from common.Address,
	contract *common.Address,
	data []byte,
) (
	*evmtypes.MsgEthereumTxResponse,
	error,
)

CallEVMWithData performs a smart contract method call using contract data

func (Keeper) ConvertCoin

func (k Keeper) ConvertCoin(
	goCtx context.Context,
	msg *types.MsgConvertCoin,
) (*types.MsgConvertCoinResponse, error)

ConvertCoin converts ERC20 tokens into Cosmos-native Coins for both Cosmos-native and ERC20 TokenPair Owners

func (Keeper) ConvertERC20

func (k Keeper) ConvertERC20(
	goCtx context.Context,
	msg *types.MsgConvertERC20,
) (*types.MsgConvertERC20Response, error)

ConvertERC20 converts ERC20 tokens into Cosmos-native Coins for both Cosmos-native and ERC20 TokenPair Owners

func (Keeper) CreateCoinMetadata

func (k Keeper) CreateCoinMetadata(ctx sdk.Context, contract common.Address) (*banktypes.Metadata, error)

CreateCoinMetadata generates the metadata to represent the ERC20 token on teleport.

func (Keeper) DeleteTokenPair

func (k Keeper) DeleteTokenPair(ctx sdk.Context, tokenPair types.TokenPair)

DeleteTokenPair removes a token pair.

func (Keeper) DeployERC20Contract

func (k Keeper) DeployERC20Contract(
	ctx sdk.Context,
	coinMetadata banktypes.Metadata,
) (common.Address, error)

DeployERC20Contract creates and deploys an ERC20 contract on the EVM with the erc20 module account as owner.

func (Keeper) DisableTimeBasedSupplyLimit

func (k Keeper) DisableTimeBasedSupplyLimit(
	ctx sdk.Context,
	erc20Address common.Address,
) error

func (Keeper) DisableTimeBasedSupplyLimitInTransferContract

func (k Keeper) DisableTimeBasedSupplyLimitInTransferContract(
	ctx sdk.Context,
	erc20Address common.Address,
) (
	*evmtypes.MsgEthereumTxResponse,
	error,
)

func (Keeper) EnableTimeBasedSupplyLimit

func (k Keeper) EnableTimeBasedSupplyLimit(
	ctx sdk.Context,
	erc20Address common.Address,
	timePeriod *big.Int,
	timeBasedLimit *big.Int,
	maxAmount *big.Int,
	minAmount *big.Int,
) error

func (Keeper) EnableTimeBasedSupplyLimitInTransferContract

func (k Keeper) EnableTimeBasedSupplyLimitInTransferContract(
	ctx sdk.Context,
	erc20Address common.Address,
	timePeriod *big.Int,
	timeBasedLimit *big.Int,
	maxAmount *big.Int,
	minAmount *big.Int,
) (
	*evmtypes.MsgEthereumTxResponse,
	error,
)

func (Keeper) GetAllTokenPairs

func (k Keeper) GetAllTokenPairs(ctx sdk.Context) []types.TokenPair

GetAllTokenPairs - get all registered token tokenPairs

func (Keeper) GetDenomMap

func (k Keeper) GetDenomMap(ctx sdk.Context, denom string) []byte

GetDenomMap returns the token pair id for the given denomination

func (Keeper) GetERC20Map

func (k Keeper) GetERC20Map(ctx sdk.Context, erc20 common.Address) []byte

GetERC20Map returns the token pair id for the given address

func (Keeper) GetParams

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

GetParams returns the total set of aggregate parameters.

func (Keeper) GetTokenPair

func (k Keeper) GetTokenPair(ctx sdk.Context, id []byte) (types.TokenPair, bool)

GetTokenPair - get registered token pair from the identifier

func (Keeper) GetTokenPairID

func (k Keeper) GetTokenPairID(ctx sdk.Context, token string) []byte

GetTokenPairID returns the pair id from either of the registered tokens.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IsDenomRegistered

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

IsDenomRegistered check if registered coin denom is registered

func (Keeper) IsERC20Registered

func (k Keeper) IsERC20Registered(ctx sdk.Context, erc20 common.Address) bool

IsERC20Registered check if registered ERC20 token is registered

func (Keeper) IsTokenPairRegistered

func (k Keeper) IsTokenPairRegistered(ctx sdk.Context, id []byte) bool

IsTokenPairRegistered - check if registered token tokenPair is registered

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MintingEnabled

func (k Keeper) MintingEnabled(ctx sdk.Context, sender, receiver sdk.AccAddress, token, denom string) (types.TokenPair, error)

MintingEnabled checks that:

  • the global parameter for intrarelaying is enabled
  • minting is enabled for the given (erc20,coin) token pair
  • recipient address is not on the blocked list
  • bank module transfers are enabled for the Cosmos coin

func (Keeper) OnAcknowledgementPacket

func (k Keeper) OnAcknowledgementPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	acknowledgement []byte,
) error

func (Keeper) OnRecvPacket

OnRecvPacket will get the denom name from ibc ,generate by port/channel/denom

func (Keeper) Params

Params return hub contract param

func (Keeper) QueryERC20

func (k Keeper) QueryERC20(ctx sdk.Context, contract common.Address) (types.ERC20Data, error)

QueryERC20 returns the data of a deployed ERC20 contract

func (Keeper) QueryERC20Trace

func (k Keeper) QueryERC20Trace(
	ctx sdk.Context,
	erc20Address common.Address,
	originChain string,
) (
	string, *big.Int, bool, error,
)

QueryERC20Trace returns if the ERC20 trace exist

func (Keeper) RegisterCoin

func (k Keeper) RegisterCoin(ctx sdk.Context, coinMetadata banktypes.Metadata) (*types.TokenPair, error)

RegisterCoin deploys an erc20 contract and creates the token pair for the existing cosmos coin

func (Keeper) RegisterERC20

func (k Keeper) RegisterERC20(ctx sdk.Context, contract common.Address) (*types.TokenPair, error)

RegisterERC20 creates a cosmos coin and registers the token pair between the coin and the ERC20

func (Keeper) RegisterERC20Trace

func (k Keeper) RegisterERC20Trace(
	ctx sdk.Context,
	contract common.Address,
	originToken string,
	originChain string,
	scale uint8,
) error

RegisterERC20Trace creates a ERC20 trace for XIBC

func (Keeper) SendPacket

func (k Keeper) SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI) error

func (Keeper) SetDenomMap

func (k Keeper) SetDenomMap(ctx sdk.Context, denom string, id []byte)

SetDenomMap sets the token pair id for the denomination

func (Keeper) SetDenomsMap

func (k Keeper) SetDenomsMap(ctx sdk.Context, denoms []string, id []byte)

SetDenomsMap sets the token pair id for the denominations

func (Keeper) SetERC20Map

func (k Keeper) SetERC20Map(ctx sdk.Context, erc20 common.Address, id []byte)

SetERC20Map sets the token pair id for the given address

func (*Keeper) SetICS4Wrapper

func (k *Keeper) SetICS4Wrapper(ics4Wrapper porttypes.ICS4Wrapper)

SetICS4Wrapper sets the ICS4 wrapper to the keeper. It panics if already set

func (Keeper) SetParams

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

SetParams sets the aggregate parameters to the param space.

func (Keeper) SetTokenPair

func (k Keeper) SetTokenPair(ctx sdk.Context, tokenPair types.TokenPair)

SetTokenPair stores a token pair

func (Keeper) ToggleRelay

func (k Keeper) ToggleRelay(ctx sdk.Context, token string) (types.TokenPair, error)

ToggleRelay toggles relaying for a given token pair

func (Keeper) TokenPair

TokenPair returns a given registered token pair

func (Keeper) TokenPairs

TokenPairs return registered pairs

func (Keeper) UpdateTokenPairERC20

func (k Keeper) UpdateTokenPairERC20(ctx sdk.Context, erc20Addr, newERC20Addr common.Address) (types.TokenPair, error)

UpdateTokenPairERC20 updates the ERC20 token address for the registered token pair

func (Keeper) WriteAcknowledgement

func (k Keeper) WriteAcknowledgement(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI, ack exported.Acknowledgement) error

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

Jump to

Keyboard shortcuts

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