1

Any help determining where I'm failing here would be helpful. I believe it has everything to do with my syntax, but am fairly new to DAPP development, but I believe the problem is in this line below. Thank in advance.

/// @notice Transfer the token from sender to the provided address.
/// @param _to Receiver of the tokens
/// @param _value Amount of token
/// @param _data Extra data for transfer
/// @return true/false
**function (transfer)(address _to, uint256 _value, bytes _data) public returns (bool) {**
    require(transfer(_to, _value));
    require(_to.call(_data));
    Transfer(msg.sender, _to, _value, _data);
    return true;
}

full code below.

/// @title Token contract
contract Token is ERC20, ERC827, Mintable {
    mapping(address => mapping(address => uint256)) internal _allowance;

constructor(Token) public {address _autonomousConverter; address _minter; uint _initialSupply; uint _decmult ; {
        Mintable(_autonomousConverter, _minter, _initialSupply, _decmult); {
    }

/// @notice Provide allowance information
function (allowance, address _owner, address _spender) public constant returns (uint256) token ; {
    return _allowance[_owner][_spender];
}

/// @notice Transfer the token from sender to the provided address.
/// @param _to Receiver of the tokens
/// @param _value Amount of token
/// @return true/false
function (address _to, uint256 _value) public returns (bool) token;
    require(_to != address(0));
    require(_to != minter);
    require(_to != address(this));

    _balanceOf[msg.sender] = _balanceOf[msg.sender].sub(_value);
    _balanceOf[_to] = _balanceOf[_to].add(_value);

    Transfer(msg.sender, _to, _value);
    return true;
}

/// @notice Transfer the token from sender to the provided address.
/// @param _to Receiver of the tokens
/// @param _value Amount of token
/// @param _data Extra data for transfer
/// @return true/false
function (transfer)(address _to, uint256 _value, bytes _data) public returns (bool) {
    require(transfer(_to, _value));
    require(_to.call(_data));
    Transfer(msg.sender, _to, _value, _data);
    return true;
}

/// @notice Transfer the token based on allowance.
/// msg.sender must have allowance for spending the tokens from owner ie _from
/// @param _from Owner of the tokens
/// @param _to Receiver of the tokens
/// @param _value Amount of token
/// @return true/false
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { 
    require(_to != address(0));       
    require(_to != minter);
    require(_to != address(this));
    require(_allowance[_from][msg.sender] >= _value);

    _balanceOf[_from] = _balanceOf[_from].sub(_value);
    _balanceOf[_to] = _balanceOf[_to].add(_value);
    _allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(_value);

    Transfer(_from, _to, _value);
    return true;
}

/// @notice Transfer then token based on allowance.
/// msg.sender must have allowance for spending the tokens from owner ie _from
/// @param _from Owner of the tokens
/// @param _to Receiver of the tokens
/// @param _value Amount of token
/// @param _data Extra data for transfer operation
/// @return true/false
function transferFrom(address _from, address _to, uint256 _value, bytes _data) public returns (bool) {
    require(transferFrom(_from, _to, _value));
    require(_to.call(_data));
    Transfer(_from, _to, _value, _data);
    return true;
}

/// @notice Approve spender to spend the token ie approve allowance
/// @param _spender Spender of the token
/// @param _value Amount of token that can be spent by spender
/// @return true/false
function approve(address _spender, uint256 _value) public returns (bool) {
    require(_spender != address(this));
    _allowance[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
}

/// @notice Approve spender to spend the token ie approve allowance
/// @param _spender Spender of the token
/// @param _value Amount of token that can be spent by spender
/// @param _data Extra data for approval
/// @return true/false
function approve(address _spender, uint256 _value, bytes _data) public returns (bool) {
    require(approve(_spender, _value));
    require(_spender.call(_data));
    Approval(msg.sender, _spender, _value, _data);
    return true;
}

/// @notice Transfer the token from sender to all the address provide in array.
/// @dev Left 160 bits are the recipient address and the right 96 bits are the token amount.
/// @param bits array of uint
/// @return true/false
function multiTransfer(uint[] bits) public returns (bool) {
    for (uint i = 0; i < bits.length; i++) {
        address a = address(bits[i] >> 96);
        uint amount = bits[i] & ((1 << 96) - 1);
        if (!transfer(a, amount)) revert();
    }

    return true;
}

/// @notice Increase allowance of spender
/// @param _spender Spender of the token
/// @param _value Amount of token that can be spent by spender
/// @return true/false
function approveMore(address _spender, uint256 _value) public returns (bool) {
    uint previous = _allowance[msg.sender][_spender];
    uint newAllowance = previous.add(_value);
    _allowance[msg.sender][_spender] = newAllowance;
    Approval(msg.sender, _spender, newAllowance);
    return true;
}

/// @notice Decrease allowance of spender
/// @param _spender Spender of the token
/// @param _value Amount of token that can be spent by spender
/// @return true/false
function approveLess(address _spender, uint256 _value) public returns (bool) {
    uint previous = _allowance[msg.sender][_spender];
    uint newAllowance = previous.sub(_value);
    _allowance[msg.sender][_spender] = newAllowance;
    Approval(msg.sender, _spender, newAllowance);
    return true;
}

}

0

function (transfer)(address _to, uint256 _value, bytes _data) public returns (bool)

You shouldn't use parenthesis for the function's name, delete them.

function transfer(address _to, uint256 _value, bytes _data) public returns (bool)


Beside that, I see other errors in your code.

function (allowance, address _owner, address _spender) should be function allowance(address _owner, address _spender)

Also, why there is token at the end?


function (address _to, uint256 _value) public returns (bool) token;

No name?


constructor(Token) public {address _autonomousConverter; address _minter; uint _initialSupply; uint _decmult ; {...} is wrong. It should be :

constructor(parameters...) {...code}

| improve this answer | |
  • I removed the parenthesis frm arnd my functions name. I also removed token to reflect the line below, but I still receive ParserError: Expected token LParen got 'Identifier' function allowance(address _owner, address _spender) public constant returns (uint256); . Clearly this is something I'm doing wrong. Again, thanks for all of your help } /// @notice Provide allowance information function allowance(address _owner, address _spender) public constant returns (uint256); return _allowance[_owner][_spender]; } – Andrew Botwin May 2 '18 at 17:46
  • New error found. – Elisha Drion May 2 '18 at 17:56

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.