btctoken

package
v0.3.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const (
	NameMethodName     = "name"
	SymbolMethodName   = "symbol"
	DecimalsMethodName = "decimals"
	Decimals           = uint8(18)
	Symbol             = "BTC"
	Name               = "BTC"
)
View Source
const (
	PermitMethodName          = "permit"
	NonceMethodName           = "nonce"
	DomainSeparatorMethodName = "DOMAIN_SEPARATOR"
	PermitTypehashMethodName  = "PERMIT_TYPEHASH"
	PermitTypehash            = "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
)
View Source
const (
	TransferMethodName     = "transfer"
	TransferFromMethodName = "transferFrom"
)
View Source
const (
	AllowanceMethodName = "allowance"
)

AllowanceMethodName is the name of the Allowance method that should match the name in the contract ABI.

View Source
const ApprovalEventName = "Approval"

ApprovalEventName is the name of the Approval event. It matches the name of the event in the contract ABI.

View Source
const BalanceOfMethodName = "balanceOf"

BalanceOfMethodName is the name of the balanceOf method. It matches the name of the method in the contract ABI.

View Source
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.

View Source
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

View Source
const TotalSupplyMethodName = "totalSupply"

TotalSupplyMethodName is the name of the totalSupply method. It matches the name of the method in the contract ABI.

View Source
const TransferEventName = "Transfer"

TransferEventName is the name of the Transfer event. It matches the name of the event in the contract ABI.

Variables

View Source
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
	)
)
View Source
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

Jump to

Keyboard shortcuts

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