Skip to content

Commit

Permalink
Fix sol linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Dafflon committed Nov 4, 2018
1 parent e8ae1bc commit d171e97
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
12 changes: 6 additions & 6 deletions contracts/ERC20Token.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ pragma solidity ^0.4.21;


interface ERC20Token {
function name() public constant returns (string);
function symbol() public constant returns (string);
function decimals() public constant returns (uint8);
function totalSupply() public constant returns (uint256);
function balanceOf(address owner) public constant returns (uint256);
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public view returns (uint256);
function balanceOf(address owner) public view returns (uint256);
function transfer(address to, uint256 amount) public returns (bool);
function transferFrom(address from, address to, uint256 amount) public returns (bool);
function approve(address spender, uint256 amount) public returns (bool);
function allowance(address owner, address spender) public constant returns (uint256);
function allowance(address owner, address spender) public view returns (uint256);

// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed from, address indexed to, uint256 amount);
Expand Down
24 changes: 12 additions & 12 deletions contracts/ERC777BaseToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {
/* -- ERC777 Interface Implementation -- */
//
/// @return the name of the token
function name() public constant returns (string) { return mName; }
function name() public view returns (string) { return mName; }

/// @return the symbol of the token
function symbol() public constant returns (string) { return mSymbol; }
function symbol() public view returns (string) { return mSymbol; }

/// @return the granularity of the token
function granularity() public constant returns (uint256) { return mGranularity; }
function granularity() public view returns (uint256) { return mGranularity; }

/// @return the total supply of the token
function totalSupply() public constant returns (uint256) { return mTotalSupply; }
function totalSupply() public view returns (uint256) { return mTotalSupply; }

/// @notice Return the account balance of some account
/// @param _tokenHolder Address for which the balance is returned
/// @return the balance of `_tokenAddress`.
function balanceOf(address _tokenHolder) public constant returns (uint256) { return mBalances[_tokenHolder]; }
function balanceOf(address _tokenHolder) public view returns (uint256) { return mBalances[_tokenHolder]; }

/// @notice Return the list of default operators
/// @return the list of all the default operators
Expand All @@ -84,7 +84,7 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {
} else {
mAuthorizedOperators[_operator][msg.sender] = true;
}
AuthorizedOperator(_operator, msg.sender);
emit AuthorizedOperator(_operator, msg.sender);
}

/// @notice Revoke a third party `_operator`'s rights to manage (send) `msg.sender`'s tokens.
Expand All @@ -96,14 +96,14 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {
} else {
mAuthorizedOperators[_operator][msg.sender] = false;
}
RevokedOperator(_operator, msg.sender);
emit RevokedOperator(_operator, msg.sender);
}

