precompile

package
v7.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitEvent

func EmitEvent(evm *vm.EVM, data []byte, topics []common.Hash)

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
}

type AddPendingPoolRewardsMethod

type AddPendingPoolRewardsMethod struct {
	*Keeper
	abi.Method
	abi.Event
}

func NewAddPendingPoolRewardsMethod

func NewAddPendingPoolRewardsMethod(keeper *Keeper) *AddPendingPoolRewardsMethod

func (*AddPendingPoolRewardsMethod) GetMethodId

func (m *AddPendingPoolRewardsMethod) GetMethodId() []byte

func (*AddPendingPoolRewardsMethod) IsReadonly

func (m *AddPendingPoolRewardsMethod) IsReadonly() bool

func (*AddPendingPoolRewardsMethod) NewAddPendingPoolRewardsEvent

func (m *AddPendingPoolRewardsMethod) NewAddPendingPoolRewardsEvent(args *crosschaintypes.AddPendingPoolRewardArgs, sender common.Address) (data []byte, topic []common.Hash, err error)

func (*AddPendingPoolRewardsMethod) PackInput

func (*AddPendingPoolRewardsMethod) PackOutput

func (m *AddPendingPoolRewardsMethod) PackOutput(success bool) ([]byte, error)

func (*AddPendingPoolRewardsMethod) RequiredGas

func (m *AddPendingPoolRewardsMethod) RequiredGas() uint64

func (*AddPendingPoolRewardsMethod) Run

func (m *AddPendingPoolRewardsMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*AddPendingPoolRewardsMethod) UnpackInput

type BankKeeper

type BankKeeper interface {
	GetSupply(ctx sdk.Context, denom string) sdk.Coin
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
	MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error
	BurnCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
	GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool)
}

type BridgeCallMethod

type BridgeCallMethod struct {
	*Keeper
	abi.Method
	abi.Event
}

func NewBridgeCallMethod

func NewBridgeCallMethod(keeper *Keeper) *BridgeCallMethod

func (*BridgeCallMethod) GetMethodId

func (m *BridgeCallMethod) GetMethodId() []byte

func (*BridgeCallMethod) IsReadonly

func (m *BridgeCallMethod) IsReadonly() bool

func (*BridgeCallMethod) NewBridgeCallEvent

func (m *BridgeCallMethod) NewBridgeCallEvent(args *crosschaintypes.BridgeCallArgs, sender, origin common.Address, eventNonce *big.Int) (data []byte, topic []common.Hash, err error)

func (*BridgeCallMethod) PackInput

func (m *BridgeCallMethod) PackInput(args crosschaintypes.BridgeCallArgs) ([]byte, error)

func (*BridgeCallMethod) PackOutput

func (m *BridgeCallMethod) PackOutput(nonceNonce *big.Int) ([]byte, error)

func (*BridgeCallMethod) RequiredGas

func (m *BridgeCallMethod) RequiredGas() uint64

func (*BridgeCallMethod) Run

func (m *BridgeCallMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*BridgeCallMethod) UnpackInput

func (m *BridgeCallMethod) UnpackInput(data []byte) (*crosschaintypes.BridgeCallArgs, error)

type BridgeCoinAmountMethod

type BridgeCoinAmountMethod struct {
	*Keeper
	abi.Method
}

func NewBridgeCoinAmountMethod

func NewBridgeCoinAmountMethod(keeper *Keeper) *BridgeCoinAmountMethod

func (*BridgeCoinAmountMethod) GetMethodId

func (m *BridgeCoinAmountMethod) GetMethodId() []byte

func (*BridgeCoinAmountMethod) IsReadonly

func (m *BridgeCoinAmountMethod) IsReadonly() bool

func (*BridgeCoinAmountMethod) PackInput

func (*BridgeCoinAmountMethod) PackOutput

func (m *BridgeCoinAmountMethod) PackOutput(amount *big.Int) ([]byte, error)

func (*BridgeCoinAmountMethod) RequiredGas

func (m *BridgeCoinAmountMethod) RequiredGas() uint64

