For example here is my example function in smart contract:
function adoptCreeptomas(uint256 beastQuantity, address referrer
) public payable whenNotPaused {
msg.sender.transfer(50);
}
And then I try to test this contract:
describe("adopted creeptoma", async function() {
it('adopted', async function() {
let instance = await CreeptomaPresale.deployed();
let pre = convertEther(getBalance(investor));
await instance.adoptCreeptomas.call(beastQuantity, 0 {from: investor, value: ether(100)});
let after = convertEther(getBalance(investor));
console.log("before: " + pre + "--after: " + after);
});
});
The printing log is: before: 100--after: 100
Here is my getBalance method:
export function getBalance(address) {
return web3.eth.getBalance(address)
}
I don't know why balance of account doesn't decrease. Please help me.
Thanks
{from: investor, value: ether(15)}but not my number in method transfer. for example:msg.sender.transfer(10);So is that means all ether will be consumed by function in contract ? thanks. – hqt Apr 18 '18 at 18:18fromaddress to thetoaddress if the transaction is successful. – Rob Hitchens Apr 19 '18 at 03:55