From 779788c0068340493505e2d7e9f72230fbb75e40 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sat, 31 Dec 2022 02:08:53 -0800 Subject: [PATCH] add param to SentBomb event --- src/Main.sol | 6 ++++-- testing.sh | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 testing.sh diff --git a/src/Main.sol b/src/Main.sol index 625c43e..dd3418c 100644 --- a/src/Main.sol +++ b/src/Main.sol @@ -71,7 +71,8 @@ contract Main is Owned { /// @param from Sender of the bombs /// @param tokenId Unaboomer token which was targeted /// @param hit Whether or not the bomb killed the token or not (was a dud / already killed) - event SentBomb(address indexed from, uint256 indexed tokenId, bool hit); + /// @param owned Whether or not the sender was the owner of the BOOMR token + event SentBomb(address indexed from, uint256 indexed tokenId, bool hit, bool owned); constructor() Owned(msg.sender) {} @@ -201,7 +202,8 @@ contract Main is Owned { uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % supply; bool dud = unaboomer.tokenDead(randomBoomer); unaboomer.die(randomBoomer); - emit SentBomb(msg.sender, randomBoomer, !dud); + bool senderOwned = msg.sender == unaboomer.ownerOf(randomBoomer); + emit SentBomb(msg.sender, randomBoomer, !dud, senderOwned); } mailbomb.explode(msg.sender, _amount); } diff --git a/testing.sh b/testing.sh new file mode 100644 index 0000000..89347f0 --- /dev/null +++ b/testing.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export $(cat .env) +forge script script/Unaboomer.s.sol:DeployProject --private-key=$LOCAL_KEY --rpc-url http://localhost:8545 --broadcast +cast send --private-key=$LOCAL_KEY --rpc-url=$LOCAL_RPC --value "10 ether" 0x653D2d1D10c79017b2eA5F5a6F02D9Ab6e725395 \ No newline at end of file