From f373f2590dccb0ca7114392df81b39a5d428a2a2 Mon Sep 17 00:00:00 2001
From: Solovyov1796 <xinyu@0g.ai>
Date: Wed, 12 Jun 2024 01:36:29 +0800
Subject: [PATCH] use chaincfg.MakeCoinForGasDenom

---
 migrate/utils/periodic_vesting_reset_test.go | 46 ++++++++++----------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go
index 5424eb93..b7cde17f 100644
--- a/migrate/utils/periodic_vesting_reset_test.go
+++ b/migrate/utils/periodic_vesting_reset_test.go
@@ -42,7 +42,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) {
 }
 
 func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) {
-	balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))
+	balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6)))
 	vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
 
 	periods := vestingtypes.Periods{
@@ -65,7 +65,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) {
 }
 
 func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) {
-	balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))
+	balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6)))
 	vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
 
 	periods := vestingtypes.Periods{
@@ -98,7 +98,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) {
 }
 
 func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) {
-	balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))
+	balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6)))
 	vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
 
 	periods := vestingtypes.Periods{
@@ -126,25 +126,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing
 }
 
 func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) {
-	balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(4e6)))
+	balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(4e6)))
 	vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
 
 	periods := vestingtypes.Periods{
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // -15 days - vested
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // +15 days - vesting
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // +30 days - vesting
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 	}
 
@@ -160,36 +160,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) {
 	expectedPeriods := []vestingtypes.Period{
 		{
 			Length: 15 * 24 * 60 * 60, // 15 days
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		{
 			Length: 15 * 24 * 60 * 60, // 15 days
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 	}
 
-	assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated")
+	assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated")
 	assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated")
 	assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period")
 	assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated")
 }
 
 func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) {
-	balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6)))
+	balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(3e6)))
 	vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
 
 	periods := vestingtypes.Periods{
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // -15 days - vested
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // +15 days - vesting
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 	}
 
@@ -199,35 +199,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin
 	newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour)
 	ResetPeriodicVestingAccount(vacc, newVestingStartTime)
 
-	assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated")
-	assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated")
+	assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated")
+	assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated")
 }
 
 func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) {
-	balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6)))
+	balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(3e6)))
 	vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
 
 	periods := vestingtypes.Periods{
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // -15 days - vested
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 		vestingtypes.Period{
 			Length: 15 * 24 * 60 * 60, // +15 days - vesting
-			Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
+			Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))),
 		},
 	}
 
 	vacc := createVestingAccount(balance, vestingStartTime, periods)
-	vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))))
+	vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))))
 
 	newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour)
 	ResetPeriodicVestingAccount(vacc, newVestingStartTime)
 
 	assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified")
-	assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified")
+	assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified")
 }