allowlist

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidParameters = errors.New("invalid parameters provided to create a functions contract cache ORM")
)

Functions

func ExtractContractVersion added in v2.10.0

func ExtractContractVersion(str string) (string, error)

Types

type ORM

type ORM interface {
	GetAllowedSenders(offset, limit uint, qopts ...pg.QOpt) ([]common.Address, error)
	CreateAllowedSenders(allowedSenders []common.Address, qopts ...pg.QOpt) error
	DeleteAllowedSenders(blockedSenders []common.Address, qopts ...pg.QOpt) error
	PurgeAllowedSenders(qopts ...pg.QOpt) error
}

func NewORM

func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig, routerContractAddress common.Address) (ORM, error)

type OnchainAllowlist

type OnchainAllowlist interface {
	job.ServiceCtx

	Allow(common.Address) bool
	UpdateFromContract(ctx context.Context) error
}

OnchainAllowlist maintains an allowlist of addresses fetched from the blockchain (EVM-only). Use UpdateFromContract() for a one-time update or set OnchainAllowlistConfig.UpdateFrequencySec for repeated updates. All methods are thread-safe.

func NewOnchainAllowlist

func NewOnchainAllowlist(client evmclient.Client, config OnchainAllowlistConfig, orm ORM, lggr logger.Logger) (OnchainAllowlist, error)

type OnchainAllowlistConfig

type OnchainAllowlistConfig struct {
	// ContractAddress is required
	ContractAddress    common.Address `json:"contractAddress"`
	ContractVersion    uint32         `json:"contractVersion"`
	BlockConfirmations uint           `json:"blockConfirmations"`
	// UpdateFrequencySec can be zero to disable periodic updates
	UpdateFrequencySec        uint `json:"updateFrequencySec"`
	UpdateTimeoutSec          uint `json:"updateTimeoutSec"`
	StoredAllowlistBatchSize  uint `json:"storedAllowlistBatchSize"`
	OnchainAllowlistBatchSize uint `json:"onchainAllowlistBatchSize"`
	// FetchingDelayInRangeSec prevents RPC client being rate limited when fetching the allowlist in ranges.
	FetchingDelayInRangeSec uint `json:"fetchingDelayInRangeSec"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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