Documentation
¶
Index ¶
- Constants
- Variables
- func FromDecimal(value *big.Int, decimals int) float64
- func ToDecimal(value float64, decimals int) *big.Int
- type BlockchainController
- type BlockchainService
- func (s *BlockchainService) Approve(ctx context.Context, spender common.Address, amount *big.Int) (common.Hash, error)
- func (s *BlockchainService) CheckConnectivity(ctx context.Context, url string, addr common.Address) (time.Duration, error)
- func (s *BlockchainService) CheckPortOpen(ctx context.Context, urlStr string) (bool, error)
- func (s *BlockchainService) ClaimProviderBalance(ctx context.Context, sessionID [32]byte) (common.Hash, error)
- func (s *BlockchainService) CloseSession(ctx context.Context, sessionID common.Hash) (common.Hash, error)
- func (s *BlockchainService) CreateNewBid(ctx context.Context, modelID common.Hash, pricePerSecond *lib.BigInt) (*structs.Bid, error)
- func (s *BlockchainService) CreateNewModel(ctx context.Context, modelID common.Hash, ipfsID common.Hash, fee *lib.BigInt, ...) (*structs.Model, error)
- func (s *BlockchainService) CreateNewProvider(ctx context.Context, stake *lib.BigInt, endpoint string) (*structs.Provider, error)
- func (s *BlockchainService) DeleteBid(ctx context.Context, bidId common.Hash) (common.Hash, error)
- func (s *BlockchainService) DeregisterModel(ctx context.Context, modelId common.Hash) (common.Hash, error)
- func (s *BlockchainService) DeregisterProdiver(ctx context.Context) (common.Hash, error)
- func (s *BlockchainService) GetActiveBidsByModel(ctx context.Context, modelId common.Hash, offset *big.Int, limit uint8, ...) ([]*structs.Bid, error)
- func (s *BlockchainService) GetActiveBidsByProvider(ctx context.Context, provider common.Address, offset *big.Int, limit uint8, ...) ([]*structs.Bid, error)
- func (s *BlockchainService) GetActiveBidsByProviderCount(ctx context.Context, provider common.Address) (*big.Int, error)
- func (s *BlockchainService) GetAllBidsWithRating(ctx context.Context, modelAgentID [32]byte) ([][32]byte, []m.IBidStorageBid, []sr.IStatsStorageProviderModelStats, ...)
- func (s *BlockchainService) GetAllModels(ctx context.Context) ([]*structs.Model, error)
- func (s *BlockchainService) GetAllProviders(ctx context.Context) ([]*structs.Provider, error)
- func (s *BlockchainService) GetAllowance(ctx context.Context, spender common.Address) (*big.Int, error)
- func (s *BlockchainService) GetBalance(ctx context.Context) (eth *big.Int, mor *big.Int, err error)
- func (s *BlockchainService) GetBidByID(ctx context.Context, ID common.Hash) (*structs.Bid, error)
- func (s *BlockchainService) GetBidsByModelAgent(ctx context.Context, modelId [32]byte, offset *big.Int, limit uint8, ...) ([]*structs.Bid, error)
- func (s *BlockchainService) GetBidsByProvider(ctx context.Context, providerAddr common.Address, offset *big.Int, limit uint8, ...) ([]*structs.Bid, error)
- func (s *BlockchainService) GetLatestBlock(ctx context.Context) (uint64, error)
- func (s *BlockchainService) GetModels(ctx context.Context, offset *big.Int, limit uint8, order r.Order) ([]*structs.Model, error)
- func (s *BlockchainService) GetMyAddress(ctx context.Context) (common.Address, error)
- func (s *BlockchainService) GetProvider(ctx context.Context, providerAddr common.Address) (*structs.Provider, error)
- func (s *BlockchainService) GetProviderClaimableBalance(ctx context.Context, sessionID common.Hash) (*big.Int, error)
- func (s *BlockchainService) GetProviders(ctx context.Context, offset *big.Int, limit uint8, order r.Order) ([]*structs.Provider, error)
- func (s *BlockchainService) GetRatedBids(ctx context.Context, modelID common.Hash) ([]structs.ScoredBid, error)
- func (s *BlockchainService) GetSession(ctx context.Context, sessionID common.Hash) (*structs.Session, error)
- func (s *BlockchainService) GetSessions(ctx context.Context, user, provider common.Address, offset *big.Int, ...) ([]*structs.Session, error)
- func (s *BlockchainService) GetSessionsIds(ctx context.Context, user, provider common.Address, offset *big.Int, ...) ([]common.Hash, error)
- func (s *BlockchainService) GetTodaysBudget(ctx context.Context) (*big.Int, error)
- func (s *BlockchainService) GetTokenSupply(ctx context.Context) (*big.Int, error)
- func (s *BlockchainService) GetTransactions(ctx context.Context, page uint64, limit uint8) ([]structs.RawTransaction, error)
- func (s *BlockchainService) ModelExists(ctx context.Context, modelID common.Hash) (bool, error)
- func (s *BlockchainService) OpenSession(ctx context.Context, approval, approvalSig []byte, stake *big.Int, ...) (common.Hash, error)
- func (s *BlockchainService) OpenSessionByModelId(ctx context.Context, modelID common.Hash, duration *big.Int, ...) (common.Hash, error)
- func (s *BlockchainService) SendETH(ctx context.Context, to common.Address, amount *big.Int) (common.Hash, error)
- func (s *BlockchainService) SendMOR(ctx context.Context, to common.Address, amount *big.Int) (common.Hash, error)
- type EventsListener
- type ExplorerClient
- type ModelStats
- type SessionExpiryHandler
Constants ¶
View Source
const DecimalsMOR = 18
Variables ¶
View Source
var ( ErrPrKey = errors.New("cannot get private key") ErrTxOpts = errors.New("failed to get transactOpts") ErrNonce = errors.New("failed to get nonce") ErrEstimateGas = errors.New("failed to estimate gas") ErrSignTx = errors.New("failed to sign transaction") ErrSendTx = errors.New("failed to send transaction") ErrWaitMined = errors.New("failed to wait for transaction to be mined") ErrSessionStore = errors.New("failed to store session") ErrSessionReport = errors.New("failed to get session report from provider") ErrSessionUserReport = errors.New("failed to get session report from user") ErrBid = errors.New("failed to get bid") ErrProvider = errors.New("failed to get provider") ErrTokenSupply = errors.New("failed to parse token supply") ErrBudget = errors.New("failed to parse token budget") ErrMyAddress = errors.New("failed to get my address") ErrInitSession = errors.New("failed to initiate session") ErrApprove = errors.New("failed to approve") ErrMarshal = errors.New("failed to marshal open session payload") ErrOpenOwnBid = errors.New("cannot open session with own bid") ErrNoBid = errors.New("no bids available") ErrModel = errors.New("can't get model") )
Functions ¶
Types ¶
type BlockchainController ¶
type BlockchainController struct {
// contains filtered or unexported fields
}
func NewBlockchainController ¶
func NewBlockchainController(service *BlockchainService, log lib.ILogger) *BlockchainController
func (*BlockchainController) RegisterRoutes ¶
func (c *BlockchainController) RegisterRoutes(r interfaces.Router)
type BlockchainService ¶
type BlockchainService struct {
// contains filtered or unexported fields
}
func NewBlockchainService ¶
func NewBlockchainService( ethClient i.EthClient, mc multicall.MulticallBackend, diamonContractAddr common.Address, morTokenAddr common.Address, explorer *ExplorerClient, privateKey i.PrKeyProvider, proxyService *proxyapi.ProxyServiceSender, sessionRepo *sessionrepo.SessionRepositoryCached, scorerAlgo *rating.Rating, log lib.ILogger, legacyTx bool, ) *BlockchainService
func (*BlockchainService) CheckConnectivity ¶
func (*BlockchainService) CheckPortOpen ¶
func (*BlockchainService) ClaimProviderBalance ¶
func (*BlockchainService) CloseSession ¶
func (*BlockchainService) CreateNewBid ¶
func (*BlockchainService) CreateNewModel ¶
func (*BlockchainService) CreateNewProvider ¶
func (*BlockchainService) DeregisterModel ¶
func (*BlockchainService) DeregisterProdiver ¶
func (*BlockchainService) GetActiveBidsByModel ¶
func (*BlockchainService) GetActiveBidsByProvider ¶
func (*BlockchainService) GetActiveBidsByProviderCount ¶
func (*BlockchainService) GetAllBidsWithRating ¶
func (s *BlockchainService) GetAllBidsWithRating(ctx context.Context, modelAgentID [32]byte) ([][32]byte, []m.IBidStorageBid, []sr.IStatsStorageProviderModelStats, []pr.IProviderStorageProvider, error)
func (*BlockchainService) GetAllModels ¶
func (*BlockchainService) GetAllProviders ¶
func (*BlockchainService) GetAllowance ¶
func (*BlockchainService) GetBalance ¶
func (*BlockchainService) GetBidByID ¶
func (*BlockchainService) GetBidsByModelAgent ¶
func (*BlockchainService) GetBidsByProvider ¶
func (*BlockchainService) GetLatestBlock ¶
func (s *BlockchainService) GetLatestBlock(ctx context.Context) (uint64, error)
func (*BlockchainService) GetMyAddress ¶
func (*BlockchainService) GetProvider ¶
func (s *BlockchainService) GetProvider(ctx context.Context, providerAddr common.Address) (*structs.Provider, error)
GetMyAddress returns the provider by its wallet address, returns nil if provider is not registered
func (*BlockchainService) GetProviderClaimableBalance ¶
func (*BlockchainService) GetProviders ¶
func (*BlockchainService) GetRatedBids ¶
func (*BlockchainService) GetSession ¶
func (*BlockchainService) GetSessions ¶
func (*BlockchainService) GetSessionsIds ¶
func (*BlockchainService) GetTodaysBudget ¶
func (*BlockchainService) GetTokenSupply ¶
func (*BlockchainService) GetTransactions ¶
func (s *BlockchainService) GetTransactions(ctx context.Context, page uint64, limit uint8) ([]structs.RawTransaction, error)
func (*BlockchainService) ModelExists ¶
func (*BlockchainService) OpenSession ¶
func (*BlockchainService) OpenSessionByModelId ¶
type EventsListener ¶
type EventsListener struct {
// contains filtered or unexported fields
}
func NewEventsListener ¶
func NewEventsListener(sessionRepo *sessionrepo.SessionRepositoryCached, sessionRouter *registries.SessionRouter, wallet interfaces.Wallet, logWatcher contracts.LogWatcher, log *lib.Logger) *EventsListener
type ExplorerClient ¶
type ExplorerClient struct {
// contains filtered or unexported fields
}
func NewExplorerClient ¶
func (*ExplorerClient) GetEthTransactions ¶
func (e *ExplorerClient) GetEthTransactions(ctx context.Context, address common.Address, page uint64, limit uint8) ([]structs.RawTransaction, error)
func (*ExplorerClient) GetTokenTransactions ¶
func (e *ExplorerClient) GetTokenTransactions(ctx context.Context, address common.Address, page uint64, limit uint8) ([]structs.RawTransaction, error)
type ModelStats ¶
type SessionExpiryHandler ¶
type SessionExpiryHandler struct {
// contains filtered or unexported fields
}
func NewSessionExpiryHandler ¶
func NewSessionExpiryHandler(blockchainService *BlockchainService, sessionStorage *storages.SessionStorage, wallet interfaces.Wallet, log lib.ILogger) *SessionExpiryHandler
Source Files
¶
Click to show internal directories.
Click to hide internal directories.