bit of a refactor #1

Merged
mico merged 4 commits from review into main 2024-10-25 09:13:40 +00:00
Showing only changes of commit 49b7110a6c - Show all commits

View File

@ -109,13 +109,13 @@ contract RaidGeld is ERC20, Ownable {
}
uint256 cost = RaidGeldUtils.calculateUnitPrice(unit, currentLevel, n_units);
// First trigger a raid so player receives what he is due at to this moment
performRaid(msg.sender);
require(balanceOf(msg.sender) > cost, "Not enough GELD to add this much");
// TODO: Since we are first minting then burning the token, this could be simplified
// by first calculating the difference and then minting / burning in just one operation
// First trigger a raid so player receives what he is due at to this moment
performRaid(msg.sender);
// then burn the cost of the new army
_burn(msg.sender, cost);