contract

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InterfaceIDERC721 method ID from https://eips.ethereum.org/EIPS/eip-721#:~:text=0x80ac58cd.
	InterfaceIDERC721 = [4]byte(hexutil.MustDecode("0x80ac58cd"))
	// InterfaceIDERC1155 method ID from https://eips.ethereum.org/EIPS/eip-1155#:~:text=0xd9b67a26.
	InterfaceIDERC1155 = [4]byte(hexutil.MustDecode("0xd9b67a26"))
)

Functions

func ContainsMethodIDs

func ContainsMethodIDs(code []byte, methodIDs ...[4]byte) bool

ContainsMethodIDs checks if the code contains all the method IDs.

func DetectERC1155WithCode

func DetectERC1155WithCode(_ uint64, _ common.Address, code []byte) bool

DetectERC1155WithCode detects if bytecode of the contract is ERC-1155.

func DetectERC165WithCode

func DetectERC165WithCode(_ uint64, _ common.Address, code []byte) bool

DetectERC165WithCode detects if bytecode of the contract is ERC-165.

func DetectERC1967WithCode

func DetectERC1967WithCode(_ uint64, _ common.Address, code []byte) bool

DetectERC1967WithCode detects if bytecode of the contract is ERC-1967.

func DetectERC20WithCode

func DetectERC20WithCode(_ uint64, address common.Address, code []byte) bool

DetectERC20WithCode detects if bytecode of the contract is ERC-20.

func DetectERC721WithCode

func DetectERC721WithCode(_ uint64, _ common.Address, code []byte) bool

DetectERC721WithCode detects if bytecode of the contract is ERC-721.

func DetectNFTStandard

func DetectNFTStandard(ctx context.Context, _ uint64, address common.Address, blockNumber *big.Int, ethereumClient ethereum.Client) (metadata.Standard, error)

DetectNFTStandard detects the NFT standard of the contract by ERC-165.

func DetectTokenStandard

func DetectTokenStandard(ctx context.Context, chainID uint64, address common.Address, blockNumber *big.Int, ethereumClient ethereum.Client) (metadata.Standard, error)

DetectTokenStandard detects the token standard of the contract by bytecode. It supports the ERC-1967 proxy contract.

func EventHash

func EventHash(event string) common.Hash

EventHash calculates the event hash of the event signature.

func MatchAddresses

func MatchAddresses(address common.Address, addresses ...common.Address) bool

MatchAddresses checks if the address matches any of the addresses.

func MatchEventHashes

func MatchEventHashes(hash common.Hash, eventHashes ...common.Hash) bool

MatchEventHashes checks if the hash matches any of the event hashes.

func MatchMethodIDs

func MatchMethodIDs(input []byte, methodIDs ...[4]byte) bool

MatchMethodIDs checks if the input matches any of the method IDs.

func MethodID

func MethodID(method string) [4]byte

MethodID calculates the method ID of the function selector.

Types

This section is empty.

Jump to

Keyboard shortcuts

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