1

I'll be happy to get some clarifications on this function. Some usage example can be found here: https://github.com/Giveth/minime/blob/master/contracts/MiniMeToken.sol

Rows 31-31:

contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public;
}

Rows 247-266:

function approveAndCall(address _spender, uint256 _amount, bytes _extraData
) public returns (bool success) {
    require(approve(_spender, _amount));

    ApproveAndCallFallBack(_spender).receiveApproval(
        msg.sender,
        _amount,
        this,
        _extraData
    );

    return true;
}

I don't see an implementation of the function in the contracts code but just declaring and calling it.

1

receiveApproval function need to be implemented in service contract.

If token contract receives tokens via 'approveAndCall', it passes all values to receiveApproval which is in the service contract.

_spender is address of service contract.

I'm Korean and my english is not good but I hope you can understand what I'm saying.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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