Documentation
¶
Index ¶
- Constants
- Variables
- func CheckOriginAndSender(contract *vm.Contract, origin common.Address, sender common.Address) (common.Address, error)
- func CreateAndValidateMsgTransfer(sourcePort, sourceChannel string, coin sdk.Coin, ...) (*transfertypes.MsgTransfer, error)
- func EmitIBCTransferEvent(ctx sdk.Context, stateDB vm.StateDB, event abi.Event, ...) error
- func NewDenomHashRequest(args []interface{}) (*transfertypes.QueryDenomHashRequest, error)
- func NewDenomRequest(args []interface{}) (*transfertypes.QueryDenomRequest, error)
- func NewDenomsRequest(method *abi.Method, args []interface{}) (*transfertypes.QueryDenomsRequest, error)
- func NewMsgTransfer(method *abi.Method, args []interface{}) (*transfertypes.MsgTransfer, common.Address, error)
- type DenomResponse
- type DenomsResponse
- type EventIBCTransfer
- type EventTransferAuthorization
- type PageRequest
- type Precompile
- func (p Precompile) Denom(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) DenomHash(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) Denoms(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) Execute(ctx sdk.Context, stateDB vm.StateDB, contract *vm.Contract, readOnly bool) ([]byte, error)
- func (Precompile) IsTransaction(method *abi.Method) bool
- func (p Precompile) RequiredGas(input []byte) uint64
- func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error)
- func (p *Precompile) Transfer(ctx sdk.Context, contract *vm.Contract, stateDB vm.StateDB, method *abi.Method, ...) ([]byte, error)
Constants ¶
const ( // ErrInvalidSourcePort is raised when the source port is invalid. ErrInvalidSourcePort = "invalid source port" // ErrInvalidSourceChannel is raised when the source channel is invalid. ErrInvalidSourceChannel = "invalid source port" // ErrInvalidSender is raised when the sender is invalid. ErrInvalidSender = "invalid sender: %s" // ErrInvalidReceiver is raised when the receiver is invalid. ErrInvalidReceiver = "invalid receiver: %s" // ErrInvalidTimeoutTimestamp is raised when the timeout timestamp is invalid. ErrInvalidTimeoutTimestamp = "invalid timeout timestamp: %d" // ErrInvalidMemo is raised when the memo is invalid. ErrInvalidMemo = "invalid memo: %s" // ErrInvalidHash is raised when the hash is invalid. ErrInvalidHash = "invalid hash: %s" // ErrNoMatchingAllocation is raised when no matching allocation is found. ErrNoMatchingAllocation = "no matching allocation found for source port: %s, source channel: %s, and denom: %s" // ErrDifferentOriginFromSender is raised when the origin address is not the same as the sender address. ErrDifferentOriginFromSender = "origin address %s is not the same as sender address %s" // ErrDenomNotFound is raised when the denom for the specified request does not exist. ErrDenomNotFound = "denomination not found" )
const ( // DenomMethod defines the ABI method name for the ICS20 Denom // query. DenomMethod = "denom" // DenomsMethod defines the ABI method name for the ICS20 Denoms // query. DenomsMethod = "denoms" // DenomHashMethod defines the ABI method name for the ICS20 DenomHash // query. DenomHashMethod = "denomHash" )
const ( // DefaultRevisionNumber is the default value used to not set a timeout revision number DefaultRevisionNumber = 0 // DefaultRevisionHeight is the default value used to not set a timeout revision height DefaultRevisionHeight = 0 // DefaultTimeoutMinutes is the default value in minutes used to set a timeout timestamp DefaultTimeoutMinutes = 10 )
const (
// EventTypeIBCTransfer defines the event type for the ICS20 Transfer transaction.
EventTypeIBCTransfer = "IBCTransfer"
)
const PrecompileAddress = "0x0000000000000000000000000000000000000802"
PrecompileAddress of the ICS-20 EVM extension in hex format.
const ( // TransferMethod defines the ABI method name for the ICS20 Transfer // transaction. TransferMethod = "transfer" )
Variables ¶
var (
ABI abi.ABI
)
var DefaultTimeoutHeight = clienttypes.NewHeight(DefaultRevisionNumber, DefaultRevisionHeight)
DefaultTimeoutHeight is the default value used to set a timeout height
Functions ¶
func CheckOriginAndSender ¶
func CheckOriginAndSender(contract *vm.Contract, origin common.Address, sender common.Address) (common.Address, error)
CheckOriginAndSender ensures the correct sender is being used.
func CreateAndValidateMsgTransfer ¶
func CreateAndValidateMsgTransfer( sourcePort, sourceChannel string, coin sdk.Coin, senderAddress, receiverAddress string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, ) (*transfertypes.MsgTransfer, error)
CreateAndValidateMsgTransfer creates a new MsgTransfer message and run validate basic.
func EmitIBCTransferEvent ¶
func EmitIBCTransferEvent( ctx sdk.Context, stateDB vm.StateDB, event abi.Event, precompileAddr, senderAddr common.Address, receiver string, sourcePort, sourceChannel string, token sdk.Coin, memo string, ) error
EmitIBCTransferEvent creates a new IBC transfer event emitted on a Transfer transaction.
func NewDenomHashRequest ¶
func NewDenomHashRequest(args []interface{}) (*transfertypes.QueryDenomHashRequest, error)
NewDenomHashRequest returns a new denom hash request from the given arguments.
func NewDenomRequest ¶ added in v0.2.0
func NewDenomRequest(args []interface{}) (*transfertypes.QueryDenomRequest, error)
NewDenomRequest returns a new denom request from the given arguments.
func NewDenomsRequest ¶ added in v0.2.0
func NewDenomsRequest(method *abi.Method, args []interface{}) (*transfertypes.QueryDenomsRequest, error)
NewDenomsRequest returns a new denoms request from the given arguments.
func NewMsgTransfer ¶
func NewMsgTransfer(method *abi.Method, args []interface{}) (*transfertypes.MsgTransfer, common.Address, error)
NewMsgTransfer returns a new transfer message from the given arguments.
Types ¶
type DenomResponse ¶ added in v0.2.0
type DenomResponse struct {
Denom transfertypes.Denom
}
DenomResponse defines the data for the denom response.
type DenomsResponse ¶ added in v0.2.0
type DenomsResponse struct {
Denoms []transfertypes.Denom
PageResponse query.PageResponse
}
DenomsResponse defines the data for the denoms response.
type EventIBCTransfer ¶
type EventIBCTransfer struct {
Sender common.Address
Receiver common.Hash
SourcePort string
SourceChannel string
Denom string
Amount *big.Int
Memo string
}
EventIBCTransfer is the event type emitted when a transfer is executed.
type EventTransferAuthorization ¶
type EventTransferAuthorization struct {
Grantee common.Address
Granter common.Address
Allocations []cmn.ICS20Allocation
}
EventTransferAuthorization is the event type emitted when a transfer authorization is created.
type PageRequest ¶
type PageRequest struct {
PageRequest query.PageRequest
}
PageRequest defines the data for the page request.
type Precompile ¶
type Precompile struct {
cmn.Precompile
abi.ABI
// contains filtered or unexported fields
}
func NewPrecompile ¶
func NewPrecompile( bankKeeper cmn.BankKeeper, stakingKeeper cmn.StakingKeeper, transferKeeper cmn.TransferKeeper, channelKeeper cmn.ChannelKeeper, ) *Precompile
NewPrecompile creates a new ICS-20 Precompile instance as a PrecompiledContract interface.
func (Precompile) Denom ¶ added in v0.2.0
func (p Precompile) Denom( ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}, ) ([]byte, error)
Denom returns the requested denomination information.
func (Precompile) DenomHash ¶
func (p Precompile) DenomHash( ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}, ) ([]byte, error)
DenomHash returns the denom hash (in hex format) of the denomination information.
func (Precompile) Denoms ¶ added in v0.2.0
func (p Precompile) Denoms( ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}, ) ([]byte, error)
Denoms returns the requested denomination information.
func (Precompile) IsTransaction ¶
func (Precompile) IsTransaction(method *abi.Method) bool
IsTransaction checks if the given method name corresponds to a transaction or query.
Available ics20 transactions are:
- Transfer
func (Precompile) RequiredGas ¶
func (p Precompile) RequiredGas(input []byte) uint64
RequiredGas calculates the precompiled contract's base gas rate.