2

I am pretty new at both ehtereum and Solidity, so my question might be trivial. But I was not able to find an answer Googling for it. I am looking at the contract code for Bittrex deposit. I found this function

function tokenFallback(address _from, uint _value, bytes _data) {
    (_from);
    (_value);
    (_data);
 }

It looks like it just calls the parameters as functions. Can anyone tell me what is going on?

Also, is there a list somewhere with all the standard stuff you have when coding Solidity. I can find the data types and such, but I didn't know the fallback function was a thing. Are there other standard functions like the fallback function?

Thanks

1
  • Where is the contract code for Bittrex deposit available? Commented Mar 14, 2018 at 20:11

1 Answer 1

6

On the main question: (_from); is not a function call. It's basically a no-op (it does nothing at all). So why use it? I think only to suppress the compiler warning about unused function parameters.

If we remove the parameters from the function body,

function tokenFallback(address _from, uint _value, bytes _data) {
}

putting this into solc gives,

test.solc:2:28: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function tokenFallback(address _from, uint _value, bytes _data) {
                           ^-----------^
test.solc:2:43: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function tokenFallback(address _from, uint _value, bytes _data) {
                                          ^---------^
test.solc:2:56: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function tokenFallback(address _from, uint _value, bytes _data) {
                                                       ^---------^

which is horribly noisy.

As for a comprehensive list of everything you need to know about Solidity, I'm not aware of one. Read a lot of code; ask a lot of questions - doing fine so far!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.