4e32c7edb3
Update to markets 0.3.1 with multiaddr support for miners
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package utils
|
|
|
|
import (
|
|
"github.com/filecoin-project/lotus/api"
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
|
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
|
peer "github.com/libp2p/go-libp2p-core/peer"
|
|
"github.com/multiformats/go-multiaddr"
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
|
)
|
|
|
|
func NewStorageProviderInfo(address address.Address, miner address.Address, sectorSize abi.SectorSize, peer peer.ID, addrs []multiaddr.Multiaddr) storagemarket.StorageProviderInfo {
|
|
|
|
return storagemarket.StorageProviderInfo{
|
|
Address: address,
|
|
Worker: miner,
|
|
SectorSize: uint64(sectorSize),
|
|
PeerID: peer,
|
|
Addrs: addrs,
|
|
}
|
|
}
|
|
|
|
func FromOnChainDeal(prop market.DealProposal, state market.DealState) storagemarket.StorageDeal {
|
|
return storagemarket.StorageDeal{
|
|
DealProposal: prop,
|
|
DealState: state,
|
|
}
|
|
}
|
|
|
|
func ToSharedBalance(bal api.MarketBalance) storagemarket.Balance {
|
|
return storagemarket.Balance{
|
|
Locked: bal.Locked,
|
|
Available: big.Sub(bal.Escrow, bal.Locked),
|
|
}
|
|
}
|