Documentation ¶
Index ¶
- Constants
- type Precompile
- func (Precompile) Address() common.Address
- func (p Precompile) Bech32ToHex(method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) HexToBech32(method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) RequiredGas(_ []byte) uint64
- func (p Precompile) Run(_ *vm.EVM, contract *vm.Contract, _ bool) (bz []byte, err error)
Constants ¶
const ( // HexToBech32Method defines the ABI method name to convert a EIP-55 // hex formatted address to bech32 address string. HexToBech32Method = "hexToBech32" // Bech32ToHexMethod defines the ABI method name to convert a bech32 // formatted address string to an EIP-55 address. Bech32ToHexMethod = "bech32ToHex" )
const (
// PrecompileAddress defines the address of the bech32 precompile contract.
PrecompileAddress = "0x0000000000000000000000000000000000000400"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Precompile ¶
Precompile defines the precompiled contract for Bech32 encoding.
func NewPrecompile ¶
func NewPrecompile(baseGas uint64) (*Precompile, error)
NewPrecompile creates a new bech32 Precompile instance as a PrecompiledContract interface.
func (Precompile) Address ¶
func (Precompile) Address() common.Address
Address defines the address of the bech32 compile contract. address: 0x0000000000000000000000000000000000000400
func (Precompile) Bech32ToHex ¶
func (p Precompile) Bech32ToHex( method *abi.Method, args []interface{}, ) ([]byte, error)
Bech32ToHex converts a bech32 address to its corresponding EIP-55 hex format. The Human Readable Prefix (HRP) must be provided in the arguments. This function fails if the address is invalid or if the bech32 conversion fails.
func (Precompile) HexToBech32 ¶
func (p Precompile) HexToBech32( method *abi.Method, args []interface{}, ) ([]byte, error)
HexToBech32 converts a hex address to its corresponding Bech32 format. The Human Readable Prefix (HRP) must be provided in the arguments. This function fails if the address is invalid or if the bech32 conversion fails.
func (Precompile) RequiredGas ¶
func (p Precompile) RequiredGas(_ []byte) uint64
RequiredGas calculates the contract gas use.