Move genesis locked funds into filVested
This commit is contained in:
parent
b6b5a79833
commit
5b280057b8
@ -850,6 +850,7 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if act.Code == builtin.AccountActorCodeID {
|
} else if act.Code == builtin.AccountActorCodeID {
|
||||||
|
// should only ever be "faucet" accounts in testnets
|
||||||
kaddr, err := address.NewFromBytes([]byte(k))
|
kaddr, err := address.NewFromBytes([]byte(k))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("decoding address: %w", err)
|
return xerrors.Errorf("decoding address: %w", err)
|
||||||
@ -897,19 +898,22 @@ func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch,
|
|||||||
vf = big.Add(vf, au)
|
vf = big.Add(vf, au)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// these should only ever be "faucet" accounts in testnets
|
||||||
for _, v := range sm.genInfo.genesisActors {
|
for _, v := range sm.genInfo.genesisActors {
|
||||||
act, err := st.GetActor(v.addr)
|
act, err := st.GetActor(v.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), xerrors.Errorf("failed to get actor: %w", err)
|
return big.Zero(), xerrors.Errorf("failed to get actor: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We should probably slowly phase initBal into TotalCircSupply, instead of considering them locked forever
|
|
||||||
diff := big.Sub(v.initBal, act.Balance)
|
diff := big.Sub(v.initBal, act.Balance)
|
||||||
if diff.GreaterThan(big.Zero()) {
|
if diff.GreaterThan(big.Zero()) {
|
||||||
vf = big.Add(vf, diff)
|
vf = big.Add(vf, diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vf = big.Add(vf, sm.genInfo.genesisPledge)
|
||||||
|
vf = big.Add(vf, sm.genInfo.genesisMarketFunds)
|
||||||
|
|
||||||
return vf, nil
|
return vf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,23 +966,12 @@ func (sm *StateManager) GetFilLocked(ctx context.Context, st *state.StateTree) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), xerrors.Errorf("failed to get filMarketLocked: %w", err)
|
return big.Zero(), xerrors.Errorf("failed to get filMarketLocked: %w", err)
|
||||||
}
|
}
|
||||||
// TODO: We should probably slowly phase genesisMarketFunds into TotalCircSupply, instead of considering them locked forever
|
|
||||||
filMarketLocked = types.BigSub(filMarketLocked, sm.genInfo.genesisMarketFunds)
|
|
||||||
if filMarketLocked.LessThan(big.Zero()) {
|
|
||||||
filMarketLocked = big.Zero()
|
|
||||||
}
|
|
||||||
|
|
||||||
filPowerLocked, err := getFilPowerLocked(ctx, st)
|
filPowerLocked, err := getFilPowerLocked(ctx, st)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), xerrors.Errorf("failed to get filPowerLocked: %w", err)
|
return big.Zero(), xerrors.Errorf("failed to get filPowerLocked: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We should probably slowly phase genesisPledge into TotalCircSupply, instead of considering them locked forever
|
|
||||||
filPowerLocked = types.BigSub(filPowerLocked, sm.genInfo.genesisPledge)
|
|
||||||
if filPowerLocked.LessThan(big.Zero()) {
|
|
||||||
filPowerLocked = big.Zero()
|
|
||||||
}
|
|
||||||
|
|
||||||
return types.BigAdd(filMarketLocked, filPowerLocked), nil
|
return types.BigAdd(filMarketLocked, filPowerLocked), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user