Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(TemporalDiscount): change discount window once per day #51

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/circles/TemporalDiscount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ contract TemporalDiscount is IERC20 {
/**
* Discount window reduces the resolution for calculating
* the discount of balances from once per second (block.timestamp)
* to once per week.
* 1 week = 7 * 24 * 3600 seconds = 604800 seconds = 1 weeks
* to once per day.
* 1 day = 24 * 3600 seconds = 86400 seconds = 1 days
*/
uint256 public constant DISCOUNT_WINDOW = 1 weeks;
uint256 public constant DISCOUNT_WINDOW = 1 days;

/**
* Arbitrary origin for counting time since 10 December 2021
Expand Down Expand Up @@ -50,12 +50,12 @@ contract TemporalDiscount is IERC20 {
* = 0.99999999769879842873...
* => gamma_64x64 = gamma * 2**64
* = 18446744031260000000
* If however, we express per unit of 1 week, 7% p.a.:
* => gamma = (0.93)^(1/52)
* = 0.998605383136377398...
* => gamma_64x64 = 18421018000000000000
* If however, we express per unit of 1 day, 7% p.a.:
* => gamma = (0.93)^(1/365)
* = 0.999801195948159168...
* => gamma_64x64 = 18443076800000000000
*/
int128 public constant GAMMA_64x64 = int128(18421018000000000000);
int128 public constant GAMMA_64x64 = int128(18443076800000000000);

// State variables

Expand Down
2 changes: 1 addition & 1 deletion test/graph/GraphPathTransfer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract GraphPathTransferTest is Test, TimeSetup {
for (uint256 i = 0; i < N; i++) {
// vm.prank(addresses[i]);
circleNodes[i].claimIssuance();
assertEq(circleNodes[i].balanceOf(addresses[i]), 48 * TIC);
assertEq(circleNodes[i].balanceOf(addresses[i]), 47985693847056789184);
}

// to build a correct flow matrix, we need to present the vertices
Expand Down