Skip to content

Commit

Permalink
add events
Browse files Browse the repository at this point in the history
  • Loading branch information
dhvanipa committed May 14, 2024
1 parent 638f715 commit 6f67ee1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/hardhat/contracts/Game.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ contract Game is IOptionalSystemHook {
getEntityFromPlayer(msgSender) != bytes32(0),
"You Must First Spawn An Avatar In Biome-1 To Play The Game."
);
emit GameNotif(string.concat(Strings.toHexString(msgSender), " has joined the game"));
}

function onAfterCallSystem(
Expand All @@ -77,6 +78,8 @@ contract Game is IOptionalSystemHook {
(bool sent, ) = msgSender.call{ value: address(this).balance }("");
require(sent, "Failed to send Ether");

emit GameNotif(string.concat(Strings.toHexString(winner), " won the game!"));

return;
}

Expand Down
13 changes: 13 additions & 0 deletions packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ const deployedContracts = {
stateMutability: "payable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "string",
name: "message",
type: "string",
},
],
name: "GameNotif",
type: "event",
},
{
inputs: [],
name: "biomeWorldAddress",
Expand Down

0 comments on commit 6f67ee1

Please sign in to comment.