systemcontracts

package
v2.3.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GenericStorageABI = `` /* 9709-byte string literal not displayed */

GenericStorageABI is the ABI definition for the GenericStorage contract

View Source
const GenericStorageByteCodeStr = "" /* 22280-byte string literal not displayed */
View Source
const NamespaceStorageABI = `` /* 15150-byte string literal not displayed */

NamespaceStorageABI is the ABI definition for the NamespaceStorage contract

View Source
const NamespaceStorageContractByteCodeStr = "" /* 35728-byte string literal not displayed */

NamespaceStorageContractByteCodeStr is the bytecode for the NamespaceStorage contract

Variables

This section is empty.

Functions

func DecodeGenericValue

func DecodeGenericValue(o interface{}, data GenericValue) error

DecodeGenericValue decodes a GenericValue into a specific object

Types

type BatchGetResult

type BatchGetResult struct {
	Values      []GenericValue `json:"values"`
	ExistsFlags []bool         `json:"existsFlags"`
}

BatchGetResult represents the result of a batch get operation

type ContractBackend

type ContractBackend interface {
	Call(callMsg *ethereum.CallMsg) ([]byte, error)
	Handle(callMsg *ethereum.CallMsg) error
}

ContractBackend defines the interface for contract backend operations

type GenericStorageContract

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

GenericStorageContract provides an interface to interact with the GenericStorage smart contract

func NewGenericStorageContract

func NewGenericStorageContract(contractAddress common.Address, backend ContractBackend, owner common.Address) (*GenericStorageContract, error)

NewGenericStorageContract creates a new GenericStorage contract instance

func (*GenericStorageContract) Address

func (g *GenericStorageContract) Address() common.Address

Address returns the contract address

func (*GenericStorageContract) BatchGet

func (g *GenericStorageContract) BatchGet(keys [][]byte) (*BatchGetResult, error)

BatchGet retrieves multiple values by their keys

func (*GenericStorageContract) Clear

func (g *GenericStorageContract) Clear() error

Clear removes all stored data (emergency function)

func (*GenericStorageContract) Count

func (g *GenericStorageContract) Count() (*big.Int, error)

Count returns the total number of stored items

func (*GenericStorageContract) Exists

func (g *GenericStorageContract) Exists(key []byte) (bool, error)

Exists checks if a key exists in the storage

func (*GenericStorageContract) Get

func (g *GenericStorageContract) Get(key []byte) (*GetResult, error)

Get retrieves data by key

func (*GenericStorageContract) List

func (g *GenericStorageContract) List(offset, limit uint64) (*ListResult, error)

List retrieves all stored data with pagination

func (*GenericStorageContract) ListKeys

func (g *GenericStorageContract) ListKeys(offset, limit uint64) (*ListKeysResult, error)

ListKeys retrieves all keys with pagination (lightweight version)

func (*GenericStorageContract) Put

func (g *GenericStorageContract) Put(key []byte, value GenericValue) error

Put stores data with the given key

func (*GenericStorageContract) PutSimple

func (g *GenericStorageContract) PutSimple(key []byte, data []byte) error

PutSimple stores data with only primary data (convenience method)

func (*GenericStorageContract) Remove

func (g *GenericStorageContract) Remove(key []byte) (bool, error)

Remove deletes data by key

type GenericValue

type GenericValue struct {
	PrimaryData   []byte `json:"primaryData"`
	SecondaryData []byte `json:"secondaryData"`
	AuxiliaryData []byte `json:"auxiliaryData"`
}

GenericValue represents the value structure in the GenericStorage contract

type GenericValueContainer

type GenericValueContainer interface {
	Decode(data GenericValue) error
	Encode() (GenericValue, error)
}

GenericValueContainer is an interface for objects that can be encoded/decoded to/from GenericValue

type GetResult

type GetResult struct {
	Value     GenericValue `json:"value"`
	KeyExists bool         `json:"keyExists"`
}

GetResult represents the result of a get operation

type ListKeysResult

type ListKeysResult struct {
	KeyList [][]byte `json:"keyList"`
	Total   *big.Int `json:"total"`
}

ListKeysResult represents the result of a listKeys operation

type ListResult

type ListResult struct {
	KeyList [][]byte       `json:"keyList"`
	Values  []GenericValue `json:"values"`
	Total   *big.Int       `json:"total"`
}

ListResult represents the result of a list operation

type NamespaceBatchGetResult

type NamespaceBatchGetResult = BatchGetResult

NamespaceBatchGetResult represents the result of a batch get operation

type NamespaceGenericValue

type NamespaceGenericValue = GenericValue

NamespaceGenericValue represents the value structure in the NamespaceStorage contract This is the same as GenericValue but renamed to avoid conflicts

type NamespaceGetResult

type NamespaceGetResult = GetResult

NamespaceGetResult represents the result of a get operation

type NamespaceListKeysResult

type NamespaceListKeysResult = ListKeysResult

NamespaceListKeysResult represents the result of a listKeys operation

type NamespaceListNamespacesResult

type NamespaceListNamespacesResult struct {
	NamespaceList []string   `json:"namespaceList"`
	Counts        []*big.Int `json:"counts"`
	Total         *big.Int   `json:"total"`
}

NamespaceListNamespacesResult represents the result of a listNamespaces operation

type NamespaceListResult

type NamespaceListResult = ListResult

NamespaceListResult represents the result of a list operation

type NamespaceStorageContract

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

NamespaceStorageContract provides an interface to interact with the NamespaceStorage smart contract

func NewNamespaceStorageContract

func NewNamespaceStorageContract(contractAddress common.Address, backend ContractBackend, owner common.Address) (*NamespaceStorageContract, error)

