deals: Nicer output in client cli
This commit is contained in:
parent
738e8c5a3c
commit
bee0ecf97f
@ -77,13 +77,7 @@ type StorageDealProposal struct {
|
|||||||
Provider address.Address
|
Provider address.Address
|
||||||
|
|
||||||
ProposalExpiration uint64
|
ProposalExpiration uint64
|
||||||
Duration uint64 // TODO: spec proposes 'DealExpiration', but that's awkward as it
|
Duration uint64 // TODO: spec
|
||||||
// doesn't tell when the deal actually starts, so the price per block is impossible to
|
|
||||||
// calculate. It also doesn't incentivize the miner to seal / activate sooner, as he
|
|
||||||
// still get's paid the full amount specified in the deal
|
|
||||||
//
|
|
||||||
// Changing to duration makes sure that the price-per-block is defined, and the miner
|
|
||||||
// doesn't get paid when not storing the sector
|
|
||||||
|
|
||||||
StoragePricePerEpoch types.BigInt
|
StoragePricePerEpoch types.BigInt
|
||||||
StorageCollateral types.BigInt
|
StorageCollateral types.BigInt
|
||||||
|
@ -101,8 +101,7 @@ var clientDealCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: parse bigint
|
price, err := types.ParseFIL(cctx.Args().Get(2))
|
||||||
price, err := strconv.ParseInt(cctx.Args().Get(2), 10, 32)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -112,7 +111,7 @@ var clientDealCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
proposal, err := api.ClientStartDeal(ctx, data, miner, types.NewInt(uint64(price)), uint64(dur))
|
proposal, err := api.ClientStartDeal(ctx, data, miner, types.BigInt(price), uint64(dur))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -164,7 +163,7 @@ var clientFindCmd = &cli.Command{
|
|||||||
fmt.Printf("ERR %s@%s: %s\n", offer.Miner, offer.MinerPeerID, offer.Err)
|
fmt.Printf("ERR %s@%s: %s\n", offer.Miner, offer.MinerPeerID, offer.Err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Printf("RETRIEVAL %s@%s-%sfil-%db\n", offer.Miner, offer.MinerPeerID, offer.MinPrice, offer.Size)
|
fmt.Printf("RETRIEVAL %s@%s-%sfil-%db\n", offer.Miner, offer.MinerPeerID, types.FIL(offer.MinPrice), offer.Size)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -308,20 +307,20 @@ var clientQueryAskCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Ask: %s\n", maddr)
|
fmt.Printf("Ask: %s\n", maddr)
|
||||||
fmt.Printf("Price per Byte: %s\n", ask.Ask.Price)
|
fmt.Printf("Price per Byte: %s\n", types.FIL(ask.Ask.Price))
|
||||||
|
|
||||||
size := cctx.Int64("size")
|
size := cctx.Int64("size")
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
perEpoch := types.BigDiv(types.BigMul(ask.Ask.Price, types.NewInt(uint64(size))), types.NewInt(1<<30))
|
perEpoch := types.BigDiv(types.BigMul(ask.Ask.Price, types.NewInt(uint64(size))), types.NewInt(1<<30))
|
||||||
fmt.Printf("Price per Block: %s\n", perEpoch)
|
fmt.Printf("Price per Block: %s\n", types.FIL(perEpoch))
|
||||||
|
|
||||||
duration := cctx.Int64("duration")
|
duration := cctx.Int64("duration")
|
||||||
if duration == 0 {
|
if duration == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fmt.Printf("Total Price: %s\n", types.BigMul(perEpoch, types.NewInt(uint64(duration))))
|
fmt.Printf("Total Price: %s\n", types.FIL(types.BigMul(perEpoch, types.NewInt(uint64(duration)))))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user