liderako / eth_contracts

0 stars 1 forks source link

Avoid using `call`? #8

Closed liderako closed 6 years ago

liderako commented 6 years ago

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 commented 6 years ago

Done