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

Avoid using call? #8

Closed
liderako opened this issue Dec 5, 2017 · 1 comment
Closed

Avoid using call? #8

liderako opened this issue Dec 5, 2017 · 1 comment

Comments

@liderako
Copy link
Owner

liderako commented Dec 5, 2017

Hey,

Your smart contract generates a warning in Remix about using call here:

function withdraw() {
if (tokens[0][msg.sender] < amount) throw;
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.call.value(amount)()) throw;
Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
Shouldn't this have been written like:

function withdraw() {
if (tokens[0][msg.sender] < amount) throw;
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.send(amount)) throw;
Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}

Thoughts?
Or perhaps using transfer if you have a need to modify the gas amount. See here: ethereum/solidity#610

@liderako
Copy link
Owner Author

liderako commented Dec 5, 2017

Done

@liderako liderako closed this as completed Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant