-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: Improve Stake Time Calculation Accuracy #119
Closed
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f70ad2e
Add version.go file to manage project versioning
izikdepth be43535
update cli & discord files to utilize version.go for managing project…
izikdepth 6cebbd2
Removed xml and json tags
izikdepth aebda8c
Merge branch 'robopac-project:main' into main
izikdepth f77ba95
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth 5647db0
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth abc9fab
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth 817288f
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth c93d1bd
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth 2ad7b6e
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth 01d9adb
Merge branch 'main' of github.com:izikdepth/RoboPac
izikdepth 47fb3d3
fix stake time error
izikdepth f0f2014
Merge branch 'pagu-project:main' into fix/stake-time
izikdepth 3f56718
Refactor: Replace int64 with amount.Amount for Duration Handling and …
izikdepth c53c9bc
Refactor: ensure consistent use of Amount struct to format pac values
izikdepth 1530750
fmt: format blockchain.go
izikdepth 9ace7d7
Refactor: refactor blockchain module to use amount.Amount struct
izikdepth 795943b
Merge branch 'pagu-project:main' into fix/stake-time
izikdepth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"github.com/pagu-project/Pagu/client" | ||
"github.com/pagu-project/Pagu/engine/command" | ||
"github.com/pagu-project/Pagu/utils" | ||
// "github.com/pagu-project/Pagu/utils" | ||
) | ||
|
||
const ( | ||
|
@@ -114,11 +115,12 @@ func (bc *Blockchain) calcRewardHandler(cmd command.Command, _ command.AppID, _ | |
|
||
rewardInt := stake * blocks / int(amount.Amount(bi.TotalPower).ToPAC()) | ||
|
||
reward := amount.Amount(rewardInt) | ||
// convert from nanoPac to PAC. | ||
totalPowerInPAC := bi.TotalPower / 1_000_000_000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @izikdepth please one time read and check amount.Amount functions. |
||
|
||
return cmd.SuccessfulResult("Approximately you earn %v PAC reward, with %v PAC stake 🔒 on your validator in one %s ⏰ with %s total power ⚡ of committee."+ | ||
"\n\n> Note📝: This number is just an estimation. It will vary depending on your stake amount and total network power.", | ||
utils.FormatNumber(int64(reward)), utils.FormatNumber(int64(stake)), duration, utils.FormatNumber(int64(amount.Amount(bi.TotalPower).ToPAC()))) | ||
rewardInt, strconv.Itoa(stake), duration, utils.FormatNumber(totalPowerInPAC)) | ||
} | ||
|
||
func (bc *Blockchain) calcFeeHandler(cmd command.Command, _ command.AppID, _ string, args ...string) command.CommandResult { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line.