lotus/chain/deals/types.go

100 lines
1.8 KiB
Go
Raw Normal View History

2019-08-02 14:09:54 +00:00
package deals
import (
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/go-lotus/chain/actors"
"github.com/filecoin-project/go-lotus/chain/address"
"github.com/filecoin-project/go-lotus/chain/types"
)
func init() {
cbor.RegisterCborType(PaymentInfo{})
cbor.RegisterCborType(StorageDealProposal{})
cbor.RegisterCborType(SignedStorageDealProposal{})
cbor.RegisterCborType(PieceInclusionProof{})
cbor.RegisterCborType(StorageDealResponse{})
cbor.RegisterCborType(SignedStorageDealResponse{})
}
type SerializationMode string
const (
SerializationUnixFs = "UnixFs"
SerializationRaw = "Raw"
SerializationIPLD = "IPLD"
)
type DealState int
const (
Unknown = iota
Rejected
Accepted
Started
Failed
Staged
Sealing
Complete
)
// TODO: this should probably be in a separate package with other paych utils
type PaymentInfo struct {
PayChActor address.Address
Payer address.Address
ChannelMessage cid.Cid
Vouchers []actors.SignedVoucher
}
type StorageDealProposal struct {
2019-08-06 11:30:14 +00:00
PieceRef string
2019-08-02 14:09:54 +00:00
SerializationMode SerializationMode
CommP []byte
2019-08-06 11:30:14 +00:00
Size uint64
2019-08-02 14:09:54 +00:00
TotalPrice types.BigInt
Duration uint64
Payment PaymentInfo
MinerAddress address.Address
ClientAddress address.Address
}
type SignedStorageDealProposal struct {
Proposal StorageDealProposal
2019-08-02 16:25:10 +00:00
Signature *types.Signature
2019-08-02 14:09:54 +00:00
}
// response
2019-08-06 11:30:14 +00:00
2019-08-02 14:09:54 +00:00
type PieceInclusionProof struct {
2019-08-06 11:30:14 +00:00
Position uint64
2019-08-02 14:09:54 +00:00
ProofElements [32]byte
}
type StorageDealResponse struct {
State DealState
// Rejected / Accepted / Failed / Staged
Message string
Proposal cid.Cid
// Sealing
PieceInclusionProof PieceInclusionProof
// Complete
2019-08-06 23:08:34 +00:00
SectorCommitMessage *cid.Cid
2019-08-02 14:09:54 +00:00
}
type SignedStorageDealResponse struct {
Response StorageDealResponse
2019-08-02 16:25:10 +00:00
Signature *types.Signature
2019-08-02 14:09:54 +00:00
}