Skip to content

Commit

Permalink
Merge pull request #51 from CirclesUBI/20231214-daily-demurrage-and-t…
Browse files Browse the repository at this point in the history
…esting

(TemporalDiscount): change discount window once per day
  • Loading branch information
benjaminbollen authored Dec 14, 2023
2 parents e5693ab + 858f8f4 commit 0bb97bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 0bb97bf

Please sign in to comment.