@@ -138,7 +138,7 @@ const Main = async () => {
138138 console . log ( `Buy Tx Data:` , txData ) ;
139139
140140 // send a buy Tx
141- nonce ++ ;
141+ nonce += 1 ;
142142 oneInch . sendTx ( {
143143 data : txData . tx ,
144144 nonce
@@ -156,13 +156,13 @@ const Main = async () => {
156156 * Approve Token if it has not been approved before and save it to db
157157 */
158158 // approve if token has not been approved
159- const token_is_approved = await Approve . exists ( { token : token , by : process . env . PUBLIC_KEY ! . toLowerCase ( ) } )
159+ const token_is_approved = await Approve . exists ( { token : token } )
160160 if ( ! token_is_approved ) {
161161 // approve if not approved
162162 message = `Approving ${ token . name } ...`
163163 sendMessage ( users , message )
164164 let txData = await oneInch . approve ( token . address )
165- nonce ++ ;
165+ nonce += 1 ;
166166 await oneInch . sendTx ( {
167167 data : txData . tx ,
168168 nonce
@@ -182,7 +182,7 @@ const Main = async () => {
182182 let tries = 0
183183 let tokenBalance = '0'
184184 while ( tries < 2000 ) {
185- tokenBalance = await oneInch . balanceOf ( tx . toToken . address )
185+ tokenBalance = await oneInch . balanceOf ( token . address )
186186 if ( parseInt ( tokenBalance ) > parseInt ( new BigNumber ( token_amount ) . multipliedBy ( 0.5 ) . toString ( ) ) ) {
187187 break
188188 }
@@ -206,10 +206,11 @@ const Main = async () => {
206206 console . log ( `Sell Tx Data:` , txData ) ;
207207
208208 // send the sell Tx
209- nonce ++ ;
209+ nonce += 1 ;
210210 oneInch . sendTx ( {
211211 data : txData . tx ,
212- nonce
212+ nonce,
213+ gasLimit : config . GAS_LIMIT
213214 } ) . then ( async ( tx : any ) => {
214215 if ( tx . hash ) {
215216 console . log ( `Tx for Sell:` , tx . hash )
0 commit comments