NewNamespaceStorageContract creates a new NamespaceStorage contract instance

func (*NamespaceStorageContract) Address

func (ns *NamespaceStorageContract) Address() common.Address

Address returns the contract address

func (*NamespaceStorageContract) BatchGet

func (ns *NamespaceStorageContract) BatchGet(namespace string, keys [][]byte) (*NamespaceBatchGetResult, error)

BatchGet retrieves multiple values by their keys within a namespace

func (*NamespaceStorageContract) BatchPut

func (ns *NamespaceStorageContract) BatchPut(namespace string, keys [][]byte, values []NamespaceGenericValue) error

BatchPut stores multiple key-value pairs in the same namespace

func (*NamespaceStorageContract) ClearAll

func (ns *NamespaceStorageContract) ClearAll() error

ClearAll clears all stored data across all namespaces (emergency function)

func (*NamespaceStorageContract) ClearNamespace

func (ns *NamespaceStorageContract) ClearNamespace(namespace string) error

ClearNamespace clears all data in a specific namespace

func (*NamespaceStorageContract) CountInNamespace

func (ns *NamespaceStorageContract) CountInNamespace(namespace string) (*big.Int, error)

CountInNamespace returns the number of items in a namespace

func (*NamespaceStorageContract) Exists

func (ns *NamespaceStorageContract) Exists(namespace string, key []byte) (bool, error)

Exists checks if a key exists in a namespace

func (*NamespaceStorageContract) Get

func (ns *NamespaceStorageContract) Get(namespace string, key []byte) (*NamespaceGetResult, error)

Get retrieves data by namespace and key

func (*NamespaceStorageContract) HasNamespace

func (ns *NamespaceStorageContract) HasNamespace(namespace string) (bool, error)

HasNamespace checks if a namespace exists

func (*NamespaceStorageContract) List

func (ns *NamespaceStorageContract) List(namespace string, offset, limit *big.Int) (*NamespaceListResult, error)

List retrieves all stored data in a namespace with pagination

func (*NamespaceStorageContract) ListKeys

func (ns *NamespaceStorageContract) ListKeys(namespace string, offset, limit *big.Int) (*NamespaceListKeysResult, error)

ListKeys retrieves all keys in a namespace with pagination

func (*NamespaceStorageContract) ListNamespaces

func (ns *NamespaceStorageContract) ListNamespaces(offset, limit *big.Int) (*NamespaceListNamespacesResult, error)

ListNamespaces retrieves all namespaces with pagination

func (*NamespaceStorageContract) NamespaceCount

func (ns *NamespaceStorageContract) NamespaceCount() (*big.Int, error)

NamespaceCount returns the total number of namespaces

func (*NamespaceStorageContract) Put

func (ns *NamespaceStorageContract) Put(namespace string, key []byte, value NamespaceGenericValue) error

Put stores data with the given namespace and key

func (*NamespaceStorageContract) Remove

func (ns *NamespaceStorageContract) Remove(namespace string, key []byte) (bool, error)

Remove deletes data by namespace and key

func (*NamespaceStorageContract) TotalCount

func (ns *NamespaceStorageContract) TotalCount() (*big.Int, error)

TotalCount returns the total number of items across all namespaces

type NamespaceStorageContractWrapper

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

NamespaceStorageContractWrapper wraps the NamespaceStorageContract

func NewNamespaceStorageContractWrapper

func NewNamespaceStorageContractWrapper(contractAddress common.Address, backend ContractBackend, owner common.Address, ns string) (*NamespaceStorageContractWrapper, error)

func (*NamespaceStorageContractWrapper) Address

Address returns the contract address

func (*NamespaceStorageContractWrapper) BatchGet

BatchGet retrieves multiple values by their keys within a namespace

func (*NamespaceStorageContractWrapper) BatchPut

func (ns *NamespaceStorageContractWrapper) BatchPut(keys [][]byte, values []NamespaceGenericValue) error

BatchPut stores multiple key-value pairs in the same namespace

func (*NamespaceStorageContractWrapper) Clear

Clear removes all data in the namespace

func (*NamespaceStorageContractWrapper) Count

func (ns *NamespaceStorageContractWrapper) Count() (*big.Int, error)

Count returns the number of items in the namespace

func (*NamespaceStorageContractWrapper) Exists

func (ns *NamespaceStorageContractWrapper) Exists(key []byte) (bool, error)

Exists checks if a key exists in a namespace

func (*NamespaceStorageContractWrapper) Get

Get retrieves data by namespace and key

func (*NamespaceStorageContractWrapper) List

List retrieves all stored data in a namespace with pagination

func (*NamespaceStorageContractWrapper) ListKeys

func (ns *NamespaceStorageContractWrapper) ListKeys(offset, limit uint64) (*NamespaceListKeysResult, error)

ListKeys retrieves all keys in a namespace with pagination

func (*NamespaceStorageContractWrapper) Put

Put stores data with the given namespace and key

func (*NamespaceStorageContractWrapper) Remove

func (ns *NamespaceStorageContractWrapper) Remove(key []byte) (bool, error)

Remove deletes data by namespace and key

type StorageContract

type StorageContract interface {
	Address() common.Address
	Put(key []byte, value GenericValue) error
	Get(key []byte) (*GetResult, error)
	Remove(key []byte) (bool, error)
	Exists(key []byte) (bool, error)
	List(uint64, uint64) (*ListResult, error)
	ListKeys(uint64, uint64) (*ListKeysResult, error)
	BatchGet(keys [][]byte) (*BatchGetResult, error)
	Count() (*big.Int, error)
}

StorageContract provides an interface to interact with the storage smart contract

Jump to

Keyboard shortcuts

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