├── LICENSE
├── README.md
├── constants
└── index.js
├── next.config.js
├── package-lock.json
├── package.json
├── pages
├── _app.js
├── api
│ └── hello.js
└── index.js
├── public
├── 0.svg
├── Logo.png
├── favicon.ico
├── favicon_io
│ ├── android-chrome-192x192.png
│ ├── android-chrome-512x512.png
│ ├── apple-touch-icon.png
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ └── site.webmanifest
└── vercel.svg
└── styles
├── Home.module.css
└── globals.css
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 web3reviewer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Base Genesis NFT User
2 | 1. Create a new erc20 token using remix and this contract
3 | https://mirror.xyz/0xmoei.eth/q6bkosOnWcQ-wkZeRoVdYiMDSWXvBeR2NuLV92SnZ_g
4 | 2. Verify your contract
5 | 3. Submit contract for decoding via Dune
6 | 4. Create a new repository based on this template for the Front-end.
7 | 5. Change the TOKEN_CONTRACT_ADDRESS in constants/index.js to your newly token address.
8 | 6. Deploy it in Netlify.
9 | 7. Follow the Base instruction to submit the NFT request.
10 | https://base.mirror.xyz/hwNwqXHVoLlO8s4DZppog4DfGvM34tigaDjOWuEJQfY
11 | ```
12 | Connect deployer wallet to builder.base.org and complete the form (<2min)
13 | Do not deploy your front-end until our Mainnet GA launch in early August, when we open Base for everyone
14 | ```
15 |
--------------------------------------------------------------------------------
/constants/index.js:
--------------------------------------------------------------------------------
1 | export const TOKEN_CONTRACT_ADDRESS = "0xfF5cC26d33A84F10760718b207B1765744D0fB0A";
2 | export const TOKEN_CONTRACT_ABI = [
3 | {
4 | "anonymous": false,
5 | "inputs": [
6 | {
7 | "indexed": true,
8 | "internalType": "address",
9 | "name": "owner",
10 | "type": "address"
11 | },
12 | {
13 | "indexed": true,
14 | "internalType": "address",
15 | "name": "spender",
16 | "type": "address"
17 | },
18 | {
19 | "indexed": false,
20 | "internalType": "uint256",
21 | "name": "value",
22 | "type": "uint256"
23 | }
24 | ],
25 | "name": "Approval",
26 | "type": "event"
27 | },
28 | {
29 | "inputs": [
30 | {
31 | "internalType": "address",
32 | "name": "spender",
33 | "type": "address"
34 | },
35 | {
36 | "internalType": "uint256",
37 | "name": "amount",
38 | "type": "uint256"
39 | }
40 | ],
41 | "name": "approve",
42 | "outputs": [
43 | {
44 | "internalType": "bool",
45 | "name": "",
46 | "type": "bool"
47 | }
48 | ],
49 | "stateMutability": "nonpayable",
50 | "type": "function"
51 | },
52 | {
53 | "inputs": [
54 | {
55 | "internalType": "uint256",
56 | "name": "amount",
57 | "type": "uint256"
58 | }
59 | ],
60 | "name": "burn",
61 | "outputs": [],
62 | "stateMutability": "nonpayable",
63 | "type": "function"
64 | },
65 | {
66 | "inputs": [
67 | {
68 | "internalType": "uint256",
69 | "name": "amount",
70 | "type": "uint256"
71 | }
72 | ],
73 | "name": "mint",
74 | "outputs": [],
75 | "stateMutability": "nonpayable",
76 | "type": "function"
77 | },
78 | {
79 | "inputs": [
80 | {
81 | "internalType": "address",
82 | "name": "recipient",
83 | "type": "address"
84 | },
85 | {
86 | "internalType": "uint256",
87 | "name": "amount",
88 | "type": "uint256"
89 | }
90 | ],
91 | "name": "transfer",
92 | "outputs": [
93 | {
94 | "internalType": "bool",
95 | "name": "",
96 | "type": "bool"
97 | }
98 | ],
99 | "stateMutability": "nonpayable",
100 | "type": "function"
101 | },
102 | {
103 | "anonymous": false,
104 | "inputs": [
105 | {
106 | "indexed": true,
107 | "internalType": "address",
108 | "name": "from",
109 | "type": "address"
110 | },
111 | {
112 | "indexed": true,
113 | "internalType": "address",
114 | "name": "to",
115 | "type": "address"
116 | },
117 | {
118 | "indexed": false,
119 | "internalType": "uint256",
120 | "name": "value",
121 | "type": "uint256"
122 | }
123 | ],
124 | "name": "Transfer",
125 | "type": "event"
126 | },
127 | {
128 | "inputs": [
129 | {
130 | "internalType": "address",
131 | "name": "sender",
132 | "type": "address"
133 | },
134 | {
135 | "internalType": "address",
136 | "name": "recipient",
137 | "type": "address"
138 | },
139 | {
140 | "internalType": "uint256",
141 | "name": "amount",
142 | "type": "uint256"
143 | }
144 | ],
145 | "name": "transferFrom",
146 | "outputs": [
147 | {
148 | "internalType": "bool",
149 | "name": "",
150 | "type": "bool"
151 | }
152 | ],
153 | "stateMutability": "nonpayable",
154 | "type": "function"
155 | },
156 | {
157 | "inputs": [
158 | {
159 | "internalType": "address",
160 | "name": "",
161 | "type": "address"
162 | },
163 | {
164 | "internalType": "address",
165 | "name": "",
166 | "type": "address"
167 | }
168 | ],
169 | "name": "allowance",
170 | "outputs": [
171 | {
172 | "internalType": "uint256",
173 | "name": "",
174 | "type": "uint256"
175 | }
176 | ],
177 | "stateMutability": "view",
178 | "type": "function"
179 | },
180 | {
181 | "inputs": [
182 | {
183 | "internalType": "address",
184 | "name": "",
185 | "type": "address"
186 | }
187 | ],
188 | "name": "balanceOf",
189 | "outputs": [
190 | {
191 | "internalType": "uint256",
192 | "name": "",
193 | "type": "uint256"
194 | }
195 | ],
196 | "stateMutability": "view",
197 | "type": "function"
198 | },
199 | {
200 | "inputs": [],
201 | "name": "decimals",
202 | "outputs": [
203 | {
204 | "internalType": "uint8",
205 | "name": "",
206 | "type": "uint8"
207 | }
208 | ],
209 | "stateMutability": "view",
210 | "type": "function"
211 | },
212 | {
213 | "inputs": [],
214 | "name": "name",
215 | "outputs": [
216 | {
217 | "internalType": "string",
218 | "name": "",
219 | "type": "string"
220 | }
221 | ],
222 | "stateMutability": "view",
223 | "type": "function"
224 | },
225 | {
226 | "inputs": [],
227 | "name": "symbol",
228 | "outputs": [
229 | {
230 | "internalType": "string",
231 | "name": "",
232 | "type": "string"
233 | }
234 | ],
235 | "stateMutability": "view",
236 | "type": "function"
237 | },
238 | {
239 | "inputs": [],
240 | "name": "totalSupply",
241 | "outputs": [
242 | {
243 | "internalType": "uint256",
244 | "name": "",
245 | "type": "uint256"
246 | }
247 | ],
248 | "stateMutability": "view",
249 | "type": "function"
250 | }
251 | ];
252 |
--------------------------------------------------------------------------------
/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: true,
4 | swcMinify: true,
5 | }
6 |
7 | module.exports = nextConfig
8 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "ethers": "^5.7.1",
13 | "next": "12.3.1",
14 | "react": "18.2.0",
15 | "react-dom": "18.2.0",
16 | "web3modal": "^1.9.9"
17 | },
18 | "devDependencies": {
19 | "eslint": "8.25.0",
20 | "eslint-config-next": "12.3.1"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/pages/_app.js:
--------------------------------------------------------------------------------
1 | import '../styles/globals.css'
2 |
3 | function MyApp({ Component, pageProps }) {
4 | return
5 | }
6 |
7 | export default MyApp
8 |
--------------------------------------------------------------------------------
/pages/api/hello.js:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 |
3 | export default function handler(req, res) {
4 | res.status(200).json({ name: 'John Doe' })
5 | }
6 |
--------------------------------------------------------------------------------
/pages/index.js:
--------------------------------------------------------------------------------
1 | import { BigNumber, Contract, providers, utils } from "ethers";
2 | import Head from "next/head";
3 | import React, { useEffect, useRef, useState } from "react";
4 | import Web3Modal from "web3modal";
5 | import { TOKEN_CONTRACT_ABI, TOKEN_CONTRACT_ADDRESS } from "../constants";
6 | import styles from "../styles/Home.module.css";
7 |
8 | export default function Home() {
9 | const zero = BigNumber.from(0);
10 | const [walletConnected, setWalletConnected] = useState(false);
11 | const [loading, setLoading] = useState(false);
12 | const [tokensToBeClaimed, setTokensToBeClaimed] = useState(zero);
13 | const [balanceOfCryptoDevTokens, setBalanceOfCryptoDevTokens] =
14 | useState(zero);
15 | const [tokenAmount, setTokenAmount] = useState(zero);
16 | const [tokensMinted, setTokensMinted] = useState(zero);
17 | const [isOwner, setIsOwner] = useState(false);
18 | const web3ModalRef = useRef();
19 |
20 | const getTokensToBeClaimed = async () => {
21 | const MAX_TOTAL_SUPPLY = BigInt(1000000000000000 * 10 ** 18);
22 | setTokensToBeClaimed(69000000);
23 | };
24 |
25 | const getBalanceOfFCKFTokens = async () => {
26 | try {
27 | const provider = await getProviderOrSigner();
28 | const tokenContract = new Contract(
29 | TOKEN_CONTRACT_ADDRESS,
30 | TOKEN_CONTRACT_ABI,
31 | provider
32 | );
33 | const signer = await getProviderOrSigner(true);
34 | const address = await signer.getAddress();
35 | const balance = await tokenContract.balanceOf(address);
36 | setBalanceOfCryptoDevTokens(balance);
37 | } catch (err) {
38 | console.error(err);
39 | setBalanceOfCryptoDevTokens(zero);
40 | }
41 | };
42 |
43 | const burnMemeToken = async (burnAmount) => {
44 | try {
45 | const signer = await getProviderOrSigner(true);
46 | const tokenContract = new Contract(
47 | TOKEN_CONTRACT_ADDRESS,
48 | TOKEN_CONTRACT_ABI,
49 | signer
50 | );
51 | console.log("Amount Eth: ", burnAmount);
52 | const tx = await tokenContract.burn(BigInt(burnAmount * 10 ** 18));
53 | setLoading(true);
54 | // wait for the transaction to get mined
55 | await tx.wait();
56 | setLoading(false);
57 | window.alert("YOU BURNED YOUR TOKENS");
58 | await getBalanceOfFCKFTokens();
59 | await getTotalTokensMinted();
60 | await getTokensToBeClaimed();
61 | } catch (err) {
62 | console.error(err);
63 | }
64 | };
65 |
66 | const getTotalTokensMinted = async () => {
67 | try {
68 | const provider = await getProviderOrSigner();
69 | const tokenContract = new Contract(
70 | TOKEN_CONTRACT_ADDRESS,
71 | TOKEN_CONTRACT_ABI,
72 | provider
73 | );
74 | // Get all the tokens that have been minted
75 | const _tokensMinted = await tokenContract.totalSupply();
76 | setTokensMinted(_tokensMinted);
77 | } catch (err) {
78 | console.error(err);
79 | }
80 | };
81 |
82 | const getOwner = async () => {
83 | try {
84 | const provider = await getProviderOrSigner();
85 | const tokenContract = new Contract(
86 | TOKEN_CONTRACT_ADDRESS,
87 | TOKEN_CONTRACT_ABI,
88 | provider
89 | );
90 | const _owner = await tokenContract.owner();
91 | const signer = await getProviderOrSigner(true);
92 | const address = await signer.getAddress();
93 | if (address.toLowerCase() === _owner.toLowerCase()) {
94 | setIsOwner(true);
95 | }
96 | } catch (err) {
97 | console.error(err.message);
98 | }
99 | };
100 |
101 | const getProviderOrSigner = async (needSigner = false) => {
102 | const provider = await web3ModalRef.current.connect();
103 | const web3Provider = new providers.Web3Provider(provider);
104 | const { chainId } = await web3Provider.getNetwork();
105 | if (chainId !== 8453) {
106 | window.alert("Change the network to Base Mainet");
107 | throw new Error("Change network to Base Mainet");
108 | }
109 |
110 | if (needSigner) {
111 | const signer = web3Provider.getSigner();
112 | return signer;
113 | }
114 | return web3Provider;
115 | };
116 |
117 | const connectWallet = async () => {
118 | try {
119 | await getProviderOrSigner();
120 | setWalletConnected(true);
121 | } catch (err) {
122 | console.error(err);
123 | }
124 | };
125 |
126 | useEffect(() => {
127 | if (!walletConnected) {
128 | web3ModalRef.current = new Web3Modal({
129 | network: "bsc",
130 | providerOptions: {},
131 | disableInjectedProvider: false,
132 | });
133 | connectWallet();
134 | getTotalTokensMinted();
135 | getBalanceOfFCKFTokens();
136 | getTokensToBeClaimed();
137 | }
138 | }, [walletConnected]);
139 | const renderButton = () => {
140 | if (loading) {
141 | return (
142 |
143 | Loading...
144 |
145 | );
146 | }
147 | // if owner is connected, withdrawCoins() is called
148 | /*if (walletConnected && isOwner) {
149 | return (
150 |
151 |
152 | Withdraw Coins
153 |
154 |
155 | );
156 | }*/
157 | // If user doesn't have any tokens to claim, show the mint button
158 | return (
159 |
160 |
161 | setTokenAmount(e.target.value)}
165 | className={styles.input}
166 | />
167 |
168 |
169 |
0)}
172 | onClick={() => burnMemeToken(tokenAmount)}
173 | >
174 | Burn Tokens
175 |
176 |
177 | );
178 | };
179 |
180 | return (
181 |
182 |
183 |
Token Burner
184 |
185 |
186 |
187 |
188 |
Welcome to BURNER DAPP!
189 | {walletConnected ? (
190 |
191 |
192 | {/* Format Ether helps us in converting a BigNumber to string */}
193 | You have minted{" "}
194 | {parseFloat(
195 | utils.formatEther(balanceOfCryptoDevTokens)
196 | ).toLocaleString()}{" "}
197 | token
198 |
199 |
200 | {/* Format Ether helps us in converting a BigNumber to string */}
201 | Overall{" "}
202 | {parseFloat(utils.formatEther(tokensMinted)).toLocaleString()}{" "}
203 | have been minted!!!
204 |
205 | {renderButton()}
206 |
207 | ) : (
208 |
209 | Connect your wallet
210 |
211 | )}
212 |
213 |
214 |
219 |
220 | );
221 | }
222 |
--------------------------------------------------------------------------------
/public/0.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/Logo.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/favicon.ico
--------------------------------------------------------------------------------
/public/favicon_io/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/favicon_io/android-chrome-192x192.png
--------------------------------------------------------------------------------
/public/favicon_io/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/favicon_io/android-chrome-512x512.png
--------------------------------------------------------------------------------
/public/favicon_io/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/favicon_io/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon_io/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/favicon_io/favicon-16x16.png
--------------------------------------------------------------------------------
/public/favicon_io/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xmoei/basedapp/c1cf0d41de9cc1515f7e84d7f18b3203ea7e100a/public/favicon_io/favicon-32x32.png
--------------------------------------------------------------------------------
/public/favicon_io/site.webmanifest:
--------------------------------------------------------------------------------
1 | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
--------------------------------------------------------------------------------
/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/styles/Home.module.css:
--------------------------------------------------------------------------------
1 | .main {
2 | min-height: 90vh;
3 | display: flex;
4 | flex-direction: row;
5 | justify-content: center;
6 | align-items: center;
7 | font-family: "Courier New", Courier, monospace;
8 | }
9 |
10 | .footer {
11 | display: flex;
12 | padding: 2rem 0;
13 | border-top: 1px solid #eaeaea;
14 | justify-content: center;
15 | align-items: center;
16 | }
17 |
18 | .image {
19 | width: 70%;
20 | height: 50%;
21 | margin-left: 20%;
22 | }
23 |
24 | .input {
25 | width: 200px;
26 | height: 100%;
27 | padding: 1%;
28 | margin-bottom: 2%;
29 | box-shadow: 0 0 15px 4px rgba(0, 0, 0, 0.06);
30 | border-radius: 10px;
31 | }
32 |
33 | .title {
34 | font-size: 2rem;
35 | margin: 2rem 0;
36 | }
37 |
38 | .description {
39 | line-height: 1;
40 | margin: 2rem 0;
41 | font-size: 1.2rem;
42 | }
43 |
44 | .button {
45 | border-radius: 4px;
46 | background-color: blue;
47 | border: none;
48 | color: #ffffff;
49 | font-size: 15px;
50 | padding: 5px;
51 | width: 100px;
52 | cursor: pointer;
53 | margin-bottom: 2%;
54 | }
55 | @media (max-width: 1000px) {
56 | .main {
57 | width: 100%;
58 | flex-direction: column;
59 | justify-content: center;
60 | align-items: center;
61 | }
62 | }
--------------------------------------------------------------------------------
/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
18 | @media (prefers-color-scheme: dark) {
19 | html {
20 | color-scheme: dark;
21 | }
22 | body {
23 | color: white;
24 | background: black;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------