Skip to content

Commit

Permalink
Fix calico vesting (#942)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell authored Jan 22, 2021
1 parent 60e5969 commit 4825a6a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions blockchain/state_manager/src/vm_circ_supply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use clock::ChainEpoch;
use fil_types::{FILECOIN_PRECISION, FIL_RESERVED};
use interpreter::CircSupplyCalc;
use lazycell::AtomicLazyCell;
use networks::{UPGRADE_ACTORS_V2_HEIGHT, UPGRADE_IGNITION_HEIGHT, UPGRADE_LIFTOFF_HEIGHT};
use networks::{
UPGRADE_ACTORS_V2_HEIGHT, UPGRADE_CALICO_HEIGHT, UPGRADE_IGNITION_HEIGHT,
UPGRADE_LIFTOFF_HEIGHT,
};
use num_bigint::BigInt;
use state_tree::StateTree;
use std::error::Error as StdError;
Expand Down Expand Up @@ -132,16 +135,26 @@ pub fn get_fil_vested(
.ignition
.borrow()
.expect("Post ignition should be initialized");
let calico_vesting = genesis_info
.vesting
.calico
.borrow()
.expect("calico vesting should be initialized");

if height <= UPGRADE_IGNITION_HEIGHT {
for actor in pre_ignition {
return_value += &actor.initial_balance - actor.amount_locked(height);
}
} else {
} else if height <= UPGRADE_CALICO_HEIGHT {
for actor in post_ignition {
return_value +=
&actor.initial_balance - actor.amount_locked(height - actor.start_epoch);
}
} else {
for actor in calico_vesting {
return_value +=
&actor.initial_balance - actor.amount_locked(height - actor.start_epoch);
}
}

if height <= UPGRADE_ACTORS_V2_HEIGHT {
Expand Down

0 comments on commit 4825a6a

Please sign in to comment.