├── config └── default.json ├── readme_images ├── guide-site.png └── guide-terminal.png ├── routes ├── userRoutes.ts ├── authRoutes.ts ├── walletRoutes.ts └── claimRoutes.ts ├── utils ├── db.ts ├── functions.ts ├── interfaces.ts └── constants.ts ├── controllers ├── userController.ts ├── authController.ts ├── claimController.ts └── walletController.ts ├── README.md ├── server.ts ├── middlewares └── authMiddleware.ts ├── package.json ├── .gitignore └── tsconfig.json /config/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "jwtSecret": "netzero" 3 | } -------------------------------------------------------------------------------- /readme_images/guide-site.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dejan-Teofilovic/netzero-backend/HEAD/readme_images/guide-site.png -------------------------------------------------------------------------------- /readme_images/guide-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dejan-Teofilovic/netzero-backend/HEAD/readme_images/guide-terminal.png -------------------------------------------------------------------------------- /routes/userRoutes.ts: -------------------------------------------------------------------------------- 1 | import express, { Router } from "express"; 2 | import { getUserTypes } from "../controllers/userController"; 3 | 4 | const authMiddleware = require("../middlewares/authMiddleware"); 5 | const router: Router = express.Router(); 6 | 7 | router.get("/get-user-types", getUserTypes); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /utils/db.ts: -------------------------------------------------------------------------------- 1 | import ServerlessMysql from "serverless-mysql"; 2 | import { DB_PORT } from "./constants"; 3 | 4 | const { DB_NAME, DB_USERNAME, DB_PASSWORD, DB_HOST } = process.env; 5 | 6 | const db = ServerlessMysql({ 7 | config: { 8 | database: DB_NAME, 9 | user: DB_USERNAME, 10 | password: DB_PASSWORD, 11 | host: DB_HOST, 12 | port: DB_PORT 13 | } 14 | }); 15 | 16 | module.exports = db; 17 | -------------------------------------------------------------------------------- /utils/functions.ts: -------------------------------------------------------------------------------- 1 | export const getCurrentDateTime = () => { 2 | let currentMoment = new Date(); 3 | let dd = String(currentMoment.getDate()).padStart(2, "0"); 4 | let mm = String(currentMoment.getMonth() + 1).padStart(2, "0"); //January is 0! 5 | let yyyy = currentMoment.getFullYear(); 6 | let hh = currentMoment.getHours(); 7 | let min = currentMoment.getMinutes(); 8 | let ss = currentMoment.getSeconds(); 9 | 10 | return `${yyyy}-${mm}-${dd} ${hh}:${min}:${ss}`; 11 | }; 12 | -------------------------------------------------------------------------------- /routes/authRoutes.ts: -------------------------------------------------------------------------------- 1 | import express, { Router } from "express"; 2 | import { 3 | login, 4 | signup, 5 | checkExpirationOfToken, 6 | } from "../controllers/authController"; 7 | 8 | const authMiddleware = require("../middlewares/authMiddleware"); 9 | const router: Router = express.Router(); 10 | 11 | router.post("/login", login); 12 | router.post("/signup", signup); 13 | router.get("/check-expiration-of-token", authMiddleware, checkExpirationOfToken); 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /controllers/userController.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import { IUserType } from "../utils/interfaces"; 3 | const db = require("../utils/db"); 4 | 5 | export const getUserTypes = (req: Request, res: Response) => { 6 | db.query("SELECT * FROM user_types;") 7 | .then((results: Array) => { 8 | return res.json(results); 9 | }) 10 | .catch((error: Error) => { 11 | console.log(">>>>>>>>> error of getUserTypes => ", error); 12 | return res.sendStatus(500); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /routes/walletRoutes.ts: -------------------------------------------------------------------------------- 1 | import express, { Router } from "express"; 2 | import { 3 | connectWallet, 4 | enableMint, 5 | sendEthToOffsetter 6 | } from "../controllers/walletController"; 7 | 8 | const authMiddleware = require("../middlewares/authMiddleware"); 9 | const router: Router = express.Router(); 10 | 11 | router.post("/connect-wallet", authMiddleware, connectWallet); 12 | router.get("/enable-mint", authMiddleware, enableMint); 13 | router.post("/send-eth-to-offsetter", authMiddleware, sendEthToOffsetter); 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /routes/claimRoutes.ts: -------------------------------------------------------------------------------- 1 | import express, { Router } from "express"; 2 | import { 3 | claim, 4 | getClaimById, 5 | getClaimsByUserId, 6 | getMintableClaims 7 | } from "../controllers/claimController"; 8 | 9 | const authMiddleware = require("../middlewares/authMiddleware"); 10 | const router: Router = express.Router(); 11 | 12 | router.post("/create", authMiddleware, claim); 13 | router.get("/get-claims-by-user-id/:userId", authMiddleware, getClaimsByUserId); 14 | router.get("/get-mintable-claims", authMiddleware, getMintableClaims); 15 | router.get("/get-claim-by-id/:claimId", authMiddleware, getClaimById); 16 | 17 | module.exports = router; 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Netzero (backend) 2 | 3 | ## Live site 4 | [![Live site](readme_images/guide-site.png)](https://netzerocarbontoken.com) 5 | 6 | ## Contact info 7 | - **Email:** dejanteofilovic2@gmail.com 8 | - **Discord:** [dejan_teofilovic](https://discord.gg/PztT2r5U) 9 | 10 | ## Release date 11 | Mar 20, 2023 12 | 13 | ## Environment 14 | - `Node.js v18.12.1` 15 | 16 | ## Stack 17 | - **Framework:** `Express.js v4.18.2` 18 | - **Database:** `MySQL v8.0.27-winx64` 19 | 20 | ## How to run the project. 21 | 1. Please open terminal window in the root directory. 22 | 2. Please run command `npm run start` in it. 23 | 24 | ![guide-terminal](readme_images/guide-terminal.png) -------------------------------------------------------------------------------- /server.ts: -------------------------------------------------------------------------------- 1 | import express, { Express } from "express"; 2 | import dotenv from "dotenv"; 3 | import cors from "cors"; 4 | 5 | dotenv.config(); 6 | 7 | const app: Express = express(); 8 | 9 | app.use( 10 | cors({ 11 | origin: "*" 12 | }) 13 | ); 14 | 15 | // Init Middleware 16 | app.use(express.json()); 17 | 18 | // Define Routes 19 | app.use("/api/auth", require("./routes/authRoutes")); 20 | app.use("/api/user", require("./routes/userRoutes")); 21 | app.use("/api/wallet", require("./routes/walletRoutes")); 22 | app.use("/api/claim", require("./routes/claimRoutes")); 23 | 24 | const PORT = process.env.PORT || 5000; 25 | 26 | app.listen(PORT, () => console.log(`Server started on port ${PORT}`)); 27 | -------------------------------------------------------------------------------- /middlewares/authMiddleware.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | const jwt = require("jsonwebtoken"); 3 | const config = require("config"); 4 | 5 | module.exports = function (req: Request, res: Response, next: Function) { 6 | // Get token from header 7 | const token = req.header("x-auth-token"); 8 | 9 | // Check if not token 10 | if (!token) { 11 | return res.status(401).json({ msg: "No token, authorization denied" }); 12 | } 13 | 14 | // Verify token 15 | try { 16 | jwt.verify(token, config.get("jwtSecret"), (error: Error, decoded: any) => { 17 | if (error) { 18 | return res.status(401).json({ msg: "Token is not valid" }); 19 | } else { 20 | // req.user = decoded.user; 21 | next(); 22 | } 23 | }); 24 | } catch (err) { 25 | res.status(500).json({ msg: "Server Error" }); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netzero-backend", 3 | "version": "1.0.0", 4 | "description": "The backend of NetZero", 5 | "main": "server.ts", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "nodemon server", 9 | "start": "node dist/server", 10 | "build": "npx tsc" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/Dejan-Teofilovic/netzero-backend.git" 15 | }, 16 | "keywords": [ 17 | "gls" 18 | ], 19 | "author": "", 20 | "license": "ISC", 21 | "bugs": { 22 | "url": "https://github.com/Dejan-Teofilovic/netzero-backend/issues" 23 | }, 24 | "homepage": "https://github.com/Dejan-Teofilovic/netzero-backend#readme", 25 | "dependencies": { 26 | "bcryptjs": "^2.4.3", 27 | "concurrently": "^7.6.0", 28 | "config": "^3.3.9", 29 | "cors": "^2.8.5", 30 | "dotenv": "^16.0.3", 31 | "ethers": "^5.7.2", 32 | "express": "^4.18.2", 33 | "jsonwebtoken": "^9.0.0", 34 | "serverless-mysql": "^1.5.4" 35 | }, 36 | "devDependencies": { 37 | "@types/cors": "^2.8.13", 38 | "@types/express": "^4.17.17", 39 | "@types/node": "^18.14.0", 40 | "nodemon": "^2.0.20", 41 | "typescript": "^4.9.5" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /utils/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface IOkPacket { 2 | fieldCount: number; 3 | affectedRows: number; 4 | insertId: number; 5 | serverStatus: number; 6 | warningCount: number; 7 | message: string; 8 | protocol41: boolean; 9 | changedRows: number; 10 | } 11 | 12 | export interface IUserType { 13 | id: number; 14 | type: string; 15 | } 16 | 17 | export interface IMyClaim { 18 | id: number; 19 | id_wallet_address: number; 20 | wallet_address: string; 21 | token_amount: number; 22 | eth_amount: number; 23 | carbon_amount: number; 24 | fee_amount: number; 25 | mintable_token_amount: number; 26 | created_at: string; 27 | updated_at: string; 28 | } 29 | 30 | export interface IMintableClaim { 31 | id: number; 32 | id_wallet_address: number; 33 | id_user: number; 34 | user_first_name: string; 35 | user_last_name: string; 36 | wallet_address: string; 37 | token_amount: number; 38 | eth_amount: number; 39 | carbon_amount: number; 40 | fee_amount: number; 41 | mintable_token_amount: number; 42 | created_at: string; 43 | updated_at: string; 44 | } 45 | 46 | export interface IClaim { 47 | id: number; 48 | id_wallet_address: number; 49 | token_amount: number; 50 | eth_amount: number; 51 | carbon_amount: number; 52 | fee_amount: number; 53 | mintable_token_amount: number; 54 | created_at: string; 55 | updated_at: string; 56 | } 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /controllers/authController.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import { getCurrentDateTime } from "../utils/functions"; 3 | const bcrypt = require("bcryptjs"); 4 | const config = require("config"); 5 | const jwt = require("jsonwebtoken"); 6 | const db = require("../utils/db"); 7 | 8 | /** 9 | * Admin login 10 | */ 11 | export const login = async (req: Request, res: Response) => { 12 | const { email, password } = req.body; 13 | const currentDateTime = getCurrentDateTime(); 14 | const user = await ( 15 | await db.query("SELECT * FROM users WHERE email = ?;", [email]) 16 | )[0]; 17 | 18 | if (!user) { 19 | return res.sendStatus(404); 20 | } 21 | 22 | const isMatch = await bcrypt.compare(password, user.password); 23 | 24 | if (!isMatch) { 25 | return res.sendStatus(403); 26 | } 27 | 28 | await db.query("UPDATE users SET last_logged_at = ?;", [currentDateTime]); 29 | 30 | jwt.sign( 31 | { user }, 32 | config.get("jwtSecret"), 33 | { expiresIn: "5 days" }, 34 | (error: Error, token: string) => { 35 | if (error) { 36 | return res.sendStatus(500); 37 | } 38 | return res.json(token); 39 | } 40 | ); 41 | }; 42 | 43 | /** 44 | * Admin signup 45 | */ 46 | export const signup = async (req: Request, res: Response) => { 47 | try { 48 | const { firstName, lastName, email, password, userTypeId } = req.body; 49 | const currentDateTime = getCurrentDateTime(); 50 | const user = await ( 51 | await db.query("SELECT * FROM users WHERE email = ?;", [email]) 52 | )[0]; 53 | if (user) { 54 | return res.sendStatus(400); 55 | } 56 | 57 | const salt = await bcrypt.genSalt(10); 58 | const cryptedPassword = await bcrypt.hash(password, salt); 59 | 60 | const { insertId } = await db.query( 61 | "INSERT INTO users (first_name, last_name, email, password, created_at, last_logged_at, id_user_type) VALUES (?, ?, ?, ?, ?, ?, ?);", 62 | [ 63 | firstName, 64 | lastName, 65 | email, 66 | cryptedPassword, 67 | currentDateTime, 68 | currentDateTime, 69 | userTypeId 70 | ] 71 | ); 72 | 73 | const createdUser = await ( 74 | await db.query("SELECT * FROM users WHERE id = ?;", [insertId]) 75 | )[0]; 76 | 77 | jwt.sign( 78 | { user: createdUser }, 79 | config.get("jwtSecret"), 80 | { expiresIn: "5 days" }, 81 | (error: Error, token: string) => { 82 | if (error) { 83 | return res.sendStatus(500); 84 | } 85 | return res.json(token); 86 | } 87 | ); 88 | } catch (error) { 89 | console.log(">>>>>>>> error of signup => ", error); 90 | return res.sendStatus(500); 91 | } 92 | }; 93 | 94 | /** 95 | * Check whether admin's access token is expired or not. 96 | */ 97 | export const checkExpirationOfToken = async (req: Request, res: Response) => { 98 | return res.sendStatus(200); 99 | }; 100 | -------------------------------------------------------------------------------- /controllers/claimController.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import { getCurrentDateTime } from "../utils/functions"; 3 | import { IMyClaim, IMintableClaim, IClaim } from "../utils/interfaces"; 4 | const db = require("../utils/db"); 5 | 6 | /* Get the claims of a user */ 7 | export const getClaimsByUserId = (req: Request, res: Response) => { 8 | const { userId } = req.params; 9 | db.query( 10 | ` 11 | SELECT 12 | claims.*, 13 | wallet_addresses.wallet_address 14 | FROM claims 15 | LEFT JOIN wallet_addresses ON claims.id_wallet_address = wallet_addresses.id 16 | LEFT JOIN users ON wallet_addresses.id_user = users.id 17 | WHERE users.id = ?; 18 | `, 19 | [userId] 20 | ) 21 | .then((results: Array) => { 22 | return res.json(results); 23 | }) 24 | .catch((error: Error) => { 25 | console.log(">>>>>>>> error of getClaimByUserId => ", error); 26 | return res.sendStatus(500); 27 | }); 28 | }; 29 | 30 | /* Claim new tokens */ 31 | export const claim = async (req: Request, res: Response) => { 32 | const { tokenAmount, ethAmount, carbonAmount, feeAmount, walletAddressId } = 33 | req.body; 34 | const currentDateTime = getCurrentDateTime(); 35 | 36 | try { 37 | await db.query( 38 | "INSERT INTO claims(id_wallet_address, token_amount, eth_amount, carbon_amount, fee_amount, mintable_token_amount, created_at) VALUES(?, ?, ?, ?, ?, ?, ?);", 39 | [ 40 | walletAddressId, 41 | tokenAmount, 42 | ethAmount, 43 | carbonAmount, 44 | feeAmount, 45 | tokenAmount, 46 | currentDateTime 47 | ] 48 | ); 49 | return res.sendStatus(200); 50 | } catch (error) { 51 | console.log(">>>>>> error of claim => ", error); 52 | return res.sendStatus(500); 53 | } 54 | }; 55 | 56 | /* Get mintable claims */ 57 | export const getMintableClaims = (req: Request, res: Response) => { 58 | db.query( 59 | ` 60 | SELECT 61 | claims.*, 62 | wallet_addresses.wallet_address, 63 | wallet_addresses.id_user, 64 | users.first_name AS user_first_name, 65 | users.last_name AS user_last_name 66 | FROM claims 67 | LEFT JOIN wallet_addresses ON claims.id_wallet_address = wallet_addresses.id 68 | LEFT JOIN users ON wallet_addresses.id_user = users.id 69 | WHERE claims.mintable_token_amount > 0; 70 | ` 71 | ) 72 | .then((results: Array) => { 73 | return res.json(results); 74 | }) 75 | .catch((error: Error) => { 76 | console.log(">>>>>>>> error of getClaimByUserId => ", error); 77 | return res.sendStatus(500); 78 | }); 79 | }; 80 | 81 | /* Get claim by its id */ 82 | export const getClaimById = (req: Request, res: Response) => { 83 | const { claimId } = req.params; 84 | db.query( 85 | ` 86 | SELECT 87 | claims.*, 88 | wallet_addresses.wallet_address 89 | FROM claims 90 | LEFT JOIN wallet_addresses ON wallet_addresses.id = claims.id_wallet_address 91 | WHERE claims.id = ?; 92 | `, 93 | [Number(claimId)] 94 | ) 95 | .then((results: Array) => { 96 | return res.json(results[0]); 97 | }) 98 | .catch((error: Error) => { 99 | console.log(">>>>>>> error of getClaimById => ", error); 100 | return res.sendStatus(500); 101 | }); 102 | }; 103 | -------------------------------------------------------------------------------- /controllers/walletController.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "ethers"; 2 | import { Request, Response } from "express"; 3 | import { 4 | ADMIN_WALLET_ADDRESS, 5 | CHAIN_ID, 6 | CONTRACT_ABI, 7 | CONTRACT_ADDRESS, 8 | RPC_URL 9 | } from "../utils/constants"; 10 | import { getCurrentDateTime } from "../utils/functions"; 11 | const db = require("../utils/db"); 12 | 13 | /* Connect wallet */ 14 | export const connectWallet = async (req: Request, res: Response) => { 15 | const { userId, walletAddress } = req.body; 16 | try { 17 | const existedWalletAddress = ( 18 | await db.query( 19 | "SELECT * FROM wallet_addresses WHERE id_user = ? AND wallet_address = ?;", 20 | [userId, walletAddress] 21 | ) 22 | )[0]; 23 | 24 | if (existedWalletAddress) { 25 | return res.json(existedWalletAddress); 26 | } else { 27 | const { insertId } = await db.query( 28 | "INSERT INTO wallet_addresses(id_user, wallet_address) VALUES(?, ?);", 29 | [userId, walletAddress] 30 | ); 31 | return res.json({ 32 | id: insertId, 33 | id_user: userId, 34 | wallet_address: walletAddress 35 | }); 36 | } 37 | } catch (error) {} 38 | }; 39 | 40 | /* Enable mint */ 41 | export const enableMint = async (req: Request, res: Response) => { 42 | const { PRIVATE_KEY_OF_ADMIN_WALLET } = process.env; 43 | 44 | try { 45 | const network = ethers.providers.getNetwork(CHAIN_ID); 46 | const provider = new ethers.providers.JsonRpcProvider(RPC_URL, network); 47 | const signer = new ethers.Wallet( 48 | PRIVATE_KEY_OF_ADMIN_WALLET || "", 49 | provider 50 | ); 51 | const contract = new ethers.Contract( 52 | CONTRACT_ADDRESS, 53 | CONTRACT_ABI, 54 | signer 55 | ); 56 | const tx = await contract.setMintable(true, { from: signer.address }); 57 | await tx.wait(); 58 | return res.sendStatus(200); 59 | } catch (error) { 60 | console.log(">>>>>>> error of enableMint => ", error); 61 | return res.sendStatus(500); 62 | } 63 | }; 64 | 65 | /* Send Ethereum to the offsetter's wallet */ 66 | export const sendEthToOffsetter = async (req: Request, res: Response) => { 67 | const { 68 | claimId, 69 | walletAddress, 70 | ethAmount, 71 | feeAmount, 72 | tokenAmount, 73 | carbonAmount, 74 | claimedTokenAmount 75 | } = req.body; 76 | const { PRIVATE_KEY_OF_ADMIN_WALLET } = process.env; 77 | console.log(">>>>>>> req.body => ", req.body); 78 | try { 79 | const network = ethers.providers.getNetwork(CHAIN_ID); 80 | const provider = new ethers.providers.JsonRpcProvider(RPC_URL, network); 81 | const signer = new ethers.Wallet( 82 | PRIVATE_KEY_OF_ADMIN_WALLET || "", 83 | provider 84 | ); 85 | const tx = await signer.sendTransaction({ 86 | to: walletAddress, 87 | value: ethers.utils.parseEther(`${Number(ethAmount) - Number(feeAmount)}`) 88 | }); 89 | await tx.wait(); 90 | 91 | const currentDateTime = getCurrentDateTime(); 92 | await db.query( 93 | ` 94 | INSERT INTO offset_projects(id_claim, eth_amount, carbon_amount, token_amount, fee_amount, created_at) 95 | VALUES(?, ?, ?, ?, ?, ?); 96 | `, 97 | [ 98 | Number(claimId), 99 | Number(ethAmount), 100 | Number(carbonAmount), 101 | Number(tokenAmount), 102 | Number(feeAmount), 103 | currentDateTime 104 | ] 105 | ); 106 | await db.query( 107 | "UPDATE claims SET mintable_token_amount = ? WHERE id = ?;", 108 | [Number(claimedTokenAmount) - Number(tokenAmount), claimId] 109 | ); 110 | return res.sendStatus(200); 111 | } catch (error) { 112 | console.log(">>>>>>> error of enableMint => ", error); 113 | return res.sendStatus(500); 114 | } 115 | }; 116 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "resolveJsonModule": true, /* Enable importing .json files. */ 39 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 40 | 41 | /* JavaScript Support */ 42 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 43 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 44 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 45 | 46 | /* Emit */ 47 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 52 | "outDir": "./dist", /* Specify an output folder for all emitted files. */ 53 | // "removeComments": true, /* Disable emitting comments. */ 54 | // "noEmit": true, /* Disable emitting files from a compilation. */ 55 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 56 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 57 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 58 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 59 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 60 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | 71 | /* Interop Constraints */ 72 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 77 | 78 | /* Type Checking */ 79 | "strict": true, /* Enable all strict type-checking options. */ 80 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 81 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 82 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 83 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 84 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 85 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 86 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 87 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 88 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 89 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 90 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 91 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 92 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 93 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 94 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 95 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 96 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 97 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 98 | 99 | /* Completeness */ 100 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 101 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /utils/constants.ts: -------------------------------------------------------------------------------- 1 | export const DB_PORT = 3306; 2 | export const MSG_ALREADY_PAID = "You already paid for this delivery."; 3 | export const CHAIN_ID = 5; 4 | export const RPC_URL = "https://rpc.ankr.com/eth_goerli"; 5 | export const CONTRACT_ADDRESS = "0x36b5EbDe82430398156030f8afD2b57e85f1753C"; 6 | export const CONTRACT_ABI = [ 7 | { inputs: [], stateMutability: "nonpayable", type: "constructor" }, 8 | { 9 | anonymous: false, 10 | inputs: [ 11 | { 12 | indexed: true, 13 | internalType: "address", 14 | name: "owner", 15 | type: "address" 16 | }, 17 | { 18 | indexed: true, 19 | internalType: "address", 20 | name: "spender", 21 | type: "address" 22 | }, 23 | { 24 | indexed: false, 25 | internalType: "uint256", 26 | name: "value", 27 | type: "uint256" 28 | } 29 | ], 30 | name: "Approval", 31 | type: "event" 32 | }, 33 | { 34 | anonymous: false, 35 | inputs: [ 36 | { 37 | indexed: false, 38 | internalType: "uint256", 39 | name: "marketingFee", 40 | type: "uint256" 41 | }, 42 | { 43 | indexed: false, 44 | internalType: "uint256", 45 | name: "liquidityFee", 46 | type: "uint256" 47 | } 48 | ], 49 | name: "BuyFeeUpdated", 50 | type: "event" 51 | }, 52 | { 53 | anonymous: false, 54 | inputs: [ 55 | { 56 | indexed: true, 57 | internalType: "address", 58 | name: "account", 59 | type: "address" 60 | }, 61 | { indexed: false, internalType: "bool", name: "isExcluded", type: "bool" } 62 | ], 63 | name: "ExcludeFromFees", 64 | type: "event" 65 | }, 66 | { 67 | anonymous: false, 68 | inputs: [ 69 | { 70 | indexed: false, 71 | internalType: "address", 72 | name: "account", 73 | type: "address" 74 | }, 75 | { indexed: false, internalType: "bool", name: "excluded", type: "bool" } 76 | ], 77 | name: "ExcludedFromFee", 78 | type: "event" 79 | }, 80 | { 81 | anonymous: false, 82 | inputs: [ 83 | { 84 | indexed: false, 85 | internalType: "address", 86 | name: "updAds", 87 | type: "address" 88 | } 89 | ], 90 | name: "MaxTxnExcluded", 91 | type: "event" 92 | }, 93 | { 94 | anonymous: false, 95 | inputs: [ 96 | { 97 | indexed: false, 98 | internalType: "uint256", 99 | name: "newNum", 100 | type: "uint256" 101 | } 102 | ], 103 | name: "MaxTxnUpdated", 104 | type: "event" 105 | }, 106 | { 107 | anonymous: false, 108 | inputs: [ 109 | { 110 | indexed: false, 111 | internalType: "uint256", 112 | name: "newNum", 113 | type: "uint256" 114 | } 115 | ], 116 | name: "MaxWalletAmount", 117 | type: "event" 118 | }, 119 | { 120 | anonymous: false, 121 | inputs: [ 122 | { 123 | indexed: true, 124 | internalType: "address", 125 | name: "previousOwner", 126 | type: "address" 127 | }, 128 | { 129 | indexed: true, 130 | internalType: "address", 131 | name: "newOwner", 132 | type: "address" 133 | } 134 | ], 135 | name: "OwnershipTransferred", 136 | type: "event" 137 | }, 138 | { 139 | anonymous: false, 140 | inputs: [ 141 | { 142 | indexed: false, 143 | internalType: "uint256", 144 | name: "marketingFee", 145 | type: "uint256" 146 | }, 147 | { 148 | indexed: false, 149 | internalType: "uint256", 150 | name: "liquidityFee", 151 | type: "uint256" 152 | } 153 | ], 154 | name: "SellFeeUpdated", 155 | type: "event" 156 | }, 157 | { 158 | anonymous: false, 159 | inputs: [ 160 | { indexed: true, internalType: "address", name: "pair", type: "address" }, 161 | { indexed: true, internalType: "bool", name: "value", type: "bool" } 162 | ], 163 | name: "SetAutomatedMarketMakerPair", 164 | type: "event" 165 | }, 166 | { 167 | anonymous: false, 168 | inputs: [ 169 | { 170 | indexed: false, 171 | internalType: "uint256", 172 | name: "tokensSwapped", 173 | type: "uint256" 174 | }, 175 | { 176 | indexed: false, 177 | internalType: "uint256", 178 | name: "ethReceived", 179 | type: "uint256" 180 | }, 181 | { 182 | indexed: false, 183 | internalType: "uint256", 184 | name: "tokensIntoLiquidity", 185 | type: "uint256" 186 | } 187 | ], 188 | name: "SwapAndLiquify", 189 | type: "event" 190 | }, 191 | { 192 | anonymous: false, 193 | inputs: [ 194 | { indexed: true, internalType: "address", name: "from", type: "address" }, 195 | { indexed: true, internalType: "address", name: "to", type: "address" }, 196 | { 197 | indexed: false, 198 | internalType: "uint256", 199 | name: "value", 200 | type: "uint256" 201 | } 202 | ], 203 | name: "Transfer", 204 | type: "event" 205 | }, 206 | { 207 | anonymous: false, 208 | inputs: [ 209 | { 210 | indexed: true, 211 | internalType: "address", 212 | name: "newWallet", 213 | type: "address" 214 | }, 215 | { 216 | indexed: true, 217 | internalType: "address", 218 | name: "oldWallet", 219 | type: "address" 220 | } 221 | ], 222 | name: "feeWalletUpdated", 223 | type: "event" 224 | }, 225 | { 226 | anonymous: false, 227 | inputs: [ 228 | { 229 | indexed: false, 230 | internalType: "bool", 231 | name: "tradingActive", 232 | type: "bool" 233 | } 234 | ], 235 | name: "tradingEnabled", 236 | type: "event" 237 | }, 238 | { 239 | inputs: [{ internalType: "address", name: "", type: "address" }], 240 | name: "_isExcludedMaxTransactionAmount", 241 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 242 | stateMutability: "view", 243 | type: "function" 244 | }, 245 | { 246 | inputs: [ 247 | { internalType: "address", name: "owner", type: "address" }, 248 | { internalType: "address", name: "spender", type: "address" } 249 | ], 250 | name: "allowance", 251 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 252 | stateMutability: "view", 253 | type: "function" 254 | }, 255 | { 256 | inputs: [ 257 | { internalType: "address", name: "spender", type: "address" }, 258 | { internalType: "uint256", name: "amount", type: "uint256" } 259 | ], 260 | name: "approve", 261 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 262 | stateMutability: "nonpayable", 263 | type: "function" 264 | }, 265 | { 266 | inputs: [{ internalType: "address", name: "", type: "address" }], 267 | name: "automatedMarketMakerPairs", 268 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 269 | stateMutability: "view", 270 | type: "function" 271 | }, 272 | { 273 | inputs: [{ internalType: "address", name: "account", type: "address" }], 274 | name: "balanceOf", 275 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 276 | stateMutability: "view", 277 | type: "function" 278 | }, 279 | { 280 | inputs: [], 281 | name: "buyTotalFees", 282 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 283 | stateMutability: "view", 284 | type: "function" 285 | }, 286 | { 287 | inputs: [], 288 | name: "decimals", 289 | outputs: [{ internalType: "uint8", name: "", type: "uint8" }], 290 | stateMutability: "view", 291 | type: "function" 292 | }, 293 | { 294 | inputs: [ 295 | { internalType: "address", name: "spender", type: "address" }, 296 | { internalType: "uint256", name: "subtractedValue", type: "uint256" } 297 | ], 298 | name: "decreaseAllowance", 299 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 300 | stateMutability: "nonpayable", 301 | type: "function" 302 | }, 303 | { 304 | inputs: [ 305 | { internalType: "address[]", name: "snipers_", type: "address[]" } 306 | ], 307 | name: "delSnipers", 308 | outputs: [], 309 | stateMutability: "nonpayable", 310 | type: "function" 311 | }, 312 | { 313 | inputs: [], 314 | name: "disableTransferDelay", 315 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 316 | stateMutability: "nonpayable", 317 | type: "function" 318 | }, 319 | { 320 | inputs: [], 321 | name: "enableTrading", 322 | outputs: [], 323 | stateMutability: "nonpayable", 324 | type: "function" 325 | }, 326 | { 327 | inputs: [ 328 | { internalType: "address", name: "account", type: "address" }, 329 | { internalType: "bool", name: "excluded", type: "bool" } 330 | ], 331 | name: "excludeFromFees", 332 | outputs: [], 333 | stateMutability: "nonpayable", 334 | type: "function" 335 | }, 336 | { 337 | inputs: [ 338 | { internalType: "address", name: "updAds", type: "address" }, 339 | { internalType: "bool", name: "isEx", type: "bool" } 340 | ], 341 | name: "excludeFromMaxTransaction", 342 | outputs: [], 343 | stateMutability: "nonpayable", 344 | type: "function" 345 | }, 346 | { 347 | inputs: [], 348 | name: "feeWallet", 349 | outputs: [{ internalType: "address", name: "", type: "address" }], 350 | stateMutability: "view", 351 | type: "function" 352 | }, 353 | { 354 | inputs: [ 355 | { internalType: "address", name: "spender", type: "address" }, 356 | { internalType: "uint256", name: "addedValue", type: "uint256" } 357 | ], 358 | name: "increaseAllowance", 359 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 360 | stateMutability: "nonpayable", 361 | type: "function" 362 | }, 363 | { 364 | inputs: [{ internalType: "address", name: "account", type: "address" }], 365 | name: "isExcludedFromFees", 366 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 367 | stateMutability: "view", 368 | type: "function" 369 | }, 370 | { 371 | inputs: [{ internalType: "address", name: "addr", type: "address" }], 372 | name: "isSniper", 373 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 374 | stateMutability: "view", 375 | type: "function" 376 | }, 377 | { 378 | inputs: [], 379 | name: "limitsInEffect", 380 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 381 | stateMutability: "view", 382 | type: "function" 383 | }, 384 | { 385 | inputs: [], 386 | name: "maxTransactionAmount", 387 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 388 | stateMutability: "view", 389 | type: "function" 390 | }, 391 | { 392 | inputs: [], 393 | name: "maxWallet", 394 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 395 | stateMutability: "view", 396 | type: "function" 397 | }, 398 | { 399 | inputs: [ 400 | { internalType: "address", name: "addr", type: "address" }, 401 | { internalType: "uint256", name: "amount", type: "uint256" } 402 | ], 403 | name: "mint", 404 | outputs: [], 405 | stateMutability: "nonpayable", 406 | type: "function" 407 | }, 408 | { 409 | inputs: [], 410 | name: "mintable", 411 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 412 | stateMutability: "view", 413 | type: "function" 414 | }, 415 | { 416 | inputs: [], 417 | name: "name", 418 | outputs: [{ internalType: "string", name: "", type: "string" }], 419 | stateMutability: "view", 420 | type: "function" 421 | }, 422 | { 423 | inputs: [], 424 | name: "owner", 425 | outputs: [{ internalType: "address", name: "", type: "address" }], 426 | stateMutability: "view", 427 | type: "function" 428 | }, 429 | { 430 | inputs: [], 431 | name: "removeLimits", 432 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 433 | stateMutability: "nonpayable", 434 | type: "function" 435 | }, 436 | { 437 | inputs: [ 438 | { 439 | internalType: "contract IERC20", 440 | name: "tokenAddress", 441 | type: "address" 442 | }, 443 | { internalType: "address", name: "walletaddress", type: "address" } 444 | ], 445 | name: "removeTokens", 446 | outputs: [], 447 | stateMutability: "nonpayable", 448 | type: "function" 449 | }, 450 | { 451 | inputs: [], 452 | name: "renounceOwnership", 453 | outputs: [], 454 | stateMutability: "nonpayable", 455 | type: "function" 456 | }, 457 | { 458 | inputs: [], 459 | name: "sellTotalFees", 460 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 461 | stateMutability: "view", 462 | type: "function" 463 | }, 464 | { 465 | inputs: [ 466 | { internalType: "address", name: "pair", type: "address" }, 467 | { internalType: "bool", name: "value", type: "bool" } 468 | ], 469 | name: "setAutomatedMarketMakerPair", 470 | outputs: [], 471 | stateMutability: "nonpayable", 472 | type: "function" 473 | }, 474 | { 475 | inputs: [{ internalType: "bool", name: "_mintable", type: "bool" }], 476 | name: "setMintable", 477 | outputs: [], 478 | stateMutability: "nonpayable", 479 | type: "function" 480 | }, 481 | { 482 | inputs: [ 483 | { internalType: "address[]", name: "snipers_", type: "address[]" } 484 | ], 485 | name: "setSnipers", 486 | outputs: [], 487 | stateMutability: "nonpayable", 488 | type: "function" 489 | }, 490 | { 491 | inputs: [], 492 | name: "swapTokensAtAmount", 493 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 494 | stateMutability: "view", 495 | type: "function" 496 | }, 497 | { 498 | inputs: [], 499 | name: "symbol", 500 | outputs: [{ internalType: "string", name: "", type: "string" }], 501 | stateMutability: "view", 502 | type: "function" 503 | }, 504 | { 505 | inputs: [], 506 | name: "totalSupply", 507 | outputs: [{ internalType: "uint256", name: "", type: "uint256" }], 508 | stateMutability: "view", 509 | type: "function" 510 | }, 511 | { 512 | inputs: [], 513 | name: "tradingActive", 514 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 515 | stateMutability: "view", 516 | type: "function" 517 | }, 518 | { 519 | inputs: [ 520 | { internalType: "address", name: "recipient", type: "address" }, 521 | { internalType: "uint256", name: "amount", type: "uint256" } 522 | ], 523 | name: "transfer", 524 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 525 | stateMutability: "nonpayable", 526 | type: "function" 527 | }, 528 | { 529 | inputs: [], 530 | name: "transferDelayEnabled", 531 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 532 | stateMutability: "view", 533 | type: "function" 534 | }, 535 | { 536 | inputs: [ 537 | { internalType: "address", name: "sender", type: "address" }, 538 | { internalType: "address", name: "recipient", type: "address" }, 539 | { internalType: "uint256", name: "amount", type: "uint256" } 540 | ], 541 | name: "transferFrom", 542 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 543 | stateMutability: "nonpayable", 544 | type: "function" 545 | }, 546 | { 547 | inputs: [{ internalType: "address", name: "newOwner", type: "address" }], 548 | name: "transferOwnership", 549 | outputs: [], 550 | stateMutability: "nonpayable", 551 | type: "function" 552 | }, 553 | { 554 | inputs: [], 555 | name: "uniswapV2Pair", 556 | outputs: [{ internalType: "address", name: "", type: "address" }], 557 | stateMutability: "view", 558 | type: "function" 559 | }, 560 | { 561 | inputs: [], 562 | name: "uniswapV2Router", 563 | outputs: [ 564 | { internalType: "contract IUniswapV2Router02", name: "", type: "address" } 565 | ], 566 | stateMutability: "view", 567 | type: "function" 568 | }, 569 | { 570 | inputs: [ 571 | { internalType: "uint256", name: "marketingFee", type: "uint256" }, 572 | { internalType: "uint256", name: "liquidityFee", type: "uint256" } 573 | ], 574 | name: "updateBuyFees", 575 | outputs: [], 576 | stateMutability: "nonpayable", 577 | type: "function" 578 | }, 579 | { 580 | inputs: [{ internalType: "address", name: "newWallet", type: "address" }], 581 | name: "updateFeeWallet", 582 | outputs: [], 583 | stateMutability: "nonpayable", 584 | type: "function" 585 | }, 586 | { 587 | inputs: [{ internalType: "uint256", name: "newNum", type: "uint256" }], 588 | name: "updateMaxTxnAmount", 589 | outputs: [], 590 | stateMutability: "nonpayable", 591 | type: "function" 592 | }, 593 | { 594 | inputs: [{ internalType: "uint256", name: "newNum", type: "uint256" }], 595 | name: "updateMaxWalletAmount", 596 | outputs: [], 597 | stateMutability: "nonpayable", 598 | type: "function" 599 | }, 600 | { 601 | inputs: [ 602 | { internalType: "uint256", name: "marketingFee", type: "uint256" }, 603 | { internalType: "uint256", name: "liquidityFee", type: "uint256" } 604 | ], 605 | name: "updateSellFees", 606 | outputs: [], 607 | stateMutability: "nonpayable", 608 | type: "function" 609 | }, 610 | { 611 | inputs: [{ internalType: "uint256", name: "newAmount", type: "uint256" }], 612 | name: "updateSwapTokensAtAmount", 613 | outputs: [{ internalType: "bool", name: "", type: "bool" }], 614 | stateMutability: "nonpayable", 615 | type: "function" 616 | }, 617 | { 618 | inputs: [], 619 | name: "withdrawFees", 620 | outputs: [], 621 | stateMutability: "nonpayable", 622 | type: "function" 623 | }, 624 | { stateMutability: "payable", type: "receive" } 625 | ]; 626 | export const ADMIN_WALLET_ADDRESS = 627 | "0xB9E3C5693f0B808f50410C4fd28ee7f2B88E1B18"; 628 | --------------------------------------------------------------------------------