feat: finish challenge
Some checks failed
Lint / ci (lts/*, ubuntu-latest) (push) Has been cancelled
Some checks failed
Lint / ci (lts/*, ubuntu-latest) (push) Has been cancelled
This commit is contained in:
@@ -12,11 +12,11 @@ const Events: NextPage = () => {
|
||||
eventName: "BuyTokens",
|
||||
});
|
||||
|
||||
// // SellTokens Events
|
||||
// const { data: sellTokenEvents, isLoading: isSellEventsLoading } = useScaffoldEventHistory({
|
||||
// contractName: "Vendor",
|
||||
// eventName: "SellTokens",
|
||||
// });
|
||||
// SellTokens Events
|
||||
const { data: sellTokenEvents, isLoading: isSellEventsLoading } = useScaffoldEventHistory({
|
||||
contractName: "Vendor",
|
||||
eventName: "SellTokens",
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex items-center flex-col flex-grow pt-10">
|
||||
@@ -66,7 +66,7 @@ const Events: NextPage = () => {
|
||||
</div>
|
||||
|
||||
{/* SellTokens Events */}
|
||||
{/* <div className="mt-14">
|
||||
<div className="mt-14">
|
||||
<div className="text-center mb-4">
|
||||
<span className="block text-2xl font-bold">Sell Token Events</span>
|
||||
</div>
|
||||
@@ -108,7 +108,7 @@ const Events: NextPage = () => {
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -33,18 +33,18 @@ const TokenVendor: NextPage = () => {
|
||||
const { writeContractAsync: writeVendorAsync } = useScaffoldWriteContract({ contractName: "Vendor" });
|
||||
const { writeContractAsync: writeYourTokenAsync } = useScaffoldWriteContract({ contractName: "YourToken" });
|
||||
|
||||
// const { data: vendorTokenBalance } = useScaffoldReadContract({
|
||||
// contractName: "YourToken",
|
||||
// functionName: "balanceOf",
|
||||
// args: [vendorContractData?.address],
|
||||
// });
|
||||
const { data: vendorTokenBalance } = useScaffoldReadContract({
|
||||
contractName: "YourToken",
|
||||
functionName: "balanceOf",
|
||||
args: [vendorContractData?.address],
|
||||
});
|
||||
|
||||
// const { data: vendorEthBalance } = useWatchBalance({ address: vendorContractData?.address });
|
||||
const { data: vendorEthBalance } = useWatchBalance({ address: vendorContractData?.address });
|
||||
|
||||
// const { data: tokensPerEth } = useScaffoldReadContract({
|
||||
// contractName: "Vendor",
|
||||
// functionName: "tokensPerEth",
|
||||
// });
|
||||
const { data: tokensPerEth } = useScaffoldReadContract({
|
||||
contractName: "Vendor",
|
||||
functionName: "tokensPerEth",
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -57,8 +57,7 @@ const TokenVendor: NextPage = () => {
|
||||
<span className="font-bold ml-1">{yourTokenSymbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* Vendor Balances */}
|
||||
{/* <hr className="w-full border-secondary my-3" />
|
||||
<hr className="w-full border-secondary my-3" />
|
||||
<div>
|
||||
Vendor token balance:{" "}
|
||||
<div className="inline-flex items-center justify-center">
|
||||
@@ -69,11 +68,10 @@ const TokenVendor: NextPage = () => {
|
||||
<div>
|
||||
Vendor eth balance: {Number(formatEther(vendorEthBalance?.value || 0n)).toFixed(4)}
|
||||
<span className="font-bold ml-1">ETH</span>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Buy Tokens */}
|
||||
{/* <div className="flex flex-col items-center space-y-4 bg-base-100 shadow-lg shadow-secondary border-8 border-secondary rounded-xl p-6 mt-8 w-full max-w-lg">
|
||||
<div className="flex flex-col items-center space-y-4 bg-base-100 shadow-lg shadow-secondary border-8 border-secondary rounded-xl p-6 mt-8 w-full max-w-lg">
|
||||
<div className="text-xl">Buy tokens</div>
|
||||
<div>{tokensPerEth?.toString() || 0} tokens per ETH</div>
|
||||
|
||||
@@ -98,7 +96,7 @@ const TokenVendor: NextPage = () => {
|
||||
>
|
||||
Buy Tokens
|
||||
</button>
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
{!!yourTokenBalance && (
|
||||
<div className="flex flex-col items-center space-y-4 bg-base-100 shadow-lg shadow-secondary border-8 border-secondary rounded-xl p-6 mt-8 w-full max-w-lg">
|
||||
@@ -132,7 +130,7 @@ const TokenVendor: NextPage = () => {
|
||||
)}
|
||||
|
||||
{/* Sell Tokens */}
|
||||
{/* {!!yourTokenBalance && (
|
||||
{!!yourTokenBalance && (
|
||||
<div className="flex flex-col items-center space-y-4 bg-base-100 shadow-lg shadow-secondary border-8 border-secondary rounded-xl p-6 mt-8 w-full max-w-lg">
|
||||
<div className="text-xl">Sell tokens</div>
|
||||
<div>{tokensPerEth?.toString() || 0} tokens per ETH</div>
|
||||
@@ -180,7 +178,7 @@ const TokenVendor: NextPage = () => {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)} */}
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user