Skip to content

Commit 28784f9

Browse files
(test/demurrage): quick test on stable point of issuance
1 parent f6f81b9 commit 28784f9

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

test/circles/Demurrage.t.sol

+25
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,29 @@ contract DemurrageTest is Test, TimeCirclesSetup, Approximation {
5555
);
5656
}
5757
}
58+
59+
// Test on stable point of issuance
60+
61+
function testStablePointIssuance() public view {
62+
// Stable point of issuance 120804.56 Circles
63+
uint192 stable = uint192(120804563587458981173795 + 2343);
64+
console.log("stable: ", stable);
65+
66+
// overshoot stable amount 120804563587458981178828 attoCRC
67+
// undershoot stable amount 120804563587458981173795 attoCRC
68+
// difference 0.000000000000005033 CRC
69+
70+
uint192 dailyIssuance = uint192(24 * CRC);
71+
72+
uint192 balance = stable;
73+
74+
for (uint256 i = 0; i < 20; i++) {
75+
uint192 demurragedBalance = uint192(demurrage.calculateDiscountedBalance(balance, 1));
76+
uint192 newBalance = demurragedBalance + dailyIssuance;
77+
console.log("balance: ", newBalance);
78+
balance = newBalance;
79+
}
80+
81+
console.log("stable: ", stable);
82+
}
5883
}

test/circles/MockDemurrage.sol

+4
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ contract MockDemurrage is Demurrage {
2121
function rLength() external pure returns (uint256) {
2222
return R_TABLE_LOOKUP;
2323
}
24+
25+
function calculateDiscountedBalance(uint256 _balance, uint256 _daysDifference) external view returns (uint256) {
26+
return _calculateDiscountedBalance(_balance, _daysDifference);
27+
}
2428
}

0 commit comments

Comments
 (0)