So I am creating a web application that interacts with a smart contract that I deployed on the Ropsten TestNet.
I am able to withdraw ether from the contract to my Metamask account using a withdraw function.
However I am struggling to find out the correct method to deposit ether to the Smart Contract i.e what syntax/function do I need to use. My contract is definitely Payable(), and lets me deposit ether when I view and interact with it through Etherscan.
Any help would be greatly appreciated as I am under a lot of pressure. Thanks!
Here is how I can withdraw ether... now I need a deposit function
abi = JSON.parse('[{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getMyBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"}]');
var bankContract = web3.eth.contract(abi);
contractInstance = bankContract.at('TheContractAddressHere');
function withdraw() {
contractInstance.withdraw(300000000000000000, { from: web3.eth.accounts[0]}, function(err, result){ revert(); } );
}