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

Track prepaid amount and withdraw treasury #110

Merged
merged 10 commits into from
Sep 27, 2024
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
Prev Previous commit
fix comments
  • Loading branch information
syntrust committed Sep 26, 2024
commit a63abfb7cf45340815c5520c00f4e8d82eb564a6
7 changes: 2 additions & 5 deletions contracts/StorageContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,11 @@ abstract contract StorageContract is DecentralizedKV, ReentrancyGuardTransient {
if (updatePrepaidTime) {
prepaidLastMineTime = _minedTs;
}
if (prepaidAmountSaved > 0) {
accPrepaidAmount += prepaidAmountSaved;
}
accPrepaidAmount += treasuryReward;
accPrepaidAmount += prepaidAmountSaved + treasuryReward;
// Update mining info.
MiningLib.update(infos[_shardId], _minedTs, _diff);

require(treasuryReward + minerReward <= address(this).balance, "StorageContract: not enough balance");
require(minerReward <= address(this).balance, "StorageContract: not enough balance");
// Actually `transfer` is limited by the amount of gas allocated, which is not sufficient to enable reentrancy attacks.
// However, this behavior may restrict the extensibility of scenarios where the receiver is a contract that requires
// additional gas for its fallback functions of proper operations.
Expand Down
Loading