diff --git a/src/abi/main.json b/src/abi/main.json
index d7aa5eb..32492a4 100644
--- a/src/abi/main.json
+++ b/src/abi/main.json
@@ -125,6 +125,57 @@
"stateMutability": "view",
"type": "function"
},
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "killCount",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "leaderboard",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "leaderboardPointer",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
{
"inputs": [],
"name": "mailbomb",
diff --git a/src/styles/sections.css b/src/styles/sections.css
index 6e2a737..c8a9c39 100644
--- a/src/styles/sections.css
+++ b/src/styles/sections.css
@@ -72,11 +72,11 @@
}
#gameMapTitle {
- margin: 1em 0 0 0;
+ margin: 1em 0 1em 0;
}
#gameStats {
- margin: .5em 0 .5em 0;
+ margin: .5em 0 0 0;
position: absolute;
z-index: 99;
background-color: rgba(0,0,0,.6);
@@ -129,4 +129,15 @@
50% { opacity: .7 }
75% { opacity: .9 }
100% { opacity: 1 }
+}
+
+#killLeader {
+ margin: .5em 0 .5em 0;
+ position: absolute;
+ z-index: 99;
+ background-color: rgba(0,0,0,.6);
+ padding: 2px;
+ border-radius: 4px;
+ text-align: left;
+ right: 0;
}
\ No newline at end of file
diff --git a/src/template/Sections.jsx b/src/template/Sections.jsx
index a028681..b243f10 100644
--- a/src/template/Sections.jsx
+++ b/src/template/Sections.jsx
@@ -149,20 +149,23 @@ class GameMap extends React.Component {
Metaverse Map
- - _ Alive Unaboomers: {this.state.unaboomerSupply - this.state.unaboomersKilled}
- - _ Dead Unaboomers: {this.state.unaboomersKilled}
- - _ Active Bombs: {this.state.bombSupply - this.state.bombsExploded}
- - _ Exploded Bombs: {this.state.bombsExploded}
- - _ Dud Bombs: {this.state.bombsExploded}
+ - Active Unaboomers: {this.state.unaboomerSupply - this.state.unaboomersKilled}
+ - Dead Unaboomers: {this.state.unaboomersKilled}
+ - _ Active Bombs: {this.state.bombSupply - this.state.bombsExploded}
+ - _ Exploded Bombs: {this.state.bombsExploded}
+ - _ Dud Bombs: {this.state.bombsExploded}
+
+
+
Kill Leader: {this.props.killLeader}
+
{this.props.killLeaderCount} kills
+
-
-
-
-
-
+
+
+
>
)
@@ -182,6 +185,9 @@ function Section3() {
bombSupply: 0,
bombsExploded: 0,
unaboomersKilled: 0,
+ leaderboardPointer: 0,
+ killLeader: '',
+ killLeaderCount: 0,
results: [],
tokensKilled: []
});
@@ -189,57 +195,50 @@ function Section3() {
setOptions(preState => ({...preState , ...obj}))
}
const { isConnected, address } = useAccount();
+ const defOpt = {
+ address: contractAddress,
+ abi: MainABI,
+ enabled: isConnected
+ }
useContractReads({
contracts: [
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'unaboomerPrice'
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'bombPrice'
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'unaboomerBalance',
args: [address]
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'bombBalance',
args: [address]
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'unaboomerSupply'
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'bombSupply'
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'bombsExploded'
},
{
- address: contractAddress,
- abi: MainABI,
- enabled: isConnected,
+ ...defOpt,
functionName: 'unaboomersKilled'
+ },
+ {
+ ...defOpt,
+ functionName: 'leaderboardPointer'
}
],
watch: true,
@@ -254,6 +253,41 @@ function Section3() {
bombSupply: data[5].toString(),
bombsExploded: data[6].toString(),
unaboomersKilled: data[7].toString(),
+ leaderboardPointer: data[8].toString()
+ });
+ }
+ });
+ useContractReads({
+ contracts: [
+ {
+ ...defOpt,
+ enabled: options.leaderboardPointer > 0,
+ functionName: 'leaderboard',
+ args: [options.leaderboardPointer]
+ }
+ ],
+ watch: true,
+ cacheTime: 10000,
+ onSuccess(data) {
+ handleStateChange({
+ killLeader: data[0].toString(),
+ });
+ }
+ });
+ useContractReads({
+ contracts: [
+ {
+ ...defOpt,
+ enabled: options.killLeader.length > 0,
+ functionName: 'killCount',
+ args: [options.killLeader]
+ }
+ ],
+ watch: true,
+ cacheTime: 10000,
+ onSuccess(data) {
+ handleStateChange({
+ killLeaderCount: data[0].toString(),
});
}
});
@@ -298,7 +332,6 @@ function Section3() {
log.topics[0] === '0x38c7e2e8001cefb27535bd6bcc6363c6d6a6a83dbb77f092b78956334596f9ed'
).map((log) => {
const res = iface.decodeEventLog("SentBomb", log.data, log.topics);
- console.log(res);
if (res.hit) {
if (res.owned) {
NotificationManager.error(`Your bomb exploded during assembly and killed your Unaboomer ${res.tokenId.toString()}`, 'oof', 10000);
@@ -361,6 +394,8 @@ function Section3() {
bombsExploded={options.bombsExploded}
unaboomerSupply={options.unaboomerSupply}
unaboomersKilled={options.unaboomersKilled}
+ killLeader={options.killLeader}
+ killLeaderCount={options.killLeaderCount}
/>
>
||