repository

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

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

Go to latest
Published: Apr 11, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockNotFound = errors.New("requested block can not be found in Opera blockchain")

ErrBlockNotFound represents an error returned if a block can not be found.

Functions

func SetConfig

func SetConfig(c *config.Config)

SetConfig sets the repository configuration to be used to establish and maintain external repository connections.

func SetLogger

func SetLogger(l logger.AppLogger)

SetLogger sets the repository logger to be used to collect logging info.

Types

type Repository

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

func New

func New(cfg *config.Config, log *logger.AppLogger) *Repository

New creates a new repository from given config and logger.

func NewWithInstances

func NewWithInstances(db *db.Db, rpc *rpc.Rpc, tracer tracing.TracerInterface, log *logger.AppLogger) *Repository

NewWithInstances creates a new repository from given instances.

func R

func R() *Repository

R provides access to the singleton instance of the Repository.

func (*Repository) BlockByHash

func (repo *Repository) BlockByHash(hash *common.Hash) (*types.Block, error)

BlockByHash returns a block at Opera blockchain represented by a hash. Top block is returned if the hash is not provided. If the block is not found, ErrBlockNotFound error is returned.

func (*Repository) BlockByNumber

func (repo *Repository) BlockByNumber(num *hexutil.Uint64) (*types.Block, error)

BlockByNumber returns a block at Opera blockchain represented by a number. Top block is returned if the number is not provided. If the block is not found, ErrBlockNotFound error is returned.

func (*Repository) BlockHeight

func (repo *Repository) BlockHeight() (*hexutil.Big, error)

BlockHeight returns the current height of the Opera blockchain in blocks.

func (*Repository) CompleteWithdrawal

func (repo *Repository) CompleteWithdrawal(projectId uint64, epoch uint64, amount *big.Int) error

CompleteWithdrawal completes withdrawal of the given amount from the given project.

func (*Repository) CurrentEpoch

func (repo *Repository) CurrentEpoch() (uint64, error)

CurrentEpoch returns the current epoch number.

func (*Repository) DatabaseTransaction

func (repo *Repository) DatabaseTransaction(fn func(context.Context, *db.Db) error) error

DatabaseTransaction runs the given function in a database transaction. The callback function is passed the repository instance with the transaction as the connection. The transaction is automatically committed if the callback function returns nil, otherwise it is rolled back. The callback function is passed a context that is cancelled after dbQueryTimeoutDuration. If the callback function does not return within this time, the transaction is rolled back.

func (*Repository) GasMonetizationAbi

func (repo *Repository) GasMonetizationAbi() *abi.ABI

GasMonetizationAbi provides access to decoded ABI of Fantom Gas Monetization contract.

func (*Repository) GasMonetizationAddress

func (repo *Repository) GasMonetizationAddress() common.Address

GasMonetizationAddress returns the address of the gas monetization contract.

func (*Repository) HasPendingWithdrawal

func (repo *Repository) HasPendingWithdrawal(projectId uint64, epoch uint64) (bool, error)

HasPendingWithdrawal returns true if there is a pending withdrawal for the given project.

func (*Repository) IncreaseTotalAmountClaimed

func (repo *Repository) IncreaseTotalAmountClaimed(amount *big.Int) error

IncreaseTotalAmountClaimed increases the total amount claimed for all projects.

func (*Repository) IncreaseTotalAmountCollected

func (repo *Repository) IncreaseTotalAmountCollected(amount *big.Int) error

IncreaseTotalAmountCollected increases the total amount collected for all projects.

func (*Repository) IncreaseTotalTransactionsCount

func (repo *Repository) IncreaseTotalTransactionsCount(amount uint64) error

IncreaseTotalTransactionsCount increases the total transactions count for all projects.

func (*Repository) LastProcessedBlock

func (repo *Repository) LastProcessedBlock() (uint64, error)

LastProcessedBlock returns the last processed block number.

func (*Repository) ProjectContractQuery

func (repo *Repository) ProjectContractQuery() db.ProjectContractQueryBuilder

ProjectContractQuery returns a new project contract query builder.

func (*Repository) ProjectQuery

func (repo *Repository) ProjectQuery() db.ProjectQueryBuilder

ProjectQuery returns a new project query builder.

func (*Repository) SetTotalAmountClaimed

func (repo *Repository) SetTotalAmountClaimed(amount *big.Int) error

SetTotalAmountClaimed sets the total amount claimed for all projects.

func (*Repository) SetTotalAmountCollected

func (repo *Repository) SetTotalAmountCollected(amount *big.Int) error

SetTotalAmountCollected sets the total amount collected for all projects.

func (*Repository) SetTotalTransactionsCount

func (repo *Repository) SetTotalTransactionsCount(count uint64) error

SetTotalTransactionsCount sets the total transactions count for all projects.

func (*Repository) StoreProject

func (repo *Repository) StoreProject(project *types.Project) error

StoreProject stores the project in the database.

func (*Repository) StoreWithdrawalRequest

func (repo *Repository) StoreWithdrawalRequest(request *types.WithdrawalRequest) error

StoreWithdrawalRequest stores a new withdrawal request into the database.

func (*Repository) TotalAmountClaimed

func (repo *Repository) TotalAmountClaimed() (*big.Int, error)

TotalAmountClaimed returns the total amount claimed for all projects.

func (*Repository) TotalAmountCollected

func (repo *Repository) TotalAmountCollected() (*big.Int, error)

TotalAmountCollected returns the total amount collected for all projects.

func (*Repository) TotalTransactionsCount

func (repo *Repository) TotalTransactionsCount() (uint64, error)

TotalTransactionsCount returns the total transactions count for all projects.

func (*Repository) TraceTransaction

func (repo *Repository) TraceTransaction(hash common.Hash) ([]types.TransactionTrace, error)

TraceTransaction returns the structured transaction traces.

func (*Repository) Transaction

func (repo *Repository) Transaction(hash *common.Hash) (*types.Transaction, error)

Transaction returns a transaction at Opera blockchain by a hash, nil if not found. If the transaction is not found, ErrTransactionNotFound error is returned.

func (*Repository) TransactionQuery

func (repo *Repository) TransactionQuery() db.TransactionQueryBuilder

TransactionQuery returns a new transaction query builder.

func (*Repository) UpdateCurrentEpoch

func (repo *Repository) UpdateCurrentEpoch(id uint64) error

UpdateCurrentEpoch updates the last observed epoch number.

func (*Repository) UpdateLastProcessedBlock

func (repo *Repository) UpdateLastProcessedBlock(id uint64) error

UpdateLastProcessedBlock updates the last observed block number.

func (*Repository) UpdateProject

func (repo *Repository) UpdateProject(project *types.Project) error

UpdateProject updates the project in the database.

func (*Repository) UpdateWithdrawalRequest

func (repo *Repository) UpdateWithdrawalRequest(request *types.WithdrawalRequest) error

UpdateWithdrawalRequest updates the withdrawal request in the database.

func (*Repository) WithdrawalRequestQuery

func (repo *Repository) WithdrawalRequestQuery() db.WithdrawalRequestQueryBuilder

WithdrawalRequestQuery returns a new withdrawal request query builder.

Directories

Path Synopsis
rpc
Package rpc provides high level access to the Fantom Opera blockchain node through RPC interface.
Package rpc provides high level access to the Fantom Opera blockchain node through RPC interface.

Jump to

Keyboard shortcuts

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