This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
/
auctioneer.go
60 lines (55 loc) · 1.78 KB
/
auctioneer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package auctioneer
import (
"time"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/textileio/bidbot/lib/auction"
"github.com/textileio/broker-core/broker"
)
// Auction defines the core auction model.
type Auction struct {
ID auction.ID
BatchID broker.BatchID
PayloadCid cid.Cid
DealSize uint64
DealDuration uint64
DealReplication uint32
DealVerified bool
FilEpochDeadline uint64
ExcludedStorageProviders []string
Providers []string
Sources auction.Sources
ClientAddress string
Status broker.AuctionStatus
Bids map[auction.BidID]Bid
WinningBids map[auction.BidID]WinningBid
StartedAt time.Time
UpdatedAt time.Time
Duration time.Duration
ErrorCause string
}
// Bid defines the core bid model.
type Bid struct {
ID auction.BidID
StorageProviderID string
WalletAddrSig []byte
BidderID peer.ID
AskPrice int64 // attoFIL per GiB per epoch
VerifiedAskPrice int64 // attoFIL per GiB per epoch
StartEpoch uint64
FastRetrieval bool
ReceivedAt time.Time
WonAt time.Time
ProposalCid cid.Cid
ProposalCidDeliveredAt time.Time
ProposalCidDeliveryError string
DealUID string
}
// WinningBid contains details about a winning bid.
type WinningBid struct {
BidderID peer.ID
ProposalCid cid.Cid
DealUID string
WinningReason string
ErrorCause string // an error that may have occurred when delivering the proposal cid
}