1
0
forked from mico/idle_moloch

initial raid time is now set to block.timestamp to prevent silly things happening

This commit is contained in:
mic0 2024-10-23 16:46:02 +02:00
parent 4a5354f092
commit 799d9ae435
Signed by: mico
GPG Key ID: A3F8023524CF1C8D
3 changed files with 11 additions and 6 deletions

View File

@ -91,6 +91,8 @@ const PlayerProvider = ({ children }: { children: ReactNode }) => {
}
});
console.log(player)
const register = useCallback(() => {
writeContract({
abi,

View File

@ -49,7 +49,8 @@ contract RaidGeld is ERC20, Ownable {
_mint(msg.sender, INITIAL_GELD);
// Set initial states
players[msg.sender] = Player({total_minted: INITIAL_GELD, created_at: block.timestamp, last_raided_at: 0});
players[msg.sender] =
Player({total_minted: INITIAL_GELD, created_at: block.timestamp, last_raided_at: block.timestamp});
armies[msg.sender] = Army({
moloch_denier: Raider({level: 0}),
apprentice: Raider({level: 0}),

View File

@ -55,7 +55,7 @@ contract raid_geldTest is Test {
Player memory player = raid_geld.getPlayer(player1);
assertEq(player.total_minted, raid_geld.INITIAL_GELD());
assertEq(player.created_at, block.timestamp);
assertEq(player.last_raided_at, 0);
assertEq(player.last_raided_at, block.timestamp);
Army memory army = raid_geld.getArmy(player1);
@ -149,6 +149,8 @@ contract raid_geldTest is Test {
uint256 balance = raid_geld.balanceOf(player1);
// Warp time a bit so first raid doesnt fail
vm.warp(block.timestamp + raid_geld.RAID_WAIT());
// Trigger raid funds minting
raid_geld.raid();