lotus/markets/utils/converters.go

35 lines
972 B
Go
Raw Normal View History

package utils
import (
2020-02-20 08:37:10 +00:00
"github.com/filecoin-project/lotus/api"
2020-02-08 02:18:32 +00:00
"github.com/filecoin-project/specs-actors/actors/abi"
2020-02-20 08:37:10 +00:00
"github.com/filecoin-project/specs-actors/actors/builtin/market"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/storagemarket"
)
2020-02-08 02:18:32 +00:00
func NewStorageProviderInfo(address address.Address, miner address.Address, sectorSize abi.SectorSize, peer peer.ID) storagemarket.StorageProviderInfo {
return storagemarket.StorageProviderInfo{
Address: address,
Worker: miner,
2020-02-08 02:18:32 +00:00
SectorSize: uint64(sectorSize),
PeerID: peer,
}
}
2020-02-20 08:37:10 +00:00
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: bal.Escrow,
}
}