|
|
@ -1,5 +1,5 @@
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
import { ethers } from 'ethers';
|
|
|
|
import { ethers, BigNumber } from 'ethers';
|
|
|
|
import { useAccount, useContractReads, usePrepareContractWrite, useContractWrite } from 'wagmi';
|
|
|
|
import { useAccount, useContractReads, usePrepareContractWrite, useContractWrite } from 'wagmi';
|
|
|
|
import Typewriter from 'react-ts-typewriter';
|
|
|
|
import Typewriter from 'react-ts-typewriter';
|
|
|
|
import Slider from 'rc-slider';
|
|
|
|
import Slider from 'rc-slider';
|
|
|
@ -102,14 +102,38 @@ export function Section3() {
|
|
|
|
args: [address]
|
|
|
|
args: [address]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
watch: true,
|
|
|
|
onSuccess(data) {
|
|
|
|
onSuccess(data) {
|
|
|
|
setBoomerPrice(data[0].toString());
|
|
|
|
setBoomerPrice(data[0].toString());
|
|
|
|
setBombPrice(data[1].toString());
|
|
|
|
setBombPrice(data[1].toString());
|
|
|
|
setBoomerBalance(data[2].toString());
|
|
|
|
setBoomerBalance(data[2].toString());
|
|
|
|
setBombBalance(data[3].toString());
|
|
|
|
setBombBalance(data[3].toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const radicalizeBoomersPrepare = usePrepareContractWrite({
|
|
|
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
|
|
|
functionName: 'radicalizeBoomers',
|
|
|
|
|
|
|
|
args: [boomerAmount],
|
|
|
|
|
|
|
|
overrides: {
|
|
|
|
|
|
|
|
from: address,
|
|
|
|
|
|
|
|
value: BigNumber.from((boomerPrice * boomerAmount).toString())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
const radicalizeBoomersWrite = useContractWrite(radicalizeBoomersPrepare.config);
|
|
|
|
|
|
|
|
const assembleBombsPrepare = usePrepareContractWrite({
|
|
|
|
|
|
|
|
address: contractAddress,
|
|
|
|
|
|
|
|
abi: MainABI,
|
|
|
|
|
|
|
|
enabled: isConnected,
|
|
|
|
|
|
|
|
functionName: 'assembleBombs',
|
|
|
|
|
|
|
|
args: [bombAmount],
|
|
|
|
|
|
|
|
overrides: {
|
|
|
|
|
|
|
|
from: address,
|
|
|
|
|
|
|
|
value: BigNumber.from((bombPrice * bombAmount).toString())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
const assembleBombsWrite = useContractWrite(assembleBombsPrepare.config);
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<section className="section">
|
|
|
|
<section className="section">
|
|
|
|
{isConnected &&
|
|
|
|
{isConnected &&
|
|
|
@ -120,8 +144,8 @@ export function Section3() {
|
|
|
|
<p>You have {boomerBalance} BOOMR</p>
|
|
|
|
<p>You have {boomerBalance} BOOMR</p>
|
|
|
|
<img src={Boomer} alt="" width="120px" />
|
|
|
|
<img src={Boomer} alt="" width="120px" />
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<AwesomeButton type="secondary" ripple={true}>
|
|
|
|
<AwesomeButton type="secondary" ripple={true} disabled={!radicalizeBoomersWrite.write} onPress={() => radicalizeBoomersWrite.write?.()}>
|
|
|
|
mint {boomerAmount} ({ethers.utils.formatEther((boomerPrice * boomerAmount).toString())} Ξ)
|
|
|
|
{radicalizeBoomersWrite.isLoading && <>minting {boomerAmount}</> || <>mint {boomerAmount} ({ethers.utils.formatEther((boomerPrice * boomerAmount).toString())} Ξ)</>}
|
|
|
|
</AwesomeButton>
|
|
|
|
</AwesomeButton>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<Slider className="slider" min={1} max={30} trackStyle={{
|
|
|
|
<Slider className="slider" min={1} max={30} trackStyle={{
|
|
|
@ -135,8 +159,8 @@ export function Section3() {
|
|
|
|
<p>You have {bombBalance} BOMB</p>
|
|
|
|
<p>You have {bombBalance} BOMB</p>
|
|
|
|
<img src={Bomb} alt="" width="100px" />
|
|
|
|
<img src={Bomb} alt="" width="100px" />
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<AwesomeButton type="secondary" ripple={true}>
|
|
|
|
<AwesomeButton type="secondary" ripple={true} disabled={!assembleBombsWrite.write} onPress={() => assembleBombsWrite.write?.()}>
|
|
|
|
mint {bombAmount} ({ethers.utils.formatEther((bombPrice * bombAmount).toString())} Ξ)
|
|
|
|
{assembleBombsWrite.isLoading && <>minting {bombAmount}</> || <>mint {bombAmount} ({ethers.utils.formatEther((bombPrice * bombAmount).toString())} Ξ)</>}
|
|
|
|
</AwesomeButton>
|
|
|
|
</AwesomeButton>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<Slider className="slider" min={1} max={30} trackStyle={{
|
|
|
|
<Slider className="slider" min={1} max={30} trackStyle={{
|
|
|
|