adding stuff back

master
lza_menace 2 years ago
parent 055de1c1db
commit be4b71652d

@ -125,44 +125,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "addresses",
"type": "address[]"
}
],
"name": "getKillCounts",
"outputs": [
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "getLeaderboard",
"outputs": [
{
"internalType": "address[]",
"name": "addresses",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{

@ -138,7 +138,7 @@
background-color: rgba(0,0,0,.6);
padding: 2px;
border-radius: 4px;
text-align: right;
text-align: center;
right: 0;
padding: .75em;
}

@ -6,6 +6,7 @@ import Slider from 'rc-slider';
import { Parallax } from 'react-parallax';
import { animateScroll as scroll } from 'react-scroll'
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { publicProvider } from 'wagmi/providers/public';
import { AwesomeButton } from 'react-awesome-button';
import Boomer from '../img/unaboomer.png';
@ -165,12 +166,12 @@ class GameMap extends React.Component {
<img src={Boomer} width="50px" />
<p className="nopad">
Kill Leader:<br />
? kills
<a href="https://etherscan.io/address/xxx" target="_blank">
{this.shorten(this.props.leaderAddress)}
</a>
</p>
<p className="nopad">
<a href="https://etherscan.io/address/${this.props.killLeader}" target="_blank">
me
</a>
{this.props.leaderKillCount} kills
</p>
</div>
<div className="map">
@ -197,10 +198,9 @@ function Section3() {
bombSupply: 0,
bombsExploded: 0,
unaboomersKilled: 0,
leaderboardAddresses: [],
leaderboardAmounts: [],
results: [],
tokensKilled: []
leaderboardPointer: 0,
leaderAddress: '',
leaderKillCount: 0
});
const handleStateChange = (obj) =>{
setOptions(preState => ({...preState , ...obj}))
@ -246,10 +246,14 @@ function Section3() {
{
...defOpt,
functionName: 'unaboomersKilled'
},
{
...defOpt,
functionName: 'leaderboardPointer'
}
],
watch: true,
cacheTime: 5000,
cacheTime: 10_000,
onSuccess(data) {
handleStateChange({
unaboomerPrice: data[0].toString(),
@ -259,39 +263,36 @@ function Section3() {
unaboomerSupply: data[4].toString(),
bombSupply: data[5].toString(),
bombsExploded: data[6].toString(),
unaboomersKilled: data[7].toString()
unaboomersKilled: data[7].toString(),
leaderboardPointer: data[8].toString(),
});
}
});
useContractRead({
address: contractAddress,
abi: MainABI,
enabled: options.unaboomersKilled > 0,
functionName: 'getLeaderboard',
args: [5],
enabled: options.leaderboardPointer > 0,
functionName: 'leaderboard',
args: [options.leaderboardPointer],
watch: true,
cacheTime: 10_000,
onSuccess(data) {
console.log('get lb addresses')
console.log(data);
onSuccess: async (data) => {
handleStateChange({
leaderboardAddresses: data,
leaderAddress: data,
});
}
});
useContractRead({
address: contractAddress,
abi: MainABI,
enabled: options.leaderboardAddresses.length > 0,
functionName: 'getKillCounts',
args: [options.leaderboardAddresses],
enabled: options.leaderAddress.length > 0,
functionName: 'killCount',
args: [options.leaderAddress],
watch: true,
cacheTime: 10_000,
onSuccess(data) {
console.log('get kill counts')
console.log(data);
handleStateChange({
leaderboardAmounts: data,
leaderKillCount: data.toString(),
});
}
});
@ -332,7 +333,7 @@ function Section3() {
const sendBombsWrite = useContractWrite(sendBombsPrepare.config);
useWaitForTransaction({
hash: sendBombsWrite.data?.hash,
enabled: sendBombsWrite.isSuccess,
enabled: sendBombsWrite.status === 'success',
onSuccess(data) {
const iface = new ethers.utils.Interface(MainABI);
data.logs.filter(log =>
@ -401,8 +402,8 @@ function Section3() {
bombsExploded={options.bombsExploded}
unaboomerSupply={options.unaboomerSupply}
unaboomersKilled={options.unaboomersKilled}
killLeader={options.killLeader}
killLeaderCount={options.killLeaderCount}
leaderAddress={options.leaderAddress}
leaderKillCount={options.leaderKillCount}
/>
</>
||

Loading…
Cancel
Save