Documentation
¶
Index ¶
Constants ¶
const ( ApproveMethodName = "approve" ApprovalExpiration = time.Hour * 24 * 365 * time.Duration(100) // 100 years )
ApproveMethodName is the name of the approve method that should match the name in the contract ABI.
const ( NameMethodName = "name" SymbolMethodName = "symbol" DecimalsMethodName = "decimals" Decimals = uint8(18) Symbol = "BTC" Name = "BTC" )
const ( PermitMethodName = "permit" NonceMethodName = "nonce" DomainSeparatorMethodName = "DOMAIN_SEPARATOR" PermitTypehashMethodName = "PERMIT_TYPEHASH" PermitTypehash = "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" )
const ( TransferMethodName = "transfer" TransferFromMethodName = "transferFrom" )
const (
AllowanceMethodName = "allowance"
)
AllowanceMethodName is the name of the Allowance method that should match the name in the contract ABI.
const ApprovalEventName = "Approval"
ApprovalEventName is the name of the Approval event. It matches the name of the event in the contract ABI.
const BalanceOfMethodName = "balanceOf"
BalanceOfMethodName is the name of the balanceOf method. It matches the name of the method in the contract ABI.
const EvmAddress = "0x7b7c000000000000000000000000000000000000"
EvmAddress is the EVM address of the BTC token precompile. Token address is prefixed with 0x7b7c which was used to derive Mezo chain ID. This prefix is used to avoid potential collisions with EVM native precompiles.
const EvmByteCode = "" /* 4926-byte string literal not displayed */
This bytecode was generated by compiling the BTCCaller contract found in the precompile/hardhat package. Then extracting `deployedBytecode` from the build artifacts
const TotalSupplyMethodName = "totalSupply"
TotalSupplyMethodName is the name of the totalSupply method. It matches the name of the method in the contract ABI.
const TransferEventName = "Transfer"
TransferEventName is the name of the Transfer event. It matches the name of the event in the contract ABI.
Variables ¶
var DomainSeparator []byte
DomainSeparator was generated by combination of encoding and hashing different params shown in the pseudo code below.
keccak256(encode(
keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(BTC), keccak256(1), chainId, // e.g 31612 0x7b7C000000000000000000000000000000000000 ) )
var SendMsgURL = sdk.MsgTypeURL(&banktypes.MsgSend{})
SendMsgURL defines the authorization type for MsgSend
Functions ¶
func NewPrecompile ¶
func NewPrecompile(bankKeeper bankkeeper.Keeper, authzkeeper authzkeeper.Keeper, evmkeeper evmkeeper.Keeper, id string) (*precompile.Contract, error)
NewPrecompile creates a new BTC token precompile.
Types ¶
type ApprovalEvent ¶
type ApprovalEvent struct {
// contains filtered or unexported fields
}
ApprovalEvent is the implementation of the Approval event that contains the following arguments: - owner (indexed): the address of BTC owner, - to (indexed): the address of spender, - amount (non-indexed): the amount of tokens approved.
func NewApprovalEvent ¶
func NewApprovalEvent(from, to common.Address, amount *big.Int) *ApprovalEvent
func (*ApprovalEvent) Arguments ¶
func (ae *ApprovalEvent) Arguments() []*precompile.EventArgument
func (*ApprovalEvent) EventName ¶
func (ae *ApprovalEvent) EventName() string
type TransferEvent ¶
type TransferEvent struct {
// contains filtered or unexported fields
}
transferEvent is the implementation of the Transfer event that contains the following arguments: - from (indexed): the address from which the tokens are transferred, - to (indexed): the address to which the tokens are transferred, - value (non-indexed): the amount of tokens transferred.
func NewTransferEvent ¶
func NewTransferEvent(from, to common.Address, value *big.Int) *TransferEvent
func (*TransferEvent) Arguments ¶
func (te *TransferEvent) Arguments() []*precompile.EventArgument
func (*TransferEvent) EventName ¶
func (te *TransferEvent) EventName() string