ExtropyIO / defi-bot

Tutorial for building DeFi arbitrage bots
1.17k stars 462 forks source link

Cannot read property of 'address' of undefined #12

Open Watermana opened 3 years ago

Watermana commented 3 years ago

I'm getting this error whenever I run the index.js bot and I'm not sure what the solution is. I've tried defining 'address' in the code where it's throwing the error, and it still says the same thing.

INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). INFO: Could not find files for the given pattern(s). C:\Users\water\Documents\github\defi-bot\node_modules\web3-eth-accounts\lib\index.js:408 if (!this[account.address]) { ^

TypeError: Cannot read property 'address' of undefined at Wallet.add (C:\Users\water\Documents\github\defi-bot\node_modules\web3-eth-accounts\lib\index.js:408:23) at Object. (C:\Users\water\Documents\github\defi-bot\src\index.js:23:26) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47

Does anyone have any ideas what could be causing this issue?

restorepro commented 3 years ago

Verify your metamask wallet addresses.

Watermana commented 3 years ago

Verify your metamask wallet addresses.

All the addresses in my .env file are correct to my metamask wallet.

restorepro commented 3 years ago

Did you get it to work yet? I am getting a web3 error when I run the index.js file...

restorepro commented 3 years ago

Here is my output that I get when I run the script...

qwert@eqrt-MacBook-Pro defi-bot-1 % node src/index.js Listening on 5000 Fetching market data @ 2021-05-31T16:44:51-05:00 ...

Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee Order has taker fee /Users/qwert/test/defi-bot-1/node_modules/web3-eth-abi/lib/index.js:298 throw new Error('Returned values aren\'t valid, did it run Out of Gas? ' +

restorepro commented 3 years ago

I read in a few places that it may be the version of web3.js that causes the issue or changing the compiler version from 5.17 to a lower 5.x version in remix. I tried both and neither worked for me.

Screen Shot 2021-05-31 at 5 55 46 PM
restorepro commented 3 years ago

Did you add the HDWallets package and configure it in the truffle-config.js file?

dnblack3 commented 3 years ago

could this be the issue? https://docs.soliditylang.org/en/v0.8.6/050-breaking-changes.html Explicitness requirement

tdev00 commented 2 years ago

Has anyone solved this issue? I was not able to. I was not able to run the project from the root directory or from the src. "node index.js" from the src or "node src/index.js" from the root dir.

My env file is in the root directory, and the address matches up with my metamask address. What else could it be?