func (*BridgeCoinAmountMethod) Run

func (m *BridgeCoinAmountMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*BridgeCoinAmountMethod) UnpackInput

func (*BridgeCoinAmountMethod) UnpackOutput

func (m *BridgeCoinAmountMethod) UnpackOutput(data []byte) (*big.Int, error)

type CancelPendingBridgeCallMethod

type CancelPendingBridgeCallMethod struct {
	*Keeper
	abi.Method
	abi.Event
}

func NewCancelPendingBridgeCallMethod

func NewCancelPendingBridgeCallMethod(keeper *Keeper) *CancelPendingBridgeCallMethod

func (*CancelPendingBridgeCallMethod) GetMethodId

func (m *CancelPendingBridgeCallMethod) GetMethodId() []byte

func (*CancelPendingBridgeCallMethod) IsReadonly

func (m *CancelPendingBridgeCallMethod) IsReadonly() bool

func (*CancelPendingBridgeCallMethod) NewCancelPendingBridgeCallEvent

func (m *CancelPendingBridgeCallMethod) NewCancelPendingBridgeCallEvent(sender common.Address, chainName string, txId *big.Int) (data []byte, topic []common.Hash, err error)

func (*CancelPendingBridgeCallMethod) PackInput

func (*CancelPendingBridgeCallMethod) PackOutput

func (m *CancelPendingBridgeCallMethod) PackOutput(success bool) ([]byte, error)

func (*CancelPendingBridgeCallMethod) RequiredGas

func (m *CancelPendingBridgeCallMethod) RequiredGas() uint64

func (*CancelPendingBridgeCallMethod) Run

func (m *CancelPendingBridgeCallMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*CancelPendingBridgeCallMethod) UnpackInput

type CancelSendToExternalMethod

type CancelSendToExternalMethod struct {
	*Keeper
	Method abi.Method
	Event  abi.Event
}

func NewCancelSendToExternalMethod

func NewCancelSendToExternalMethod(keeper *Keeper) *CancelSendToExternalMethod

func (*CancelSendToExternalMethod) GetMethodId

func (m *CancelSendToExternalMethod) GetMethodId() []byte

func (*CancelSendToExternalMethod) IsReadonly

func (m *CancelSendToExternalMethod) IsReadonly() bool

func (*CancelSendToExternalMethod) NewCancelSendToExternalEvent

func (m *CancelSendToExternalMethod) NewCancelSendToExternalEvent(sender common.Address, chainName string, txId *big.Int) (data []byte, topic []common.Hash, err error)

func (*CancelSendToExternalMethod) PackInput

func (m *CancelSendToExternalMethod) PackInput(chainName string, txId *big.Int) ([]byte, error)

func (*CancelSendToExternalMethod) PackOutput

func (m *CancelSendToExternalMethod) PackOutput(success bool) ([]byte, error)

func (*CancelSendToExternalMethod) RequiredGas

func (m *CancelSendToExternalMethod) RequiredGas() uint64

func (*CancelSendToExternalMethod) Run

func (m *CancelSendToExternalMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*CancelSendToExternalMethod) UnpackInput

type Contract

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

func NewPrecompiledContract

func NewPrecompiledContract(
	bankKeeper BankKeeper,
	erc20Keeper Erc20Keeper,
	ibcTransferKeeper IBCTransferKeeper,
	accountKeeper AccountKeeper,
	govKeeper GovKeeper,
	router *Router,
) *Contract

func (*Contract) Address

func (c *Contract) Address() common.Address

func (*Contract) IsStateful

func (c *Contract) IsStateful() bool

func (*Contract) RequiredGas

func (c *Contract) RequiredGas(input []byte) uint64

func (*Contract) Run

func (c *Contract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) (ret []byte, err error)

type CrossChainMethod

type CrossChainMethod struct {
	*Keeper
	abi.Method
	abi.Event
}

func NewCrossChainMethod

func NewCrossChainMethod(keeper *Keeper) *CrossChainMethod

