I am trying to write a test using the Truffle framework and for one of the tests I need to send the contract some ether. Is there a way that I can programmatically make a specified ether account send money to the contract?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
You should be able to do this using the
web3.eth.accounts array (ex:
web3.eth.accounts). If you are using test-rpc, there will be a set of pre-created accounts that are accessible via that array.
There is a tutorial you could try following: https://citywebconsultants.co.uk/blog/blockchain/introducing-ethereum-development-part-3-testrpc-and-truffle