Documentation ¶
Index ¶
- Constants
- func DecodeCursor(encodedCursor string) (*big.Int, error)
- func SaveAst(db *sql.DB, ast *Ast) error
- func SaveCfg(db *sql.DB, cfg *Cfg) error
- func SaveConstructor(db *sql.DB, constructor *Constructor) error
- func SaveContract(db *sql.DB, contract *Contract) error
- func SaveEvents(db *sql.DB, fns []*Event) error
- func SaveFunction(db *sql.DB, fn *Function) error
- func SaveFunctions(db *sql.DB, fns []*Function) error
- func SaveMetadata(db *sql.DB, metadata *Metadata) error
- func SaveStandard(db *sql.DB, standard *Standard) error
- func SaveStandards(db *sql.DB, standards []*Standard) error
- func SaveToken(db *sql.DB, token *Token) error
- func SaveVariable(db *sql.DB, variable *Variable) error
- func SaveVariables(db *sql.DB, variables []*Variable) error
- func UpdateContract(db *sql.DB, contract *Contract) error
- type Ast
- type Cfg
- type Constructor
- type Contract
- type DbStats
- type Event
- type Function
- func GetContractFunctionBySignature(db *sql.DB, networkId *big.Int, contractId int64, signature string) (*Function, error)
- func GetContractFunctionByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64, referenceId string) (*Function, error)
- func GetFunctionBySignature(db *sql.DB, networkId *big.Int, signature string) (*Function, error)
- type Metadata
- type Standard
- type Token
- type Variable
Constants ¶
const AstKeyPrefix = "contract:ast:entry"
AstKeyPrefix is a constant defining the prefix for the database keys of contract metadata entries.
const CfgKeyPrefix = "contract:cfg:entry"
CfgKeyPrefix is a constant defining the prefix for the database keys of contract cfg entries.
const ConstructorKeyPrefix = "contract:constructor:entry"
ConstructorKeyPrefix is a constant defining the prefix for the database keys of contract constructor entries.
const ContractKeyPrefix = "contract:entry"
ContractKeyPrefix is a constant defining the prefix for the database keys of contract entries.
const EventKeyPrefix = "contract:event:entry"
EventKeyPrefix is a constant defining the prefix for the database keys of contract metadata entries.
const FunctionKeyPrefix = "contract:function:entry"
FunctionKeyPrefix is a constant defining the prefix for the database keys of contract metadata entries.
const MetadataKeyPrefix = "contract:metadata:entry"
MetadataKeyPrefix is a constant defining the prefix for the database keys of contract metadata entries.
const StandardKeyPrefix = "contract:standard:entry"
StandardKeyPrefix is a constant defining the prefix for the database keys of contract standard entries.
const TokenKeyPrefix = "contract:token:entry"
TokenKeyPrefix is a constant defining the prefix for the database keys of contract metadata entries.
const VariableKeyPrefix = "contract:variable:entry"
VariableKeyPrefix is a constant defining the prefix for the database keys of contract metadata entries.
Variables ¶
This section is empty.
Functions ¶
func SaveConstructor ¶
func SaveConstructor(db *sql.DB, constructor *Constructor) error
SaveConstructor saves Constructor instance to the SQLite database.
func SaveContract ¶
SaveContract saves a Contract instance to the SQLite database.
func SaveEvents ¶
SaveEvents performs a bulk insert of multiple Event instances into the SQLite database.
func SaveFunction ¶
SaveFunction saves Function instance to the SQLite database.
func SaveFunctions ¶
SaveFunctions performs a bulk insert of multiple Function instances into the SQLite database.
func SaveMetadata ¶
SaveMetadata saves a Contract instance to the SQLite database.
func SaveStandard ¶
SaveStandard saves Standard instance to the SQLite database.
func SaveStandards ¶
SaveStandards performs a bulk insert of multiple Standard instances into the SQLite database.
func SaveVariable ¶
SaveVariable saves Variable instance to the SQLite database.
func SaveVariables ¶
SaveVariables performs a bulk insert of multiple Variable instances into the SQLite database.
Types ¶
type Ast ¶
type Ast struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt UnitsCount int64 ContractsCount int64 InterfacesCount int64 LibrariesCount int64 StateVariablesCount int64 FunctionsCount int64 EventsCount int64 Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractAstByUniqueIndex ¶
GetContractAstByUniqueIndex retrieves a single contract ast from the database based on a unique combination of network_id and contract id.
func (*Ast) EncodeCursor ¶
func (*Ast) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.
func (*Ast) IsCompleted ¶
type Cfg ¶
type Cfg struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt Mermaid string Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractCfgByUniqueIndex ¶
GetContractCfgByUniqueIndex retrieves a single contract cfg from the database based on a unique combination of network_id and contract id.
func (*Cfg) EncodeCursor ¶
func (*Cfg) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.
func (*Cfg) IsCompleted ¶
type Constructor ¶
type Constructor struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt Signature string `bun:"signature"` Arguments json.RawMessage `bun:"arguments"` ArgumentsRaw json.RawMessage `bun:"arguments_raw"` Abi json.RawMessage `bun:"abi"` Unit json.RawMessage `bun:"unit"` Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractConstructorByUniqueIndex ¶
func GetContractConstructorByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64) (*Constructor, error)
GetContractConstructorByUniqueIndex retrieves a single contract constructor from the database based on a unique combination of network_id and contract id.
func (*Constructor) EncodeCursor ¶
func (c *Constructor) EncodeCursor() string
func (*Constructor) GetKey ¶
func (c *Constructor) GetKey() string
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.
func (*Constructor) IsCompleted ¶
func (c *Constructor) IsCompleted() bool
type Contract ¶
type Contract struct { Id int64 NetworkId *types.BigInt BlockNumber *types.BigInt BlockHash types.Hash TransactionHash types.Hash Address types.Address Name string Standards types.Standards Proxy bool License string CompilerVersion string SolgoVersion string Optimized bool OptimizationRuns uint64 EVMVersion string ABI string Verified bool SourcesProvider string VerificationProvider string ExecutionBytecode types.Bytecode Bytecode types.Bytecode SafetyState utils.SafetyStateType SourceAvailable bool SelfDestructed bool ProxyImplementations types.Addresses CompletedStates types.States FailedStates types.States Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractByAddress ¶
func GetContractByAddress(db *sql.DB, networkId *big.Int, address common.Address) (*Contract, error)
GetContractByAddress retrieves a single contract from the database based on a unique combination of network_id, block_number, and address.
func GetContractByUniqueIndex ¶
func GetContractByUniqueIndex(db *sql.DB, networkId *big.Int, blockNumber *big.Int, address common.Address) (*Contract, error)
GetContractByUniqueIndex retrieves a single contract from the database based on a unique combination of network_id, block_number, and address.
func (*Contract) EncodeCursor ¶
func (*Contract) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.
func (*Contract) IsCompleted ¶
type DbStats ¶
type DbStats struct { ContractsCount int64 `json:"contractsCount"` // The total number of contracts in the database. FullContractsCount int64 `json:"fullContractsCount"` // The count of contracts that are fully processed and not partial. MetadataCount int64 `json:"metadataCount"` // The number of metadata entries related to contracts. AstCount int64 `json:"astCount"` // The count of AST (Abstract Syntax Tree) entries, typically used for source code analysis. CfgCount int64 `json:"cfgCount"` // The number of CFG (Control Flow Graph) entries, important for understanding the flow of contracts. StandardsCount int64 `json:"standardsCount"` // The count of entries related to various contract standards (e.g., ERC-20, ERC-721). TokensCount int64 `json:"tokensCount"` // The number of token entries, often used in contracts for creating cryptocurrencies or other digital assets. ConstructorsCount int64 `json:"constructsCount"` // The count of constructor functions within contracts, essential for contract initialization. VariablesCount int64 `json:"variablesCount"` // The number of variables defined across all contracts. FunctionsCount int64 `json:"functionsCount"` // The count of functions defined in contracts, crucial for contract operations. EventsCount int64 `json:"eventsCount"` // The number of events defined in contracts, used for state changes and notifications within the blockchain. DatabaseSizeMb float64 `json:"databaseSizeMb"` // Size of the database in MB }
DbStats represents the statistical data regarding various blockchain-related entities stored in the database. This includes counts of contracts, metadata, and other elements important for smart contract analysis and management.
type Event ¶
type Event struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt ReferenceId string Name string Signature string SignatureRaw string SignatureBytes []byte Anonymous bool Abi json.RawMessage Unit json.RawMessage Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractEventBySignature ¶
func GetContractEventBySignature(db *sql.DB, networkId *big.Int, contractId int64, signature string) (*Event, error)
GetContractEventBySignature retrieves a single contract event from the database based on a unique combination of network_id, contract id and log signature (topic 0).
func GetContractEventByUniqueIndex ¶
func GetContractEventByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64, referenceId string) (*Event, error)
GetContractEventByUniqueIndex retrieves a single contract function from the database based on a unique combination of network_id and contract id.
func (*Event) EncodeCursor ¶
func (*Event) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, network id, and contract id.
func (*Event) IsCompleted ¶
type Function ¶
type Function struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt ReferenceId string Name string Type string Signature string SignatureRaw string SignatureBytes []byte Abi json.RawMessage Implemented bool Visibility string Mutability string Virtual bool Unit json.RawMessage Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractFunctionBySignature ¶
func GetContractFunctionBySignature(db *sql.DB, networkId *big.Int, contractId int64, signature string) (*Function, error)
GetContractFunctionBySignature retrieves a single contract function from the database based on a unique combination of network_id and contract id and signature.
func GetContractFunctionByUniqueIndex ¶
func GetContractFunctionByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64, referenceId string) (*Function, error)
GetContractFunctionByUniqueIndex retrieves a single contract function from the database based on a unique combination of network_id and contract id.
func GetFunctionBySignature ¶
GetFunctionBySignature retrieves a single contract function from the database based on a unique combination of network_id and signature.
func (*Function) EncodeCursor ¶
func (*Function) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, network id, and contract id.
func (*Function) IsCompleted ¶
type Metadata ¶
type Metadata struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt CborLength int16 AuxBytes string Ipfs string Bzzr0 string Bzzr1 string SolcVersion string Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractMetadataByUniqueIndex ¶
func GetContractMetadataByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64) (*Metadata, error)
GetContractMetadataByUniqueIndex retrieves a single contract metadata from the database based on a unique combination of network_id and contract id.
func (*Metadata) EncodeCursor ¶
func (*Metadata) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.
func (*Metadata) IsCompleted ¶
type Standard ¶
type Standard struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt Name string Type standards.Standard Confidence string ConfidencePoints float64 DiscoveredTokens int64 MaximumTokens int64 Threshold float64 Unit json.RawMessage Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractStandardByUniqueIndex ¶
func GetContractStandardByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64, standardType standards.Standard) (*Standard, error)
GetContractStandardByUniqueIndex retrieves a single contract standard from the database based on a unique combination of network_id and contract id.
func (*Standard) EncodeCursor ¶
func (*Standard) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, network id, and contract id.
func (*Standard) IsCompleted ¶
type Token ¶
type Token struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt Name string Symbol string Decimals int64 TotalSupply string Valid bool Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetTokenByUniqueIndex ¶
GetTokenByUniqueIndex retrieves a single token from the database based on a unique combination of network_id and contract id.
func (*Token) EncodeCursor ¶
func (*Token) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.
func (*Token) IsCompleted ¶
type Variable ¶
type Variable struct { Id int64 NetworkId *types.BigInt ContractId *types.BigInt Name string Type string StateMutability string Visibility string IsConstant bool IsAddress bool IsContract bool IsArray bool IsDynamicArray bool IsMapping bool IsStruct bool StorageIndex int64 Size int64 Offset int64 Unit json.RawMessage Processed bool Partial bool CreatedAt time.Time UpdatedAt time.Time }
func GetContractVariableByUniqueIndex ¶
func GetContractVariableByUniqueIndex(db *sql.DB, networkId *big.Int, contractId int64, name string) (*Variable, error)
GetContractVariableByUniqueIndex retrieves a single contract state variable from the database based on a unique combination of network_id and contract id.
func (*Variable) EncodeCursor ¶
func (*Variable) GetKey ¶
GetKey constructs and returns a unique key for the entry combining the prefix, network, networkID, and address.