Documentation ¶
Index ¶
- Constants
- type AppBase
- type BillingBatchReceipt
- type BillingBatchRequest
- type BillingReceipt
- type BillingRequest
- type BillingService
- func (bs *BillingService) Bill(ctx context.Context, req *BillingRequest) (*BillingReceipt, error)
- func (bs *BillingService) BillBatch(ctx context.Context, req *BillingBatchRequest) (*BillingReceipt, error)
- func (bs *BillingService) DelStatements(billID uint64)
- func (bs *BillingService) GetAndDelStatements(billID uint64) map[uint32]int64
- func (bs *BillingService) GetStatements(billID uint64) map[uint32]int64
- type BlockchainService
- func (svc *BlockchainService) DecreaseAccountBalance(app, address common.Address, amount *big.Int, block int64) (bool, error)
- func (svc *BlockchainService) DeleteAccountStatus(app, address common.Address) (*model.AppAccount, error)
- func (bs *BlockchainService) Deposit()
- func (bs *BlockchainService) DepositPending(request *DepositRequest) error
- func (svc *BlockchainService) GetAppConfigResourceWithId(app common.Address, resourceId string) (*contract.IAppConfigConfigEntry, error)
- func (svc *BlockchainService) GetOrFetchAppAccountStatus(app, address common.Address) (*model.AppAccount, error)
- func (svc *BlockchainService) IncreaseAccountBalance(app, address common.Address, amount *big.Int, block int64) (bool, error)
- func (bs *BlockchainService) OnAppCreated(event *contract.AppRegistryCreated, rawlog *types.Log) error
- func (bs *BlockchainService) OnConfirmStatus(app, addr common.Address, balance *big.Int, frozen, block int64) error
- func (bs *BlockchainService) OnDeposit(event *contract.AppDeposit, rawlog *types.Log) error
- func (bs *BlockchainService) OnFrozen(event *contract.AppFrozen, rawlog *types.Log) error
- func (bs *BlockchainService) OnReorgRevert(revertToBlock int64) error
- func (bs *BlockchainService) OnResourceChanged(event *contract.ApiWeightTokenResourceChanged, rawlog *types.Log) error
- func (bs *BlockchainService) OnTransfer(event *contract.VipCoinTransferSingle, rawlog *types.Log) error
- func (bs *BlockchainService) OnWithdraw(event *contract.AppWithdraw, rawlog *types.Log) error
- func (bs *BlockchainService) StatusConfirmQueue() <-chan [2]common.Address
- func (svc *BlockchainService) UpdateAccountStatus(app, address common.Address, balance *big.Int, frozen, block *int64) (*model.AppAccount, error)
- func (svc *BlockchainService) ValidateAppOperator(appAddr, operator common.Address) error
- func (svc *BlockchainService) ValidateBillingApp(app common.Address) error
- func (svc *BlockchainService) WithholdAccountFee(app, address common.Address, amount *big.Int) (bool, error)
- func (svc *BlockchainService) WriteOffAccountFee(app, address common.Address, amount *big.Int) (bool, error)
- type DepositRequest
- type Factory
Constants ¶
View Source
const (
KeyBillingLocker = util.MutexKey("BillingLocker")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppBase ¶
type AppBase struct { Addr common.Address // APP contract address PaymentType contract.PaymentType // payment type CardTracker common.Address // VIP card tracker contract address ApiWeightToken common.Address // `ApiWeightToken` contract address VipCoin common.Address // `VipCoin` contract address PendingSeconds *big.Int // pending seconds for delaying config Resources map[string]resourceConfig // resource config UpdateBlock int64 // the last block of which to update resources }
func (*AppBase) IsBillingMode ¶
func (*AppBase) IsSubscriptionMode ¶
type BillingBatchReceipt ¶
type BillingBatchReceipt = BillingReceipt
type BillingBatchRequest ¶
type BillingReceipt ¶
type BillingRequest ¶
type BillingService ¶
type BillingService struct {
// contains filtered or unexported fields
}
func NewBillingService ¶
func NewBillingService(sqliteStore *sqlite.SqliteStore, chainSvc *BlockchainService) *BillingService
func (*BillingService) Bill ¶
func (bs *BillingService) Bill(ctx context.Context, req *BillingRequest) (*BillingReceipt, error)
func (*BillingService) BillBatch ¶
func (bs *BillingService) BillBatch(ctx context.Context, req *BillingBatchRequest) (*BillingReceipt, error)
func (*BillingService) DelStatements ¶
func (bs *BillingService) DelStatements(billID uint64)
func (*BillingService) GetAndDelStatements ¶
func (bs *BillingService) GetAndDelStatements(billID uint64) map[uint32]int64
func (*BillingService) GetStatements ¶
func (bs *BillingService) GetStatements(billID uint64) map[uint32]int64
type BlockchainService ¶
type BlockchainService struct {
// contains filtered or unexported fields
}
func NewBlockchainService ¶
func NewBlockchainService( sqliteStore *sqlite.SqliteStore, memStore *memdb.MemStore, provider *blockchain.Provider, ) (*BlockchainService, error)
func (*BlockchainService) DecreaseAccountBalance ¶
func (svc *BlockchainService) DecreaseAccountBalance( app, address common.Address, amount *big.Int, block int64) (bool, error)
DecreaseAccountBalance decreases APP balance of specific account.
func (*BlockchainService) DeleteAccountStatus ¶
func (svc *BlockchainService) DeleteAccountStatus(app, address common.Address) (*model.AppAccount, error)
DeleteAccountStatus deletes APP account of specific address.
func (*BlockchainService) Deposit ¶
func (bs *BlockchainService) Deposit()
func (*BlockchainService) DepositPending ¶
func (bs *BlockchainService) DepositPending(request *DepositRequest) error
func (*BlockchainService) GetAppConfigResourceWithId ¶
func (svc *BlockchainService) GetAppConfigResourceWithId( app common.Address, resourceId string) (*contract.IAppConfigConfigEntry, error)
func (*BlockchainService) GetOrFetchAppAccountStatus ¶
func (svc *BlockchainService) GetOrFetchAppAccountStatus(app, address common.Address) (*model.AppAccount, error)
GetOrFetchAppAccount gets APP account status of specific address.
func (*BlockchainService) IncreaseAccountBalance ¶
func (svc *BlockchainService) IncreaseAccountBalance( app, address common.Address, amount *big.Int, block int64) (bool, error)
IncreaseAccountBalance increases APP balance of specific account.
func (*BlockchainService) OnAppCreated ¶
func (bs *BlockchainService) OnAppCreated(event *contract.AppRegistryCreated, rawlog *types.Log) error
func (*BlockchainService) OnConfirmStatus ¶
func (*BlockchainService) OnDeposit ¶
func (bs *BlockchainService) OnDeposit(event *contract.AppDeposit, rawlog *types.Log) error
func (*BlockchainService) OnReorgRevert ¶
func (bs *BlockchainService) OnReorgRevert(revertToBlock int64) error
func (*BlockchainService) OnResourceChanged ¶
func (bs *BlockchainService) OnResourceChanged(event *contract.ApiWeightTokenResourceChanged, rawlog *types.Log) error
func (*BlockchainService) OnTransfer ¶
func (bs *BlockchainService) OnTransfer(event *contract.VipCoinTransferSingle, rawlog *types.Log) error
func (*BlockchainService) OnWithdraw ¶
func (bs *BlockchainService) OnWithdraw(event *contract.AppWithdraw, rawlog *types.Log) error
func (*BlockchainService) StatusConfirmQueue ¶
func (bs *BlockchainService) StatusConfirmQueue() <-chan [2]common.Address
func (*BlockchainService) UpdateAccountStatus ¶
func (svc *BlockchainService) UpdateAccountStatus( app, address common.Address, balance *big.Int, frozen, block *int64) (*model.AppAccount, error)
UpdateAccountStatus updates APP account status (balance, frozen status etc.,) of specific address.
func (*BlockchainService) ValidateAppOperator ¶
func (svc *BlockchainService) ValidateAppOperator(appAddr, operator common.Address) error
ValidateAppOperator validates if the account address is the valid operator for the APP contract.
func (*BlockchainService) ValidateBillingApp ¶
func (svc *BlockchainService) ValidateBillingApp(app common.Address) error
func (*BlockchainService) WithholdAccountFee ¶
func (svc *BlockchainService) WithholdAccountFee(app, address common.Address, amount *big.Int) (bool, error)
WithholdAccountFee withholds APP fee from specific account.
func (*BlockchainService) WriteOffAccountFee ¶
func (svc *BlockchainService) WriteOffAccountFee(app, address common.Address, amount *big.Int) (bool, error)
WriteOffAccountFee writes off APP fee from specific account.
type DepositRequest ¶
type Factory ¶
type Factory struct { Blockchain *BlockchainService Billing *BillingService }
func MustNewFactory ¶
func MustNewFactory(store *sqlite.SqliteStore, memStore *memdb.MemStore, provider *blockchain.Provider) *Factory
Click to show internal directories.
Click to hide internal directories.