From 4ee083ee08f8ad3c9cbb0bf6c6c60343abefee82 Mon Sep 17 00:00:00 2001 From: akins-dev Date: Mon, 22 Jan 2024 16:08:35 +0100 Subject: [PATCH] initial commit --- README.md | 10 ++++++++++ bot.ts | 3 +-- commands/help.command.ts | 2 +- controllers/faq.controller.ts | 10 ++++++---- handlers/leaderboard.handler.ts | 8 +++++--- handlers/tasks.handler.ts | 6 +++++- validations/config.validation.ts | 10 ++++++++++ views/index.ts | 10 ++++++++-- 8 files changed, 46 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6d9dd71..84dbbde 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,13 @@ ethers supabase ## Contributors + + +## Little notes +```npx prisma db push``` to connect db + +```npx prsma generate``` to start using prisma client + +```npx prisma studio``` to view database locally + +```npm run dev``` to run bot \ No newline at end of file diff --git a/bot.ts b/bot.ts index bbc8300..e813d9c 100644 --- a/bot.ts +++ b/bot.ts @@ -14,7 +14,7 @@ import { conversations, createConversation, } from "@grammyjs/conversations"; -import { callbackHandler, listenerComposer } from "./handlers"; +import { callbackHandler, listenerComposer, callBackQueryComposer } from "./handlers"; import { CreateTokenMenu, initTaxMenu, @@ -31,7 +31,6 @@ import { import { accountMenu } from "./views"; import withdrawEthConversation from "./conversations/withdrawEth.conversations"; import { freeStorage } from "@grammyjs/storage-free"; -import { callBackQueryComposer } from "./handlers"; import { distribute, run, sequentialize } from "@grammyjs/runner"; import validate from "./validations/config.validation"; import { I18n } from "@grammyjs/i18n"; diff --git a/commands/help.command.ts b/commands/help.command.ts index 2d42671..2c5a493 100644 --- a/commands/help.command.ts +++ b/commands/help.command.ts @@ -5,7 +5,7 @@ import { MyContext } from "../bot"; import { Conversation } from "@grammyjs/conversations"; export async function helpCommand(_ctx: CommandContext) { await _ctx.reply( - `JOIN OUR TELEGRAM CHANNEL TO GET HELP \n ${process.env.BOT_NAME} ` + `JOIN OUR TELEGRAM CHANNEL TO GET HELP \n ${process.env.CHANNEL_LINK} ` ); //await askQuestion(_ctx as MyContext, "What is your Name?"); diff --git a/controllers/faq.controller.ts b/controllers/faq.controller.ts index e622e26..3d8e60d 100644 --- a/controllers/faq.controller.ts +++ b/controllers/faq.controller.ts @@ -3,11 +3,13 @@ import { boldenText } from "../utils"; export async function faqController(ctx: MyContext) { await ctx.reply( - `โ„น๏ธ FAQ \n${boldenText( - "Transaction Error Messages" - )} \n \n1. Insufficient Output Amount \n Your slippage tolerance is too low for this transaction. Either increase your slippage tolerance in the wallet settings or increase your gas price/delta to gain more priority on the blockchain.\n \n2. ${boldenText( + `โ„น๏ธ \n${boldenText( + "FAQ" + )}(Transaction Error Messages) \n \n1. ${boldenText( + "Insufficient Output Amount" + )} \nYour slippage tolerance is too low for this transaction. Either increase your slippage tolerance in the wallet settings or increase your gas price/delta to gain more priority on the blockchain.\n \n2. ${boldenText( "Excessive/Insufficient Input Amount" - )} \n This happens when the bot attempts to buy an exact number of number of tokens, but the token's volatility turns out to be too extreme, even with your slippage taken into consideration. For example, assume that you want to buy exactly 1 token, and the current price for that 1 token is 1 FTM. With 100% slippage, the bot will allow you to pay up to 2 FTM to get that token. If the token's volatility is too extreme that even 2 FTM isn't enough to purchase 1 token, the transaction will fail. For sells, it can happen when the bot is trying to sell 0 tokens.\n \n3. ${boldenText( + )} \nThis happens when the bot attempts to buy an exact number of number of tokens, but the token's volatility turns out to be too extreme, even with your slippage taken into consideration. For example, assume that you want to buy exactly 1 token, and the current price for that 1 token is 1 FTM. With 100% slippage, the bot will allow you to pay up to 2 FTM to get that token. If the token's volatility is too extreme that even 2 FTM isn't enough to purchase 1 token, the transaction will fail. For sells, it can happen when the bot is trying to sell 0 tokens.\n \n3. ${boldenText( "Insufficient funds for gas x price + value" )} \nYour wallet doesn't have enough funds to cover the transaction value and its gas fees. If you're using Ape Max, disable it and try again. If not, double check your gas settings and compare the potential gas fees to your wallet's FTM balance. \n \n4. ${boldenText( diff --git a/handlers/leaderboard.handler.ts b/handlers/leaderboard.handler.ts index 635ab09..546e9bf 100644 --- a/handlers/leaderboard.handler.ts +++ b/handlers/leaderboard.handler.ts @@ -5,13 +5,15 @@ import { rewardsMenu } from "../views"; export async function getLeaderboard(ctx: MyContext, msgId: number) { let user = await getAllUsers(); - let leaderboard = `${boldenText( + let leaderboard = `๐Ÿ†${boldenText( + " Leaderboard " + )}๐Ÿ† \n๐Ÿ“Only top 10 trading activities will show on the Leaderboard\n \n${boldenText( "Name" - )} | Points \nOnly top 10 trading activities will show on the Leaderboard `; + )} | Points \n `; user.sort((a, b) => b.points - a.points); user.forEach((el, id) => { if (id <= 9) { - leaderboard += `\n${id + 1} ${el.userName} | ${el.points}`; + leaderboard += `\n${id + 1}. ${el.userName} | ${el.points}`; } }); diff --git a/handlers/tasks.handler.ts b/handlers/tasks.handler.ts index ee05f73..0f238bf 100644 --- a/handlers/tasks.handler.ts +++ b/handlers/tasks.handler.ts @@ -1,11 +1,15 @@ import { MyContext } from "../bot"; import { rewardsMenu } from "../views"; +import { boldenText } from "../utils"; export async function getTasks(ctx: MyContext, msgId: number) { ctx.api.editMessageText( ctx.chat.id, msgId, - ` Task List \n 1. Refer to earn - 80 points per referral \n 2. Execute snipe - 150 points per snipe \n3. 10000 FTM in volume - 500 points \n4. Execute swaps - 50 points \n5. Copy trade - 70 points `, + `๐ŸŽฏ${boldenText( + " TASK LIST" + )} \n \n1. Refer to earn - 80 points per referral \n2. Execute snipe - 150 points per snipe \n3. 10000 FTM in volume - 500 points \n4. Execute swaps - 50 points \n5. Copy trade - 70 points + `, { reply_markup: rewardsMenu(), parse_mode: "HTML", diff --git a/validations/config.validation.ts b/validations/config.validation.ts index aebc7d4..4aae584 100644 --- a/validations/config.validation.ts +++ b/validations/config.validation.ts @@ -34,6 +34,16 @@ async function validate() { !deployerContract || !botUserName ) { + console.log(monogo); + console.log(botToken); + console.log(rpc); + console.log(botName); + console.log(channelId); + console.log(etherScanAPiKEy); + console.log(scanurl); + console.log(graphClient); + console.log(deployerContract); + console.log(botUserName); throw error("Configurations are missing"); } else { console.info("Configurations Files are Saved"); diff --git a/views/index.ts b/views/index.ts index afdfe30..edb0518 100644 --- a/views/index.ts +++ b/views/index.ts @@ -16,13 +16,19 @@ export async function viewWalletDetailsView( ctx.reply( `๐Ÿ”’${boldenText( " New Encrypted Fantom Wallet Created" - )}.๐Ÿ”’\n \n ๐Ÿ’ณ Wallet Address:\n ${makeCopiable( + )}! ๐ŸŽ‰\n \n${boldenText( + "๐ŸšจKEEP THE DETAILS BELOW SAFE! ๐Ÿšจ" + )}\n \n ๐Ÿ’ณ Wallet Address:\n ${makeCopiable( publicKey )}\n \n ๐Ÿ”‘ Private Key:\n${makeCopiable( privateKey )}\n \n๐Ÿ”Mnemonic Phrase:\n${makeCopiable( mnemonic - )} \n \n \n \n It is important to retain these details if you wish to access your wallet from outside this telegram account in the future, however, if these details are compromised it will grant full access to your wallet and funds. \n \n \n ---------------------------------------------\n**Store these details securely offline and then delete this message.**\n---------------------------------------------`, + )} \n \n \n \nโš ๏ธ${boldenText( + "It is important to retain these details if you wish to access your wallet from outside this telegram account in the future, however, if these details are compromised it will grant full access to your wallet and funds." + )}โš ๏ธ\n \n \n ---------------------------------------------\n ๐Ÿšจ${boldenText( + "STORE THESE DETAILS SECURELY OFFLINE AND THEN DELETE THIS MESSAGE." + )}๐Ÿšจ \n---------------------------------------------`, { parse_mode: "HTML" } ); }