Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't trust outside contract #2

Open
ryu9827 opened this issue Jul 23, 2019 · 0 comments
Open

Don't trust outside contract #2

ryu9827 opened this issue Jul 23, 2019 · 0 comments

Comments

@ryu9827
Copy link

ryu9827 commented Jul 23, 2019

function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable {
if (token == 0x000000000000000000000000000000000000bEEF){
multisendEther(_contributors, _balances);
} else {
uint256 total = 0;
require(_contributors.length <= arrayLimit());
ERC20 erc20token = ERC20(token);
uint8 i = 0;
for (i; i < _contributors.length; i++) {
erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]);
total += _balances[i];
}
setTxCount(msg.sender, txCount(msg.sender).add(1));
Multisended(total, token);
}
}

When our contract is calling functions in outside contracts, we need to verify if the expected behaviors are really being executed.
At line 111, it's calling erc20token.transferFrom(). We expect the token contract to transfer the tokens to the _contributors by this function. But a dummy token contract can be designed not to do the transaction.
This is usually a critical issue due to the potential loss if the Dapp syncronizes the balances of those _contributors. But in our case, it is simply a minor issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant