more info in audit outputs
This commit is contained in:
parent
8f4911ac0d
commit
cd9af278b4
@ -18,7 +18,7 @@ func (f FIL) String() string {
|
||||
func (f FIL) Unitless() string {
|
||||
r := new(big.Rat).SetFrac(f.Int, big.NewInt(int64(build.FilecoinPrecision)))
|
||||
if r.Sign() == 0 {
|
||||
return "0 FIL"
|
||||
return "0"
|
||||
}
|
||||
return strings.TrimRight(strings.TrimRight(r.FloatString(18), "0"), ".")
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/docker/go-units"
|
||||
lotusbuiltin "github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
||||
|
||||
@ -33,16 +34,19 @@ import (
|
||||
)
|
||||
|
||||
type accountInfo struct {
|
||||
Address address.Address
|
||||
Balance types.FIL
|
||||
Type string
|
||||
Power abi.StoragePower
|
||||
Worker address.Address
|
||||
Owner address.Address
|
||||
InitialPledge types.FIL
|
||||
PreCommits types.FIL
|
||||
LockedFunds types.FIL
|
||||
Sectors uint64
|
||||
Address address.Address
|
||||
Balance types.FIL
|
||||
Type string
|
||||
Power abi.StoragePower
|
||||
Worker address.Address
|
||||
Owner address.Address
|
||||
InitialPledge types.FIL
|
||||
PreCommits types.FIL
|
||||
LockedFunds types.FIL
|
||||
Sectors uint64
|
||||
VestingStart abi.ChainEpoch
|
||||
VestingDuration abi.ChainEpoch
|
||||
VestingAmount types.FIL
|
||||
}
|
||||
|
||||
var auditsCmd = &cli.Command{
|
||||
@ -115,10 +119,8 @@ var chainBalanceCmd = &cli.Command{
|
||||
infos = append(infos, ai)
|
||||
}
|
||||
|
||||
fmt.Printf("Address,Balance,Type,Power,Worker,Owner\n")
|
||||
for _, acc := range infos {
|
||||
fmt.Printf("%s,%s,%s,%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type, acc.Power, acc.Worker, acc.Owner)
|
||||
}
|
||||
printAccountInfos(infos, false)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@ -196,6 +198,7 @@ var chainBalanceStateCmd = &cli.Command{
|
||||
LockedFunds: types.FIL(big.NewInt(0)),
|
||||
InitialPledge: types.FIL(big.NewInt(0)),
|
||||
PreCommits: types.FIL(big.NewInt(0)),
|
||||
VestingAmount: types.FIL(big.NewInt(0)),
|
||||
}
|
||||
|
||||
if minerInfo && act.IsStorageMinerActor() {
|
||||
@ -234,6 +237,32 @@ var chainBalanceStateCmd = &cli.Command{
|
||||
ai.Worker = minfo.Worker
|
||||
ai.Owner = minfo.Owner
|
||||
}
|
||||
|
||||
if act.IsMultisigActor() {
|
||||
mst, err := multisig.Load(store, act)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ai.VestingStart, err = mst.StartEpoch()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ib, err := mst.InitialBalance()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ai.VestingAmount = types.FIL(ib)
|
||||
|
||||
ai.VestingDuration, err = mst.UnlockDuration()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
infos = append(infos, ai)
|
||||
return nil
|
||||
})
|
||||
@ -241,22 +270,27 @@ var chainBalanceStateCmd = &cli.Command{
|
||||
return xerrors.Errorf("failed to loop over actors: %w", err)
|
||||
}
|
||||
|
||||
if minerInfo {
|
||||
fmt.Printf("Address,Balance,Type,Sectors,Worker,Owner,InitialPledge,Locked,PreCommits\n")
|
||||
for _, acc := range infos {
|
||||
fmt.Printf("%s,%s,%s,%d,%s,%s,%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type, acc.Sectors, acc.Worker, acc.Owner, acc.InitialPledge, acc.LockedFunds, acc.PreCommits)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Address,Balance,Type\n")
|
||||
for _, acc := range infos {
|
||||
fmt.Printf("%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type)
|
||||
}
|
||||
}
|
||||
printAccountInfos(infos, minerInfo)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func printAccountInfos(infos []accountInfo, minerInfo bool) {
|
||||
if minerInfo {
|
||||
fmt.Printf("Address,Balance,Type,Sectors,Worker,Owner,InitialPledge,Locked,PreCommits,VestingStart,VestingDuration,VestingAmount\n")
|
||||
for _, acc := range infos {
|
||||
fmt.Printf("%s,%s,%s,%d,%s,%s,%s,%s,%s,%d,%d,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type, acc.Sectors, acc.Worker, acc.Owner, acc.InitialPledge.Unitless(), acc.LockedFunds.Unitless(), acc.PreCommits.Unitless(), acc.VestingStart, acc.VestingDuration, acc.VestingAmount.Unitless())
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Address,Balance,Type\n")
|
||||
for _, acc := range infos {
|
||||
fmt.Printf("%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var chainPledgeCmd = &cli.Command{
|
||||
Name: "stateroot-pledge",
|
||||
Description: "Calculate sector pledge numbers",
|
||||
|
Loading…
Reference in New Issue
Block a user