Skip to content

Commit

Permalink
App comments + README
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCaso committed Dec 30, 2021
1 parent 32f7b20 commit 2ae021b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,26 @@ A Telegram Bot which will notify you whenever a new pair is added on your favoui
```
const mnemonic = 'YOUR MNEMONIC PHRASE GOES HERE';
```
2. On Telegram, search BotFather and create a bot. At the end of the procedure you'll find a key in this format:
2. On Telegram, search BotFather and create a bot. At the end of the procedure you'll find a key in a format like 7862412351:ABCdI2ujasdasguun38nuan8nin-512kjhi and insert it on line 7 of app.js:
```
7862412351:ABCdI2ujasdasguun38nuan8nin-512kjhi
const bot = new Telegraf('YOUR API TOKEN GOES HERE');
```
and insert it on line 7 of app.js:
3. If you want to add a DEX you want to scan, you have 3 things to do:
- Create an object with DEX factory contract address, URL RPC of its blockchain and its name. Example:
```
const bot = new Telegraf('YOUR API TOKEN GOES HERE');
const traderjoe = {
address: '0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10',
rpcLink: 'https://api.avax.network/ext/bc/C/rpc',
dex: 'TraderJoe'
};
```
- Create the contract object. Example:
```
const netswapFactory = buildContract(netswap.address, netswap.rpcLink);
```
- Add the listening and log creation. Example:
```
traderjoeFactory.on('PairCreated', async (_token0, _token1, _pairAddress) => {
logPairInfo(_token0, _token1, _pairAddress, traderjoe.rpcLink, traderjoe.dex, context);
});
```
36 changes: 17 additions & 19 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ const tethys = {

const trisolaris = {
address: '0xc66F594268041dB60507F00703b152492fb176E7',
rpcLink: 'https://mainnet.aurora.dev/Fon6fPMs5rCdJc4mxX4kiSK1vsKdzc3D8k6UF8aruek',
dex: 'Trisolaris'
rpcLink: 'https://mainnet.aurora.dev/Fon6fPMs5rCdJc4mxX4kiSK1vsKdzc3D8k6UF8aruek',
dex: 'Trisolaris'
};

const fuseswap = {
address: '0x1d1f1A7280D67246665Bb196F38553b469294f3a',
rpcLink: 'https://rpc.fuse.io',
dex: 'Fuseswap'
rpcLink: 'https://rpc.fuse.io',
dex: 'Fuseswap'
};

const traderjoe = {
address: '0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10',
rpcLink: 'https://api.avax.network/ext/bc/C/rpc',
dex: 'TraderJoe'
rpcLink: 'https://api.avax.network/ext/bc/C/rpc',
dex: 'TraderJoe'
};

/*
Expand All @@ -55,16 +55,16 @@ const fuseswapFactory = buildContract(fuseswap.address, fuseswap.rpcLink);
const traderjoeFactory = buildContract(traderjoe.address, traderjoe.rpcLink);

/*
=============================================
STARTING BOT - NO NEED TO MODIFY
=============================================
============
STARTING BOT
============
*/

bot.start((context) => {
/*
=====================================================================
LISTENING ON EVERY CONTRACT'S PAIR CREATION EVENT - NO NEED TO MODIFY
=====================================================================
============================================================================
LISTENING ON EVERY CONTRACT'S PAIR CREATION EVENT - ADD LISTENING EVENT HERE
============================================================================
*/
console.log('Bot started.')
context.reply('Scanning your favourite dexs...')
Expand Down Expand Up @@ -93,13 +93,11 @@ bot.start((context) => {
bot.launch()

/*
=============
=============
AUX FUNCTIONS
=============
=============
=========================
=========================
==== AUX FUNCTIONS ====
=========================
=========================
*/

function buildContract(_address, _rpcLink) {
Expand Down

0 comments on commit 2ae021b

Please sign in to comment.