From 041b2d7ee98ea7aad296af2dc1037956acaa8572 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Thu, 14 Dec 2023 18:53:37 +0000 Subject: [PATCH 1/2] (TemporalDiscount): change discount window from once per week to once per day --- src/circles/TemporalDiscount.sol | 16 ++++++++-------- test/graph/GraphPathTransfer.t.sol | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/circles/TemporalDiscount.sol b/src/circles/TemporalDiscount.sol index a35417b..54867e9 100644 --- a/src/circles/TemporalDiscount.sol +++ b/src/circles/TemporalDiscount.sol @@ -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 @@ -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 diff --git a/test/graph/GraphPathTransfer.t.sol b/test/graph/GraphPathTransfer.t.sol index 6182887..edcaaae 100644 --- a/test/graph/GraphPathTransfer.t.sol +++ b/test/graph/GraphPathTransfer.t.sol @@ -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 From 858f8f43080a295a5041da42dab0671432af7a6c Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Thu, 14 Dec 2023 19:06:21 +0000 Subject: [PATCH 2/2] (temporal discount): update comment after review --- src/circles/TemporalDiscount.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/circles/TemporalDiscount.sol b/src/circles/TemporalDiscount.sol index 54867e9..14ead13 100644 --- a/src/circles/TemporalDiscount.sol +++ b/src/circles/TemporalDiscount.sol @@ -52,7 +52,7 @@ contract TemporalDiscount is IERC20 { * = 18446744031260000000 * If however, we express per unit of 1 day, 7% p.a.: * => gamma = (0.93)^(1/365) - * = 0.999801195948159168.. + * = 0.999801195948159168... * => gamma_64x64 = 18443076800000000000 */ int128 public constant GAMMA_64x64 = int128(18443076800000000000);