Documentation
¶
Index ¶
- Constants
- Variables
- func Router() address.Address
- func ToFilBig(x *big.Int) fbig.Int
- func WithMaxFee(maxFee abi.TokenAmount) evmMsgOpt
- type BlockHeader
- func (blk *BlockHeader) Cid() cid.Cid
- func (t *BlockHeader) MarshalCBOR(w io.Writer) error
- func (blk *BlockHeader) Serialize() ([]byte, error)
- func (blk *BlockHeader) SigningBytes() ([]byte, error)
- func (blk *BlockHeader) ToStorageBlock() (block.Block, error)
- func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error)
- type BlockLink
- type ClientState
- type ClientVoucher
- type OpType
- type ProofData
- type ProofRequest
- type ProofResponse
- type ProofReward
- type ProviderVoucher
- type Service
- func (s *Service) AcceptServiceActor(ctx context.Context, from address.Address) error
- func (s *Service) ClientCancelWithdrawal(ctx context.Context, from address.Address) (cid.Cid, error)
- func (s *Service) ClientCompleteWithdrawal(ctx context.Context, from address.Address) (cid.Cid, error)
- func (s *Service) ClientDeposit(ctx context.Context, from address.Address, amount fbig.Int) (cid.Cid, error)
- func (s *Service) ClientInitiateWithdrawal(ctx context.Context, from address.Address, amount abi.TokenAmount) (cid.Cid, error)
- func (s *Service) CreateClientVoucher(ctx context.Context, clientID uint64, cumulativeAmount *big.Int, nonce uint64) ([]byte, error)
- func (s *Service) CreateProviderVoucher(ctx context.Context, providerID uint64, cumulativeAmount *big.Int, ...) ([]byte, error)
- func (s *Service) GetClientState(ctx context.Context, clientID uint64) (*ClientState, error)
- func (s *Service) GetProviderState(ctx context.Context, providerID uint64) (fbig.Int, uint64, error)
- func (s *Service) GetServiceState(ctx context.Context) (uint64, fbig.Int, fbig.Int, fbig.Int, uint64, fbig.Int, error)
- func (s *Service) ProposeServiceActor(ctx context.Context, from address.Address, newServiceActor address.Address) error
- func (s *Service) ServiceCancelWithdrawal(ctx context.Context, from address.Address) error
- func (s *Service) ServiceCompleteWithdrawal(ctx context.Context, from address.Address) error
- func (s *Service) ServiceDeposit(ctx context.Context, from address.Address, amount fbig.Int) error
- func (s *Service) ServiceInitiateWithdrawal(ctx context.Context, from address.Address, amount fbig.Int) error
- func (s *Service) ServiceRedeemClientVoucher(ctx context.Context, from address.Address, clientID uint64, ...) (cid.Cid, error)
- func (s *Service) ServiceRedeemProviderVoucher(ctx context.Context, from address.Address, providerID uint64, ...) (cid.Cid, error)
- func (s *Service) ValidateClientVoucher(ctx context.Context, clientID uint64, cumulativeAmount *big.Int, nonce uint64, ...) (bool, error)
- func (s *Service) ValidateProviderVoucher(ctx context.Context, providerID uint64, cumulativeAmount *big.Int, ...) (bool, error)
- func (s *Service) VerifyVoucherUpdate(best, proposed *ClientVoucher) (*big.Int, error)
- type WorkAsk
- type WorkRequest
- type WorkResponse
Constants ¶
View Source
const AcceptServiceActorABI = `` /* 130-byte string literal not displayed */
View Source
const CancelClientWithdrawalABI = `` /* 139-byte string literal not displayed */
View Source
const CancelServiceWithdrawalABI = `` /* 140-byte string literal not displayed */
View Source
const CompleteClientWithdrawalABI = `` /* 141-byte string literal not displayed */
View Source
const CompleteServiceWithdrawalABI = `` /* 142-byte string literal not displayed */
View Source
const CreateClientVoucherABI = `` /* 410-byte string literal not displayed */
View Source
const CreateProviderVoucherABI = `` /* 414-byte string literal not displayed */
View Source
const DepositABI = `[
{
"inputs": [],
"name": "deposit",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
]`
View Source
const GetClientStateABI = `` /* 587-byte string literal not displayed */
View Source
const GetProviderStateABI = `` /* 358-byte string literal not displayed */
View Source
const GetServiceStateABI = `` /* 691-byte string literal not displayed */
View Source
const InitiateClientWithdrawalABI = `` /* 212-byte string literal not displayed */
View Source
const InitiateServiceWithdrawalABI = `` /* 213-byte string literal not displayed */
View Source
const ProposeServiceActorABI = `` /* 211-byte string literal not displayed */
View Source
const RedeemClientVoucherABI = `` /* 417-byte string literal not displayed */
View Source
const RedeemProviderVoucherABI = `` /* 421-byte string literal not displayed */
View Source
const RouterMainnet = "0xFf34254F6d017503B5f1E444339042AB6A3E4323"
RouterMainnet is the Ethereum form of the router address. This is just an example.
View Source
const ServiceDepositABI = `` /* 128-byte string literal not displayed */
View Source
const ValidateClientVoucherABI = `` /* 480-byte string literal not displayed */
View Source
const ValidateProviderVoucherABI = `` /* 484-byte string literal not displayed */
View Source
const WithdrawWindow = 4 * time.Hour
Variables ¶
View Source
var MaxPrice = types.FromFil(1)
View Source
var PriceResolution = types.NewInt(1_000_000_000) // 1nFIL
Functions ¶
func WithMaxFee ¶
func WithMaxFee(maxFee abi.TokenAmount) evmMsgOpt
Types ¶
type BlockHeader ¶
type BlockHeader struct {
Version uint64
Parent BlockLink
Height uint64
L1Base types.TipSetKey
OpType OpType
PaymentCumulative abi.TokenAmount
PaymentNonce uint64
PaymentSignature []byte
Provider *address.Address
Client *address.Address
Metadata string
Validator address.Address
Signature *crypto.Signature
}
func (*BlockHeader) Cid ¶
func (blk *BlockHeader) Cid() cid.Cid
func (*BlockHeader) MarshalCBOR ¶
func (t *BlockHeader) MarshalCBOR(w io.Writer) error
func (*BlockHeader) Serialize ¶
func (blk *BlockHeader) Serialize() ([]byte, error)
func (*BlockHeader) SigningBytes ¶
func (blk *BlockHeader) SigningBytes() ([]byte, error)
func (*BlockHeader) ToStorageBlock ¶
func (blk *BlockHeader) ToStorageBlock() (block.Block, error)
func (*BlockHeader) UnmarshalCBOR ¶
func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error)
type BlockLink ¶
type BlockLink = *genadt.CborLink[*BlockHeader]
type ClientState ¶
type ClientVoucher ¶
type ClientVoucher struct {
ClientID uint64
CumulativeAmount *big.Int
Nonce uint64
Signature []byte
}
ClientVoucher ...
type ProofData ¶
type ProofData struct {
SectorID *abi.SectorID
// proof request enum
PoRep *proof.Commit1OutRaw
Snap *proof.Snap
}
func (*ProofData) CheckOutput ¶
type ProofRequest ¶
type ProofRequest struct {
Data cid.Cid `json:"data"`
PaymentClientID int64 `json:"payment_client_id"`
PaymentNonce int64 `json:"payment_nonce"`
PaymentCumulativeAmount abi.TokenAmount `json:"payment_cumulative_amount"`
PaymentSignature []byte `json:"payment_signature"`
}
type ProofResponse ¶
type ProofReward ¶
type ProofReward struct {
Status string `json:"status"`
PoW bool `json:"pow"`
Nonce uint64 `json:"nonce"`
Amount abi.TokenAmount `json:"amount"`
CumulativeAmount abi.TokenAmount `json:"cumulative_amount"`
Signature []byte `json:"signature"`
}
type ProviderVoucher ¶
type ProviderVoucher struct {
ProviderID uint64
CumulativeAmount *big.Int
Nonce uint64
Signature []byte
}
ProviderVoucher ...
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewServiceCustomSend ¶
func (*Service) AcceptServiceActor ¶
func (*Service) ClientCancelWithdrawal ¶
func (*Service) ClientCompleteWithdrawal ¶
func (*Service) ClientDeposit ¶
func (s *Service) ClientDeposit( ctx context.Context, from address.Address, amount fbig.Int, ) (cid.Cid, error)
ClientDeposit calls `deposit()` with a pay value = the deposit amount in attoFIL and returns the deposit cid
func (*Service) ClientInitiateWithdrawal ¶
func (*Service) CreateClientVoucher ¶
func (*Service) CreateProviderVoucher ¶
func (*Service) GetClientState ¶
func (*Service) GetProviderState ¶
func (*Service) GetServiceState ¶
func (*Service) ProposeServiceActor ¶
func (*Service) ServiceCancelWithdrawal ¶
func (*Service) ServiceCompleteWithdrawal ¶
func (*Service) ServiceDeposit ¶
func (*Service) ServiceInitiateWithdrawal ¶
func (*Service) ServiceRedeemClientVoucher ¶
func (s *Service) ServiceRedeemClientVoucher( ctx context.Context, from address.Address, clientID uint64, cumulativeAmount fbig.Int, nonce uint64, sig []byte, opts ...evmMsgOpt, ) (cid.Cid, error)
ServiceRedeemClientVoucher calls `redeemClientVoucher(clientID, cumulativeAmount, nonce, signature)`.
func (*Service) ServiceRedeemProviderVoucher ¶
func (s *Service) ServiceRedeemProviderVoucher( ctx context.Context, from address.Address, providerID uint64, cumulativeAmount fbig.Int, nonce uint64, sig []byte, ) (cid.Cid, error)
ServiceRedeemProviderVoucher calls `redeemProviderVoucher(providerID, cumulativeAmount, nonce, signature)`.
func (*Service) ValidateClientVoucher ¶
func (*Service) ValidateProviderVoucher ¶
func (*Service) VerifyVoucherUpdate ¶
func (s *Service) VerifyVoucherUpdate(best, proposed *ClientVoucher) (*big.Int, error)
type WorkRequest ¶
type WorkResponse ¶
type WorkResponse struct {
Requests []WorkRequest `json:"requests"`
ActiveAsks []WorkAsk `json:"active_asks"`
}
Click to show internal directories.
Click to hide internal directories.