forked from mico/idle_moloch
Raid increases total minted now
This commit is contained in:
parent
7567cc6789
commit
48602ccd9b
@ -73,7 +73,11 @@ contract Geld is ERC20, Ownable {
|
||||
require(block.timestamp >= players[msg.sender].last_raided_at + RAID_WAIT, "Tried minting too soon");
|
||||
|
||||
// TODO: Make real calculation based on army
|
||||
_mint(msg.sender, 50 * 10 ** decimals());
|
||||
uint256 new_geld = 50 * 10 ** decimals();
|
||||
|
||||
_mint(msg.sender, new_geld);
|
||||
|
||||
total_minted += new_geld;
|
||||
|
||||
players[msg.sender].last_raided_at = block.timestamp;
|
||||
}
|
||||
|
||||
@ -107,13 +107,16 @@ contract GeldTest is Test {
|
||||
registerPlayer();
|
||||
|
||||
uint256 balance = geld.balanceOf(player1);
|
||||
uint256 total_minted = geld.total_minted();
|
||||
|
||||
// Trigger raid funds minting
|
||||
geld.raid();
|
||||
|
||||
// New balance should be larger
|
||||
uint256 newBalance = geld.balanceOf(player1);
|
||||
uint256 newTotalMinted = geld.total_minted();
|
||||
assertLt(balance, newBalance);
|
||||
assertLt(total_minted, newTotalMinted);
|
||||
|
||||
// Expect fail if we raid again, we need to wait a bit
|
||||
vm.expectRevert();
|
||||
@ -125,6 +128,8 @@ contract GeldTest is Test {
|
||||
|
||||
// Balance should reflect that
|
||||
uint256 newestBalance = geld.balanceOf(player1);
|
||||
uint256 newestTotalMinted = geld.total_minted();
|
||||
assertLt(newTotalMinted, newestTotalMinted);
|
||||
assertLt(newBalance, newestBalance);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user