Documentation
¶
Index ¶
- func ConvertStringToBigInt(st string) big.Int
- func ConvertStringToInt64(st string) uint64
- func EtherToWei(etherAmount float64) *big.Int
- func EtherToWeiUint64(etherAmount float64) uint64
- func GetAddress(privateKey *ecdsa.PrivateKey) common.Address
- func GetAddressFromSignedMessage(message []byte, sig []byte) (common.Address, error)
- func GetPublicKey(privateKey *ecdsa.PrivateKey) ecdsa.PublicKey
- func ParsePrivateKey(privateKey string) (*ecdsa.PrivateKey, error)
- func SignMessage(privateKey *ecdsa.PrivateKey, message []byte) ([]byte, error)
- func WeiToEther(wei *big.Int) *big.Float
- type Contracts
- type ContractsV2
- type EventChannelCollection
- type EventChannels
- type JobCreatorEventChannels
- type MediationEventChannels
- type PaymentEventChannels
- type PowEventChannels
- type PowValidPOWSubmission
- type StorageEventChannels
- type TokenEventChannels
- type Web3Options
- type Web3SDK
- func (sdk *Web3SDK) AcceptResult(dealId string) (string, error)
- func (sdk *Web3SDK) AddResult(dealId string, resultsId string, dataId string, instructionCount uint64) (string, error)
- func (sdk *Web3SDK) AddUserToList(serviceType uint8) error
- func (sdk *Web3SDK) Agree(deal data.Deal) (string, error)
- func (sdk *Web3SDK) CheckResult(dealId string) (string, error)
- func (sdk *Web3SDK) GetAddress() common.Address
- func (sdk *Web3SDK) GetBalance(address string) (*big.Int, error)
- func (sdk *Web3SDK) GetGenerateChallenge(ctx context.Context, nodeId string) (string, *pow.PowGenerateChallenge, error)
- func (sdk *Web3SDK) GetLPBalance(address string) (*big.Int, error)
- func (sdk *Web3SDK) GetServiceAddresses(serviceType string) ([]common.Address, error)
- func (sdk *Web3SDK) GetSolverAddresses() ([]common.Address, error)
- func (sdk *Web3SDK) GetSolverUrl(address string) (string, error)
- func (sdk *Web3SDK) GetUser(address common.Address) (users.SharedStructsUser, error)
- func (sdk *Web3SDK) MediationAcceptResult(dealId string) (string, error)
- func (sdk *Web3SDK) MediationRejectResult(dealId string) (string, error)
- func (sdk *Web3SDK) SendPowSignal(ctx context.Context) (*pow.PowNewPowRound, error)
- func (sdk *Web3SDK) SubmitWork(ctx context.Context, nonce *big.Int, nodeId string) (common.Hash, error)
- func (sdk *Web3SDK) UpdateUser(metadataCID string, url string, roles []uint8) error
- func (sdk *Web3SDK) WaitTx(ctx context.Context, tx *types.Transaction) (*types.Receipt, error)
- type Web3SDKV2
- func (sdk *Web3SDKV2) AcceptJobPayment(amount *big.Int) (bool, error)
- func (sdk *Web3SDKV2) AcceptResourceProviderCollateral(amount *big.Int) (bool, error)
- func (sdk *Web3SDKV2) ApproveTokenTransfer(amount *big.Int, spender common.Address) (string, error)
- func (sdk *Web3SDKV2) GetAddress() common.Address
- func (sdk *Web3SDKV2) GetBalance(address string) (*big.Int, error)
- func (sdk *Web3SDKV2) GetDeal(dealId string) (lilypadproxy.SharedStructsDeal, error)
- func (sdk *Web3SDKV2) GetEscrowBalance(address common.Address) (*big.Int, error)
- func (sdk *Web3SDKV2) GetLilypadL2TokenAddress() (common.Address, error)
- func (sdk *Web3SDKV2) GetLilypadPaymentEngineAddress() (common.Address, error)
- func (sdk *Web3SDKV2) GetLilypadStorageAddress() (common.Address, error)
- func (sdk *Web3SDKV2) GetLilypadUserAddress() (common.Address, error)
- func (sdk *Web3SDKV2) GetMinimumResourceProviderCollateralAmount() (*big.Int, error)
- func (sdk *Web3SDKV2) GetResult(resultId string) (lilypadproxy.SharedStructsResult, error)
- func (sdk *Web3SDKV2) SaveDeal(deal lilypadproxy.SharedStructsDeal) (bool, error)
- func (sdk *Web3SDKV2) SaveResult(result lilypadproxy.SharedStructsResult) (bool, error)
- func (sdk *Web3SDKV2) WaitTx(ctx context.Context, tx *types.Transaction) (*types.Receipt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertStringToBigInt ¶
func ConvertStringToInt64 ¶
func EtherToWei ¶
func EtherToWeiUint64 ¶
func GetAddress ¶
func GetAddress(privateKey *ecdsa.PrivateKey) common.Address
func GetPublicKey ¶
func GetPublicKey(privateKey *ecdsa.PrivateKey) ecdsa.PublicKey
func ParsePrivateKey ¶
func ParsePrivateKey(privateKey string) (*ecdsa.PrivateKey, error)
func SignMessage ¶
func SignMessage(privateKey *ecdsa.PrivateKey, message []byte) ([]byte, error)
Types ¶
type Contracts ¶
type Contracts struct {
Token *token.Token
Payments *payments.Payments
Storage *storage.Storage
Users *users.Users
JobCreator *jobcreator.Jobcreator
Mediation *mediation.Mediation
Controller *controller.Controller
Pow *pow.Pow
}
these are the go-binding wrappers for the various deployed contracts
func NewContracts ¶
type ContractsV2 ¶
type ContractsV2 struct {
LilypadPaymentEngine *lilypadpaymentengine.LilypadPaymentEngine
LilypadProxy *lilypadproxy.LilypadProxy
LilypadModuleDirectory *lilypadmoduledirectory.LilypadModuleDirectory
LilypadContractRegistry *lilypadcontractregistry.LilypadContractRegistry
LilypadStorage *lilypadstorage.LilypadStorage
LilypadUser *lilypaduser.LilypadUser
LilypadTokenomics *lilypadtokenomics.LilypadTokenomics
LilypadToken *lilypadtoken.LilypadToken
}
These are the Go binding wrappers for the new version of the protocol
func NewContractsV2 ¶
func NewContractsV2( options Web3Options, client *ethclient.Client, callOpts *bind.CallOpts, ) (*ContractsV2, error)
Creates the new Go-binding wrapper modules for the new protocol
type EventChannelCollection ¶
type EventChannels ¶
type EventChannels struct {
Token *TokenEventChannels
Payment *PaymentEventChannels
Storage *StorageEventChannels
JobCreator *JobCreatorEventChannels
Mediation *MediationEventChannels
Pow *PowEventChannels
// contains filtered or unexported fields
}
func NewEventChannels ¶
func NewEventChannels() *EventChannels
func (*EventChannels) Start ¶
func (eventChannels *EventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
type JobCreatorEventChannels ¶
type JobCreatorEventChannels struct {
// contains filtered or unexported fields
}
func NewJobCreatorEventChannels ¶
func NewJobCreatorEventChannels() *JobCreatorEventChannels
func (*JobCreatorEventChannels) Start ¶
func (s *JobCreatorEventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
func (*JobCreatorEventChannels) SubscribeJobAdded ¶
func (t *JobCreatorEventChannels) SubscribeJobAdded(handler func(jobcreator.JobcreatorJobAdded))
type MediationEventChannels ¶
type MediationEventChannels struct {
// contains filtered or unexported fields
}
func NewMediationEventChannels ¶
func NewMediationEventChannels() *MediationEventChannels
func (*MediationEventChannels) Start ¶
func (m *MediationEventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
func (*MediationEventChannels) SubscribeMediationRequested ¶
func (m *MediationEventChannels) SubscribeMediationRequested(handler func(mediation.MediationMediationRequested))
type PaymentEventChannels ¶
type PaymentEventChannels struct {
// contains filtered or unexported fields
}
func NewPaymentEventChannels ¶
func NewPaymentEventChannels() *PaymentEventChannels
func (*PaymentEventChannels) Start ¶
func (p *PaymentEventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
func (*PaymentEventChannels) SubscribePayment ¶
func (p *PaymentEventChannels) SubscribePayment(handler func(payments.PaymentsPayment))
type PowEventChannels ¶
type PowEventChannels struct {
// contains filtered or unexported fields
}
func NewPowEventChannels ¶
func NewPowEventChannels() *PowEventChannels
func (*PowEventChannels) Start ¶
func (s *PowEventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
func (*PowEventChannels) SubscribenewPowRound ¶
func (t *PowEventChannels) SubscribenewPowRound(handler func(pow.PowNewPowRound))
type PowValidPOWSubmission ¶
type StorageEventChannels ¶
type StorageEventChannels struct {
// contains filtered or unexported fields
}
func NewStorageEventChannels ¶
func NewStorageEventChannels() *StorageEventChannels
func (*StorageEventChannels) Start ¶
func (s *StorageEventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
func (*StorageEventChannels) SubscribeDealStateChange ¶
func (t *StorageEventChannels) SubscribeDealStateChange(handler func(storage.StorageDealStateChange))
type TokenEventChannels ¶
type TokenEventChannels struct {
// contains filtered or unexported fields
}
func NewTokenEventChannels ¶
func NewTokenEventChannels() *TokenEventChannels
func (*TokenEventChannels) Start ¶
func (t *TokenEventChannels) Start( ctx context.Context, cm *system.CleanupManager, sdk *Web3SDK, ) error
func (*TokenEventChannels) SubscribeTransfer ¶
func (t *TokenEventChannels) SubscribeTransfer(handler func(token.TokenTransfer))
type Web3Options ¶
type Web3Options struct {
// core settings
RpcURL string `json:"rpc_url" toml:"rpc_url"`
PrivateKey string `json:"private_key" toml:"private_key"`
ChainID int `json:"chain_id" toml:"chain_id"`
// contract addresses
ControllerAddress string `json:"controller_address" toml:"controller_address"`
PaymentsAddress string `json:"payments_address" toml:"payments_address"`
StorageAddress string `json:"storage_address" toml:"storage_address"`
UsersAddress string `json:"users_address" toml:"users_address"`
TokenAddress string `json:"token_address" toml:"token_address"`
MediationAddress string `json:"mediation_address" toml:"mediation_address"`
JobCreatorAddress string `json:"jobcreator_address" toml:"jobcreator_address"`
PowAddress string `json:"pow_address" toml:"pow_address"`
// V2 Protocol
LilypadProxyAddress string `json:"lilypad_proxy_address" toml:"lilypad_proxy_address"`
LilypadPaymentEngineAddress string `json:"lilypad_payment_engine_address" toml:"lilypad_payment_engine_address"`
LilypadStorageAddress string `json:"lilypad_storage_address" toml:"lilypad_storage_address"`
LilypadUserAddress string `json:"lilypad_user_address" toml:"lilypad_user_address"`
LilypadL2TokenAddress string `json:"lilypad_l2_token_address" toml:"lilypad_l2_token_address"`
LilypadL1TokenAddress string `json:"lilypad_l1_token_address" toml:"lilypad_l1_token_address"`
LilypadTokenomicsAddress string `json:"lilypad_tokenomics_address" toml:"lilypad_tokenomics_address"`
LilypadModuleDirectoryAddress string `json:"lilypad_module_directory_address" toml:"lilypad_module_directory_address"`
LilypadContractRegistryAddress string `json:"lilypad_contract_registry_address" toml:"lilypad_contract_registry_address"`
// this is injected by whatever service we are running
// it's used for logging tx's
Service system.Service `json:"-" toml:"-"`
}
type Web3SDK ¶
type Web3SDK struct {
Options Web3Options
PrivateKey *ecdsa.PrivateKey
Client *ethclient.Client
CallOpts *bind.CallOpts
TransactOpts *bind.TransactOpts
Contracts *Contracts
Log *zerolog.Logger
}
func NewContractSDK ¶
func (*Web3SDK) AddUserToList ¶
func (*Web3SDK) GetAddress ¶
func (*Web3SDK) GetGenerateChallenge ¶
func (*Web3SDK) GetServiceAddresses ¶
func (*Web3SDK) GetSolverAddresses ¶
func (*Web3SDK) MediationAcceptResult ¶
func (*Web3SDK) MediationRejectResult ¶
func (*Web3SDK) SendPowSignal ¶
func (*Web3SDK) SubmitWork ¶
func (*Web3SDK) UpdateUser ¶
type Web3SDKV2 ¶
type Web3SDKV2 struct {
Options Web3Options
PrivateKey *ecdsa.PrivateKey
Client *ethclient.Client
CallOpts *bind.CallOpts
TransactOpts *bind.TransactOpts
Contracts *ContractsV2
Log *zerolog.Logger
}
func NewContractSDKV2 ¶
func (*Web3SDKV2) AcceptJobPayment ¶
func (*Web3SDKV2) AcceptResourceProviderCollateral ¶
func (*Web3SDKV2) ApproveTokenTransfer ¶
func (*Web3SDKV2) GetAddress ¶
func (*Web3SDKV2) GetDeal ¶
func (sdk *Web3SDKV2) GetDeal(dealId string) (lilypadproxy.SharedStructsDeal, error)
func (*Web3SDKV2) GetEscrowBalance ¶
func (*Web3SDKV2) GetLilypadL2TokenAddress ¶
func (*Web3SDKV2) GetLilypadPaymentEngineAddress ¶
func (*Web3SDKV2) GetLilypadStorageAddress ¶
func (*Web3SDKV2) GetLilypadUserAddress ¶
func (*Web3SDKV2) GetMinimumResourceProviderCollateralAmount ¶
func (*Web3SDKV2) GetResult ¶
func (sdk *Web3SDKV2) GetResult(resultId string) (lilypadproxy.SharedStructsResult, error)
func (*Web3SDKV2) SaveDeal ¶
func (sdk *Web3SDKV2) SaveDeal(deal lilypadproxy.SharedStructsDeal) (bool, error)
func (*Web3SDKV2) SaveResult ¶
func (sdk *Web3SDKV2) SaveResult(result lilypadproxy.SharedStructsResult) (bool, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.