Skip to content

Commit 81bf48c

Browse files
authored
Add lp plus issuance deployment helper (#141)
1 parent a604c20 commit 81bf48c

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

constants/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,5 @@ var SPTierDTL = map[uint8]*big.Int{
9292
var SP_PLUS_TIERS = uint8(4)
9393

9494
var LP_PLUS_ISSUANCE_SECONDS = SecondsInMinute * MinutesInHour * HoursInDay * 14 // 14 days
95+
var LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH = SecondsInMinute * MinutesInHour // 1 hour
96+
var LP_PLUS_MAINNET_WINDOW_START_TS int = 1765900800 // Tue Dec 16 2025 08:00:00 GMT-0800 (PST)

deploy/deploy.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"math/big"
55

66
"github.com/ethereum/go-ethereum/common"
7+
"github.com/glifio/go-pools/constants"
78
"github.com/glifio/go-pools/types"
89
)
910

@@ -102,3 +103,13 @@ var (
102103
// no events will occur on these contracts before this epoch
103104
ProtocolV2UpgradeEpoch = big.NewInt(0)
104105
)
106+
107+
// GetLPPlusIssuanceSeconds returns the issuance window in seconds based on the given timestamp.
108+
// Returns LP_PLUS_ISSUANCE_SECONDS if timestamp is after LP_PLUS_MAINNET_WINDOW_START_TS,
109+
// otherwise returns LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH.
110+
func GetLPPlusIssuanceSeconds(timestamp int) int {
111+
if timestamp >= constants.LP_PLUS_MAINNET_WINDOW_START_TS {
112+
return constants.LP_PLUS_ISSUANCE_SECONDS
113+
}
114+
return constants.LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH
115+
}

deploy/deploy_test.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package deploy
2+
3+
import (
4+
"testing"
5+
6+
"github.com/glifio/go-pools/constants"
7+
)
8+
9+
func TestGetLPPlusIssuanceSeconds(t *testing.T) {
10+
testCases := []struct {
11+
name string
12+
timestamp int
13+
want int
14+
}{
15+
{
16+
name: "before launch",
17+
timestamp: constants.LP_PLUS_MAINNET_WINDOW_START_TS - 1,
18+
want: constants.LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH,
19+
},
20+
{
21+
name: "after launch",
22+
timestamp: constants.LP_PLUS_MAINNET_WINDOW_START_TS + 1,
23+
want: constants.LP_PLUS_ISSUANCE_SECONDS,
24+
},
25+
{
26+
name: "hardcoded launch timestamp before",
27+
timestamp: 1765823486,
28+
want: constants.LP_PLUS_ISSUANCE_SECONDS_PRE_LAUNCH,
29+
},
30+
{
31+
name: "hardcoded launch timestamp after",
32+
timestamp: 1765987200,
33+
want: constants.LP_PLUS_ISSUANCE_SECONDS,
34+
},
35+
}
36+
37+
for _, tc := range testCases {
38+
t.Run(tc.name, func(t *testing.T) {
39+
got := GetLPPlusIssuanceSeconds(tc.timestamp)
40+
if got != tc.want {
41+
t.Errorf("GetLPPlusIssuanceSeconds(%d) = %d; want %d", tc.timestamp, got, tc.want)
42+
}
43+
})
44+
}
45+
}

0 commit comments

Comments
 (0)