April 2017
Intermediate to advanced
266 pages
7h 4m
English
To send ether to your Solidity test contract, it should have a public function that returns uint, called initialBalance in that contract. This can be written directly as a function or a public variable. When your test contract is deployed to the network, truffle will send that amount of ether from your test account to your test contract. Your test contract can then use that ether to script ether interactions within your contract under test. Note that initialBalance is optional and not required. For example, take a look at the following code:
import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/MyContract.sol"; contract TestContract { // Truffle will send the TestContract ...