Documentation
¶
Index ¶
- func FindLogByTopic(txReceipt *Receipt, topic common.Hash) (*types.Log, error)
- type API
- type AddedToBlacklistData
- type BasicAPI
- func (api *BasicAPI) Blacklist() BlacklistAPI
- func (api *BasicAPI) Events() EventsAPI
- func (api *BasicAPI) LiveToken() TokenAPI
- func (api *BasicAPI) Market() MarketAPI
- func (api *BasicAPI) OracleUSD() OracleAPI
- func (api *BasicAPI) ProfileRegistry() ProfileRegistryAPI
- func (api *BasicAPI) SideToken() TokenAPI
- func (api *BasicAPI) TestToken() TestTokenAPI
- type BasicBlacklistAPI
- func (api *BasicBlacklistAPI) Add(ctx context.Context, key *ecdsa.PrivateKey, who, whom common.Address) (*types.Transaction, error)
- func (api *BasicBlacklistAPI) AddMaster(ctx context.Context, key *ecdsa.PrivateKey, root common.Address) (*types.Transaction, error)
- func (api *BasicBlacklistAPI) Check(ctx context.Context, who, whom common.Address) (bool, error)
- func (api *BasicBlacklistAPI) Remove(ctx context.Context, key *ecdsa.PrivateKey, whom common.Address) error
- func (api *BasicBlacklistAPI) RemoveMaster(ctx context.Context, key *ecdsa.PrivateKey, root common.Address) (*types.Transaction, error)
- func (api *BasicBlacklistAPI) SetMarketAddress(ctx context.Context, key *ecdsa.PrivateKey, market common.Address) (*types.Transaction, error)
- type BasicEventsAPI
- type BasicMarketAPI
- func (api *BasicMarketAPI) Bill(ctx context.Context, key *ecdsa.PrivateKey, dealID *big.Int) <-chan error
- func (api *BasicMarketAPI) CancelChangeRequest(ctx context.Context, key *ecdsa.PrivateKey, id *big.Int) error
- func (api *BasicMarketAPI) CancelOrder(ctx context.Context, key *ecdsa.PrivateKey, id *big.Int) <-chan error
- func (api *BasicMarketAPI) CloseDeal(ctx context.Context, key *ecdsa.PrivateKey, dealID *big.Int, blacklisted bool) <-chan error
- func (api *BasicMarketAPI) ConfirmWorker(ctx context.Context, key *ecdsa.PrivateKey, slave common.Address) <-chan error
- func (api *BasicMarketAPI) CreateChangeRequest(ctx context.Context, key *ecdsa.PrivateKey, req *pb.DealChangeRequest) (*big.Int, error)
- func (api *BasicMarketAPI) GetDealChangeRequestInfo(ctx context.Context, changeRequestID *big.Int) (*pb.DealChangeRequest, error)
- func (api *BasicMarketAPI) GetDealInfo(ctx context.Context, dealID *big.Int) (*pb.Deal, error)
- func (api *BasicMarketAPI) GetDealsAmount(ctx context.Context) (*big.Int, error)
- func (api *BasicMarketAPI) GetMaster(ctx context.Context, slave common.Address) (common.Address, error)
- func (api *BasicMarketAPI) GetNumBenchmarks(ctx context.Context) (uint64, error)
- func (api *BasicMarketAPI) GetOrderInfo(ctx context.Context, orderID *big.Int) (*pb.Order, error)
- func (api *BasicMarketAPI) GetOrdersAmount(ctx context.Context) (*big.Int, error)
- func (api *BasicMarketAPI) OpenDeal(ctx context.Context, key *ecdsa.PrivateKey, askID, bidID *big.Int) <-chan DealOrError
- func (api *BasicMarketAPI) PlaceOrder(ctx context.Context, key *ecdsa.PrivateKey, order *pb.Order) <-chan OrderOrError
- func (api *BasicMarketAPI) RegisterWorker(ctx context.Context, key *ecdsa.PrivateKey, master common.Address) <-chan error
- func (api *BasicMarketAPI) RemoveWorker(ctx context.Context, key *ecdsa.PrivateKey, master, slave common.Address) <-chan error
- type BilledData
- type BlacklistAPI
- type CertificateCreatedData
- type Config
- type CustomClient
- type CustomEthereumClient
- type DealChangeRequestSentData
- type DealChangeRequestUpdatedData
- type DealOpenedData
- type DealOrError
- type DealUpdatedData
- type ErrorData
- type EthereumClientBackend
- type Event
- type EventsAPI
- type MarketAPI
- type Option
- func WithBlockConfirmations(c int64) Option
- func WithConfig(cfg *Config) Option
- func WithLivechainClient(c CustomEthereumClient) Option
- func WithLivechainEndpoint(s string) Option
- func WithLivechainGasPrice(p int64) Option
- func WithSidechainClient(c CustomEthereumClient) Option
- func WithSidechainEndpoint(s string) Option
- func WithSidechainGasPrice(p int64) Option
- func WithTimeout(d time.Duration) Option
- type OracleAPI
- type OracleUSDAPI
- type OrderOrError
- type OrderPlacedData
- type OrderUpdatedData
- type ProfileRegistry
- type ProfileRegistryAPI
- type Receipt
- type RemovedFromBlacklistData
- type StandardTokenApi
- func (api *StandardTokenApi) AllowanceOf(ctx context.Context, from string, to string) (*big.Int, error)
- func (api *StandardTokenApi) Approve(ctx context.Context, key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error)
- func (api *StandardTokenApi) BalanceOf(ctx context.Context, address string) (*big.Int, error)
- func (api *StandardTokenApi) TotalSupply(ctx context.Context) (*big.Int, error)
- func (api *StandardTokenApi) Transfer(ctx context.Context, key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error)
- func (api *StandardTokenApi) TransferFrom(ctx context.Context, key *ecdsa.PrivateKey, from string, to string, ...) (*types.Transaction, error)
- type TestTokenAPI
- type TestTokenApi
- type TokenAPI
- type ValidatorCreatedData
- type ValidatorDeletedData
- type WorkerAnnouncedData
- type WorkerConfirmedData
- type WorkerRemovedData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶ added in v0.4.1
type API interface { ProfileRegistry() ProfileRegistryAPI Events() EventsAPI Market() MarketAPI Blacklist() BlacklistAPI LiveToken() TokenAPI SideToken() TokenAPI TestToken() TestTokenAPI OracleUSD() OracleAPI }
type AddedToBlacklistData ¶ added in v0.4.1
type BasicAPI ¶ added in v0.4.1
type BasicAPI struct {
// contains filtered or unexported fields
}
func (*BasicAPI) Blacklist ¶ added in v0.4.1
func (api *BasicAPI) Blacklist() BlacklistAPI
func (*BasicAPI) ProfileRegistry ¶ added in v0.4.1
func (api *BasicAPI) ProfileRegistry() ProfileRegistryAPI
func (*BasicAPI) TestToken ¶ added in v0.4.1
func (api *BasicAPI) TestToken() TestTokenAPI
type BasicBlacklistAPI ¶ added in v0.4.1
type BasicBlacklistAPI struct {
// contains filtered or unexported fields
}
func (*BasicBlacklistAPI) Add ¶ added in v0.4.1
func (api *BasicBlacklistAPI) Add(ctx context.Context, key *ecdsa.PrivateKey, who, whom common.Address) (*types.Transaction, error)
func (*BasicBlacklistAPI) AddMaster ¶ added in v0.4.1
func (api *BasicBlacklistAPI) AddMaster(ctx context.Context, key *ecdsa.PrivateKey, root common.Address) (*types.Transaction, error)
func (*BasicBlacklistAPI) Remove ¶ added in v0.4.1
func (api *BasicBlacklistAPI) Remove(ctx context.Context, key *ecdsa.PrivateKey, whom common.Address) error
func (*BasicBlacklistAPI) RemoveMaster ¶ added in v0.4.1
func (api *BasicBlacklistAPI) RemoveMaster(ctx context.Context, key *ecdsa.PrivateKey, root common.Address) (*types.Transaction, error)
func (*BasicBlacklistAPI) SetMarketAddress ¶ added in v0.4.1
func (api *BasicBlacklistAPI) SetMarketAddress(ctx context.Context, key *ecdsa.PrivateKey, market common.Address) (*types.Transaction, error)
type BasicEventsAPI ¶ added in v0.4.1
type BasicEventsAPI struct {
// contains filtered or unexported fields
}
type BasicMarketAPI ¶ added in v0.4.1
type BasicMarketAPI struct {
// contains filtered or unexported fields
}
func (*BasicMarketAPI) Bill ¶ added in v0.4.1
func (api *BasicMarketAPI) Bill(ctx context.Context, key *ecdsa.PrivateKey, dealID *big.Int) <-chan error
func (*BasicMarketAPI) CancelChangeRequest ¶ added in v0.4.1
func (api *BasicMarketAPI) CancelChangeRequest(ctx context.Context, key *ecdsa.PrivateKey, id *big.Int) error
func (*BasicMarketAPI) CancelOrder ¶ added in v0.4.1
func (api *BasicMarketAPI) CancelOrder(ctx context.Context, key *ecdsa.PrivateKey, id *big.Int) <-chan error
func (*BasicMarketAPI) CloseDeal ¶ added in v0.4.1
func (api *BasicMarketAPI) CloseDeal(ctx context.Context, key *ecdsa.PrivateKey, dealID *big.Int, blacklisted bool) <-chan error
func (*BasicMarketAPI) ConfirmWorker ¶ added in v0.4.1
func (api *BasicMarketAPI) ConfirmWorker(ctx context.Context, key *ecdsa.PrivateKey, slave common.Address) <-chan error
func (*BasicMarketAPI) CreateChangeRequest ¶ added in v0.4.1
func (api *BasicMarketAPI) CreateChangeRequest(ctx context.Context, key *ecdsa.PrivateKey, req *pb.DealChangeRequest) (*big.Int, error)
func (*BasicMarketAPI) GetDealChangeRequestInfo ¶ added in v0.4.1
func (api *BasicMarketAPI) GetDealChangeRequestInfo(ctx context.Context, changeRequestID *big.Int) (*pb.DealChangeRequest, error)
func (*BasicMarketAPI) GetDealInfo ¶ added in v0.4.1
func (*BasicMarketAPI) GetDealsAmount ¶ added in v0.4.1
func (*BasicMarketAPI) GetNumBenchmarks ¶ added in v0.4.1
func (api *BasicMarketAPI) GetNumBenchmarks(ctx context.Context) (uint64, error)
func (*BasicMarketAPI) GetOrderInfo ¶ added in v0.4.1
func (*BasicMarketAPI) GetOrdersAmount ¶ added in v0.4.1
func (*BasicMarketAPI) OpenDeal ¶ added in v0.4.1
func (api *BasicMarketAPI) OpenDeal(ctx context.Context, key *ecdsa.PrivateKey, askID, bidID *big.Int) <-chan DealOrError
func (*BasicMarketAPI) PlaceOrder ¶ added in v0.4.1
func (api *BasicMarketAPI) PlaceOrder(ctx context.Context, key *ecdsa.PrivateKey, order *pb.Order) <-chan OrderOrError
func (*BasicMarketAPI) RegisterWorker ¶ added in v0.4.1
func (api *BasicMarketAPI) RegisterWorker(ctx context.Context, key *ecdsa.PrivateKey, master common.Address) <-chan error
func (*BasicMarketAPI) RemoveWorker ¶ added in v0.4.1
func (api *BasicMarketAPI) RemoveWorker(ctx context.Context, key *ecdsa.PrivateKey, master, slave common.Address) <-chan error
type BilledData ¶ added in v0.4.1
type BlacklistAPI ¶ added in v0.4.1
type BlacklistAPI interface { Check(ctx context.Context, who, whom common.Address) (bool, error) Add(ctx context.Context, key *ecdsa.PrivateKey, who, whom common.Address) (*types.Transaction, error) Remove(ctx context.Context, key *ecdsa.PrivateKey, whom common.Address) error AddMaster(ctx context.Context, key *ecdsa.PrivateKey, root common.Address) (*types.Transaction, error) RemoveMaster(ctx context.Context, key *ecdsa.PrivateKey, root common.Address) (*types.Transaction, error) SetMarketAddress(ctx context.Context, key *ecdsa.PrivateKey, market common.Address) (*types.Transaction, error) }
func NewBasicBlacklist ¶ added in v0.4.1
func NewBasicBlacklist(address common.Address, opts *chainOpts) (BlacklistAPI, error)
type CertificateCreatedData ¶ added in v0.4.1
type Config ¶ added in v0.4.1
Config represents SONM blockchain configuration structure that can act as a building block for more complex configs.
func (*Config) UnmarshalYAML ¶ added in v0.4.1
type CustomClient ¶ added in v0.4.1
func (*CustomClient) GetLastBlock ¶ added in v0.4.1
func (*CustomClient) GetTransactionReceipt ¶ added in v0.4.1
type CustomEthereumClient ¶ added in v0.4.1
type CustomEthereumClient interface { EthereumClientBackend // GetLastBlock returns number of last mined block GetLastBlock(ctx context.Context) (*big.Int, error) // GetTransactionReceipt returns receipt of mined transaction or notFound if tx not mined GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*Receipt, error) }
CustomEthereumClient extends EthereumClientBackend
func NewClient ¶ added in v0.4.1
func NewClient(endpoint string) (CustomEthereumClient, error)
type DealChangeRequestSentData ¶ added in v0.4.1
type DealChangeRequestUpdatedData ¶ added in v0.4.1
type DealOpenedData ¶ added in v0.4.1
type DealOrError ¶
type DealUpdatedData ¶ added in v0.4.1
type EthereumClientBackend ¶ added in v0.4.1
type EthereumClientBackend interface { bind.ContractBackend ethereum.ChainReader ethereum.TransactionReader }
EthereumClientBackend release all methods to execute interaction with Ethereum Blockchain
type EventsAPI ¶ added in v0.4.1
type MarketAPI ¶ added in v0.4.1
type MarketAPI interface { OpenDeal(ctx context.Context, key *ecdsa.PrivateKey, askID, bigID *big.Int) <-chan DealOrError CloseDeal(ctx context.Context, key *ecdsa.PrivateKey, dealID *big.Int, blacklisted bool) <-chan error GetDealInfo(ctx context.Context, dealID *big.Int) (*pb.Deal, error) GetDealsAmount(ctx context.Context) (*big.Int, error) PlaceOrder(ctx context.Context, key *ecdsa.PrivateKey, order *pb.Order) <-chan OrderOrError CancelOrder(ctx context.Context, key *ecdsa.PrivateKey, id *big.Int) <-chan error GetOrderInfo(ctx context.Context, orderID *big.Int) (*pb.Order, error) GetOrdersAmount(ctx context.Context) (*big.Int, error) Bill(ctx context.Context, key *ecdsa.PrivateKey, dealID *big.Int) <-chan error RegisterWorker(ctx context.Context, key *ecdsa.PrivateKey, master common.Address) <-chan error ConfirmWorker(ctx context.Context, key *ecdsa.PrivateKey, slave common.Address) <-chan error RemoveWorker(ctx context.Context, key *ecdsa.PrivateKey, master, slave common.Address) <-chan error GetMaster(ctx context.Context, slave common.Address) (common.Address, error) GetDealChangeRequestInfo(ctx context.Context, id *big.Int) (*pb.DealChangeRequest, error) CreateChangeRequest(ctx context.Context, key *ecdsa.PrivateKey, request *pb.DealChangeRequest) (*big.Int, error) CancelChangeRequest(ctx context.Context, key *ecdsa.PrivateKey, id *big.Int) error GetNumBenchmarks(ctx context.Context) (uint64, error) }
type Option ¶ added in v0.4.1
type Option func(options *options)
func WithBlockConfirmations ¶ added in v0.4.1
func WithConfig ¶ added in v0.4.1
func WithLivechainClient ¶
func WithLivechainClient(c CustomEthereumClient) Option
func WithLivechainEndpoint ¶
func WithLivechainGasPrice ¶
func WithSidechainClient ¶ added in v0.4.1
func WithSidechainClient(c CustomEthereumClient) Option
func WithSidechainEndpoint ¶ added in v0.4.1
func WithSidechainGasPrice ¶ added in v0.4.1
func WithTimeout ¶ added in v0.4.1
type OracleAPI ¶ added in v0.4.1
type OracleAPI interface { // SetCurrentPrice sets current price relation between some currency and SONM token SetCurrentPrice(ctx context.Context, key *ecdsa.PrivateKey, price *big.Int) (*types.Transaction, error) // GetCurrentPrice returns current price relation between some currency and SONM token GetCurrentPrice(ctx context.Context) (*big.Int, error) }
OracleAPI manage price relation between some currency and SNM token
type OracleUSDAPI ¶ added in v0.4.1
type OracleUSDAPI struct {
// contains filtered or unexported fields
}
func (*OracleUSDAPI) GetCurrentPrice ¶ added in v0.4.1
func (*OracleUSDAPI) SetCurrentPrice ¶ added in v0.4.1
func (api *OracleUSDAPI) SetCurrentPrice(ctx context.Context, key *ecdsa.PrivateKey, price *big.Int) (*types.Transaction, error)
type OrderOrError ¶
type OrderPlacedData ¶ added in v0.4.1
type OrderUpdatedData ¶ added in v0.4.1
type ProfileRegistry ¶ added in v0.4.1
type ProfileRegistry struct {
// contains filtered or unexported fields
}
func (*ProfileRegistry) GetCertificate ¶ added in v0.4.1
func (api *ProfileRegistry) GetCertificate(ctx context.Context, certificateID *big.Int) (*pb.Certificate, error)
func (*ProfileRegistry) GetValidator ¶ added in v0.4.1
type ProfileRegistryAPI ¶ added in v0.4.1
type ProfileRegistryAPI interface { GetValidator(ctx context.Context, validatorID common.Address) (*pb.Validator, error) GetCertificate(ctx context.Context, certificateID *big.Int) (*pb.Certificate, error) }
func NewProfileRegistry ¶ added in v0.4.1
func NewProfileRegistry(address common.Address, opts *chainOpts) (ProfileRegistryAPI, error)
type Receipt ¶ added in v0.4.1
Receipt extends transaction receipt with block number on which this transaction was mined.
func WaitTransactionReceipt ¶ added in v0.4.1
func WaitTransactionReceipt(ctx context.Context, client CustomEthereumClient, confirmations int64, logParsePeriod time.Duration, tx *types.Transaction) (*Receipt, error)
func (*Receipt) UnmarshalJSON ¶ added in v0.4.1
UnmarshalJSON calls parent unmarshaller for Receipt and also unmarshall block number and associate it with the struct.
type RemovedFromBlacklistData ¶ added in v0.4.1
type StandardTokenApi ¶ added in v0.4.1
type StandardTokenApi struct {
// contains filtered or unexported fields
}
func (*StandardTokenApi) AllowanceOf ¶ added in v0.4.1
func (*StandardTokenApi) Approve ¶ added in v0.4.1
func (api *StandardTokenApi) Approve(ctx context.Context, key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error)
func (*StandardTokenApi) TotalSupply ¶ added in v0.4.1
func (*StandardTokenApi) Transfer ¶ added in v0.4.1
func (api *StandardTokenApi) Transfer(ctx context.Context, key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error)
func (*StandardTokenApi) TransferFrom ¶ added in v0.4.1
func (api *StandardTokenApi) TransferFrom(ctx context.Context, key *ecdsa.PrivateKey, from string, to string, amount *big.Int) (*types.Transaction, error)
type TestTokenAPI ¶ added in v0.4.1
type TestTokenAPI interface { // GetTokens - send 100 SNMT token for message caller // this function added for MVP purposes and has been deleted later GetTokens(ctx context.Context, key *ecdsa.PrivateKey) (*types.Transaction, error) }
func NewTestToken ¶ added in v0.4.1
func NewTestToken(address common.Address, opts *chainOpts) (TestTokenAPI, error)
type TestTokenApi ¶ added in v0.4.1
type TestTokenApi struct {
// contains filtered or unexported fields
}
func (*TestTokenApi) GetTokens ¶ added in v0.4.1
func (api *TestTokenApi) GetTokens(ctx context.Context, key *ecdsa.PrivateKey) (*types.Transaction, error)
type TokenAPI ¶ added in v0.4.1
type TokenAPI interface { // Approve - add allowance from caller to other contract to spend tokens Approve(ctx context.Context, key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error) // Transfer token from caller Transfer(ctx context.Context, key *ecdsa.PrivateKey, to string, amount *big.Int) (*types.Transaction, error) // TransferFrom fallback function for contracts to transfer you allowance TransferFrom(ctx context.Context, key *ecdsa.PrivateKey, from string, to string, amount *big.Int) (*types.Transaction, error) // BalanceOf returns balance of given address BalanceOf(ctx context.Context, address string) (*big.Int, error) // AllowanceOf returns allowance of given address to spender account AllowanceOf(ctx context.Context, from string, to string) (*big.Int, error) // TotalSupply - all amount of emitted token TotalSupply(ctx context.Context) (*big.Int, error) }
TokenAPI is a go implementation of ERC20-compatibility token with full functionality high-level interface standard description with placed: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md