I have a function that needs to make transfers to a token smart contract as well as personal accounts upon satisfaction of some conditions.
function completeSale() onlyOwner public {
if (something == true && balance >= requested) {
tokenContract.transfer(requested/100);
seller.transfer(requested - (requested/100));
buyer.transfer(balance - requested);
assert(address(this).balance == 0);
complete = true;
}
}
However, looking at the ERC20 standard, transfer is implemented as a token method:
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true; }
How does one then transfer value in ether to an ERC20 smart contract? Is this possible without writing another function that then requires a low level call (i.e. tokenAddress.myPayMethod.value(x)
or tokenAddress.call.value(x)()
)?