difftreelog
Add comments to explain numbers
in: master
1 file changed
tests/src/app-promotion.test.tsdiffbeforeafterboth24let 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 relay28const UNLOCKING_PERIOD = 4n; // 10 blocks of parachain28const UNLOCKING_PERIOD = 4n; // 4 blocks of parachain292930describe('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/day655 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) {