Anyone know why my parameter is being seemingly ignored when I run the dapp?
This function is called when I press the button to send an X amount of money to a ganache account who's address I input into an HTML form while using the dapp.
App.contracts.EthereumPractice.deployed().then(function (instance) {
return instance.sendMoney.sendTransaction(addressInput.value, {
from: web3.eth.accounts[0],
value: etherAmount
});
},
I'm pretty confident the ^etherAmount variabe is not the problem as the money is being sent, it's just being sent to the wrong place (the contract adress not the imported ganache account address).
My solidity function takes in an address parameter and transfers the money to that address parameter value, so what am I doing wrong in the Web3 part?
Here's the solidity func for those who just want to double check that
function sendMoney(address _sendToThisAddress) public {
_sendToThisAddress.transfer(this.balance);
}
When my meta mask pops up it ignores the address parameter and instead transfer the money straight to the contracts address rather than to the import ganache account address, which I am trying to send the money to.