add command to view circulating supply

This commit is contained in:
whyrusleeping
2020-08-07 12:57:03 -07:00
parent eaf0861f20
commit fbe206f843
5 changed files with 73 additions and 0 deletions
+9
View File
@@ -1184,3 +1184,12 @@ func (a *StateAPI) StateDealProviderCollateralBounds(ctx context.Context, size a
Max: max,
}, nil
}
func (a *StateAPI) StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) {
ts, err := a.Chain.GetTipSetFromKey(tsk)
if err != nil {
return abi.TokenAmount{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
}
return stmgr.GetCirculatingSupply(ctx, a.StateManager, ts)
}