abi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package abi provides helpers for working with contract ABIs beyond what generated bindings offer: address auto-discovery via the FWSS root of trust, generic event extraction from receipts, and PieceCID <-> contract struct conversions.

Index

Constants

This section is empty.

Variables

View Source
var ErrEventNotFound = errors.New("event not found in receipt")

ErrEventNotFound is returned when the named event is not present in the receipt's logs.

Functions

func DecodePieceCID

func DecodePieceCID(raw pdpverifier.CidsCid) (cid.Cid, error)

DecodePieceCID parses a CidsCid back into a cid.Cid.

func DecodePieceCIDs

func DecodePieceCIDs(raw []pdpverifier.CidsCid) ([]cid.Cid, error)

DecodePieceCIDs batches DecodePieceCID over a slice. Returns the first decoding error encountered.

func EncodePieceCID

func EncodePieceCID(c cid.Cid) pdpverifier.CidsCid

EncodePieceCID converts a cid.Cid to the on-chain Cids.Cid struct shape (the bindings alias it as CidsCid). The stored bytes are the raw CID byte representation (cid.Bytes()).

func EncodePieceCIDs

func EncodePieceCIDs(cids []cid.Cid) []pdpverifier.CidsCid

EncodePieceCIDs batches EncodePieceCID over a slice.

func ExtractEvent

func ExtractEvent(receipt *types.Receipt, contractABI *ethabi.ABI, eventName string, emitter common.Address, dst any) error

ExtractEvent finds the first log in receipt matching the event named eventName in contractABI, emitted by the optional address filter (zero address = any emitter). Non-indexed fields are unpacked into dst, which must be a pointer to a compatible struct or slice as expected by go-ethereum's abi.UnpackIntoInterface. Indexed fields are not populated; use a typed bindings helper if you need indexed topic values.

Types

type Call3

type Call3 struct {
	Target       common.Address
	AllowFailure bool
	CallData     []byte
}

type ContractCaller

type ContractCaller interface {
	bind.ContractCaller
}

ContractCaller is the subset of bind.ContractCaller used by helpers here. It is satisfied by *ethclient.Client.

type ResolvedAddresses

type ResolvedAddresses struct {
	FWSS               common.Address
	PDPVerifier        common.Address
	SPRegistry         common.Address
	USDFC              common.Address
	Payments           common.Address
	ViewContract       common.Address
	FilBeamBeneficiary common.Address
	SessionKeyRegistry common.Address
	Multicall3         common.Address // propagated from chain fallback, if known
}

ResolvedAddresses holds the set of contract addresses that FWSS points to, plus FWSS itself.

func ResolveAddresses

func ResolveAddresses(ctx context.Context, caller ContractCaller, fwssAddr common.Address) (*ResolvedAddresses, error)

ResolveAddresses reads address pointers directly from the FWSS contract. fwssAddr must be non-zero; callers that want a registry fallback should use ResolvedAddressesFromChain separately.

On any RPC/call failure the function returns an error; callers may choose to fall back to ResolvedAddressesFromChain.

func ResolvedAddressesFromChain

func ResolvedAddressesFromChain(c chain.Chain) ResolvedAddresses

ResolvedAddressesFromChain builds a ResolvedAddresses from the hard-coded chain registry. Intended as a fallback when on-chain resolution fails. ViewContract and FilBeamBeneficiary are left zero when unknown.

type Result3

type Result3 struct {
	Success    bool
	ReturnData []byte
}

func BatchCall

func BatchCall(ctx context.Context, caller ContractCaller, calls []Call3) ([]Result3, error)

Jump to

Keyboard shortcuts

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