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
2 changes: 2 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ var SPTierDTL = map[uint8]*big.Int{
var SP_PLUS_TIERS = uint8(4)

var LP_PLUS_ISSUANCE_SECONDS = SecondsInMinute * MinutesInHour * HoursInDay * 14 // 14 days
var LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH = SecondsInMinute * MinutesInHour // 1 hour
var LP_PLUS_MAINNET_WINDOW_START_TS int = 1765900800 // Tue Dec 16 2025 08:00:00 GMT-0800 (PST)
11 changes: 11 additions & 0 deletions deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/glifio/go-pools/constants"
"github.com/glifio/go-pools/types"
)

Expand Down Expand Up @@ -102,3 +103,13 @@ var (
// no events will occur on these contracts before this epoch
ProtocolV2UpgradeEpoch = big.NewInt(0)
)

// GetLPPlusIssuanceSeconds returns the issuance window in seconds based on the given timestamp.
// Returns LP_PLUS_ISSUANCE_SECONDS if timestamp is after LP_PLUS_MAINNET_WINDOW_START_TS,
// otherwise returns LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH.
func GetLPPlusIssuanceSeconds(timestamp int) int {
if timestamp >= constants.LP_PLUS_MAINNET_WINDOW_START_TS {
return constants.LP_PLUS_ISSUANCE_SECONDS
}
return constants.LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH
}
45 changes: 45 additions & 0 deletions deploy/deploy_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package deploy

import (
"testing"

"github.com/glifio/go-pools/constants"
)

func TestGetLPPlusIssuanceSeconds(t *testing.T) {
testCases := []struct {
name string
timestamp int
want int
}{
{
name: "before launch",
timestamp: constants.LP_PLUS_MAINNET_WINDOW_START_TS - 1,
want: constants.LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH,
},
{
name: "after launch",
timestamp: constants.LP_PLUS_MAINNET_WINDOW_START_TS + 1,
want: constants.LP_PLUS_ISSUANCE_SECONDS,
},
{
name: "hardcoded launch timestamp before",
timestamp: 1765823486,
want: constants.LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH,
},
{
name: "hardcoded launch timestamp after",
timestamp: 1765987200,
want: constants.LP_PLUS_ISSUANCE_SECONDS,
},
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
got := GetLPPlusIssuanceSeconds(tc.timestamp)
if got != tc.want {
t.Errorf("GetLPPlusIssuanceSeconds(%d) = %d; want %d", tc.timestamp, got, tc.want)
}
})
}
}