Documentation ¶
Overview ¶
nolint:dupl
nolint:dupl
nolint:nakedret
Contains the Bibon constant definitions ¶
nolint:nakedret,dupl
Index ¶
- Constants
- Variables
- func DecryptAssetboxWallet(walletEncrypted, passPhraseEncrypted []byte, password string, ...) (*keystore.Key, error)
- func DecryptPrivateKeyForAssetbox(address common.Address, walletEncrypted, passPhraseEncrypted []byte, ...) (*ecdsa.PrivateKey, error)
- func InitServicePart(b *Bitbon, config *Config) (err error)
- func InitStorages(ctx *node.ServiceContext, b *Bitbon) (err error)
- type API
- func (api *API) AddMiningAgent(ctx context.Context, address common.Address) error
- func (api *API) ApproveFullBalanceSafeTransfer(ctx context.Context, transfer *dto.ApproveFullBalanceSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) ApproveFullBalanceSafeTransferAsync(ctx context.Context, transfer *dto.ApproveFullBalanceSafeTransferRequest) (*common.Hash, error)
- func (api *API) ApproveFullBalanceWPCSafeTransfer(ctx context.Context, transfer *dto.ApproveFullBalanceWPCSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) ApproveFullBalanceWPCSafeTransferAsync(ctx context.Context, transfer *dto.ApproveFullBalanceWPCSafeTransferRequest) (*common.Hash, error)
- func (api *API) ApproveSafeTransfer(ctx context.Context, transfer *dto.ApproveSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) ApproveSafeTransferAsync(ctx context.Context, transfer *dto.ApproveSafeTransferRequest) (*common.Hash, error)
- func (api *API) ApproveWPCSafeTransfer(ctx context.Context, transfer *dto.ApproveWPCSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) ApproveWPCSafeTransferAsync(ctx context.Context, transfer *dto.ApproveWPCSafeTransferRequest) (*common.Hash, error)
- func (api *API) BalanceOfLocked(ctx context.Context, address common.Address) (*big.Int, error)
- func (api *API) BlockByHash(ctx context.Context, hash common.Hash) (*dto.Block, error)
- func (api *API) BlockByNumber(ctx context.Context, number uint64) (*dto.Block, error)
- func (api *API) BlockByTime(ctx context.Context, time uint64) (*dto.Block, error)
- func (api *API) BlockTransactionCountByBlockHash(ctx context.Context, hash common.Hash) (uint64, error)
- func (api *API) BlockTransactionCountByBlockNumber(ctx context.Context, number uint64) (uint64, error)
- func (api *API) BlocksByTimePeriod(ctx context.Context, request *dto.BlocksTimePeriodRequest) ([]*dto.Block, error)
- func (api *API) CancelFullBalanceSafeTransfer(ctx context.Context, transfer *dto.CancelFullBalanceSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CancelFullBalanceSafeTransferAsync(ctx context.Context, transfer *dto.CancelFullBalanceSafeTransferRequest) (*common.Hash, error)
- func (api *API) CancelFullBalanceWPCSafeTransfer(ctx context.Context, transfer *dto.CancelFullBalanceWPCSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CancelFullBalanceWPCSafeTransferAsync(ctx context.Context, transfer *dto.CancelFullBalanceWPCSafeTransferRequest) (*common.Hash, error)
- func (api *API) CancelSafeTransfer(ctx context.Context, transfer *dto.CancelSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CancelSafeTransferAsync(ctx context.Context, transfer *dto.CancelSafeTransferRequest) (*common.Hash, error)
- func (api *API) CancelWPCSafeTransfer(ctx context.Context, transfer *dto.CancelWPCSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CancelWPCSafeTransferAsync(ctx context.Context, transfer *dto.CancelWPCSafeTransferRequest) (*common.Hash, error)
- func (api *API) CheckTransactionsByTimePeriod(_ context.Context, request *dto.TransactionTimePeriodRequest) (hash common.Hash, err error)
- func (api *API) CreateFullBalanceSafeTransfer(ctx context.Context, transfer *dto.CreateFullBalanceSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CreateFullBalanceSafeTransferAsync(ctx context.Context, transfer *dto.CreateFullBalanceSafeTransferRequest) (*common.Hash, error)
- func (api *API) CreateFullBalanceWPCSafeTransfer(ctx context.Context, transfer *dto.CreateFullBalanceWPCSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CreateFullBalanceWPCSafeTransferAsync(ctx context.Context, transfer *dto.CreateFullBalanceWPCSafeTransferRequest) (*common.Hash, error)
- func (api *API) CreateSafeTransfer(ctx context.Context, transfer *dto.CreateSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CreateSafeTransferAsync(ctx context.Context, transfer *dto.CreateSafeTransferRequest) (*common.Hash, error)
- func (api *API) CreateWPCSafeTransfer(ctx context.Context, transfer *dto.CreateWPCSafeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) CreateWPCSafeTransferAsync(ctx context.Context, transfer *dto.CreateWPCSafeTransferRequest) (*common.Hash, error)
- func (api *API) DeleteAbiInfoByAddress(address common.Address) (err error)
- func (api *API) DeleteAssetbox(ctx context.Context, req *dto.DeleteAssetboxRequest) error
- func (api *API) DirectTransfer(ctx context.Context, transfer *dto.DirectTransferRequest) (*dto.TransferResponse, error)
- func (api *API) DirectTransferAsync(ctx context.Context, transfer *dto.DirectTransferRequest) (*common.Hash, error)
- func (api *API) EditAbiInfo(abiInfo *dto.AbiInfo) (err error)
- func (api *API) ExpireTransfersAsync(ctx context.Context, ids []string) (*common.Hash, error)
- func (api *API) FeeTransferAsync(ctx context.Context, transfer *dto.ServiceFeeTransferRequest) (*common.Hash, error)
- func (api *API) FillCurrentAbiInfo(_ context.Context, version dto.ContractVersion) (addresses []common.Address, err error)
- func (api *API) FrameTransfer(ctx context.Context, transfer *dto.QuickTransferRequest) (*dto.TransferResponse, error)
- func (api *API) FrameTransferAsync(ctx context.Context, transfer *dto.QuickTransferRequest) (*common.Hash, error)
- func (api *API) FullBalanceQuickTransfer(ctx context.Context, transfer *dto.FullBalanceQuickTransferRequest) (*dto.TransferResponse, error)
- func (api *API) FullBalanceQuickTransferAsync(ctx context.Context, transfer *dto.FullBalanceQuickTransferRequest) (*common.Hash, error)
- func (api *API) GetAbiAddressesByVersion(version dto.ContractVersion) (addresses []common.Address, err error)
- func (api *API) GetAbiInfosByVersion(version dto.ContractVersion) (abiInfos []*dto.AbiInfo, err error)
- func (api *API) GetAbiJSON(address common.Address) (abiJSON string, err error)
- func (api *API) GetAbiVersion(address common.Address) (version dto.ContractVersion, err error)
- func (api *API) GetAllMiningAgents(ctx context.Context) ([]common.Address, error)
- func (api *API) GetAsseboxesMiningState(ctx context.Context, addresses []common.Address) (map[common.Address]bool, error)
- func (api *API) GetAssetboxBalance(ctx context.Context, address common.Address) (*big.Int, error)
- func (api *API) GetAssetboxBalances(ctx context.Context, addresses []common.Address) (map[common.Address]*big.Int, error)
- func (api *API) GetAssetboxBalancesSum(ctx context.Context, addresses []common.Address) (*big.Int, error)
- func (api *API) GetContractAddresses() (map[string]common.Address, error)
- func (api *API) GetCurrentDistribution(ctx context.Context) (map[string]uint64, error)
- func (api *API) GetFee(ctx context.Context, opType dto.OperationType) (*big.Int, error)
- func (api *API) GetFeeDistributionAccounts(ctx context.Context, operationType *big.Int) ([]common.Address, error)
- func (api *API) GetFeeDistributionAmounts(ctx context.Context, operationType *big.Int) ([]*big.Int, error)
- func (api *API) GetFeeForOperationType(ctx context.Context, operationType dto.OperationType) (*big.Int, error)
- func (api *API) GetFeeSettings(ctx context.Context) (*dto.FeeSettingsResponse, error)
- func (api *API) GetFullAbiInfo(address common.Address) (abiInfo *dto.AbiInfo, err error)
- func (api *API) GetFullAbiInfoByVersionAndType(version dto.ContractVersion, contractType contract_snapshot.ContractType) (abiInfo *dto.AbiInfo, err error)
- func (api *API) GetPublicAssetboxInfo(ctx context.Context, address common.Address) (*dto.PublicAssetboxInfoResponse, error)
- func (api *API) GetServiceAddress() common.Address
- func (api *API) GetTransfer(ctx context.Context, transferID string) (*contracts.ReceiptTransfer, error)
- func (api *API) GetTransferByIndex(ctx context.Context, index *big.Int) (*contracts.ReceiptTransfer, error)
- func (api *API) IsMiningAgent(ctx context.Context, address common.Address) (bool, error)
- func (api *API) PrepareAssetboxes(ctx context.Context, req *dto.PrepareAssetboxesRequest) ([]*models.ShortAssetbox, error)
- func (api *API) ProposeDistribution(ctx context.Context, req dto.ProposeDistributionRequest) error
- func (api *API) QuickTransfer(ctx context.Context, transfer *dto.QuickTransferRequest) (*dto.TransferResponse, error)
- func (api *API) QuickTransferAsync(ctx context.Context, transfer *dto.QuickTransferRequest) (*common.Hash, error)
- func (api *API) RangeBlockByNumber(ctx context.Context, request *dto.RangeBlocksByNumberRequest) ([]*dto.Block, error)
- func (api *API) RemoveMiningAgent(ctx context.Context, address common.Address) error
- func (api *API) SaveAbiInfo(abiInfo *dto.AbiInfo) (err error)
- func (api *API) ServiceFeeTransfer(ctx context.Context, transfer *dto.ServiceFeeTransferRequest) (*dto.TransferResponse, error)
- func (api *API) SetContractStorageAddress(address common.Address) error
- func (api *API) SetPublicAssetboxInfo(ctx context.Context, req *dto.SetPublicAssetboxInfoRequest) error
- func (api *API) TransactionByBlockHashAndIndex(ctx context.Context, request *dto.TransactionByBlockHashAndIndexRequest) (*dto.Transaction, error)
- func (api *API) TransactionByBlockNumberAndIndex(ctx context.Context, request *dto.TransactionByBlockNumberAndIndexRequest) (*dto.Transaction, error)
- func (api *API) TransactionByHash(ctx context.Context, txHash common.Hash) (*dto.Transaction, error)
- func (api *API) TransactionsByTimePeriod(ctx context.Context, request *dto.TransactionTimePeriodRequest) ([]*dto.Transaction, error)
- func (api *API) TransferExists(ctx context.Context, transferID string) (bool, error)
- func (api *API) Version(_ context.Context) string
- type APINonce
- func (api *APINonce) ForceNoncerAccountNonce(ctx context.Context, address common.Address, nonce uint64, force bool) error
- func (api *APINonce) ForceNoncerNonceFromBlockChain(ctx context.Context, address common.Address) error
- func (api *APINonce) GetNoncerAssetboxes(ctx context.Context) ([]common.Address, error)
- func (api *APINonce) GetNonces(ctx context.Context, address common.Address) *dto.Nonces
- func (api *APINonce) RemoveAssetboxesFromNoncer(ctx context.Context, addresses []common.Address) error
- func (api *APINonce) RestoreServiceAccountNonce(ctx context.Context, fromNonce, toNonce uint64, force bool) error
- type AssetboxManager
- type Bitbon
- func (b *Bitbon) APIStopped() bool
- func (b *Bitbon) APIs() []rpc.API
- func (b *Bitbon) GetAPI() *API
- func (b *Bitbon) GetAssetboxManager() AssetboxManager
- func (b *Bitbon) GetContractsManager() ContractManager
- func (b *Bitbon) GetDecryptAssetboxWalletPassword() string
- func (b *Bitbon) GetEth() *eth.Ethereum
- func (b *Bitbon) GetFeeManager() FeeManager
- func (b *Bitbon) GetParser() *parser.Parser
- func (b *Bitbon) GetServiceAddress() common.Address
- func (b *Bitbon) GetServiceID() string
- func (b *Bitbon) GetServicePk() *ecdsa.PrivateKey
- func (b *Bitbon) GetStorage() *Storage
- func (b *Bitbon) GetTransferManager() TransferManager
- func (b *Bitbon) InitBitbonParser(apiWrapper *contracts.EthApiWrapper, storage *Storage)
- func (b *Bitbon) InjectAssetboxManager(am AssetboxManager)
- func (b *Bitbon) InjectContractManager(cm ContractManager)
- func (b *Bitbon) InjectFeeManager(fm FeeManager)
- func (b *Bitbon) InjectMiningAgent(ma MiningAgent)
- func (b *Bitbon) InjectTransferManager(tm TransferManager)
- func (b *Bitbon) Protocols() []p2p.Protocol
- func (b *Bitbon) SetDecryptAssetboxWalletPassword(value string)
- func (b *Bitbon) Start(_ *p2p.Server) (err error)
- func (b *Bitbon) Stop() error
- func (b *Bitbon) Stopped() bool
- type Config
- type ContractManager
- type FeeManager
- type Manager
- func (f *Manager) GetFee(ctx context.Context, opType dto.OperationType) (*big.Int, error)
- func (f *Manager) GetFeeDistributionAccounts(ctx context.Context, operationType *big.Int) ([]common.Address, error)
- func (f *Manager) GetFeeDistributionAmounts(ctx context.Context, operationType *big.Int) ([]*big.Int, error)
- func (f *Manager) GetFeeDistributionSettings(ctx context.Context, optType *big.Int) ([]*models.FeeDistribution, error)
- func (f *Manager) GetFeeSettings(ctx context.Context) (*models.FeeSettingsResponseObj, error)
- type MiningAgent
- type PkEncryptor
- type Storage
- func (s *Storage) BeginAbiTransaction() (storage.Transaction, error)
- func (s *Storage) Close() error
- func (s *Storage) DeleteAbiInfoByAddress(tx storage.Transaction, address common.Address) (err error)
- func (s *Storage) EditAbiInfo(tx storage.Transaction, abiInfo *dto.AbiInfo) (err error)
- func (s *Storage) GetAbiAddressesByVersion(tx storage.Transaction, version dto.ContractVersion) (addresses []common.Address, err error)
- func (s *Storage) GetAbiInfosByVersion(tx storage.Transaction, version dto.ContractVersion) (abiInfos []*dto.AbiInfo, err error)
- func (s *Storage) GetAbiJSON(tx storage.Transaction, address common.Address) (abiJSON string, err error)
- func (s *Storage) GetAbiVersion(tx storage.Transaction, address common.Address) (version dto.ContractVersion, err error)
- func (s *Storage) GetFullAbiInfo(tx storage.Transaction, address common.Address) (abiInfo *dto.AbiInfo, err error)
- func (s *Storage) GetFullAbiInfoByVersionAndType(tx storage.Transaction, version dto.ContractVersion, ...) (abiInfo *dto.AbiInfo, err error)
- func (s *Storage) GetSettingContractStorageAddress() (common.Address, error)
- func (s *Storage) SaveAbiInfo(tx storage.Transaction, abiInfo *dto.AbiInfo) (err error)
- func (s *Storage) SaveSettingContractStorageAddress(addr common.Address) error
- type TransferManager
Constants ¶
const ( ProtocolVersionStr = "1.0.0" // The same, as a string ProtocolName = "bitbon" // Nickname of the protocol in geth PrivateStorageFileName = ".bitbon.storage.sqlite" // File name for storage MaxPrepareAssetboxBatchSize = 100 DefaultPrepareAssetboxBatchSize = 10 MaxPrepareAssetboxRetries = 2 )
Bitbon constants
const MaxBlockPeriod = 300
const MaxBlockRange = 100
const MaxCheckTxPeriod = 300
const MaxTxPeriod = 300
const (
SettingContractStorageAddress = "contract_storage_addr"
)
Variables ¶
var DefaultConfig = Config{}
DefaultConfig represents (shocker!) the default configuration.
var ErrAPIStopped = errors.New("bitbon API has stopped")
var (
ErrDistributionAccountsAndAmountsLengthMismatch = errors.New("fee distribution accounts and amounts has different size")
)
var ( // ErrEmptyAddress is returned if passed assetbox address is empty ErrEmptyAddress = errors.New("empty address given") )
Functions ¶
func DecryptAssetboxWallet ¶
func InitServicePart ¶
func InitStorages ¶
func InitStorages(ctx *node.ServiceContext, b *Bitbon) (err error)
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API provides the bitbon RPC service
func (*API) AddMiningAgent ¶
func (*API) ApproveFullBalanceSafeTransfer ¶
func (api *API) ApproveFullBalanceSafeTransfer(ctx context.Context, transfer *dto.ApproveFullBalanceSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) ApproveFullBalanceSafeTransferAsync ¶
func (*API) ApproveFullBalanceWPCSafeTransfer ¶
func (api *API) ApproveFullBalanceWPCSafeTransfer(ctx context.Context, transfer *dto.ApproveFullBalanceWPCSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) ApproveFullBalanceWPCSafeTransferAsync ¶
func (*API) ApproveSafeTransfer ¶
func (api *API) ApproveSafeTransfer(ctx context.Context, transfer *dto.ApproveSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) ApproveSafeTransferAsync ¶
func (*API) ApproveWPCSafeTransfer ¶
func (api *API) ApproveWPCSafeTransfer(ctx context.Context, transfer *dto.ApproveWPCSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) ApproveWPCSafeTransferAsync ¶
func (*API) BalanceOfLocked ¶
func (*API) BlockByHash ¶
func (*API) BlockByNumber ¶
func (*API) BlockByTime ¶
func (*API) BlockTransactionCountByBlockHash ¶
func (*API) BlockTransactionCountByBlockNumber ¶
func (*API) BlocksByTimePeriod ¶
func (*API) CancelFullBalanceSafeTransfer ¶
func (api *API) CancelFullBalanceSafeTransfer(ctx context.Context, transfer *dto.CancelFullBalanceSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CancelFullBalanceSafeTransferAsync ¶
func (*API) CancelFullBalanceWPCSafeTransfer ¶
func (api *API) CancelFullBalanceWPCSafeTransfer(ctx context.Context, transfer *dto.CancelFullBalanceWPCSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CancelFullBalanceWPCSafeTransferAsync ¶
func (*API) CancelSafeTransfer ¶
func (api *API) CancelSafeTransfer(ctx context.Context, transfer *dto.CancelSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CancelSafeTransferAsync ¶
func (*API) CancelWPCSafeTransfer ¶
func (api *API) CancelWPCSafeTransfer(ctx context.Context, transfer *dto.CancelWPCSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CancelWPCSafeTransferAsync ¶
func (*API) CheckTransactionsByTimePeriod ¶
func (*API) CreateFullBalanceSafeTransfer ¶
func (api *API) CreateFullBalanceSafeTransfer(ctx context.Context, transfer *dto.CreateFullBalanceSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CreateFullBalanceSafeTransferAsync ¶
func (*API) CreateFullBalanceWPCSafeTransfer ¶
func (api *API) CreateFullBalanceWPCSafeTransfer(ctx context.Context, transfer *dto.CreateFullBalanceWPCSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CreateFullBalanceWPCSafeTransferAsync ¶
func (*API) CreateSafeTransfer ¶
func (api *API) CreateSafeTransfer(ctx context.Context, transfer *dto.CreateSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CreateSafeTransferAsync ¶
func (*API) CreateWPCSafeTransfer ¶
func (api *API) CreateWPCSafeTransfer(ctx context.Context, transfer *dto.CreateWPCSafeTransferRequest) (*dto.TransferResponse, error)
func (*API) CreateWPCSafeTransferAsync ¶
func (*API) DeleteAbiInfoByAddress ¶
func (*API) DeleteAssetbox ¶
func (*API) DirectTransfer ¶
func (api *API) DirectTransfer(ctx context.Context, transfer *dto.DirectTransferRequest) (*dto.TransferResponse, error)
func (*API) DirectTransferAsync ¶
func (*API) ExpireTransfersAsync ¶
func (*API) FeeTransferAsync ¶
func (*API) FillCurrentAbiInfo ¶
func (*API) FrameTransfer ¶
func (api *API) FrameTransfer(ctx context.Context, transfer *dto.QuickTransferRequest) (*dto.TransferResponse, error)
func (*API) FrameTransferAsync ¶
func (*API) FullBalanceQuickTransfer ¶
func (api *API) FullBalanceQuickTransfer(ctx context.Context, transfer *dto.FullBalanceQuickTransferRequest) (*dto.TransferResponse, error)
func (*API) FullBalanceQuickTransferAsync ¶
func (*API) GetAbiAddressesByVersion ¶
func (*API) GetAbiInfosByVersion ¶
func (*API) GetAbiJSON ¶
func (*API) GetAbiVersion ¶
func (*API) GetAllMiningAgents ¶
func (*API) GetAsseboxesMiningState ¶
func (*API) GetAssetboxBalance ¶
func (*API) GetAssetboxBalances ¶
func (*API) GetAssetboxBalancesSum ¶
func (*API) GetContractAddresses ¶
func (*API) GetCurrentDistribution ¶
func (*API) GetFeeDistributionAccounts ¶
func (*API) GetFeeDistributionAmounts ¶
func (*API) GetFeeForOperationType ¶
func (*API) GetFeeSettings ¶
func (*API) GetFullAbiInfo ¶
func (*API) GetFullAbiInfoByVersionAndType ¶
func (api *API) GetFullAbiInfoByVersionAndType(version dto.ContractVersion, contractType contract_snapshot.ContractType) (abiInfo *dto.AbiInfo, err error)
func (*API) GetPublicAssetboxInfo ¶
func (api *API) GetPublicAssetboxInfo(ctx context.Context, address common.Address) (*dto.PublicAssetboxInfoResponse, error)
GetPublicAssetboxInfo returns public assetbox info from blockchain via calling smart contract method
func (*API) GetServiceAddress ¶
func (*API) GetTransfer ¶
func (api *API) GetTransfer(ctx context.Context, transferID string) (*contracts.ReceiptTransfer, error)
GetTransfer gets transfer data from blockchain
func (*API) GetTransferByIndex ¶
func (api *API) GetTransferByIndex(ctx context.Context, index *big.Int) (*contracts.ReceiptTransfer, error)
GetTransferByIndex gets transfer data from blockchain
func (*API) IsMiningAgent ¶
func (*API) PrepareAssetboxes ¶
func (api *API) PrepareAssetboxes(ctx context.Context, req *dto.PrepareAssetboxesRequest) ([]*models.ShortAssetbox, error)
func (*API) ProposeDistribution ¶
func (*API) QuickTransfer ¶
func (api *API) QuickTransfer(ctx context.Context, transfer *dto.QuickTransferRequest) (*dto.TransferResponse, error)
func (*API) QuickTransferAsync ¶
func (api *API) QuickTransferAsync(ctx context.Context, transfer *dto.QuickTransferRequest) (*common.Hash, error)
Async Transfers - send txHash to client, without waiting while tx has been mined
func (*API) RangeBlockByNumber ¶
func (*API) RemoveMiningAgent ¶
func (*API) ServiceFeeTransfer ¶
func (api *API) ServiceFeeTransfer(ctx context.Context, transfer *dto.ServiceFeeTransferRequest) (*dto.TransferResponse, error)
func (*API) SetContractStorageAddress ¶
func (*API) SetPublicAssetboxInfo ¶
func (*API) TransactionByBlockHashAndIndex ¶
func (api *API) TransactionByBlockHashAndIndex(ctx context.Context, request *dto.TransactionByBlockHashAndIndexRequest) (*dto.Transaction, error)
func (*API) TransactionByBlockNumberAndIndex ¶
func (api *API) TransactionByBlockNumberAndIndex(ctx context.Context, request *dto.TransactionByBlockNumberAndIndexRequest) (*dto.Transaction, error)
func (*API) TransactionByHash ¶
func (*API) TransactionsByTimePeriod ¶
func (api *API) TransactionsByTimePeriod(ctx context.Context, request *dto.TransactionTimePeriodRequest) ([]*dto.Transaction, error)
func (*API) TransferExists ¶
TransferExists checks if transfer exists blockchain
type APINonce ¶
type APINonce struct {
// contains filtered or unexported fields
}
API provides the bitbon RPC service
func (*APINonce) ForceNoncerAccountNonce ¶
func (api *APINonce) ForceNoncerAccountNonce(ctx context.Context, address common.Address, nonce uint64, force bool) error
ForceNoncerAccountNonce method sets nonce value for address in redis (noncer) Also it does some checks, to disable checks set force flag to true
func (*APINonce) ForceNoncerNonceFromBlockChain ¶
func (api *APINonce) ForceNoncerNonceFromBlockChain(ctx context.Context, address common.Address) error
ForceNoncerNonceFromBlockChain takes the nonce for address from blockchain and sets it to redis noncer
func (*APINonce) GetNoncerAssetboxes ¶
func (*APINonce) GetNonces ¶
GetNonces returns data according to nonces Fields in *dto.Nonces: dto.Nonces.Redis - nonce in noncer redis (it should be (nonce in blockchain - 1)) dto.Nonces.Blockchain - nonce in blockchain dto.Nonces.TxPoolQueued - min nonce in tx pool queued transactions dto.Nonces.TxPoolPending - min nonce in tx pool pending transactions dto.Nonces.Broken - flag that indicates if nonce is broken (there are transactions in tx pool queued transactions)
func (*APINonce) RemoveAssetboxesFromNoncer ¶
func (*APINonce) RestoreServiceAccountNonce ¶
func (api *APINonce) RestoreServiceAccountNonce(ctx context.Context, fromNonce, toNonce uint64, force bool) error
RestoreServiceAccountNonce restores service account nonce in blockchain. Method creates fake transactions (EmitEther to itself) beginning from fromNonce and till toNonce (fromNonce <= nonce < toNonce) Also it does some checks, to disable checks set force flag to true the main aim of checks is blockchainNonce == noncerNonce + 1
type AssetboxManager ¶
type AssetboxManager interface { PrepareAssetbox(ctx context.Context) (assetbox *models.Assetbox, err error) PrepareAssetboxes(ctx context.Context, count uint64) (assetboxes []*models.Assetbox, err error) SetPublicAssetboxInfo(ctx context.Context, req *dto.SetPublicAssetboxInfoRequest) (err error) SetPublicAssetboxInfos(ctx context.Context, assetboxes []*contracts.Assetbox) (err error) DeleteAssetbox(ctx context.Context, req *dto.DeleteAssetboxRequest) (err error) }
type Bitbon ¶
type Bitbon struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx *node.ServiceContext, config *Config) (b *Bitbon, err error)
New creates a new Bitbon object (including the initialisation of the common Bitbon object)
func (*Bitbon) APIStopped ¶
func (*Bitbon) GetAssetboxManager ¶
func (b *Bitbon) GetAssetboxManager() AssetboxManager
func (*Bitbon) GetContractsManager ¶
func (b *Bitbon) GetContractsManager() ContractManager
func (*Bitbon) GetDecryptAssetboxWalletPassword ¶
func (*Bitbon) GetFeeManager ¶
func (b *Bitbon) GetFeeManager() FeeManager
func (*Bitbon) GetServiceAddress ¶
func (*Bitbon) GetServiceID ¶
func (*Bitbon) GetServicePk ¶
func (b *Bitbon) GetServicePk() *ecdsa.PrivateKey
func (*Bitbon) GetStorage ¶
func (*Bitbon) GetTransferManager ¶
func (b *Bitbon) GetTransferManager() TransferManager
func (*Bitbon) InitBitbonParser ¶
func (b *Bitbon) InitBitbonParser(apiWrapper *contracts.EthApiWrapper, storage *Storage)
func (*Bitbon) InjectAssetboxManager ¶
func (b *Bitbon) InjectAssetboxManager(am AssetboxManager)
func (*Bitbon) InjectContractManager ¶
func (b *Bitbon) InjectContractManager(cm ContractManager)
func (*Bitbon) InjectFeeManager ¶
func (b *Bitbon) InjectFeeManager(fm FeeManager)
func (*Bitbon) InjectMiningAgent ¶
func (b *Bitbon) InjectMiningAgent(ma MiningAgent)
func (*Bitbon) InjectTransferManager ¶
func (b *Bitbon) InjectTransferManager(tm TransferManager)
func (*Bitbon) SetDecryptAssetboxWalletPassword ¶
type Config ¶
type Config struct { // hex of service private key (ether account) ServicePrivateKey string // ID of service ServiceID string // Key for decrypting assetbox wallets DecryptAssetboxWalletPassword string }
Config represents the configuration state of a bitbon service.
type ContractManager ¶
type ContractManager interface { // system Stop() error Ready() bool Stopped() bool WaitReady(exit chan struct{}) bool GetNoncer() *noncer.Noncer GetContractAddressAssetboxInfo() (common.Address, error) GetContractAddressAssetbox() (common.Address, error) GetContractAddressBitbon() (common.Address, error) GetContractAddressTransfer() (common.Address, error) GetContractAddressSafeTransferStorage() (common.Address, error) GetContractAddressBitbonSupport() (common.Address, error) GetContractAddressBitbonStorage() (common.Address, error) GetContractAddressAccessStorage() (common.Address, error) GetContractAddressDistributionStorage() (common.Address, error) GetContractAddressMiningAgentStorage() (common.Address, error) GetContractStorageAddress() (common.Address, error) GetContractAddresses() map[contract_snapshot.ContractType]common.Address GetCurrentContractAbiInfo(version dto.ContractVersion) ([]*dto.AbiInfo, error) SaveContractStorageAddress(addr common.Address) error GetEthAPIWrapper() *contracts.EthApiWrapper // assetboxes GetAssetboxInfo(ctx context.Context, addr common.Address) (a *contracts.Assetbox, err error) GetAssetboxBalance(ctx context.Context, addr common.Address) (balance *big.Int, err error) BalanceOfLocked(ctx context.Context, addr common.Address) (balance *big.Int, err error) GetAssetboxBalances(ctx context.Context, addresses []common.Address) (balances map[common.Address]*big.Int, err error) GetAsseboxesMiningState(ctx context.Context, address common.Address) (bool, error) GetAssetboxBalancesSum(ctx context.Context, addresses []common.Address) (sum *big.Int, err error) SetAssetboxInfo(ctx context.Context, a *contracts.Assetbox, key *ecdsa.PrivateKey) (err error) SetAssetboxInfos(ctx context.Context, a []*contracts.Assetbox, key *ecdsa.PrivateKey) (err error) GetAssetboxInfoByAlias(ctx context.Context, alias string) (a *contracts.Assetbox, err error) DeleteAssetboxInfo(ctx context.Context, key *ecdsa.PrivateKey) (err error) // transactions EmitEther(ctx context.Context, to common.Address, value *big.Int, nonce *uint64) (err error) ApproveWPCSafeTransfer(ctx context.Context, transferID, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) ApproveFullBalanceWPCSafeTransfer(ctx context.Context, transferID, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) CreateWPCSafeTransfer(ctx context.Context, t *contracts.Transfer, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) CreateFullBalanceWPCSafeTransfer(ctx context.Context, t *contracts.Transfer, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) CancelSafeTransfer(ctx context.Context, transferID, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) CancelFullBalanceSafeTransfer(ctx context.Context, transferID, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) ApproveSafeTransfer(ctx context.Context, transferID, protectionCode, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) ApproveFullBalanceSafeTransfer(ctx context.Context, transferID, protectionCode, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) WatchBitbonBalanceUnLocked(sink chan<- *contracts.Balance) (err error) WatchBitbonBalanceLocked(sink chan<- *contracts.Balance) (err error) WatchBitbonBalanceChanged(sink chan<- *contracts.Balance) (err error) WatchAssetboxInfoSet(sink chan<- *contracts.Assetbox) (err error) WatchTransferExpired(sink chan<- *contracts.TransferExpired) (err error) WatchAssetboxInfoDeleted(sink chan<- *contracts.Assetbox) (err error) GetExpiredTransfers(ctx context.Context, firstTransfer, lastTransfer *big.Int) (expireTransferIds [][32]byte, err error) GetTransferLength(ctx context.Context) (transferLength *big.Int, err error) GetOldestPending(ctx context.Context) (oldestPendingID *big.Int, err error) TransferExists(ctx context.Context, transferID []byte) (exists bool, err error) GetTransferState(ctx context.Context, transferID []byte) (state uint8, err error) QuickTransfer(ctx context.Context, to common.Address, value *big.Int, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) FullBalanceQuickTransfer(ctx context.Context, to common.Address, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) FrameTransfer(ctx context.Context, to common.Address, value *big.Int, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) GetTransferByIndex(ctx context.Context, index *big.Int) (transfer *contracts.ReceiptTransfer, err error) GetTransfer(ctx context.Context, transferID []byte) (transfer *contracts.ReceiptTransfer, err error) CancelWPCSafeTransfer(ctx context.Context, transferID, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) CancelFullBalanceWPCSafeTransfer(ctx context.Context, transferID, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) SetOldestPending(ctx context.Context, pendingIndex *big.Int, key *ecdsa.PrivateKey) (err error) RemoveMiningAgent(ctx context.Context, address common.Address, key *ecdsa.PrivateKey) (err error) ExpireSafeTransfers(ctx context.Context, ids [][32]byte, key *ecdsa.PrivateKey) (blockNum uint64, txHash common.Hash, err error) CreateSafeTransfer(ctx context.Context, t *contracts.Transfer, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) CreateFullBalanceSafeTransfer(ctx context.Context, t *contracts.Transfer, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) SearchOldestPending(ctx context.Context, firstTransfer, lastTransfer *big.Int) (index *big.Int, present bool, err error) IsMiningAgent(ctx context.Context, address common.Address) (res bool, err error) DirectTransfer(ctx context.Context, from, to common.Address, value *big.Int, extraData []byte, key *ecdsa.PrivateKey, async bool) (blockNum uint64, txHash common.Hash, err error) AddMiningAgent(ctx context.Context, address common.Address, key *ecdsa.PrivateKey) (err error) GetCurrentDistribution(ctx context.Context) (distribution map[string]uint64, err error) ProposeDistribution(ctx context.Context, distribution map[string]uint64, key *ecdsa.PrivateKey) (err error) GetAllMiningAgents(ctx context.Context) (res []common.Address, err error) ServiceFeeTransfer(ctx context.Context, params dto.ServiceFeeTransferParams, async bool) (blockNum uint64, txHash common.Hash, err error) GetFee(ctx context.Context, opType dto.OperationType) (fee *big.Int, err error) GetFeeDistributionAccounts(ctx context.Context, operationType *big.Int) (accounts []common.Address, err error) GetFeeDistributionAmounts(ctx context.Context, operationType *big.Int) (amounts []*big.Int, err error) GetFeeValueSettings(ctx context.Context) (optTypes []*big.Int, feeValues []*big.Int, err error) WatchFeeValueChanged(sink chan<- *contracts.FeeValueChanged) error WatchExceptionalAccountsChanged(sink chan<- *contracts.ExceptionalAccountsChanged) error WatchFeeDistributionSettingsChanged(sink chan<- *contracts.DistributionSettingsChanged) error }
type FeeManager ¶
type FeeManager interface { GetFee(ctx context.Context, opType dto.OperationType) (*big.Int, error) GetFeeDistributionAccounts(ctx context.Context, operationType *big.Int) ([]common.Address, error) GetFeeDistributionAmounts(ctx context.Context, operationType *big.Int) ([]*big.Int, error) GetFeeSettings(ctx context.Context) (*models.FeeSettingsResponseObj, error) }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewFeeManager ¶
func (*Manager) GetFeeDistributionAccounts ¶
func (*Manager) GetFeeDistributionAmounts ¶
func (*Manager) GetFeeDistributionSettings ¶
func (*Manager) GetFeeSettings ¶
type MiningAgent ¶
type MiningAgent interface { ProposeDistribution(ctx context.Context, req dto.ProposeDistributionRequest) (err error) GetCurrentDistribution(ctx context.Context) (distribution map[string]uint64, err error) GetAllMiningAgents(ctx context.Context) (res []common.Address, err error) IsMiningAgent(ctx context.Context, address common.Address) (res bool, err error) AddMiningAgent(ctx context.Context, address common.Address) (err error) RemoveMiningAgent(ctx context.Context, address common.Address) (err error) }
type PkEncryptor ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func (*Storage) BeginAbiTransaction ¶
func (s *Storage) BeginAbiTransaction() (storage.Transaction, error)
func (*Storage) DeleteAbiInfoByAddress ¶
func (*Storage) EditAbiInfo ¶
func (*Storage) GetAbiAddressesByVersion ¶
func (s *Storage) GetAbiAddressesByVersion(tx storage.Transaction, version dto.ContractVersion) (addresses []common.Address, err error)
func (*Storage) GetAbiInfosByVersion ¶
func (s *Storage) GetAbiInfosByVersion(tx storage.Transaction, version dto.ContractVersion) (abiInfos []*dto.AbiInfo, err error)
func (*Storage) GetAbiJSON ¶
func (*Storage) GetAbiVersion ¶
func (s *Storage) GetAbiVersion(tx storage.Transaction, address common.Address) (version dto.ContractVersion, err error)
func (*Storage) GetFullAbiInfo ¶
func (*Storage) GetFullAbiInfoByVersionAndType ¶
func (s *Storage) GetFullAbiInfoByVersionAndType(tx storage.Transaction, version dto.ContractVersion, contractType contract_snapshot.ContractType) (abiInfo *dto.AbiInfo, err error)
func (*Storage) GetSettingContractStorageAddress ¶
func (*Storage) SaveAbiInfo ¶
type TransferManager ¶
type TransferManager interface { Stop() error QuickTransfer(ctx context.Context, transfer *models.QuickTransferObj) (*models.TransferResponseObj, error) QuickTransferAsync(ctx context.Context, transfer *models.QuickTransferObj) (*models.TransferResponseObj, error) FrameTransfer(ctx context.Context, transfer *models.QuickTransferObj) (*models.TransferResponseObj, error) FrameTransferAsync(ctx context.Context, transfer *models.QuickTransferObj) (*models.TransferResponseObj, error) CreateSafeTransfer(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) CreateSafeTransferAsync(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) ApproveSafeTransfer(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) ApproveSafeTransferAsync(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) CancelSafeTransfer(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) CancelSafeTransferAsync(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) CreateWPCSafeTransfer(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) CreateWPCSafeTransferAsync(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) ApproveWPCSafeTransfer(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) ApproveWPCSafeTransferAsync(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) CancelWPCSafeTransfer(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) CancelWPCSafeTransferAsync(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) DirectTransfer(ctx context.Context, transfer *models.DirectTransferObj) (*models.TransferResponseObj, error) DirectTransferAsync(ctx context.Context, transfer *models.DirectTransferObj) (*models.TransferResponseObj, error) ExpireTransfersAsync(ctx context.Context, ids []string) (*models.TransferResponseObj, error) GetTransfer(ctx context.Context, transferID string) (*contracts.ReceiptTransfer, error) GetTransferByIndex(ctx context.Context, index *big.Int) (*contracts.ReceiptTransfer, error) TransferExists(ctx context.Context, transferID string) (bool, error) ServiceFeeTransfer(ctx context.Context, transfer *models.ServiceFeeTransferObj) (*models.TransferResponseObj, error) ServiceFeeTransferAsync(ctx context.Context, transfer *models.ServiceFeeTransferObj) (*models.TransferResponseObj, error) FullBalanceQuickTransfer(ctx context.Context, transfer *models.QuickTransferObj) (*models.TransferResponseObj, error) FullBalanceQuickTransferAsync(ctx context.Context, transfer *models.QuickTransferObj) (*models.TransferResponseObj, error) CreateFullBalanceWPCSafeTransfer(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) CreateFullBalanceWPCSafeTransferAsync(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) ApproveFullBalanceWPCSafeTransfer(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) ApproveFullBalanceWPCSafeTransferAsync(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) CancelFullBalanceWPCSafeTransfer(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) CancelFullBalanceWPCSafeTransferAsync(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) CreateFullBalanceSafeTransfer(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) CreateFullBalanceSafeTransferAsync(ctx context.Context, transfer *models.CreateTransferObj) (*models.TransferResponseObj, error) ApproveFullBalanceSafeTransfer(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) ApproveFullBalanceSafeTransferAsync(ctx context.Context, transfer *models.ApproveTransferObj) (*models.TransferResponseObj, error) CancelFullBalanceSafeTransfer(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) CancelFullBalanceSafeTransferAsync(ctx context.Context, transfer *models.CancelTransferObj) (*models.TransferResponseObj, error) }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Contains the Bibon constant definitions
|
Contains the Bibon constant definitions |
nolint:dupl
|
nolint:dupl |
nolint:nakedret,dupl nolint:nakedret nolint:nakedret nolint:nakedret nolint:nakedret nolint:nakedret,dupl nolint:nakedret,dupl
|
nolint:nakedret,dupl nolint:nakedret nolint:nakedret nolint:nakedret nolint:nakedret nolint:nakedret,dupl nolint:nakedret,dupl |
nolint:nakedret nolint:nakedret nolint:nakedret nolint:nakedret
|
nolint:nakedret nolint:nakedret nolint:nakedret nolint:nakedret |
nolint:golint,stylecheck
|
nolint:golint,stylecheck |
nolint:nakedret Package transfer is a generated GoMock package.
|
nolint:nakedret Package transfer is a generated GoMock package. |