Hi everyone
I'm working on the fallback challenge on Ethernaut. I've so far have called the below functions:
await contract.contribute({from player: value: toWei('0.0001', 'ether')})
and then
await contract.sendTransaction({from: player, to: instance, value: toWei('0.0001', 'ether')})
the above call gives me the below error
and my suspicion is that this error occurs due to the contribute call failing to contribute because when I run
fromWei(await contract.getContribution())
i get
'0'
(even though I am returned a success message saying the transaction was mined).
Any pointers would be much appreciated!
There's a syntax error somewhere in your contribute method, and possibly the sendTransaction method as well. I'm not sure how many arguments both of these methods are able to accept. However, I did get this working:
await contract.contribute({value: toWei('0.0001', 'ether')})
followed by
await contract.sendTransaction({value: toWei('0.0001', 'ether')})
By default, this value
will be sent to the contract instance
from the player
wallet address. Also note, that though the above notation works, by default the value
denomination is Wei, meaning you could also opt for this code:
await contract.sendTransaction({value: 1})
At the time of writing, this video by Mark Muskardin provides an excellent walkthrough of this challenge: