Skip to content

Commit

Permalink
fix: missing initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Dec 20, 2024
1 parent e211945 commit af4492a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
23 changes: 5 additions & 18 deletions _deploy/r/gnoswap/gns/_helper_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,9 @@ func resetGnsTokenObject(t *testing.T) {
func resetHalvingRelatedObject(t *testing.T) {
t.Helper()

for year := int64(1); year < 13; year++ {
setHalvingYearMaxAmount(year, HALVING_AMOUNTS_PER_YEAR[year-1])

if year == 1 {
setHalvingYearAccuAmount(year, HALVING_AMOUNTS_PER_YEAR[year-1])
} else {
setHalvingYearAccuAmount(year, GetHalvingYearAccuAmount(year-1)+HALVING_AMOUNTS_PER_YEAR[year-1])
}

setHalvingYearStartBlock(year, startHeight+blockPerYear*year)
setHalvingYearTimestamp(year, startTimestamp+(consts.TIMESTAMP_YEAR*year))
setHalvingYearMintAmount(year, uint64(0))

amountPerYear := GetHalvingYearMaxAmount(year) // amount per year
amountPerDay := amountPerYear / consts.DAY_PER_YEAR // amount per day
amountPerBlock := amountPerDay / uint64(blockPerDay) // amount per block
setAmountPerBlockPerHalvingYear(year, uint64(amountPerBlock))
}
startHeight = std.GetHeight()
startTimestamp = time.Now().Unix()

initializeHalvingData()
setEndTimestamp(startTimestamp + consts.TIMESTAMP_YEAR*HALVING_END_YEAR)
}
2 changes: 2 additions & 0 deletions _deploy/r/gnoswap/gns/halving.gno
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func initializeHalvingData() {
amountPerDay := currentYearMaxAmount / consts.DAY_PER_YEAR
amountPerBlock := amountPerDay / uint64(blockPerDay)
setAmountPerBlockPerHalvingYear(year, uint64(amountPerBlock))

setHalvingYearMintAmount(year, uint64(0))
}
}

Expand Down

0 comments on commit af4492a

Please sign in to comment.