git.delta.rocks / unique-network / refs/commits / d6ab0fe6df09

difftreelog

Add comments to explain numbers

Max Andreev2022-11-22parent: #890f894.patch.diff
in: master

1 file changed

modifiedtests/src/app-promotion.test.tsdiffbeforeafterboth
24let nominal: bigint;24let nominal: bigint;
25let palletAddress: string;25let palletAddress: string;
26let accounts: IKeyringPair[];26let accounts: IKeyringPair[];
27const LOCKING_PERIOD = 8n; // 20 blocks of relay27const LOCKING_PERIOD = 8n; // 8 blocks of relay
28const UNLOCKING_PERIOD = 4n; // 10 blocks of parachain28const UNLOCKING_PERIOD = 4n; // 4 blocks of parachain
2929
30describe('App promotion', () => {30describe('App promotion', () => {
31 before(async function () {31 before(async function () {
652function calculateIncome(base: bigint, iter = 0, calcPeriod: bigint = UNLOCKING_PERIOD): bigint {652function calculateIncome(base: bigint, iter = 0, calcPeriod: bigint = UNLOCKING_PERIOD): bigint {
653 const DAY = 7200n;653 const DAY = 7200n;
654 const ACCURACY = 1_000_000_000n;654 const ACCURACY = 1_000_000_000n;
655 // 5n / 10_000n = 0.05% p/day
655 const income = base + base * (ACCURACY * (calcPeriod * 5n) / (10_000n * DAY)) / ACCURACY ;656 const income = base + base * (ACCURACY * (calcPeriod * 5n) / (10_000n * DAY)) / ACCURACY ;
656 657
657 if (iter > 1) {658 if (iter > 1) {