/// @notice Check whether the `_operator` address is allowed to manage the tokens held by `_tokenHolder` address.
/// @param _operator address to check if it has the right to manage the tokens
/// @param _tokenHolder address which holds the tokens to be managed
/// @return `true` if `_operator` is authorized for `_tokenHolder`
function isOperatorFor(address _operator, address _tokenHolder) public constant returns (bool) {
function isOperatorFor(address _operator, address _tokenHolder) public view returns (bool) {
return (_operator == _tokenHolder
|| mAuthorizedOperators[_operator][_tokenHolder]
|| (mIsDefaultOperator[_operator] && !mRevokedDefaultOperator[_operator][_tokenHolder]));
Expand Down Expand Up @@ -140,10 +140,10 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {
/// @notice Check whether an address is a regular address or not.
/// @param _addr Address of the contract that has to be checked
/// @return `true` if `_addr` is a regular address (not a contract)
function isRegularAddress(address _addr) internal constant returns(bool) {
function isRegularAddress(address _addr) internal view returns(bool) {
if (_addr == 0) { return false; }
uint size;
assembly { size := extcodesize(_addr) } // solhint-disable-line no-inline-assembly
assembly { size := extcodesize(_addr) } // solium-disable-line security/no-inline-assembly
return size == 0;
}

Expand Down Expand Up @@ -181,7 +181,7 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {

callRecipient(_operator, _from, _to, _amount, _holderData, _operatorData, _preventLocking);

Sent(_operator, _from, _to, _amount, _holderData, _operatorData);
emit Sent(_operator, _from, _to, _amount, _holderData, _operatorData);
}

/// @notice Helper function actually performing the burning of tokens.
Expand All @@ -200,7 +200,7 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {
mTotalSupply = mTotalSupply.sub(_amount);

callSender(_operator, _tokenHolder, 0x0, _amount, _holderData, _operatorData);
Burned(_operator, _tokenHolder, _amount, _holderData, _operatorData);
emit Burned(_operator, _tokenHolder, _amount, _holderData, _operatorData);
}

/// @notice Helper function that checks for ERC777TokensRecipient on the recipient and calls it.
Expand Down
4 changes: 2 additions & 2 deletions contracts/ERC777ERC20BaseToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ contract ERC777ERC20BaseToken is ERC20Token, ERC777BaseToken {
internal
{
super.doSend(_operator, _from, _to, _amount, _holderData, _operatorData, _preventLocking);
if (mErc20compatible) { Transfer(_from, _to, _amount); }
if (mErc20compatible) { emit Transfer(_from, _to, _amount); }
}

function doBurn(address _operator, address _tokenHolder, uint256 _amount, bytes _holderData, bytes _operatorData)
internal
{
super.doBurn(_operator, _tokenHolder, _amount, _holderData, _operatorData);
if (mErc20compatible) { Transfer(_tokenHolder, 0x0, _amount); }
if (mErc20compatible) { emit Transfer(_tokenHolder, 0x0, _amount); }
}
}
3 changes: 2 additions & 1 deletion contracts/examples/ExampleTokensSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ contract ExampleTokensSender is ERC820Implementer, ERC820ImplementerInterface, E
bytes holderData,
bytes operatorData
) // solhint-enable no-unused-vars
public {
public
{
require(allowTokensToSend);
notified = true;
}
Expand Down
14 changes: 7 additions & 7 deletions contracts/examples/ReferenceToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ contract ReferenceToken is ERC777ERC20BaseToken, Ownable {
uint256 _granularity,
address[] _defaultOperators,
address _burnOperator
) public ERC777ERC20BaseToken(_name, _symbol, _granularity, _defaultOperators) {
mBurnOperator = _burnOperator;
}
)
public ERC777ERC20BaseToken(_name, _symbol, _granularity, _defaultOperators)
{ mBurnOperator = _burnOperator; }

/// @notice Disables the ERC20 interface. This function can only be called
/// by the owner.
function disableERC20() public onlyOwner {
mErc20compatible = false;
setInterfaceImplementation("ERC20Token", 0x0);
ERC20Disabled();
emit ERC20Disabled();
}

/// @notice Re enables the ERC20 interface. This function can only be called
/// by the owner.
function enableERC20() public onlyOwner {
mErc20compatible = true;
setInterfaceImplementation("ERC20Token", this);
ERC20Enabled();
emit ERC20Enabled();
}

/* -- Mint And Burn Functions (not part of the ERC777 standard, only the Events/tokensReceived call are) -- */
Expand All @@ -63,8 +63,8 @@ contract ReferenceToken is ERC777ERC20BaseToken, Ownable {

callRecipient(msg.sender, 0x0, _tokenHolder, _amount, "", _operatorData, true);

Minted(msg.sender, _tokenHolder, _amount, _operatorData);
if (mErc20compatible) { Transfer(0x0, _tokenHolder, _amount); }
emit Minted(msg.sender, _tokenHolder, _amount, _operatorData);
if (mErc20compatible) { emit Transfer(0x0, _tokenHolder, _amount); }
}

/// @notice Burns `_amount` tokens from `msg.sender`
Expand Down

0 comments on commit d171e97

Please sign in to comment.