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 8e17b65 commit a4503fb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/hardhat/contracts/Game.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ contract Game is ICustomUnregisterDelegation, IOptionalSystemHook {
}
require(!isAllowed, "Already allowed to drop items");
allowedItemDrops.push(msgSender);

emit GameNotif(delegatorAddress, "A new player has been added to allowed item drops");
}

function dropItem(bytes32 toolEntityId) external {
Expand All @@ -188,6 +190,8 @@ contract Game is ICustomUnregisterDelegation, IOptionalSystemHook {
bytes memory dropCallData = abi.encodeCall(IDropSystem.dropTool, (toolEntityId, dropCoord));

IWorld(biomeWorldAddress).callFrom(delegatorAddress, DropSystemId, dropCallData);

emit GameNotif(delegatorAddress, "Item dropped");
}

// Getters
Expand Down
21 changes: 20 additions & 1 deletion packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract";
const deployedContracts = {
31337: {
Game: {
address: "0xaC47e91215fb80462139756f43438402998E4A3a",
address: "0x54B8d8E2455946f2A5B8982283f2359812e815ce",
abi: [
{
inputs: [
Expand Down Expand Up @@ -46,6 +46,25 @@ const deployedContracts = {
name: "Slice_OutOfBounds",
type: "error",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "player",
type: "address",
},
{
indexed: false,
internalType: "string",
name: "message",
type: "string",
},
],
name: "GameNotif",
type: "event",
},
{
inputs: [
{
Expand Down

0 comments on commit a4503fb

Please sign in to comment.