Documentation ¶
Index ¶
- Variables
- func SetConfig(c *config.Config)
- func SetLogger(l logger.AppLogger)
- type Repository
- func (repo *Repository) BlockByHash(hash *common.Hash) (*types.Block, error)
- func (repo *Repository) BlockByNumber(num *hexutil.Uint64) (*types.Block, error)
- func (repo *Repository) BlockHeight() (*hexutil.Big, error)
- func (repo *Repository) CompleteWithdrawal(projectId uint64, epoch uint64, amount *big.Int) error
- func (repo *Repository) CurrentEpoch() (uint64, error)
- func (repo *Repository) DatabaseTransaction(fn func(context.Context, *db.Db) error) error
- func (repo *Repository) GasMonetizationAbi() *abi.ABI
- func (repo *Repository) GasMonetizationAddress() common.Address
- func (repo *Repository) HasPendingWithdrawal(projectId uint64, epoch uint64) (bool, error)
- func (repo *Repository) IncreaseTotalAmountClaimed(amount *big.Int) error
- func (repo *Repository) IncreaseTotalAmountCollected(amount *big.Int) error
- func (repo *Repository) IncreaseTotalTransactionsCount(amount uint64) error
- func (repo *Repository) LastProcessedBlock() (uint64, error)
- func (repo *Repository) ProjectContractQuery() db.ProjectContractQueryBuilder
- func (repo *Repository) ProjectQuery() db.ProjectQueryBuilder
- func (repo *Repository) SetTotalAmountClaimed(amount *big.Int) error
- func (repo *Repository) SetTotalAmountCollected(amount *big.Int) error
- func (repo *Repository) SetTotalTransactionsCount(count uint64) error
- func (repo *Repository) StoreProject(project *types.Project) error
- func (repo *Repository) StoreWithdrawalRequest(request *types.WithdrawalRequest) error
- func (repo *Repository) TotalAmountClaimed() (*big.Int, error)
- func (repo *Repository) TotalAmountCollected() (*big.Int, error)
- func (repo *Repository) TotalTransactionsCount() (uint64, error)
- func (repo *Repository) TraceTransaction(hash common.Hash) ([]types.TransactionTrace, error)
- func (repo *Repository) Transaction(hash *common.Hash) (*types.Transaction, error)
- func (repo *Repository) TransactionQuery() db.TransactionQueryBuilder
- func (repo *Repository) UpdateCurrentEpoch(id uint64) error
- func (repo *Repository) UpdateLastProcessedBlock(id uint64) error
- func (repo *Repository) UpdateProject(project *types.Project) error
- func (repo *Repository) UpdateWithdrawalRequest(request *types.WithdrawalRequest) error
- func (repo *Repository) WithdrawalRequestQuery() db.WithdrawalRequestQueryBuilder
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 (*Repository) BlockByHash ¶
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 ¶
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 ¶
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 ¶
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.