Documentation ¶
Index ¶
- Constants
- Variables
- func GetABI() abi.ABI
- func GetAddress() common.Address
- type AccountKeeper
- type BankKeeper
- type BridgeCallArgs
- type BridgeCoinAmountArgs
- type CallerRef
- type CancelSendToExternalArgs
- type Contract
- func (c *Contract) AddLog(evm *vm.EVM, event abi.Event, topics []common.Hash, args ...interface{}) error
- func (c *Contract) Address() common.Address
- func (c *Contract) BridgeCall(ctx sdk.Context, evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error)
- func (c *Contract) BridgeCoinAmount(ctx sdk.Context, evm *vm.EVM, contractAddr *vm.Contract, _ bool) ([]byte, error)
- func (c *Contract) CancelSendToExternal(ctx sdk.Context, evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error)
- func (c *Contract) CrossChain(ctx sdk.Context, evm *vm.EVM, contractAddr *vm.Contract, readonly bool) ([]byte, error)
- func (c *Contract) FIP20CrossChain(ctx sdk.Context, evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error)
- func (c *Contract) IncreaseBridgeFee(ctx sdk.Context, evm *vm.EVM, contractAddr *vm.Contract, readonly bool) ([]byte, error)
- func (c *Contract) IsStateful() bool
- func (c *Contract) RequiredGas(input []byte) uint64
- func (c *Contract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) (ret []byte, err error)
- type ContractCall
- type CrossChainArgs
- type Erc20Keeper
- type FIP20CrossChainArgs
- type IBCTransferKeeper
- type IncreaseBridgeFeeArgs
- type Precompile
- type Router
Constants ¶
View Source
const ( FIP20CrossChainGas = 40_000 // 80000 - 160000 CrossChainGas = 40_000 // 70000 - 155000 CancelSendToExternalGas = 30_000 // 70000 - 126000 IncreaseBridgeFeeGas = 40_000 // 70000 - 140000 BridgeCoinAmountFeeGas = 10_000 // 9000 BridgeCallFeeGas = 50_000 // 50000 FIP20CrossChainMethodName = "fip20CrossChain" CrossChainMethodName = "crossChain" CancelSendToExternalMethodName = "cancelSendToExternal" IncreaseBridgeFeeMethodName = "increaseBridgeFee" BridgeCoinAmountMethodName = "bridgeCoinAmount" BridgeCallMethodName = "bridgeCall" CrossChainEventName = "CrossChain" CancelSendToExternalEventName = "CancelSendToExternal" IncreaseBridgeFeeEventName = "IncreaseBridgeFee" BridgeCallEventName = "BridgeCallEvent" )
View Source
const ( // EventTypeRelayTransferCrossChain // Deprecated EventTypeRelayTransferCrossChain = "relay_transfer_cross_chain" // EventTypeCrossChain new cross chain event type EventTypeCrossChain = "cross_chain" AttributeKeyDenom = "coin" AttributeKeyTokenAddress = "token_address" AttributeKeyFrom = "from" AttributeKeyRecipient = "recipient" AttributeKeyTarget = "target" AttributeKeyMemo = "memo" )
Variables ¶
View Source
var ( CancelSendToExternalEvent = GetABI().Events[CancelSendToExternalEventName] CrossChainEvent = GetABI().Events[CrossChainEventName] IncreaseBridgeFeeEvent = GetABI().Events[IncreaseBridgeFeeEventName] BridgeCallEvent = GetABI().Events[BridgeCallEventName] )
View Source
var ( // BridgeCoinAmountMethod query the amount of bridge coin BridgeCoinAmountMethod = GetABI().Methods[BridgeCoinAmountMethodName] // CancelSendToExternalMethod cancel send to external tx CancelSendToExternalMethod = GetABI().Methods[CancelSendToExternalMethodName] // FIP20CrossChainMethod cross chain with FIP20 token, only for FIP20 token // Deprecated: use CrossChainMethod instead FIP20CrossChainMethod = GetABI().Methods[FIP20CrossChainMethodName] // CrossChainMethod cross chain with FIP20 token CrossChainMethod = GetABI().Methods[CrossChainMethodName] // IncreaseBridgeFeeMethod increase bridge fee IncreaseBridgeFeeMethod = GetABI().Methods[IncreaseBridgeFeeMethodName] // BridgeCallMethod bridge call other chain BridgeCallMethod = GetABI().Methods[BridgeCallMethodName] )
Functions ¶
func GetAddress ¶
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
GetModuleAddress(moduleName string) sdk.AccAddress
}
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) (bank.Metadata, bool) }
type BridgeCallArgs ¶
type BridgeCallArgs struct { DstChain string `abi:"_dstChain"` Receiver common.Address `abi:"_receiver"` Tokens []common.Address `abi:"_tokens"` Amounts []*big.Int `abi:"_amounts"` To common.Address `abi:"_to"` Data []byte `abi:"_data"` Value *big.Int `abi:"_value"` Memo []byte `abi:"_memo"` }
func (*BridgeCallArgs) Validate ¶
func (args *BridgeCallArgs) Validate() error
Validate validates the args
type BridgeCoinAmountArgs ¶
type BridgeCoinAmountArgs struct { Token common.Address `abi:"_token"` Target [32]byte `abi:"_target"` }
func (*BridgeCoinAmountArgs) Validate ¶
func (args *BridgeCoinAmountArgs) Validate() error
Validate validates the args
type CancelSendToExternalArgs ¶
func (*CancelSendToExternalArgs) Validate ¶
func (args *CancelSendToExternalArgs) Validate() error
Validate validates the args
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func NewPrecompiledContract ¶
func NewPrecompiledContract( ctx sdk.Context, bankKeeper BankKeeper, erc20Keeper Erc20Keeper, ibcTransferKeeper IBCTransferKeeper, accountKeeper AccountKeeper, router *Router, ) *Contract
func (*Contract) BridgeCall ¶
func (*Contract) BridgeCoinAmount ¶
func (*Contract) CancelSendToExternal ¶
func (*Contract) CrossChain ¶
func (c *Contract) CrossChain(ctx sdk.Context, evm *vm.EVM, contractAddr *vm.Contract, readonly bool) ([]byte, error)
CrossChain called at any address(account or contract)
func (*Contract) FIP20CrossChain ¶
func (c *Contract) FIP20CrossChain(ctx sdk.Context, evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error)
FIP20CrossChain only for fip20 contract transferCrossChain called
func (*Contract) IncreaseBridgeFee ¶
func (c *Contract) IncreaseBridgeFee(ctx sdk.Context, evm *vm.EVM, contractAddr *vm.Contract, readonly bool) ([]byte, error)
IncreaseBridgeFee add bridge fee to unbatched tx
func (*Contract) IsStateful ¶
func (*Contract) RequiredGas ¶
type ContractCall ¶
type ContractCall struct {
// contains filtered or unexported fields
}
func NewContractCall ¶
func (*ContractCall) ERC20TotalSupply ¶
func (cc *ContractCall) ERC20TotalSupply() (*big.Int, error)
func (*ContractCall) ERC20TransferFrom ¶
type CrossChainArgs ¶
type CrossChainArgs struct { Token common.Address `abi:"_token"` Receipt string `abi:"_receipt"` Amount *big.Int `abi:"_amount"` Fee *big.Int `abi:"_fee"` Target [32]byte `abi:"_target"` Memo string `abi:"_memo"` }
func (*CrossChainArgs) Validate ¶
func (args *CrossChainArgs) Validate() error
Validate validates the args
type Erc20Keeper ¶
type Erc20Keeper interface { ModuleAddress() common.Address GetTokenPairByAddress(ctx sdk.Context, address common.Address) (types.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) (types.TokenPair, bool) IsOriginDenom(ctx sdk.Context, denom string) bool HasDenomAlias(ctx sdk.Context, denom string) (bank.Metadata, bool) }
type FIP20CrossChainArgs ¶
type FIP20CrossChainArgs struct { Sender common.Address `abi:"_sender"` Receipt string `abi:"_receipt"` Amount *big.Int `abi:"_amount"` Fee *big.Int `abi:"_fee"` Target [32]byte `abi:"_target"` Memo string `abi:"_memo"` }
func (*FIP20CrossChainArgs) Validate ¶
func (args *FIP20CrossChainArgs) Validate() error
Validate validates the args
type IBCTransferKeeper ¶
type IBCTransferKeeper interface {
Transfer(goCtx context.Context, msg *ibctransfertypes.MsgTransfer) (*ibctransfertypes.MsgTransferResponse, error)
}
type IncreaseBridgeFeeArgs ¶
type IncreaseBridgeFeeArgs struct { Chain string `abi:"_chain"` TxID *big.Int `abi:"_txID"` Token common.Address `abi:"_token"` Fee *big.Int `abi:"_fee"` }
func (*IncreaseBridgeFeeArgs) Validate ¶
func (args *IncreaseBridgeFeeArgs) Validate() error
Validate validates the args
type Precompile ¶
type Precompile 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, receiver common.Address, coins sdk.Coins, to common.Address, data, memo []byte) (uint64, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.