2019-08-02 14:09:54 +00:00
|
|
|
package deals
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
cbor "github.com/ipfs/go-ipld-cbor"
|
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
"github.com/filecoin-project/lotus/api"
|
2019-10-18 04:47:41 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/actors"
|
|
|
|
"github.com/filecoin-project/lotus/chain/address"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2019-08-02 14:09:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
cbor.RegisterCborType(StorageDealResponse{})
|
|
|
|
cbor.RegisterCborType(SignedStorageDealResponse{})
|
2019-09-13 21:00:36 +00:00
|
|
|
|
|
|
|
cbor.RegisterCborType(AskRequest{})
|
|
|
|
cbor.RegisterCborType(AskResponse{})
|
2019-08-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
const DealProtocolID = "/fil/storage/mk/1.0.0"
|
2019-09-13 21:00:36 +00:00
|
|
|
const AskProtocolID = "/fil/storage/ask/1.0.0"
|
2019-09-10 12:35:43 +00:00
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
type Proposal struct {
|
|
|
|
DealProposal actors.StorageDealProposal
|
2019-08-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StorageDealResponse struct {
|
2019-09-10 14:13:24 +00:00
|
|
|
State api.DealState
|
2019-08-02 14:09:54 +00:00
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
// DealProposalRejected
|
2019-08-02 14:09:54 +00:00
|
|
|
Message string
|
|
|
|
Proposal cid.Cid
|
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
// DealAccepted
|
2019-10-22 10:09:36 +00:00
|
|
|
StorageDeal actors.StorageDeal
|
2019-10-21 18:12:11 +00:00
|
|
|
PublishMessage cid.Cid
|
2019-08-02 14:09:54 +00:00
|
|
|
|
2019-09-10 14:13:24 +00:00
|
|
|
// DealComplete
|
2019-10-21 18:12:11 +00:00
|
|
|
CommitMessage cid.Cid
|
2019-08-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
2019-10-21 18:12:11 +00:00
|
|
|
// TODO: Do we actually need this to be signed?
|
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
|
|
|
}
|
2019-09-13 21:00:36 +00:00
|
|
|
|
|
|
|
type AskRequest struct {
|
|
|
|
Miner address.Address
|
|
|
|
}
|
|
|
|
|
|
|
|
type AskResponse struct {
|
|
|
|
Ask *types.SignedStorageAsk
|
|
|
|
}
|