func (*CrossChainMethod) GetMethodId

func (m *CrossChainMethod) GetMethodId() []byte

func (*CrossChainMethod) IsReadonly

func (m *CrossChainMethod) IsReadonly() bool

func (*CrossChainMethod) NewCrossChainEvent

func (m *CrossChainMethod) NewCrossChainEvent(sender common.Address, token common.Address, denom, receipt string, amount, fee *big.Int, target [32]byte, memo string) (data []byte, topic []common.Hash, err error)

func (*CrossChainMethod) PackInput

func (m *CrossChainMethod) PackInput(args crosschaintypes.CrossChainArgs) ([]byte, error)

func (*CrossChainMethod) PackOutput

func (m *CrossChainMethod) PackOutput(success bool) ([]byte, error)

func (*CrossChainMethod) RequiredGas

func (m *CrossChainMethod) RequiredGas() uint64

func (*CrossChainMethod) Run

func (m *CrossChainMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*CrossChainMethod) UnpackInput

func (m *CrossChainMethod) UnpackInput(data []byte) (*crosschaintypes.CrossChainArgs, error)

type CrosschainKeeper

type CrosschainKeeper interface {
	TransferAfter(ctx sdk.Context, sender sdk.AccAddress, receive string, coins, fee sdk.Coin, originToken, insufficientLiquidity bool) error
	PrecompileCancelSendToExternal(ctx sdk.Context, txID uint64, sender sdk.AccAddress) (sdk.Coin, error)
	PrecompileIncreaseBridgeFee(ctx sdk.Context, txID uint64, sender sdk.AccAddress, addBridgeFee sdk.Coin) error
	PrecompileBridgeCall(ctx sdk.Context, sender, refund common.Address, coins sdk.Coins, to common.Address, data, memo []byte) (uint64, error)
	PrecompileCancelPendingBridgeCall(ctx sdk.Context, nonce uint64, sender sdk.AccAddress) (sdk.Coins, error)
	PrecompileAddPendingPoolRewards(ctx sdk.Context, txID uint64, sender sdk.AccAddress, reward sdk.Coin) error
}

type Erc20Keeper

type Erc20Keeper interface {
	ModuleAddress() common.Address
	GetTokenPairByAddress(ctx sdk.Context, address common.Address) (erc20types.TokenPair, bool)
	ConvertDenomToTarget(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin, fxTarget fxtypes.FxTarget) (sdk.Coin, error)
	GetIbcTimeout(ctx sdk.Context) time.Duration
	SetIBCTransferRelation(ctx sdk.Context, channel string, sequence uint64)
	HasOutgoingTransferRelation(ctx sdk.Context, moduleName string, txID uint64) bool
	ToTargetDenom(ctx sdk.Context, denom, base string, aliases []string, fxTarget fxtypes.FxTarget) string
	GetTokenPair(ctx sdk.Context, tokenOrDenom string) (erc20types.TokenPair, bool)
	IsOriginDenom(ctx sdk.Context, denom string) bool
	HasDenomAlias(ctx sdk.Context, denom string) (banktypes.Metadata, bool)
}

type ExecuteClaimMethod

type ExecuteClaimMethod struct {
	*Keeper
	abi.Method
	abi.Event
}

func NewExecuteClaimMethod

func NewExecuteClaimMethod(keeper *Keeper) *ExecuteClaimMethod

func (*ExecuteClaimMethod) GetMethodId

func (m *ExecuteClaimMethod) GetMethodId() []byte

func (*ExecuteClaimMethod) IsReadonly

func (m *ExecuteClaimMethod) IsReadonly() bool

func (*ExecuteClaimMethod) NewExecuteClaimEvent

func (m *ExecuteClaimMethod) NewExecuteClaimEvent(sender common.Address, eventNonce *big.Int, dstChain string) (data []byte, topic []common.Hash, err error)

func (*ExecuteClaimMethod) PackInput

func (*ExecuteClaimMethod) PackOutput

func (m *ExecuteClaimMethod) PackOutput(success bool) ([]byte, error)

