From 9b3bdf8f5f2cf14691475524c55b3cd998330464 Mon Sep 17 00:00:00 2001 From: Dhvani Patel Date: Tue, 14 May 2024 17:26:45 +0100 Subject: [PATCH] add events --- packages/hardhat/contracts/Game.sol | 3 + .../nextjs/contracts/deployedContracts.ts | 664 +----------------- 2 files changed, 12 insertions(+), 655 deletions(-) diff --git a/packages/hardhat/contracts/Game.sol b/packages/hardhat/contracts/Game.sol index c8e683b0..a5573967 100644 --- a/packages/hardhat/contracts/Game.sol +++ b/packages/hardhat/contracts/Game.sol @@ -106,6 +106,8 @@ contract Game is IOptionalSystemHook { submissionPrices[buildCount] = submissionPrice; names[buildCount] = name; + + emit GameNotif(address(0), "A new build has been added to the game."); } function submitBuilding(uint256 buildingId, VoxelCoord memory baseWorldCoord) external payable { @@ -162,6 +164,7 @@ contract Game is IOptionalSystemHook { earned[buildersAtId[i]] += splitAmount; (bool sent, ) = buildersAtId[i].call{ value: splitAmount }(""); require(sent, "Failed to send submission price to builder"); + emit GameNotif(buildersAtId[i], "You've earned some ether for your contribution to a build."); } if (remainder > 0) { diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 9823d6c7..d36e202f 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -5,9 +5,9 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { - 690: { + 31337: { Game: { - address: "0x129786538F698b0AA47f0A9F8a8f11a3Ff1726E6", + address: "0x63fea6E447F120B8Faf85B53cdaD8348e645D80E", abi: [ { inputs: [ @@ -42,669 +42,23 @@ const deployedContracts = { type: "error", }, { - inputs: [], - name: "biomeWorldAddress", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "buildCount", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "buildingId", - type: "uint256", - }, - { - internalType: "uint256", - name: "n", - type: "uint256", - }, - ], - name: "challengeBuilding", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { + anonymous: false, inputs: [ { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - name: "coordHashToBuilder", - outputs: [ - { + indexed: false, internalType: "address", - name: "", + name: "player", type: "address", }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint8[]", - name: "objectTypeIds", - type: "uint8[]", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord[]", - name: "relativePositions", - type: "tuple[]", - }, - { - internalType: "uint256", - name: "submissionPrice", - type: "uint256", - }, { + indexed: false, internalType: "string", - name: "name", + name: "message", type: "string", }, ], - name: "create", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "getAllBlueprints", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - components: [ - { - internalType: "uint8[]", - name: "objectTypeIds", - type: "uint8[]", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord[]", - name: "relativePositions", - type: "tuple[]", - }, - ], - internalType: "struct Build", - name: "blueprint", - type: "tuple", - }, - ], - internalType: "struct BlueprintPair[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getAllBuilders", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "address[]", - name: "builderAddresses", - type: "address[]", - }, - ], - internalType: "struct BuilderList[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getAllLocations", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord[]", - name: "location", - type: "tuple[]", - }, - ], - internalType: "struct LocationPair[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getAllNames", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "string", - name: "name", - type: "string", - }, - ], - internalType: "struct NamePair[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getAllSubmissionPrices", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "uint256", - name: "price", - type: "uint256", - }, - ], - internalType: "struct SubmissionPricePair[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getBuilds", - outputs: [ - { - components: [ - { - internalType: "string", - name: "name", - type: "string", - }, - { - components: [ - { - internalType: "uint8[]", - name: "objectTypeIds", - type: "uint8[]", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord[]", - name: "relativePositions", - type: "tuple[]", - }, - ], - internalType: "struct Build", - name: "build", - type: "tuple", - }, - ], - internalType: "struct NamedBuild[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getDisplayName", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getEarned", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getList", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "id", - type: "uint256", - }, - { - internalType: "string", - name: "name", - type: "string", - }, - { - internalType: "uint256", - name: "price", - type: "uint256", - }, - { - internalType: "address[]", - name: "builders", - type: "address[]", - }, - { - components: [ - { - internalType: "uint8[]", - name: "objectTypeIds", - type: "uint8[]", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord[]", - name: "relativePositions", - type: "tuple[]", - }, - ], - internalType: "struct Build", - name: "blueprint", - type: "tuple", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord[]", - name: "locations", - type: "tuple[]", - }, - ], - internalType: "struct ListEntry[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getStatus", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "msgSender", - type: "address", - }, - { - internalType: "ResourceId", - name: "systemId", - type: "bytes32", - }, - { - internalType: "bytes", - name: "callData", - type: "bytes", - }, - ], - name: "onAfterCallSystem", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "msgSender", - type: "address", - }, - { - internalType: "ResourceId", - name: "systemId", - type: "bytes32", - }, - { - internalType: "bytes", - name: "callData", - type: "bytes", - }, - ], - name: "onBeforeCallSystem", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "msgSender", - type: "address", - }, - { - internalType: "ResourceId", - name: "systemId", - type: "bytes32", - }, - { - internalType: "uint8", - name: "enabledHooksBitmap", - type: "uint8", - }, - { - internalType: "bytes32", - name: "callDataHash", - type: "bytes32", - }, - ], - name: "onRegisterHook", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "msgSender", - type: "address", - }, - { - internalType: "ResourceId", - name: "systemId", - type: "bytes32", - }, - { - internalType: "uint8", - name: "enabledHooksBitmap", - type: "uint8", - }, - { - internalType: "bytes32", - name: "callDataHash", - type: "bytes32", - }, - ], - name: "onUnregisterHook", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "buildingId", - type: "uint256", - }, - { - components: [ - { - internalType: "int16", - name: "x", - type: "int16", - }, - { - internalType: "int16", - name: "y", - type: "int16", - }, - { - internalType: "int16", - name: "z", - type: "int16", - }, - ], - internalType: "struct VoxelCoord", - name: "baseWorldCoord", - type: "tuple", - }, - ], - name: "submitBuilding", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "interfaceId", - type: "bytes4", - }, - ], - name: "supportsInterface", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - ], - inheritedFunctions: { - onAfterCallSystem: "@latticexyz/world/src/IOptionalSystemHook.sol", - onBeforeCallSystem: "@latticexyz/world/src/IOptionalSystemHook.sol", - onRegisterHook: "@latticexyz/world/src/IOptionalSystemHook.sol", - onUnregisterHook: "@latticexyz/world/src/IOptionalSystemHook.sol", - supportsInterface: "@latticexyz/world/src/IOptionalSystemHook.sol", - }, - }, - }, - 31337: { - Game: { - address: "0x12Bcb546bC60fF39F1Adfc7cE4605d5Bd6a6A876", - abi: [ - { - inputs: [ - { - internalType: "address", - name: "_biomeWorldAddress", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [ - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "uint256", - name: "start", - type: "uint256", - }, - { - internalType: "uint256", - name: "end", - type: "uint256", - }, - ], - name: "Slice_OutOfBounds", - type: "error", + name: "GameNotif", + type: "event", }, { inputs: [],