diff --git a/src/RaidGeld.sol b/src/RaidGeld.sol index e5bf6ba..a70b9e6 100644 --- a/src/RaidGeld.sol +++ b/src/RaidGeld.sol @@ -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);