Open vedmukherjee15 opened 2 years ago
I also got the same error, i have been stucked here for over 2days, please if you find the solution, simply post it here too
Hello @vedmukherjee15 @JayAlwaysCodes
This is "normal", the explanation is simple.
When you use [-1]
you are referring to the last instance of that deployed contract, but it has it's limitations.
In order to access to that [-1}
it means the contract address should exist on the build/deployments folder, otherwise it wont find it.
So, this will work just with networks with persistence, like rinkeby, kovan or a Pseudo persistence ganache instance, if you try to run this on development it wont work, as there is not a folder on build for that network.
Development network just works on the runtime execution, it means once the process is finished all the data gets deleted, so that's why you cannot access to the index [-1].
My recommendation is just deploy on a network with persistence and that's it.
Cheers.
thanks @cromewar... i tried deploying to rinkeby and it reverted, what could have caused it? it really feels discouraging , i will be glad if you can provide solution to this.
Try this.
Thanks, It worked
Whenever I run the above code I get an index error. Please help me out @PatrickAlphaC @cromewar