boomflow

package
v0.0.0-...-f9b7526 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditEventLogs

func AuditEventLogs(cfx *sdk.Client, epoch *big.Int, crcls []types.Address) (map[string]EventAuditDetails, error)

AuditEventLogs audits event logs of CRCL for the specified epoch.

func StartSince

func StartSince(cfxURL, matchflowURL string, epochSince *big.Int, numEpochsToAuditBalances uint64, wg *sync.WaitGroup)

StartSince starts a goroutine to audit Boomflow since specified epoch continously. Firstly, audit the account balances at specific epoch as a baseline. Then, audit the event logs epoch by epoch.

Moreover, the service will audit the account balances periodically, base on which to audit event logs epoch by epoch.

Types

type AssetAuditor

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

AssetAuditor audits contract data for a single asset.

func NewAssetAuditor

func NewAssetAuditor(asset common.Asset, cfx *sdk.Client) *AssetAuditor

NewAssetAuditor creates an instance of NewAssetAuditor.

func (*AssetAuditor) AuditAccountBalance

func (auditor *AssetAuditor) AuditAccountBalance(epochNum *big.Int) (*BalanceAuditDetails, error)

AuditAccountBalance queries account list and calculates the sum of their balances in CRCL. Note, this kind of audit depends on the data migration API in CRCL, which may be removed in future.

func (*AssetAuditor) AuditBalance

func (auditor *AssetAuditor) AuditBalance(epoch *big.Int) (*BalanceAuditDetails, error)

AuditBalance audits balance against ERC777 and CRCL contracts. Generally, this kind of audit is launched periodically, e.g. every one hour. The audit items includes: 1) ERC777.balanceOf(CRCL) 2) CRCL.totalSupply() 3) Sum(CRCL.balanceOf(account))

func (*AssetAuditor) AuditTotalSupply

func (auditor *AssetAuditor) AuditTotalSupply(epochNum *big.Int) (*big.Int, error)

AuditTotalSupply audits the total supply in CRCL against the balance of CRCL account in ERC777.

type AuditManager

type AuditManager struct {
	Cfx *sdk.Client
	// contains filtered or unexported fields
}

AuditManager audits data for all ERC777 and CRCL contracts of boomflow.

func NewAuditManager

func NewAuditManager(cfxURL, matchflowURL string) *AuditManager

NewAuditManager creates an instance of AuditManager.

func NewAuditManagerWithAssets

func NewAuditManagerWithAssets(cfxURL string, assets []common.Asset) *AuditManager

NewAuditManagerWithAssets creates an instance of AuditManager.

func (*AuditManager) AuditBalance

func (am *AuditManager) AuditBalance(epoch *big.Int) error

AuditBalance audits balance for the specified epoch.

func (*AuditManager) AuditBalanceForAsset

func (am *AuditManager) AuditBalanceForAsset(asset string, epoch *big.Int) (*BalanceAuditDetails, error)

AuditBalanceForAsset audits balance for specified asset.

func (*AuditManager) AuditNextEpoch

func (am *AuditManager) AuditNextEpoch() error

AuditNextEpoch audits event logs in CRCL for the next epoch of last balance audit details.

func (*AuditManager) Close

func (am *AuditManager) Close()

Close releases resources hold by Boomflow auditor.

type BalanceAuditDetails

type BalanceAuditDetails struct {
	TotalSupply     *big.Int                // total supply in CRCL
	AccountBalances *common.AccountBalances // account balances in CRCL
}

BalanceAuditDetails represents the details of audit against balance.

type EventAuditDetails

type EventAuditDetails struct {
	BalanceIncreased *common.AccountBalances
	BalanceReduced   *common.AccountBalances
}

EventAuditDetails represents the details of audit against CRCL event logs.

Jump to

Keyboard shortcuts

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