abi

package
v0.0.0-...-4fc266b Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamTypeUint256 = "uint256"
)

Variables

View Source
var (
	ErrSmartContractMethodParamsCountMismatch = errors.New("method params count mismatch")
	ErrSmartContractUnknownMethod             = errors.New("unknown method")
	ErrInvalidParamsData                      = errors.New("invalid params Data")
	ErrConfigStorageEmpty                     = errors.New("config storage is empty")
	ErrUnknownContract                        = errors.New("unknown contract")
	ErrNotTransferMethod                      = errors.New("not transfer method")
)

Functions

This section is empty.

Types

type Option

type Option func(*SmartContractsManager)

func WithAddressCodec

func WithAddressCodec(codec address.AddressCodec) Option

func WithStorage

func WithStorage(storage storage.BinStorage) Option

type SmartContractAbi

type SmartContractAbi struct {
	Entries []*SmartContractAbiEntry `json:"entries"`
	// contains filtered or unexported fields
}

func (*SmartContractAbi) AddEntry

func (a *SmartContractAbi) AddEntry(entry *SmartContractAbiEntry)

func (*SmartContractAbi) GetMethodById

func (a *SmartContractAbi) GetMethodById(signature [4]byte) (entry *SmartContractAbiEntry, err error)

func (*SmartContractAbi) GetMethodByName

func (a *SmartContractAbi) GetMethodByName(name string) (entry *SmartContractAbiEntry, err error)

type SmartContractAbiEntry

type SmartContractAbiEntry struct {
	Constant        bool                           `json:"constant,omitempty"`
	Signature       [4]byte                        `json:"-"`
	Name            string                         `json:"name,omitempty"`
	StateMutability string                         `json:"stateMutability,omitempty"`
	Type            string                         `json:"type"`
	Inputs          []*SmartContractAbiEntryInput  `json:"inputs,omitempty"`
	Outputs         []*SmartContractAbiEntryOutput `json:"outputs,omitempty"`
}

func NewEntry

func NewEntry() *SmartContractAbiEntry

func (*SmartContractAbiEntry) DecodeInputs

func (e *SmartContractAbiEntry) DecodeInputs(data []byte) (paramsParsed []*paramInput, err error)

func (*SmartContractAbiEntry) GetSignature

func (e *SmartContractAbiEntry) GetSignature() [4]byte

func (*SmartContractAbiEntry) String

func (e *SmartContractAbiEntry) String() string

type SmartContractAbiEntryInput

type SmartContractAbiEntryInput struct {
	Name    string `json:"name,omitempty"`
	Type    string `json:"type"`
	Indexed bool   `json:"indexed,omitempty"`
	// contains filtered or unexported fields
}

type SmartContractAbiEntryOutput

type SmartContractAbiEntryOutput struct {
	Type string `json:"type"`
	Name string `json:"name,omitempty"`
}

type SmartContractInfo

type SmartContractInfo struct {
	Name            string            `json:"name"`
	Symbol          string            `json:"symbol"`
	ContractAddress string            `json:"contract_address"`
	OriginAddress   string            `json:"origin_address"`
	Decimals        int               `json:"decimals"`
	OriginGasLimit  int64             `json:"origin_gas_limit"`
	Abi             *SmartContractAbi `json:"abi"`
}

type SmartContractsManager

type SmartContractsManager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(options ...Option) *SmartContractsManager

func (*SmartContractsManager) Add

func (*SmartContractsManager) ColdStart

func (m *SmartContractsManager) ColdStart() (err error)

func (*SmartContractsManager) Erc20CallGetBalance

func (m *SmartContractsManager) Erc20CallGetBalance(address string) (callData string, err error)

func (*SmartContractsManager) Erc20DecodeAmount

func (m *SmartContractsManager) Erc20DecodeAmount(callData []byte) (amount *big.Int)

func (*SmartContractsManager) Erc20DecodeIfTransfer

func (m *SmartContractsManager) Erc20DecodeIfTransfer(callData []byte) (address string, amount *big.Int, err error)

func (*SmartContractsManager) Erc20IsTransfer

func (m *SmartContractsManager) Erc20IsTransfer(callData []byte) bool

func (*SmartContractsManager) GetSmartContractAddressByName

func (m *SmartContractsManager) GetSmartContractAddressByName(contractName string) (contractAddress string, err error)

func (*SmartContractsManager) GetSmartContractAddressByToken

func (m *SmartContractsManager) GetSmartContractAddressByToken(symbol string) (contractAddress string, err error)

func (*SmartContractsManager) GetSmartContractByAddress

func (m *SmartContractsManager) GetSmartContractByAddress(contractAddress string) (contract *SmartContractInfo, err error)

func (*SmartContractsManager) GetSmartContractByToken

func (m *SmartContractsManager) GetSmartContractByToken(symbol string) (contract *SmartContractInfo, err error)

func (*SmartContractsManager) GetSmartContractList

func (m *SmartContractsManager) GetSmartContractList() (list map[string]string)

func (*SmartContractsManager) Init

func (m *SmartContractsManager) Init() error

func (*SmartContractsManager) Load

func (m *SmartContractsManager) Load() (err error)

func (*SmartContractsManager) Save

func (m *SmartContractsManager) Save() (err error)

func (*SmartContractsManager) Walk

func (m *SmartContractsManager) Walk(view func(c *SmartContractInfo))

Jump to

Keyboard shortcuts

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