EatTheBlocks Forum

Cannot read property 'address' of undefined

when running “node run-arbitrage.js” for course “Profitable Flashloans” I and getting “(node:81288) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘address’ of undefined”.

Also my “pragma solidity ^0.5.0;” is in red, is that fine? or did I import something incorrectly

You can ignore the red, it seems Visual Studio Code is configured with the wrong version of Solidity.
You need to deploy the smart contract to the Blockchain before running the script, you are missing one step.

1 Like

I am also facing the same issue, I have deployed the smart contract to Blockchain. Kindly suggest.

It means you are not importing the address in the file. console.log the object that is supposed to have the address, and start your debugging from there. You can hardcode the address in the file as a quick fix.

try deleting builds>contracts .
worked for me.

i think its because of some bugs in truffle which makes artifacts for a not yet completely compiled solidity file. and when you want to compile that again, some errors occures.
or some issues with permissions and accessibilities in files maybe…

anyways, try deleting builds>contracts and i hope works for you too!

1 Like

@jklepatch if hard coding it do you use the address in the contract details or the address of the ether address we wrote the contract too? If hard coded can I still Deploy that to heroku like that

Try msging me in discord. @Batman and ill see if I can help you one on one.