Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- txn type changed to uint64 #263

Merged
merged 4 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 3 additions & 6 deletions cmd/newallocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ var newallocationCmd = &cobra.Command{
}

var (
lock int64 // lock with given number of tokens
err error //
lock uint64 // lock with given number of tokens
err error //
)

if !costOnly {
Expand All @@ -95,9 +95,6 @@ var newallocationCmd = &cobra.Command{
if lockf, err = flags.GetFloat64("lock"); err != nil {
log.Fatal("error: invalid 'lock' value:", err)
}
if lock < 0 {
log.Fatal("Only positive values are allowed for --lock")
}

if convertFromUSD {
lockf, err = zcncore.ConvertUSDToToken(lockf)
Expand Down Expand Up @@ -209,7 +206,7 @@ var newallocationCmd = &cobra.Command{
},
}

func processFreeStorageFlags(flags *pflag.FlagSet) (int64, string) {
func processFreeStorageFlags(flags *pflag.FlagSet) (uint64, string) {
if flags.Changed("read_price") {
log.Fatal("free storage, read_price is predefined")
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/readpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ var rpLock = &cobra.Command{
log.Fatal("invalid 'tokens' flag: ", err)
}

if tokens < 0 {
log.Fatal("invalid token amount: negative")
}

if flags.Changed("fee") {
if fee, err = flags.GetFloat64("fee"); err != nil {
log.Fatal("invalid 'fee' flag: ", err)
Expand Down
4 changes: 4 additions & 0 deletions cmd/stakepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ var spLock = &cobra.Command{
log.Fatal("invalid 'tokens' flag: ", err)
}

if tokens < 0 {
log.Fatal("invalid token amount: negative")
}

if flags.Changed("fee") {
if fee, err = flags.GetFloat64("fee"); err != nil {
log.Fatal("invalid 'fee' flag: ", err)
Expand Down
5 changes: 1 addition & 4 deletions cmd/updateallocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,10 @@ var updateAllocationCmd = &cobra.Command{
}

var lockf float64
var lock int64
var lock uint64
if lockf, err = flags.GetFloat64("lock"); err != nil {
log.Fatal("error: invalid 'lock' value:", err)
}
if lock < 0 {
log.Fatal("Only positive values are allowed for --lock")
}

lock = zcncore.ConvertToValue(lockf)

Expand Down
4 changes: 4 additions & 0 deletions cmd/writepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ var wpLock = &cobra.Command{
log.Fatal("invalid 'tokens' flag: ", err)
}

if tokens < 0 {
log.Fatal("invalid token amount: negative")
}

if flags.Changed("fee") {
if fee, err = flags.GetFloat64("fee"); err != nil {
log.Fatal("invalid 'fee' flag: ", err)
Expand Down