lmusarella / Pancakeswap-Prediction-Bot-2023

I rewrote the code of the PancakeSwap Prediction Game BOT by bobalice7, removing the malicious code where for each transaction to the smart contract it sent transactions to this wallet 0xfB669b0e0656036D747d6C6F2666e530139d2899.
MIT License
27 stars 8 forks source link

forEach TypeError #8

Closed rootisareservedword closed 1 year ago

rootisareservedword commented 1 year ago

Hi, the bot runs successfully for several rounds but eventually this error is thrown:

Pancakeswap-Prediction-Bot/bot-lib/strategies/copytrading-strategy.module.js:56
    users.forEach(user => {
          ^

TypeError: Cannot read properties of undefined (reading 'forEach')
    at handleUsersActivity (/Pancakeswap-Prediction-Bot/bot-lib/strategies/copytrading-strategy.module.js:56:11)
    at async FragmentRunningEvent.<anonymous> (/Pancakeswap-Prediction-Bot/bot-script/pcs-bot.js:104:5)

Thanks

lmusarella commented 1 year ago

Hi, thank you so much for your support and valuable feedback. I released a fix that should solve issue #8 (although it's very strange, it's probably the size of the json that causes problems).

I also released a new release and updated the binance urls.

rootisareservedword commented 1 year ago

Awesome! Glad to help. I will test and report back. Thanks again!

rootisareservedword commented 1 year ago

I haven't received the same error that I opened this issue for in the last hour since I started testing. However, I am receiving a new error that I have not yet seen when the bot attempts to make a bet:

⛔ Transaction Error [ ⌚ 21:52 ][ 78731 ][ ERROR ] => Error: invalid BigNumber value (argument="value", value={"value":{"type":"BigNumber","hex":"0x0765cf3ee7f83fea"}}, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
    at Logger.makeError (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at Logger.throwArgumentError (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/logger/lib/index.js:250:21)
    at BigNumber.from (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/bignumber/lib/bignumber.js:239:23)
    at NumberCoder.encode (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/abi/lib/coders/number.js:36:39)
    at /Pancakeswap-Prediction-Bot/node_modules/@ethersproject/abi/lib/coders/array.js:74:19
    at Array.forEach (<anonymous>)
    at pack (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/abi/lib/coders/array.js:60:12)
    at TupleCoder.encode (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/abi/lib/coders/tuple.js:71:33)
    at AbiCoder.encode (/Pancakeswap-Prediction-Bot/node_modules/@ethersproject/abi/lib/abi-coder.js:91:15) {
  reason: 'invalid BigNumber value',
  code: 'INVALID_ARGUMENT',
  argument: 'value',
  value: {
    value: BigNumber { _hex: '0x0765cf3ee7f83fea', _isBigNumber: true }
  }
}
lmusarella commented 1 year ago

I believe it is an error due to the smart contract. I tried running it in non-simulated mode, it seems ok. Does it happen all the time or just once?

Real transactions can go wrong sometimes.

issue_8_test_1

issue_8_test

rootisareservedword commented 1 year ago

Hi, thanks for the reply. It happens all the time. I've yet to place a successful bet. I noticed you are betting BNB, whereas I am betting CAKE if that matters. I haven't tried BNB yet.

Also, I'm using copy address strategy.

rootisareservedword commented 1 year ago

It does successfully place a bet when using signal strategy and betting BNB. I'd like to use the copy address strategy and bet CAKE though. Thanks!

lmusarella commented 1 year ago

Ok I try to test CAKE in non-simulated mode

lmusarella commented 1 year ago

Ok I found the problem. The PancakeSwap smart contract on CAKE took a different request as input. I should have fixed it.

This error returns to me, but I think it is due to a problem with my wallet.

⛔ Transaction Error [ ⌚ 1:44 ][ 78765 ][ UNPREDICTABLE_GAS_LIMIT ] => execution reverted: BEP20: transfer amount exceeds allowance

rootisareservedword commented 1 year ago

Ok, I will test tomorrow. Thank you so much for taking a look!

lmusarella commented 1 year ago

I tried with another wallet of mine and it also works perfectly with CAKE.

issue_8_solved

rootisareservedword commented 1 year ago

It's working now. I'm still receiving transaction errors, but I think it's because the address that I'm copying is waiting until the very last second to place it's bet, so by the time my transaction is submitted it fails with Round not bettable. You fixed the issue that I reported, so I will close this. As always, thank you for your help!

baguito commented 1 year ago

Hi @lmusarella ,

I still have the issue [ UNPREDICTABLE_GAS_LIMIT ] => execution reverted: BEP20: transfer amount exceeds allowance. I tried different wallet and also BNB and CAKE token but any transaction is passed

Can you please help me? im trying to use copy strategy

BR

lmusarella commented 1 year ago

Hi, I think it's an enable issue. Before using the bot, did you approve the use of the smart contract (both BNB and CAKE)? Have you entered the maximum usable amount? You have to do these operations directly with Metamask on PancakeSwap.

Il lun 3 lug 2023, 15:41 baguito @.***> ha scritto:

Hi @lmusarella https://github.com/lmusarella ,

I still have the issue [ UNPREDICTABLE_GAS_LIMIT ] => execution reverted: BEP20: transfer amount exceeds allowance. I tried different wallet and also BNB and CAKE token but any transaction is passed

Can you please help me? im trying to use copy strategy

BR

— Reply to this email directly, view it on GitHub https://github.com/lmusarella/Pancakeswap-Prediction-Bot/issues/8#issuecomment-1618293015, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRDYVEVFBCCVDO2KL572YLXOLD2DANCNFSM6AAAAAAWFRNM6Q . You are receiving this because you were mentioned.Message ID: @.***>

baguito commented 1 year ago

Hi @lmusarella ,

Thanks a lot for you answer. Im using an other bot and the transaction are passing. I already approve use of smart contract

I tried all strategy in you code and got same error. im not in simulation mode

Where can i find the value for maximum usable amount ? i think it's my problem

Thanks a lot

lmusarella commented 1 year ago

Hi, try to read this https://help.coinbase.com/en/wallet/security/dapp-permissions-token-approvals