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>
|
||||
</>
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1
packages/nextjs/next-env.d.ts
vendored
1
packages/nextjs/next-env.d.ts
vendored
@@ -1,6 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
/// <reference path="./.next/types/routes.d.ts" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
@@ -15,7 +15,7 @@ export const DEFAULT_ALCHEMY_API_KEY = "cR4WnXePioePZ5fFrnSiR";
|
||||
|
||||
const scaffoldConfig = {
|
||||
// The networks on which your DApp is live
|
||||
targetNetworks: [chains.hardhat],
|
||||
targetNetworks: [chains.sepolia], //[chains.hardhat],
|
||||
// The interval at which your front-end polls the RPC servers for new data (it has no effect if you only target the local network (default is 4000))
|
||||
pollingInterval: 30000,
|
||||
// This is ours Alchemy's default API key.
|
||||
@@ -34,7 +34,7 @@ const scaffoldConfig = {
|
||||
// It's recommended to store it in an env variable:
|
||||
// .env.local for local testing, and in the Vercel/system env config for live apps.
|
||||
walletConnectProjectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || "3a8170812b534d0ff9d794f19a901d64",
|
||||
onlyLocalBurnerWallet: true,
|
||||
onlyLocalBurnerWallet: false,
|
||||
} as const satisfies ScaffoldConfig;
|
||||
|
||||
export default scaffoldConfig;
|
||||
|
||||
Reference in New Issue
Block a user