-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8856ef
commit bf814b6
Showing
9 changed files
with
399 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func (p ParamUpdatePlan) String() string { | ||
due := p.DueAt() | ||
return fmt.Sprintf(`Oracle Param Update Plan | ||
Title: %s | ||
%s | ||
Description: %s.`, p.Title, due, p.Description) | ||
} | ||
|
||
// ValidateBasic does basic validation of a ParamUpdatePlan | ||
func (p ParamUpdatePlan) ValidateBasic() error { | ||
if len(p.Title) == 0 { | ||
return ErrInvalidRequest.Wrap("name cannot be empty") | ||
} | ||
if p.Height <= 0 { | ||
return ErrInvalidRequest.Wrap("height must be greater than 0") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ShouldExecute returns true if the Plan is ready to execute given the current context | ||
func (p ParamUpdatePlan) ShouldExecute(ctx sdk.Context) bool { | ||
return p.Height == ctx.BlockHeight() | ||
} | ||
|
||
// DueAt is a string representation of when this plan is due to be executed | ||
func (p ParamUpdatePlan) DueAt() string { | ||
return fmt.Sprintf("height: %d", p.Height) | ||
} |
Oops, something went wrong.