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

test(contracts): modify Colosseum tests related to V2 #363

Merged
Merged
Changes from 1 commit
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
Next Next commit
fix(contracts): avoid divide by zero of kgh num
  • Loading branch information
seolaoh committed Jul 26, 2024
commit 76021f7baf4c51fe8c95e6754dc274f493b3153d
4 changes: 3 additions & 1 deletion packages/contracts/contracts/L1/AssetManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,9 @@ contract AssetManager is ISemver, IERC721Receiver, IAssetManager {
unchecked {
asset.totalKro += baseReward;
asset.validatorKro += validatorReward;
asset.rewardPerKghStored += boostedReward / asset.totalKgh;
if (boostedReward > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If boostedReward is greater than 0, asset.totalKgh is not zero. But why don't we check if the asset.totalKgh is zero or not directly?

asset.rewardPerKghStored += boostedReward / asset.totalKgh;
}
asset.validatorKroBonded -= BOND_AMOUNT;
}

Expand Down