@@ -37,8 +37,8 @@ func validateAmount(amount sdk.Coin) error {
3737}
3838
3939// validateEndTime checks if time is in the past
40- func validateEndTime (endTime time.Time ) error {
41- if endTime .Before (time . Now ()) {
40+ func validateEndTime (ctx sdk. Context , endTime time.Time ) error {
41+ if endTime .Before (ctx . BlockTime ()) {
4242 return fmt .Errorf ("end time %s is not in the future" , endTime )
4343 }
4444
@@ -63,7 +63,7 @@ func (k Keeper) fundsAvailable(ctx context.Context, amount sdk.Coin) error {
6363}
6464
6565// validateSchedule checks if the asked funds are available in the pool
66- func (k Keeper ) validateSchedule (ctx context .Context , schedule types.ReleaseSchedule ) error {
66+ func (k Keeper ) validateSchedule (ctx sdk .Context , schedule types.ReleaseSchedule ) error {
6767 // Validate TotalAmount
6868 if err := validateAmount (schedule .TotalAmount ); err != nil {
6969 return fmt .Errorf ("invalid total amount: %w" , err )
@@ -95,14 +95,14 @@ func (k Keeper) validateSchedule(ctx context.Context, schedule types.ReleaseSche
9595 }
9696
9797 // Time validations
98- currentTime := time .Now ()
9998 if schedule .EndTime .IsZero () {
10099 return fmt .Errorf ("end time cannot be zero" )
101100 }
102- if err = validateEndTime (schedule .EndTime ); err != nil {
101+ if err = validateEndTime (ctx , schedule .EndTime ); err != nil {
103102 return err
104103 }
105104
105+ currentTime := ctx .BlockTime ()
106106 if ! schedule .LastReleaseTime .IsZero () {
107107 if schedule .LastReleaseTime .After (currentTime ) {
108108 return fmt .Errorf ("last release time %s cannot be in the future" ,
0 commit comments