Skip to content
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
12 changes: 6 additions & 6 deletions internal/circulating_supply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ func TestCirculatingSupply(t *testing.T) {
{oneYearAfterTGEMinusOneDay, 220_824_349_667_524},
{oneYearAfterTGE, 398_395_290_749_715},
{oneYearAfterTGEPlusOneDay, 399_602_581_376_425},
{twoYearsAfterTGE, 833432444153745},
{threeYearsAfterTGE, 987593533203745},
{fourYearsAfterTGE, 1079986906381924},
{twoYearsAfterTGE, 832939859033664},
{threeYearsAfterTGE, 987338016490616},
{fourYearsAfterTGE, 1079918280757792},
}
for _, tc := range testCases {
t.Run(tc.time.String(), func(t *testing.T) {
Expand Down Expand Up @@ -82,7 +82,7 @@ func Test_coreContributorsCirculating(t *testing.T) {
{oneDayAfterTGE, 0},
{oneYearAfterTGEMinusOneDay, 0}, // one day before tokens unlock.
{oneYearAfterTGE, coreContributors / 3}, // tokens unlock on October 30th, 2024.
{twoYearsAfterTGE, 117_738_314_725_882},
{twoYearsAfterTGE, 117_577_249_999_855},
{threeYearsAfterTGE, coreContributors},
{fourYearsAfterTGE, coreContributors},
}
Expand All @@ -104,8 +104,8 @@ func Test_ecosystemCirculating(t *testing.T) {
{TGE, .25 * ecosystem},
{oneDayAfterTGE, .25 * ecosystem},
{oneYearAfterTGE, .25 * ecosystem},
{twoYearsAfterTGE, 134_155_879_274_657},
{threeYearsAfterTGE, 201_142_057_024_657},
{twoYearsAfterTGE, 133_972_355_500_000},
{threeYearsAfterTGE, 200_958_533_250_000},
{fourYearsAfterTGE, ecosystem},
}
for _, tc := range testCases {
Expand Down
13 changes: 8 additions & 5 deletions internal/dates.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ var (
// See https://www.mintscan.io/celestia/block/8662012
cip41ActivationDate = time.Date(2025, time.November, 24, 0, 0, 0, 0, time.UTC)

// TODO: verify these dates. The unlock dates may not be exactly N years
// after TGE. Instead, they may be N * 365 days after.
twoYearsAfterTGE = TGE.AddDate(2, 0, 0)
threeYearsAfterTGE = TGE.AddDate(3, 0, 0)
fourYearsAfterTGE = TGE.AddDate(4, 0, 0)
// Unlock dates are N * 365 days after TGE (not N calendar years) because
// vesting accounts do not account for leap years. The vesting accounts in
// the mainnet genesis file have end times on October 30th: one year after
// TGE for delayed vesting accounts, two or three years after TGE for
// continuous vesting accounts.
twoYearsAfterTGE = TGE.AddDate(0, 0, 2*365) // October 30, 2025
threeYearsAfterTGE = TGE.AddDate(0, 0, 3*365) // October 30, 2026
fourYearsAfterTGE = TGE.AddDate(0, 0, 4*365) // October 30, 2027
)
32 changes: 32 additions & 0 deletions internal/dates_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package internal

import (
"testing"
"time"

"github.com/stretchr/testify/require"
)

// TestUnlockDates verifies that unlock dates are computed as N * 365 days
// after TGE, ignoring leap years. Vesting accounts in the mainnet genesis file
// have end times of October 30th (not October 31st) because they do not
// account for the leap day on February 29th, 2024.
// See https://github.com/celestiaorg/supply/issues/35
func TestUnlockDates(t *testing.T) {
type testCase struct {
name string
got time.Time
want time.Time
}
testCases := []testCase{
{"oneYearAfterTGE", oneYearAfterTGE, time.Date(2024, time.October, 30, 0, 0, 0, 0, time.UTC)},
{"twoYearsAfterTGE", twoYearsAfterTGE, time.Date(2025, time.October, 30, 0, 0, 0, 0, time.UTC)},
{"threeYearsAfterTGE", threeYearsAfterTGE, time.Date(2026, time.October, 30, 0, 0, 0, 0, time.UTC)},
{"fourYearsAfterTGE", fourYearsAfterTGE, time.Date(2027, time.October, 30, 0, 0, 0, 0, time.UTC)},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
require.Equal(t, tc.want, tc.got)
})
}
}
6 changes: 3 additions & 3 deletions internal/total_supply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func TestTotalSupply(t *testing.T) {
{TGE, initialTotalSupplyInUtia},
{oneDayAfterTGE, 1000219178082191},
{oneYearAfterTGE, 1079999999999715},
{twoYearsAfterTGE, 1151791486153206},
{threeYearsAfterTGE, 1180338837179088},
{fourYearsAfterTGE, 1205929556381924},
{twoYearsAfterTGE, 1151643489533809},
{threeYearsAfterTGE, 1180266844240616},
{fourYearsAfterTGE, 1205860930757792},
}
for _, tc := range testCases {
got := TotalSupply(tc.time)
Expand Down
Loading