Documentation ¶
Index ¶
- Variables
- func ContractPayment(storeDriver store.AccountStore, address common.Address, ...) (*contractPayment, error)
- func SetLogger(w io.Writer)
- type AccountResponse
- type AddressMismatchError
- type PaymentService
- func (p *PaymentService) Account(ctx context.Context, wallet string) (*AccountResponse, error)
- func (p *PaymentService) AddNode(ctx context.Context, sig string, wallet string, nonce int64, nodeID string) error
- func (p *PaymentService) Withdraw(ctx context.Context, sig string, wallet string, nonce int64) error
- type SettleHandler
- type WithdrawBalanceMinimumError
Constants ¶
This section is empty.
Variables ¶
var ErrDepositTimelocked = errors.New("deposit is timelocked")
ErrDepositTimelocked is returned when a balance is checked but the deposit is timelocked.
var ErrWithdrawDisabled = errors.New("withdraw is disabled")
ErrWithdrawDisabled is returned when the PaymentService is initialized in read-only mode.
Functions ¶
func ContractPayment ¶ added in v0.2.3
func ContractPayment(storeDriver store.AccountStore, address common.Address, backend bind.ContractBackend, transactOpts *bind.TransactOpts) (*contractPayment, error)
ContractPayment returns an abstraction around a vipnode pool payment contract. Contract implements store.NodeBalanceStore.
Types ¶
type AccountResponse ¶ added in v0.2.6
type AccountResponse struct { NodeShortIDs []string `json:"node_short_ids"` Balance store.Balance `json:"balance"` }
AccountResponse is returned on RPC calls to pool_account
type AddressMismatchError ¶ added in v0.2.4
AddressMismatchError is used when we require a specific address but the wrong one was provided.
func (AddressMismatchError) Error ¶ added in v0.2.4
func (e AddressMismatchError) Error() string
type PaymentService ¶ added in v0.2.3
type PaymentService struct { NonceStore store.NonceStore AccountStore store.AccountStore BalanceStore store.BalanceStore // Settle is a function that disburses the given paymentAmount and replaces // the current "on-chain" balance with newBalance. It returns a transaction // ID. If nil, then Withdraw calls will error with ErrWithdrawDisabled. Settle SettleHandler // WithdrawFee (optional) takes the withdraw total and returns the new total to withdraw (with any fees applied). WithdrawFee func(*big.Int) *big.Int // WithdrawMin (optional) is the minimum amount required to allow a withdraw. WithdrawMin *big.Int }
PaymentService is an RPC service for managing pool payment-relatd requests.
func (*PaymentService) Account ¶ added in v0.2.6
func (p *PaymentService) Account(ctx context.Context, wallet string) (*AccountResponse, error)
Account is an *unverified* endpoint for retrieving the balance and list of node shortIDs associated with a wallet.
type SettleHandler ¶ added in v0.2.4
type SettleHandler func(account store.Account, paymentAmount *big.Int, newBalance *big.Int) (txID string, err error)
SettleHandler is a function that settles the balance of a given account by updating the internal balance to newBalance and disbursing paymentAmount.
type WithdrawBalanceMinimumError ¶ added in v0.2.4
WithdrawBalanceMinimumError is returned when the account balance is below the configured minimum to withdraw.
func (WithdrawBalanceMinimumError) Error ¶ added in v0.2.4
func (err WithdrawBalanceMinimumError) Error() string