func (*ExecuteClaimMethod) RequiredGas

func (m *ExecuteClaimMethod) RequiredGas() uint64

func (*ExecuteClaimMethod) Run

func (m *ExecuteClaimMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*ExecuteClaimMethod) UnpackInput

func (m *ExecuteClaimMethod) UnpackInput(data []byte) (*crosschaintypes.ExecuteClaimArgs, error)

func (*ExecuteClaimMethod) UnpackOutput

func (m *ExecuteClaimMethod) UnpackOutput(data []byte) (bool, error)

type FIP20CrossChainMethod

type FIP20CrossChainMethod struct {
	*CrossChainMethod
	abi.Method
}

func NewFIP20CrossChainMethod

func NewFIP20CrossChainMethod(keeper *Keeper) *FIP20CrossChainMethod

func (*FIP20CrossChainMethod) GetMethodId

func (m *FIP20CrossChainMethod) GetMethodId() []byte

func (*FIP20CrossChainMethod) IsReadonly

func (m *FIP20CrossChainMethod) IsReadonly() bool

func (*FIP20CrossChainMethod) PackOutput

func (m *FIP20CrossChainMethod) PackOutput(success bool) ([]byte, error)

func (*FIP20CrossChainMethod) RequiredGas

func (m *FIP20CrossChainMethod) RequiredGas() uint64

func (*FIP20CrossChainMethod) Run

func (m *FIP20CrossChainMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*FIP20CrossChainMethod) UnpackInput

type GovKeeper

type GovKeeper interface {
	CheckDisabledPrecompiles(ctx sdk.Context, contractAddress common.Address, methodId []byte) error
}

type IBCTransferKeeper

type IBCTransferKeeper interface {
	Transfer(goCtx context.Context, msg *ibctransfertypes.MsgTransfer) (*ibctransfertypes.MsgTransferResponse, error)
}

type IncreaseBridgeFeeMethod

type IncreaseBridgeFeeMethod struct {
	*Keeper
	abi.Method
	abi.Event
}

func NewIncreaseBridgeFeeMethod

func NewIncreaseBridgeFeeMethod(keeper *Keeper) *IncreaseBridgeFeeMethod

func (*IncreaseBridgeFeeMethod) GetMethodId

func (m *IncreaseBridgeFeeMethod) GetMethodId() []byte

func (*IncreaseBridgeFeeMethod) IsReadonly

func (m *IncreaseBridgeFeeMethod) IsReadonly() bool

func (*IncreaseBridgeFeeMethod) NewIncreaseBridgeFeeEvent

func (m *IncreaseBridgeFeeMethod) NewIncreaseBridgeFeeEvent(args *crosschaintypes.IncreaseBridgeFeeArgs, sender common.Address) (data []byte, topic []common.Hash, err error)

func (*IncreaseBridgeFeeMethod) PackInput

func (m *IncreaseBridgeFeeMethod) PackInput(chainName string, txId *big.Int, token common.Address, fee *big.Int) ([]byte, error)

func (*IncreaseBridgeFeeMethod) PackOutput

func (m *IncreaseBridgeFeeMethod) PackOutput(success bool) ([]byte, error)

func (*IncreaseBridgeFeeMethod) RequiredGas

func (m *IncreaseBridgeFeeMethod) RequiredGas() uint64

func (*IncreaseBridgeFeeMethod) Run

func (m *IncreaseBridgeFeeMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error)

func (*IncreaseBridgeFeeMethod) UnpackInput

type Keeper

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

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) AddRoute

func (rtr *Router) AddRoute(module string, hook crosschainkeeper.Keeper) *Router

func (*Router) GetRoute

func (rtr *Router) GetRoute(module string) (crosschainkeeper.Keeper, bool)

func (*Router) Seal

func (rtr *Router) Seal()

Seal prevents the Router from any subsequent route handlers to be registered. Seal will panic if called more than once.

func (*Router) Sealed

func (rtr *Router) Sealed() bool

Jump to

Keyboard shortcuts

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