@@ -2,6 +2,9 @@ require('dotenv').config();
22const Web3 = require ( 'web3' ) ;
33const BigNumber = require ( 'bignumber.js' ) ;
44const { mainnet} = require ( '../../addresses' )
5+ const pad = require ( "pad" ) ;
6+ const colors = require ( "colors" ) ;
7+ const moment = require ( "moment" ) ;
58
69
710process . on ( 'message' , function ( data ) {
@@ -63,7 +66,6 @@ async function arbitrage(data) {
6366
6467 const shiftedWBNBBorrowAmount = web3 . utils . toBN ( web3 . utils . toWei ( borrowAmount ) )
6568
66- console . log ( shiftedWBNBBorrowAmount . toString ( ) ) ;
6769 // get BUSD AMOUNT
6870 const rawApeBUSDValue = await apeswap . router . methods
6971 . getAmountsOut ( shiftedWBNBBorrowAmount ,
@@ -89,7 +91,7 @@ async function arbitrage(data) {
8991
9092
9193 // Set x Borrow Amount BNB / y BUSD Borrow Amount
92- const bUSDBorrowAmount = ( Number ( shiftedPancakeBUSDValue . toString ( ) ) ) ;
94+ const bUSDBorrowAmount = ( Number ( shiftedApeBUSDValue . toString ( ) ) ) ;
9395 const shiftedBUSDBorrowAmount = new BigNumber ( bUSDBorrowAmount ) . shiftedBy ( stableToken . decimals ) ;
9496
9597
@@ -202,7 +204,11 @@ async function arbitrage(data) {
202204 //console.log(apeToPancakeBUSDProfit)
203205
204206 if ( pancakeToApeWBNBProfit > 0 && pancakeToApeWBNBProfit > apeToPancakeWBNBProfit ) {
207+
205208 console . log ( "Arb opportunity found!" ) ;
209+ console . log ( pad ( colors . yellow ( 'Current Time:' ) , 30 ) ,
210+ moment ( ) . format ( 'll' ) + ' ' + moment ( ) . format ( 'LTS' ) ) ;
211+
206212 console . log ( `Flashloan WBNB on Pancakeswap at ${ pancakeWBNBResults . buy } ` ) ;
207213 console . log ( `Sell WBNB on Apeswap at ${ apeWBNBResults . sell } ` ) ;
208214 console . log ( `Expected profit: ${ pancakeToApeWBNBProfit } WBNB` ) ;
@@ -232,6 +238,8 @@ async function arbitrage(data) {
232238 }
233239 if ( apeToPancakeWBNBProfit > 0 && apeToPancakeWBNBProfit > pancakeToApeWBNBProfit ) {
234240 console . log ( "Arb opportunity found!" ) ;
241+ console . log ( pad ( colors . yellow ( 'Current Time:' ) , 30 ) ,
242+ moment ( ) . format ( 'll' ) + ' ' + moment ( ) . format ( 'LTS' ) ) ;
235243 console . log ( `Buy WBNB from Apeswap at ${ apeWBNBResults . buy } ` ) ;
236244 console . log ( `Sell WBNB from PancakeSwap at ${ pancakeWBNBResults . sell } ` ) ;
237245 console . log ( `Expected profit: ${ apeToPancakeWBNBProfit } WBNB` ) ;
@@ -261,6 +269,8 @@ async function arbitrage(data) {
261269 }
262270 if ( pancakeToApeBUSDProfit > 0 && pancakeToApeBUSDProfit > apeToPancakeBUSDProfit ) {
263271 console . log ( "Arb opportunity found!" ) ;
272+ console . log ( pad ( colors . yellow ( 'Current Time:' ) , 30 ) ,
273+ moment ( ) . format ( 'll' ) + ' ' + moment ( ) . format ( 'LTS' ) ) ;
264274 console . log ( `Flashloan BUSD on Pancakeswap at ${ pancakeBUSDResults . buy } ` ) ;
265275 console . log ( `Sell BUSD on ApeSwap at ${ apeBUSDResults . sell } ` ) ;
266276 console . log ( `Expected profit: ${ pancakeToApeBUSDProfit } BUSD` ) ;
@@ -290,6 +300,8 @@ async function arbitrage(data) {
290300 }
291301 if ( apeToPancakeBUSDProfit > 0 && apeToPancakeBUSDProfit > pancakeToApeBUSDProfit ) {
292302 console . log ( "Arb opportunity found!" ) ;
303+ console . log ( pad ( colors . yellow ( 'Current Time:' ) , 30 ) ,
304+ moment ( ) . format ( 'll' ) + ' ' + moment ( ) . format ( 'LTS' ) ) ;
293305 console . log ( `Flashloan BUSD on Apeswap at ${ apeBUSDResults . buy } ` ) ;
294306 console . log ( `Sell BUSD on Pancakeswap at ${ pancakeBUSDResults . sell } ` ) ;
295307 console . log ( `Expected profit: ${ apeToPancakeBUSDProfit } BUSD` ) ;
0 commit comments