New staking mechanics: delay on entry opposed to exit

This commit is contained in:
Greg Hysen
2019-08-26 11:04:28 -07:00
parent 88e56356c4
commit eb6ad7d29d
39 changed files with 1392 additions and 1509 deletions

View File

@@ -53,39 +53,22 @@ describe('Epochs', () => {
});
describe('Epochs & TimeLocks', () => {
it('basic epochs & timeLock periods', async () => {
///// 0/3 Validate Assumptions /////
///// 1/3 Validate Assumptions /////
expect(await stakingWrapper.getEpochDurationInSecondsAsync()).to.be.bignumber.equal(
stakingConstants.EPOCH_DURATION_IN_SECONDS,
);
expect(await stakingWrapper.getTimeLockDurationInEpochsAsync()).to.be.bignumber.equal(
stakingConstants.TIMELOCK_DURATION_IN_EPOCHS,
);
///// 1/3 Validate Initial Epoch & TimeLock Period /////
///// 2/3 Validate Initial Epoch & TimeLock Period /////
{
// epoch
const currentEpoch = await stakingWrapper.getCurrentEpochAsync();
expect(currentEpoch).to.be.bignumber.equal(stakingConstants.INITIAL_EPOCH);
// timeLock period
const currentTimeLockPeriod = await stakingWrapper.getCurrentTimeLockPeriodAsync();
expect(currentTimeLockPeriod).to.be.bignumber.equal(stakingConstants.INITIAL_TIMELOCK_PERIOD);
}
///// 2/3 Increment Epoch (TimeLock Should Not Increment) /////
///// 3/3 Increment Epoch (TimeLock Should Not Increment) /////
await stakingWrapper.skipToNextEpochAsync();
{
// epoch
const currentEpoch = await stakingWrapper.getCurrentEpochAsync();
expect(currentEpoch).to.be.bignumber.equal(stakingConstants.INITIAL_EPOCH.plus(1));
// timeLock period
const currentTimeLockPeriod = await stakingWrapper.getCurrentTimeLockPeriodAsync();
expect(currentTimeLockPeriod).to.be.bignumber.equal(stakingConstants.INITIAL_TIMELOCK_PERIOD);
}
///// 3/3 Increment Epoch (TimeLock Should Increment) /////
await stakingWrapper.skipToNextTimeLockPeriodAsync();
{
// timeLock period
const currentTimeLockPeriod = await stakingWrapper.getCurrentTimeLockPeriodAsync();
expect(currentTimeLockPeriod).to.be.bignumber.equal(stakingConstants.INITIAL_TIMELOCK_PERIOD.plus(1));
}
});
});