Commit 6c4c8989 by Leo Arias Committed by Francisco Giordano

Use prefix underscore for state variables and no underscore for parameters (#1282)

* Role tests (#1228)

* Moved RBAC tests to access.

* Added Roles.addMany and tests.

* Fixed linter error.

* Now using uint256 indexes.

* Removed RBAC tokens (#1229)

* Deleted RBACCappedTokenMock.

* Removed RBACMintableToken.

* Removed RBACMintableToken from the MintedCrowdsale tests.

* Roles can now be transfered. (#1235)

* Roles can now be transfered.

* Now explicitly checking support for the null address.

* Now rejecting transfer to a role-haver.

* Added renounce, roles can no longer be transfered to 0.

* Fixed linter errors.

* Fixed a Roles test.

* True Ownership (#1247)

* Added barebones Secondary.

* Added transferPrimary

* Escrow is now Secondary instead of Ownable.

* Now reverting on transfers to 0.

* The Secondary's primary is now private.

* Improve encapsulation on ERC165

* Improve encapsulation on ERC20

* Improve encapsulation on ERC721

* Add tests, use standard getters

* fix tests

* Fix lint

* MintableToken using Roles (#1236)

* Minor test style improvements (#1219)

* Changed .eq to .equal

* Changed equal(bool) to .to.be.bool

* Changed be.bool to equal(bool), disallowed unused expressions.

* Add ERC165Query library (#1086)

* Add ERC165Query library

* Address PR Comments

* Add tests and mocks from #1024 and refactor code slightly

* Fix javascript and solidity linting errors

* Split supportsInterface into three methods as discussed in #1086

* Change InterfaceId_ERC165 comment to match style in the rest of the repo

* Fix max-len lint issue on ERC165Checker.sol

* Conditionally ignore the asserts during solidity-coverage test

* Switch to abi.encodeWithSelector and add test for account addresses

* Switch to supportsInterfaces API as suggested by @frangio

* Adding ERC165InterfacesSupported.sol

* Fix style issues

* Add test for supportsInterfaces returning false

* Add ERC165Checker.sol newline

* feat: fix coverage implementation

* fix: solidity linting error

* fix: revert to using boolean tests instead of require statements

* fix: make supportsERC165Interface private again

* rename SupportsInterfaceWithLookupMock to avoid name clashing

* Added mint and burn tests for zero amounts. (#1230)

* Changed .eq to .equal. (#1231)

* ERC721 pausable token (#1154)

* ERC721 pausable token

* Reuse of ERC721 Basic behavior for Pausable, split view checks in paused state & style fixes

* [~] paused token behavior

* Add some detail to releasing steps (#1190)

* add note about pulling upstream changes to release branch

* add comment about upstream changes in merging section

* Increase test coverage (#1237)

* Fixed a SplitPayment test

* Deleted unnecessary function.

* Improved PostDeliveryCrowdsale tests.

* Improved RefundableCrowdsale tests.

* Improved MintedCrowdsale tests.

* Improved IncreasingPriceCrowdsale tests.

* Fixed a CappedCrowdsale test.

* Improved TimedCrowdsale tests.

* Improved descriptions of added tests.

*  ci: trigger docs update on tag  (#1186)

* MintableToken now uses Roles.

* Fixed FinalizableCrowdsale test.

* Roles can now be transfered.

* Fixed tests related to MintableToken.

* Removed Roles.check.

* Renamed transferMintPermission.

* Moved MinterRole

* Fixed RBAC.

* Adressed review comments.

* Addressed review comments

* Fixed linter errors.

* Added Events tests of Pausable contract (#1207)

* Fixed roles tests.

* Rename events to past-tense (#1181)

* fix: refactor sign.js and related tests (#1243)

* fix: refactor sign.js and related tests

* fix: remove unused dep

* fix: update package.json correctly

* Added "_" sufix to internal variables (#1171)

* Added PublicRole test.

* Fixed crowdsale tests.

* Rename ERC interfaces to I prefix (#1252)

* rename ERC20 to IERC20

* move ERC20.sol to IERC20.sol

* rename StandardToken to ERC20

* rename StandardTokenMock to ERC20Mock

* move StandardToken.sol to ERC20.sol, likewise test and mock files

* rename MintableToken to ERC20Mintable

* move MintableToken.sol to ERC20Mintable.sol, likewise test and mock files

* rename BurnableToken to ERC20Burnable

* move BurnableToken.sol to ERC20Burnable.sol, likewise for related files

* rename CappedToken to ERC20Capped

* move CappedToken.sol to ERC20Capped.sol, likewise for related files

* rename PausableToken to ERC20Pausable

* move PausableToken.sol to ERC20Pausable.sol, likewise for related files

* rename DetailedERC20 to ERC20Detailed

* move DetailedERC20.sol to ERC20Detailed.sol, likewise for related files

* rename ERC721 to IERC721, and likewise for other related interfaces

* move ERC721.sol to IERC721.sol, likewise for other 721 interfaces

* rename ERC721Token to ERC721

* move ERC721Token.sol to ERC721.sol, likewise for related files

* rename ERC721BasicToken to ERC721Basic

* move ERC721BasicToken.sol to ERC721Basic.sol, likewise for related files

* rename ERC721PausableToken to ERC721Pausable

* move ERC721PausableToken.sol to ERC721Pausable.sol

* rename ERC165 to IERC165

* move ERC165.sol to IERC165.sol

* amend comment that ERC20 is based on FirstBlood

* fix comments mentioning IERC721Receiver

* added explicit visibility (#1261)

* Remove underscores from event parameters. (#1258)

* Remove underscores from event parameters.

Fixes #1175

* Add comment about ERC

* Move contracts to subdirectories (#1253)

* Move contracts to subdirectories

Fixes #1177.

This Change also removes the LimitBalance contract.

* fix import

* move MerkleProof to cryptography

* Fix import

* Remove HasNoEther, HasNoTokens, HasNoContracts, and NoOwner (#1254)

* remove HasNoEther, HasNoTokens, HasNoContracts, and NoOwner

* remove unused ERC223TokenMock

* remove Contactable

* remove TokenDestructible

* remove DeprecatedERC721

* inline Destructible#destroy in Bounty

* remove Destructible

* Functions in interfaces changed to "external" (#1263)

* Add a leading underscore to internal and private functions. (#1257)

* Add a leading underscore to internal and private functions.

Fixes #1176

* Remove super

* update the ERC721 changes

* add missing underscore after merge

* Fix mock

* Improve encapsulation on SignatureBouncer, Whitelist and RBAC example (#1265)

* Improve encapsulation on Whitelist

* remove only

* update whitelisted crowdsale test

* Improve encapsulation on SignatureBouncer

* fix missing test

* Improve encapsulation on RBAC example

* Improve encapsulation on RBAC example

* Remove extra visibility

* Improve encapsulation on ERC20 Mintable

* Improve encapsulation on Superuser

* fix lint

* add missing constant

* Addressed review comments.

* Fixed build error.

* move interface ids to implementation contracts

* Do not prefix getters

* Improve encapsulation on Crowdsales

* add missing tests

* remove only

* Improve encapsulation on Pausable

* add the underscore

* Improve encapsulation on ownership

* fix rebase

* fix ownership

* Improve encapsulation on payments

* Add missing tests

* add missing test

* Do not prefix getters

* Do not prefix getters

* Fix tests.

* Update modifiers to call public view functions.

Fixes #1179.

* Improve encapsulation on BreakInvariantBounty

* Make researchers private

* Improve encapsulation on Crowdsales

* add missing tests

* remove only

* Improve encapsulation on Pausable

* add the underscore

* Improve encapsulation on ownership

* fix rebase

* fix ownership

* Improve encapsulation on payments

* Add missing tests

* add missing test

* Do not prefix getters

* Do not prefix getters

* Do not prefix getters

* Fix tests.

* tmp

* remove isMinter

* fix is owner call

* fix isOpen

* Fix merge

* tmp

* Improve encapsulation on TimedCrowdsale

* Add missing parentheses

* Use prefix underscore for state variables and no underscore for parameters

* Improved Roles API. (#1280)

* Improved Roles API.

* fix linter error

* Added PauserRole. (#1283)

* remove duplicate function definition

* Remove Claimable, DelayedClaimable, Heritable (#1274)

* remove Claimable, DelayedClaimable, Heritable

* remove SimpleSavingsWallet example which used Heritable

(cherry picked from commit 0dc71173)

* Role behavior tests (#1285)

* Added role tests.

* Added PauserRole tests to contracts that have that role.

* Added MinterRole tests to contracts that have that role.

* Fixed linter errors.

* Migrate Ownable to Roles (#1287)

* Added CapperRole.

* RefundEscrow is now Secondary.

* FinalizableCrowdsale is no longer Ownable.

* Removed Whitelist and WhitelistedCrowdsale, redesign needed.

* Fixed linter errors, disabled lbrace due to it being buggy.

* Remove RBAC, SignatureBouncer refactor (#1289)

* Added CapperRole.

* RefundEscrow is now Secondary.

* FinalizableCrowdsale is no longer Ownable.

* Removed Whitelist and WhitelistedCrowdsale, redesign needed.

* Fixed linter errors, disabled lbrace due to it being buggy.

* Moved SignatureBouncer tests.

* Deleted RBAC and Superuser.

* Deleted rbac directory.

* Updated readme.

* SignatureBouncer now uses SignerRole, renamed bouncer to signer.

* feat: implement ERC721Mintable and ERC721Burnable (#1276)

* feat: implement ERC721Mintable and ERC721Burnable

* fix: linting errors

* fix: remove unused mintable mock for ERC721BasicMock

* fix: add finishMinting tests

* fix: catch MintFinished typo

* inline ERC721Full behavior

* undo pretty formatting

* fix lint errors

* rename canMint to onlyBeforeMintingFinished for consistency with ERC20Mintable

* Fix the merge with the privatization branch

* fix lint

* Remove underscore

* Delete CapperRole.test.js

* fix increaseApproval
parent 254210f6
...@@ -16,35 +16,19 @@ Any exception or additions specific to our project are documented below. ...@@ -16,35 +16,19 @@ Any exception or additions specific to our project are documented below.
* Try to avoid acronyms and abbreviations. * Try to avoid acronyms and abbreviations.
* Parameters must be prefixed with an underscore. * Private state variables should have an underscore prefix.
```
function test(uint256 _testParameter1, uint256 _testParameter2) {
...
}
```
The exception are the parameters of events. There is no chance of ambiguity
with these, so they should not have underscores. Not even if they are
specified on an ERC with underscores; removing them doesn't change the ABI,
so we should be consistent with the rest of the events in this repository
and remove them.
* Internal and private state variables should have an underscore suffix.
``` ```
contract TestContract { contract TestContract {
uint256 internal internalVar_; uint256 private _privateVar;
uint256 private privateVar_;
} }
``` ```
Variables declared in a function should not follow this rule. * Parameters must not be prefixed with an underscore.
``` ```
function test() { function test(uint256 testParameter1, uint256 testParameter2) {
uint256 functionVar; ...
...
} }
``` ```
......
...@@ -20,21 +20,21 @@ contract CapperRole { ...@@ -20,21 +20,21 @@ contract CapperRole {
_; _;
} }
function isCapper(address _account) public view returns (bool) { function isCapper(address account) public view returns (bool) {
return cappers.has(_account); return cappers.has(account);
} }
function addCapper(address _account) public onlyCapper { function addCapper(address account) public onlyCapper {
cappers.add(_account); cappers.add(account);
emit CapperAdded(_account); emit CapperAdded(account);
} }
function renounceCapper() public { function renounceCapper() public {
cappers.remove(msg.sender); cappers.remove(msg.sender);
} }
function _removeCapper(address _account) internal { function _removeCapper(address account) internal {
cappers.remove(_account); cappers.remove(account);
emit CapperRemoved(_account); emit CapperRemoved(account);
} }
} }
...@@ -20,21 +20,21 @@ contract MinterRole { ...@@ -20,21 +20,21 @@ contract MinterRole {
_; _;
} }
function isMinter(address _account) public view returns (bool) { function isMinter(address account) public view returns (bool) {
return minters.has(_account); return minters.has(account);
} }
function addMinter(address _account) public onlyMinter { function addMinter(address account) public onlyMinter {
minters.add(_account); minters.add(account);
emit MinterAdded(_account); emit MinterAdded(account);
} }
function renounceMinter() public { function renounceMinter() public {
minters.remove(msg.sender); minters.remove(msg.sender);
} }
function _removeMinter(address _account) internal { function _removeMinter(address account) internal {
minters.remove(_account); minters.remove(account);
emit MinterRemoved(_account); emit MinterRemoved(account);
} }
} }
...@@ -20,21 +20,21 @@ contract PauserRole { ...@@ -20,21 +20,21 @@ contract PauserRole {
_; _;
} }
function isPauser(address _account) public view returns (bool) { function isPauser(address account) public view returns (bool) {
return pausers.has(_account); return pausers.has(account);
} }
function addPauser(address _account) public onlyPauser { function addPauser(address account) public onlyPauser {
pausers.add(_account); pausers.add(account);
emit PauserAdded(_account); emit PauserAdded(account);
} }
function renouncePauser() public { function renouncePauser() public {
pausers.remove(msg.sender); pausers.remove(msg.sender);
} }
function _removePauser(address _account) internal { function _removePauser(address account) internal {
pausers.remove(_account); pausers.remove(account);
emit PauserRemoved(_account); emit PauserRemoved(account);
} }
} }
...@@ -20,21 +20,21 @@ contract SignerRole { ...@@ -20,21 +20,21 @@ contract SignerRole {
_; _;
} }
function isSigner(address _account) public view returns (bool) { function isSigner(address account) public view returns (bool) {
return signers.has(_account); return signers.has(account);
} }
function addSigner(address _account) public onlySigner { function addSigner(address account) public onlySigner {
signers.add(_account); signers.add(account);
emit SignerAdded(_account); emit SignerAdded(account);
} }
function renounceSigner() public { function renounceSigner() public {
signers.remove(msg.sender); signers.remove(msg.sender);
} }
function _removeSigner(address _account) internal { function _removeSigner(address account) internal {
signers.remove(_account); signers.remove(account);
emit SignerRemoved(_account); emit SignerRemoved(account);
} }
} }
...@@ -10,8 +10,8 @@ import "../ownership/Ownable.sol"; ...@@ -10,8 +10,8 @@ import "../ownership/Ownable.sol";
* @dev This bounty will pay out to a researcher if they break invariant logic of the contract. * @dev This bounty will pay out to a researcher if they break invariant logic of the contract.
*/ */
contract BreakInvariantBounty is PullPayment, Ownable { contract BreakInvariantBounty is PullPayment, Ownable {
bool private claimed_; bool private _claimed;
mapping(address => address) private researchers; mapping(address => address) private _researchers;
event TargetCreated(address createdAddress); event TargetCreated(address createdAddress);
...@@ -19,7 +19,7 @@ contract BreakInvariantBounty is PullPayment, Ownable { ...@@ -19,7 +19,7 @@ contract BreakInvariantBounty is PullPayment, Ownable {
* @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed. * @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed.
*/ */
function() external payable { function() external payable {
require(!claimed_); require(!_claimed);
} }
/** /**
...@@ -27,7 +27,7 @@ contract BreakInvariantBounty is PullPayment, Ownable { ...@@ -27,7 +27,7 @@ contract BreakInvariantBounty is PullPayment, Ownable {
* @return true if the bounty was claimed, false otherwise. * @return true if the bounty was claimed, false otherwise.
*/ */
function claimed() public view returns(bool) { function claimed() public view returns(bool) {
return claimed_; return _claimed;
} }
/** /**
...@@ -37,22 +37,22 @@ contract BreakInvariantBounty is PullPayment, Ownable { ...@@ -37,22 +37,22 @@ contract BreakInvariantBounty is PullPayment, Ownable {
*/ */
function createTarget() public returns(Target) { function createTarget() public returns(Target) {
Target target = Target(_deployContract()); Target target = Target(_deployContract());
researchers[target] = msg.sender; _researchers[target] = msg.sender;
emit TargetCreated(target); emit TargetCreated(target);
return target; return target;
} }
/** /**
* @dev Transfers the contract funds to the researcher that proved the contract is broken. * @dev Transfers the contract funds to the researcher that proved the contract is broken.
* @param _target contract * @param target contract
*/ */
function claim(Target _target) public { function claim(Target target) public {
address researcher = researchers[_target]; address researcher = _researchers[target];
require(researcher != address(0)); require(researcher != address(0));
// Check Target contract invariants // Check Target contract invariants
require(!_target.checkInvariant()); require(!target.checkInvariant());
_asyncTransfer(researcher, address(this).balance); _asyncTransfer(researcher, address(this).balance);
claimed_ = true; _claimed = true;
} }
/** /**
......
...@@ -22,19 +22,19 @@ contract Crowdsale { ...@@ -22,19 +22,19 @@ contract Crowdsale {
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
// The token being sold // The token being sold
IERC20 private token_; IERC20 private _token;
// Address where funds are collected // Address where funds are collected
address private wallet_; address private _wallet;
// How many token units a buyer gets per wei. // How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit. // The rate is the conversion between wei and the smallest and indivisible token unit.
// So, if you are using a rate of 1 with a ERC20Detailed token with 3 decimals called TOK // So, if you are using a rate of 1 with a ERC20Detailed token with 3 decimals called TOK
// 1 wei will give you 1 unit, or 0.001 TOK. // 1 wei will give you 1 unit, or 0.001 TOK.
uint256 private rate_; uint256 private _rate;
// Amount of wei raised // Amount of wei raised
uint256 private weiRaised_; uint256 private _weiRaised;
/** /**
* Event for token purchase logging * Event for token purchase logging
...@@ -51,21 +51,21 @@ contract Crowdsale { ...@@ -51,21 +51,21 @@ contract Crowdsale {
); );
/** /**
* @param _rate Number of token units a buyer gets per wei * @param rate Number of token units a buyer gets per wei
* @dev The rate is the conversion between wei and the smallest and indivisible * @dev The rate is the conversion between wei and the smallest and indivisible
* token unit. So, if you are using a rate of 1 with a ERC20Detailed token * token unit. So, if you are using a rate of 1 with a ERC20Detailed token
* with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK. * with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK.
* @param _wallet Address where collected funds will be forwarded to * @param wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold * @param token Address of the token being sold
*/ */
constructor(uint256 _rate, address _wallet, IERC20 _token) public { constructor(uint256 rate, address wallet, IERC20 token) public {
require(_rate > 0); require(rate > 0);
require(_wallet != address(0)); require(wallet != address(0));
require(_token != address(0)); require(token != address(0));
rate_ = _rate; _rate = rate;
wallet_ = _wallet; _wallet = wallet;
token_ = _token; _token = token;
} }
// ----------------------------------------- // -----------------------------------------
...@@ -83,57 +83,57 @@ contract Crowdsale { ...@@ -83,57 +83,57 @@ contract Crowdsale {
* @return the token being sold. * @return the token being sold.
*/ */
function token() public view returns(IERC20) { function token() public view returns(IERC20) {
return token_; return _token;
} }
/** /**
* @return the address where funds are collected. * @return the address where funds are collected.
*/ */
function wallet() public view returns(address) { function wallet() public view returns(address) {
return wallet_; return _wallet;
} }
/** /**
* @return the number of token units a buyer gets per wei. * @return the number of token units a buyer gets per wei.
*/ */
function rate() public view returns(uint256) { function rate() public view returns(uint256) {
return rate_; return _rate;
} }
/** /**
* @return the mount of wei raised. * @return the mount of wei raised.
*/ */
function weiRaised() public view returns (uint256) { function weiRaised() public view returns (uint256) {
return weiRaised_; return _weiRaised;
} }
/** /**
* @dev low level token purchase ***DO NOT OVERRIDE*** * @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase * @param beneficiary Address performing the token purchase
*/ */
function buyTokens(address _beneficiary) public payable { function buyTokens(address beneficiary) public payable {
uint256 weiAmount = msg.value; uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount); _preValidatePurchase(beneficiary, weiAmount);
// calculate token amount to be created // calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount); uint256 tokens = _getTokenAmount(weiAmount);
// update state // update state
weiRaised_ = weiRaised_.add(weiAmount); _weiRaised = _weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens); _processPurchase(beneficiary, tokens);
emit TokensPurchased( emit TokensPurchased(
msg.sender, msg.sender,
_beneficiary, beneficiary,
weiAmount, weiAmount,
tokens tokens
); );
_updatePurchasingState(_beneficiary, weiAmount); _updatePurchasingState(beneficiary, weiAmount);
_forwardFunds(); _forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount); _postValidatePurchase(beneficiary, weiAmount);
} }
// ----------------------------------------- // -----------------------------------------
...@@ -143,29 +143,29 @@ contract Crowdsale { ...@@ -143,29 +143,29 @@ contract Crowdsale {
/** /**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations. * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations.
* Example from CappedCrowdsale.sol's _preValidatePurchase method: * Example from CappedCrowdsale.sol's _preValidatePurchase method:
* super._preValidatePurchase(_beneficiary, _weiAmount); * super._preValidatePurchase(beneficiary, weiAmount);
* require(weiRaised().add(_weiAmount) <= cap); * require(weiRaised().add(weiAmount) <= cap);
* @param _beneficiary Address performing the token purchase * @param beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase * @param weiAmount Value in wei involved in the purchase
*/ */
function _preValidatePurchase( function _preValidatePurchase(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
{ {
require(_beneficiary != address(0)); require(beneficiary != address(0));
require(_weiAmount != 0); require(weiAmount != 0);
} }
/** /**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase * @param beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase * @param weiAmount Value in wei involved in the purchase
*/ */
function _postValidatePurchase( function _postValidatePurchase(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
{ {
...@@ -174,40 +174,40 @@ contract Crowdsale { ...@@ -174,40 +174,40 @@ contract Crowdsale {
/** /**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase * @param beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted * @param tokenAmount Number of tokens to be emitted
*/ */
function _deliverTokens( function _deliverTokens(
address _beneficiary, address beneficiary,
uint256 _tokenAmount uint256 tokenAmount
) )
internal internal
{ {
token_.safeTransfer(_beneficiary, _tokenAmount); _token.safeTransfer(beneficiary, tokenAmount);
} }
/** /**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. * @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens * @param beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased * @param tokenAmount Number of tokens to be purchased
*/ */
function _processPurchase( function _processPurchase(
address _beneficiary, address beneficiary,
uint256 _tokenAmount uint256 tokenAmount
) )
internal internal
{ {
_deliverTokens(_beneficiary, _tokenAmount); _deliverTokens(beneficiary, tokenAmount);
} }
/** /**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.) * @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens * @param beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase * @param weiAmount Value in wei involved in the purchase
*/ */
function _updatePurchasingState( function _updatePurchasingState(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
{ {
...@@ -216,19 +216,19 @@ contract Crowdsale { ...@@ -216,19 +216,19 @@ contract Crowdsale {
/** /**
* @dev Override to extend the way in which ether is converted to tokens. * @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens * @param weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount * @return Number of tokens that can be purchased with the specified _weiAmount
*/ */
function _getTokenAmount(uint256 _weiAmount) function _getTokenAmount(uint256 weiAmount)
internal view returns (uint256) internal view returns (uint256)
{ {
return _weiAmount.mul(rate_); return weiAmount.mul(_rate);
} }
/** /**
* @dev Determines how ETH is stored/forwarded on purchases. * @dev Determines how ETH is stored/forwarded on purchases.
*/ */
function _forwardFunds() internal { function _forwardFunds() internal {
wallet_.transfer(msg.value); _wallet.transfer(msg.value);
} }
} }
...@@ -12,7 +12,7 @@ import "../validation/TimedCrowdsale.sol"; ...@@ -12,7 +12,7 @@ import "../validation/TimedCrowdsale.sol";
contract FinalizableCrowdsale is TimedCrowdsale { contract FinalizableCrowdsale is TimedCrowdsale {
using SafeMath for uint256; using SafeMath for uint256;
bool private finalized_ = false; bool private _finalized = false;
event CrowdsaleFinalized(); event CrowdsaleFinalized();
...@@ -20,7 +20,7 @@ contract FinalizableCrowdsale is TimedCrowdsale { ...@@ -20,7 +20,7 @@ contract FinalizableCrowdsale is TimedCrowdsale {
* @return true if the crowdsale is finalized, false otherwise. * @return true if the crowdsale is finalized, false otherwise.
*/ */
function finalized() public view returns (bool) { function finalized() public view returns (bool) {
return finalized_; return _finalized;
} }
/** /**
...@@ -28,13 +28,13 @@ contract FinalizableCrowdsale is TimedCrowdsale { ...@@ -28,13 +28,13 @@ contract FinalizableCrowdsale is TimedCrowdsale {
* work. Calls the contract's finalization function. * work. Calls the contract's finalization function.
*/ */
function finalize() public { function finalize() public {
require(!finalized_); require(!_finalized);
require(hasClosed()); require(hasClosed());
_finalization(); _finalization();
emit CrowdsaleFinalized(); emit CrowdsaleFinalized();
finalized_ = true; _finalized = true;
} }
/** /**
......
...@@ -12,39 +12,39 @@ import "../../math/SafeMath.sol"; ...@@ -12,39 +12,39 @@ import "../../math/SafeMath.sol";
contract PostDeliveryCrowdsale is TimedCrowdsale { contract PostDeliveryCrowdsale is TimedCrowdsale {
using SafeMath for uint256; using SafeMath for uint256;
mapping(address => uint256) private balances_; mapping(address => uint256) private _balances;
/** /**
* @dev Withdraw tokens only after crowdsale ends. * @dev Withdraw tokens only after crowdsale ends.
* @param _beneficiary Whose tokens will be withdrawn. * @param beneficiary Whose tokens will be withdrawn.
*/ */
function withdrawTokens(address _beneficiary) public { function withdrawTokens(address beneficiary) public {
require(hasClosed()); require(hasClosed());
uint256 amount = balances_[_beneficiary]; uint256 amount = _balances[beneficiary];
require(amount > 0); require(amount > 0);
balances_[_beneficiary] = 0; _balances[beneficiary] = 0;
_deliverTokens(_beneficiary, amount); _deliverTokens(beneficiary, amount);
} }
/** /**
* @return the balance of an account. * @return the balance of an account.
*/ */
function balanceOf(address _account) public view returns(uint256) { function balanceOf(address account) public view returns(uint256) {
return balances_[_account]; return _balances[account];
} }
/** /**
* @dev Overrides parent by storing balances instead of issuing tokens right away. * @dev Overrides parent by storing balances instead of issuing tokens right away.
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased * @param tokenAmount Amount of tokens purchased
*/ */
function _processPurchase( function _processPurchase(
address _beneficiary, address beneficiary,
uint256 _tokenAmount uint256 tokenAmount
) )
internal internal
{ {
balances_[_beneficiary] = balances_[_beneficiary].add(_tokenAmount); _balances[beneficiary] = _balances[beneficiary].add(tokenAmount);
} }
} }
...@@ -15,37 +15,37 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -15,37 +15,37 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
using SafeMath for uint256; using SafeMath for uint256;
// minimum amount of funds to be raised in weis // minimum amount of funds to be raised in weis
uint256 private goal_; uint256 private _goal;
// refund escrow used to hold funds while crowdsale is running // refund escrow used to hold funds while crowdsale is running
RefundEscrow private escrow_; RefundEscrow private _escrow;
/** /**
* @dev Constructor, creates RefundEscrow. * @dev Constructor, creates RefundEscrow.
* @param _goal Funding goal * @param goal Funding goal
*/ */
constructor(uint256 _goal) public { constructor(uint256 goal) public {
require(_goal > 0); require(goal > 0);
escrow_ = new RefundEscrow(wallet()); _escrow = new RefundEscrow(wallet());
goal_ = _goal; _goal = goal;
} }
/** /**
* @return minimum amount of funds to be raised in wei. * @return minimum amount of funds to be raised in wei.
*/ */
function goal() public view returns(uint256) { function goal() public view returns(uint256) {
return goal_; return _goal;
} }
/** /**
* @dev Investors can claim refunds here if crowdsale is unsuccessful * @dev Investors can claim refunds here if crowdsale is unsuccessful
* @param _beneficiary Whose refund will be claimed. * @param beneficiary Whose refund will be claimed.
*/ */
function claimRefund(address _beneficiary) public { function claimRefund(address beneficiary) public {
require(finalized()); require(finalized());
require(!goalReached()); require(!goalReached());
escrow_.withdraw(_beneficiary); _escrow.withdraw(beneficiary);
} }
/** /**
...@@ -53,7 +53,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -53,7 +53,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @return Whether funding goal was reached * @return Whether funding goal was reached
*/ */
function goalReached() public view returns (bool) { function goalReached() public view returns (bool) {
return weiRaised() >= goal_; return weiRaised() >= _goal;
} }
/** /**
...@@ -61,10 +61,10 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -61,10 +61,10 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
*/ */
function _finalization() internal { function _finalization() internal {
if (goalReached()) { if (goalReached()) {
escrow_.close(); _escrow.close();
escrow_.beneficiaryWithdraw(); _escrow.beneficiaryWithdraw();
} else { } else {
escrow_.enableRefunds(); _escrow.enableRefunds();
} }
super._finalization(); super._finalization();
...@@ -74,7 +74,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -74,7 +74,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Overrides Crowdsale fund forwarding, sending funds to escrow. * @dev Overrides Crowdsale fund forwarding, sending funds to escrow.
*/ */
function _forwardFunds() internal { function _forwardFunds() internal {
escrow_.deposit.value(msg.value)(msg.sender); _escrow.deposit.value(msg.value)(msg.sender);
} }
} }
...@@ -14,22 +14,22 @@ contract AllowanceCrowdsale is Crowdsale { ...@@ -14,22 +14,22 @@ contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256; using SafeMath for uint256;
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
address private tokenWallet_; address private _tokenWallet;
/** /**
* @dev Constructor, takes token wallet address. * @dev Constructor, takes token wallet address.
* @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale * @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/ */
constructor(address _tokenWallet) public { constructor(address tokenWallet) public {
require(_tokenWallet != address(0)); require(tokenWallet != address(0));
tokenWallet_ = _tokenWallet; _tokenWallet = tokenWallet;
} }
/** /**
* @return the address of the wallet that will hold the tokens. * @return the address of the wallet that will hold the tokens.
*/ */
function tokenWallet() public view returns(address) { function tokenWallet() public view returns(address) {
return tokenWallet_; return _tokenWallet;
} }
/** /**
...@@ -37,20 +37,20 @@ contract AllowanceCrowdsale is Crowdsale { ...@@ -37,20 +37,20 @@ contract AllowanceCrowdsale is Crowdsale {
* @return Amount of tokens left in the allowance * @return Amount of tokens left in the allowance
*/ */
function remainingTokens() public view returns (uint256) { function remainingTokens() public view returns (uint256) {
return token().allowance(tokenWallet_, this); return token().allowance(_tokenWallet, this);
} }
/** /**
* @dev Overrides parent behavior by transferring tokens from wallet. * @dev Overrides parent behavior by transferring tokens from wallet.
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased * @param tokenAmount Amount of tokens purchased
*/ */
function _deliverTokens( function _deliverTokens(
address _beneficiary, address beneficiary,
uint256 _tokenAmount uint256 tokenAmount
) )
internal internal
{ {
token().safeTransferFrom(tokenWallet_, _beneficiary, _tokenAmount); token().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount);
} }
} }
...@@ -13,17 +13,17 @@ contract MintedCrowdsale is Crowdsale { ...@@ -13,17 +13,17 @@ contract MintedCrowdsale is Crowdsale {
/** /**
* @dev Overrides delivery by minting tokens upon purchase. * @dev Overrides delivery by minting tokens upon purchase.
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _tokenAmount Number of tokens to be minted * @param tokenAmount Number of tokens to be minted
*/ */
function _deliverTokens( function _deliverTokens(
address _beneficiary, address beneficiary,
uint256 _tokenAmount uint256 tokenAmount
) )
internal internal
{ {
// Potentially dangerous assumption about the type of the token. // Potentially dangerous assumption about the type of the token.
require( require(
ERC20Mintable(address(token())).mint(_beneficiary, _tokenAmount)); ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
} }
} }
...@@ -13,33 +13,33 @@ import "../../math/SafeMath.sol"; ...@@ -13,33 +13,33 @@ import "../../math/SafeMath.sol";
contract IncreasingPriceCrowdsale is TimedCrowdsale { contract IncreasingPriceCrowdsale is TimedCrowdsale {
using SafeMath for uint256; using SafeMath for uint256;
uint256 private initialRate_; uint256 private _initialRate;
uint256 private finalRate_; uint256 private _finalRate;
/** /**
* @dev Constructor, takes initial and final rates of tokens received per wei contributed. * @dev Constructor, takes initial and final rates of tokens received per wei contributed.
* @param _initialRate Number of tokens a buyer gets per wei at the start of the crowdsale * @param initialRate Number of tokens a buyer gets per wei at the start of the crowdsale
* @param _finalRate Number of tokens a buyer gets per wei at the end of the crowdsale * @param finalRate Number of tokens a buyer gets per wei at the end of the crowdsale
*/ */
constructor(uint256 _initialRate, uint256 _finalRate) public { constructor(uint256 initialRate, uint256 finalRate) public {
require(_finalRate > 0); require(finalRate > 0);
require(_initialRate >= _finalRate); require(initialRate >= finalRate);
initialRate_ = _initialRate; _initialRate = initialRate;
finalRate_ = _finalRate; _finalRate = finalRate;
} }
/** /**
* @return the initial rate of the crowdsale. * @return the initial rate of the crowdsale.
*/ */
function initialRate() public view returns(uint256) { function initialRate() public view returns(uint256) {
return initialRate_; return _initialRate;
} }
/** /**
* @return the final rate of the crowdsale. * @return the final rate of the crowdsale.
*/ */
function finalRate() public view returns (uint256) { function finalRate() public view returns (uint256) {
return finalRate_; return _finalRate;
} }
/** /**
...@@ -51,20 +51,20 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale { ...@@ -51,20 +51,20 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
// solium-disable-next-line security/no-block-members // solium-disable-next-line security/no-block-members
uint256 elapsedTime = block.timestamp.sub(openingTime()); uint256 elapsedTime = block.timestamp.sub(openingTime());
uint256 timeRange = closingTime().sub(openingTime()); uint256 timeRange = closingTime().sub(openingTime());
uint256 rateRange = initialRate_.sub(finalRate_); uint256 rateRange = _initialRate.sub(_finalRate);
return initialRate_.sub(elapsedTime.mul(rateRange).div(timeRange)); return _initialRate.sub(elapsedTime.mul(rateRange).div(timeRange));
} }
/** /**
* @dev Overrides parent method taking into account variable rate. * @dev Overrides parent method taking into account variable rate.
* @param _weiAmount The value in wei to be converted into tokens * @param weiAmount The value in wei to be converted into tokens
* @return The number of tokens _weiAmount wei will buy at present time * @return The number of tokens _weiAmount wei will buy at present time
*/ */
function _getTokenAmount(uint256 _weiAmount) function _getTokenAmount(uint256 weiAmount)
internal view returns (uint256) internal view returns (uint256)
{ {
uint256 currentRate = getCurrentRate(); uint256 currentRate = getCurrentRate();
return currentRate.mul(_weiAmount); return currentRate.mul(weiAmount);
} }
} }
...@@ -11,22 +11,22 @@ import "../Crowdsale.sol"; ...@@ -11,22 +11,22 @@ import "../Crowdsale.sol";
contract CappedCrowdsale is Crowdsale { contract CappedCrowdsale is Crowdsale {
using SafeMath for uint256; using SafeMath for uint256;
uint256 private cap_; uint256 private _cap;
/** /**
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale. * @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param _cap Max amount of wei to be contributed * @param cap Max amount of wei to be contributed
*/ */
constructor(uint256 _cap) public { constructor(uint256 cap) public {
require(_cap > 0); require(cap > 0);
cap_ = _cap; _cap = cap;
} }
/** /**
* @return the cap of the crowdsale. * @return the cap of the crowdsale.
*/ */
function cap() public view returns(uint256) { function cap() public view returns(uint256) {
return cap_; return _cap;
} }
/** /**
...@@ -34,22 +34,22 @@ contract CappedCrowdsale is Crowdsale { ...@@ -34,22 +34,22 @@ contract CappedCrowdsale is Crowdsale {
* @return Whether the cap was reached * @return Whether the cap was reached
*/ */
function capReached() public view returns (bool) { function capReached() public view returns (bool) {
return weiRaised() >= cap_; return weiRaised() >= _cap;
} }
/** /**
* @dev Extend parent behavior requiring purchase to respect the funding cap. * @dev Extend parent behavior requiring purchase to respect the funding cap.
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed * @param weiAmount Amount of wei contributed
*/ */
function _preValidatePurchase( function _preValidatePurchase(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
{ {
super._preValidatePurchase(_beneficiary, _weiAmount); super._preValidatePurchase(beneficiary, weiAmount);
require(weiRaised().add(_weiAmount) <= cap_); require(weiRaised().add(weiAmount) <= _cap);
} }
} }
...@@ -12,68 +12,68 @@ import "../../access/roles/CapperRole.sol"; ...@@ -12,68 +12,68 @@ import "../../access/roles/CapperRole.sol";
contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
using SafeMath for uint256; using SafeMath for uint256;
mapping(address => uint256) private contributions_; mapping(address => uint256) private _contributions;
mapping(address => uint256) private caps_; mapping(address => uint256) private _caps;
/** /**
* @dev Sets a specific beneficiary's maximum contribution. * @dev Sets a specific beneficiary's maximum contribution.
* @param _beneficiary Address to be capped * @param beneficiary Address to be capped
* @param _cap Wei limit for individual contribution * @param cap Wei limit for individual contribution
*/ */
function setCap(address _beneficiary, uint256 _cap) external onlyCapper { function setCap(address beneficiary, uint256 cap) external onlyCapper {
caps_[_beneficiary] = _cap; _caps[beneficiary] = cap;
} }
/** /**
* @dev Returns the cap of a specific beneficiary. * @dev Returns the cap of a specific beneficiary.
* @param _beneficiary Address whose cap is to be checked * @param beneficiary Address whose cap is to be checked
* @return Current cap for individual beneficiary * @return Current cap for individual beneficiary
*/ */
function getCap(address _beneficiary) public view returns (uint256) { function getCap(address beneficiary) public view returns (uint256) {
return caps_[_beneficiary]; return _caps[beneficiary];
} }
/** /**
* @dev Returns the amount contributed so far by a specific beneficiary. * @dev Returns the amount contributed so far by a specific beneficiary.
* @param _beneficiary Address of contributor * @param beneficiary Address of contributor
* @return Beneficiary contribution so far * @return Beneficiary contribution so far
*/ */
function getContribution(address _beneficiary) function getContribution(address beneficiary)
public view returns (uint256) public view returns (uint256)
{ {
return contributions_[_beneficiary]; return _contributions[beneficiary];
} }
/** /**
* @dev Extend parent behavior requiring purchase to respect the beneficiary's funding cap. * @dev Extend parent behavior requiring purchase to respect the beneficiary's funding cap.
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed * @param weiAmount Amount of wei contributed
*/ */
function _preValidatePurchase( function _preValidatePurchase(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
{ {
super._preValidatePurchase(_beneficiary, _weiAmount); super._preValidatePurchase(beneficiary, weiAmount);
require( require(
contributions_[_beneficiary].add(_weiAmount) <= caps_[_beneficiary]); _contributions[beneficiary].add(weiAmount) <= _caps[beneficiary]);
} }
/** /**
* @dev Extend parent behavior to update beneficiary contributions * @dev Extend parent behavior to update beneficiary contributions
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed * @param weiAmount Amount of wei contributed
*/ */
function _updatePurchasingState( function _updatePurchasingState(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
{ {
super._updatePurchasingState(_beneficiary, _weiAmount); super._updatePurchasingState(beneficiary, weiAmount);
contributions_[_beneficiary] = contributions_[_beneficiary].add( _contributions[beneficiary] = _contributions[beneficiary].add(
_weiAmount); weiAmount);
} }
} }
...@@ -11,8 +11,8 @@ import "../Crowdsale.sol"; ...@@ -11,8 +11,8 @@ import "../Crowdsale.sol";
contract TimedCrowdsale is Crowdsale { contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256; using SafeMath for uint256;
uint256 private openingTime_; uint256 private _openingTime;
uint256 private closingTime_; uint256 private _closingTime;
/** /**
* @dev Reverts if not in crowdsale time range. * @dev Reverts if not in crowdsale time range.
...@@ -24,30 +24,30 @@ contract TimedCrowdsale is Crowdsale { ...@@ -24,30 +24,30 @@ contract TimedCrowdsale is Crowdsale {
/** /**
* @dev Constructor, takes crowdsale opening and closing times. * @dev Constructor, takes crowdsale opening and closing times.
* @param _openingTime Crowdsale opening time * @param openingTime Crowdsale opening time
* @param _closingTime Crowdsale closing time * @param closingTime Crowdsale closing time
*/ */
constructor(uint256 _openingTime, uint256 _closingTime) public { constructor(uint256 openingTime, uint256 closingTime) public {
// solium-disable-next-line security/no-block-members // solium-disable-next-line security/no-block-members
require(_openingTime >= block.timestamp); require(openingTime >= block.timestamp);
require(_closingTime >= _openingTime); require(closingTime >= openingTime);
openingTime_ = _openingTime; _openingTime = openingTime;
closingTime_ = _closingTime; _closingTime = closingTime;
} }
/** /**
* @return the crowdsale opening time. * @return the crowdsale opening time.
*/ */
function openingTime() public view returns(uint256) { function openingTime() public view returns(uint256) {
return openingTime_; return _openingTime;
} }
/** /**
* @return the crowdsale closing time. * @return the crowdsale closing time.
*/ */
function closingTime() public view returns(uint256) { function closingTime() public view returns(uint256) {
return closingTime_; return _closingTime;
} }
/** /**
...@@ -55,7 +55,7 @@ contract TimedCrowdsale is Crowdsale { ...@@ -55,7 +55,7 @@ contract TimedCrowdsale is Crowdsale {
*/ */
function isOpen() public view returns (bool) { function isOpen() public view returns (bool) {
// solium-disable-next-line security/no-block-members // solium-disable-next-line security/no-block-members
return block.timestamp >= openingTime_ && block.timestamp <= closingTime_; return block.timestamp >= _openingTime && block.timestamp <= _closingTime;
} }
/** /**
...@@ -64,22 +64,22 @@ contract TimedCrowdsale is Crowdsale { ...@@ -64,22 +64,22 @@ contract TimedCrowdsale is Crowdsale {
*/ */
function hasClosed() public view returns (bool) { function hasClosed() public view returns (bool) {
// solium-disable-next-line security/no-block-members // solium-disable-next-line security/no-block-members
return block.timestamp > closingTime_; return block.timestamp > _closingTime;
} }
/** /**
* @dev Extend parent behavior requiring to be within contributing period * @dev Extend parent behavior requiring to be within contributing period
* @param _beneficiary Token purchaser * @param beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed * @param weiAmount Amount of wei contributed
*/ */
function _preValidatePurchase( function _preValidatePurchase(
address _beneficiary, address beneficiary,
uint256 _weiAmount uint256 weiAmount
) )
internal internal
onlyWhileOpen onlyWhileOpen
{ {
super._preValidatePurchase(_beneficiary, _weiAmount); super._preValidatePurchase(beneficiary, weiAmount);
} }
} }
...@@ -12,10 +12,10 @@ library ECDSA { ...@@ -12,10 +12,10 @@ library ECDSA {
/** /**
* @dev Recover signer address from a message by using their signature * @dev Recover signer address from a message by using their signature
* @param _hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param _signature bytes signature, the signature is generated using web3.eth.sign() * @param signature bytes signature, the signature is generated using web3.eth.sign()
*/ */
function recover(bytes32 _hash, bytes _signature) function recover(bytes32 hash, bytes signature)
internal internal
pure pure
returns (address) returns (address)
...@@ -25,7 +25,7 @@ library ECDSA { ...@@ -25,7 +25,7 @@ library ECDSA {
uint8 v; uint8 v;
// Check the signature length // Check the signature length
if (_signature.length != 65) { if (signature.length != 65) {
return (address(0)); return (address(0));
} }
...@@ -34,9 +34,9 @@ library ECDSA { ...@@ -34,9 +34,9 @@ library ECDSA {
// currently is to use assembly. // currently is to use assembly.
// solium-disable-next-line security/no-inline-assembly // solium-disable-next-line security/no-inline-assembly
assembly { assembly {
r := mload(add(_signature, 32)) r := mload(add(signature, 32))
s := mload(add(_signature, 64)) s := mload(add(signature, 64))
v := byte(0, mload(add(_signature, 96))) v := byte(0, mload(add(signature, 96)))
} }
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions // Version of signature should be 27 or 28, but 0 and 1 are also possible versions
...@@ -49,7 +49,7 @@ library ECDSA { ...@@ -49,7 +49,7 @@ library ECDSA {
return (address(0)); return (address(0));
} else { } else {
// solium-disable-next-line arg-overflow // solium-disable-next-line arg-overflow
return ecrecover(_hash, v, r, s); return ecrecover(hash, v, r, s);
} }
} }
...@@ -58,7 +58,7 @@ library ECDSA { ...@@ -58,7 +58,7 @@ library ECDSA {
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:" * @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* and hash the result * and hash the result
*/ */
function toEthSignedMessageHash(bytes32 _hash) function toEthSignedMessageHash(bytes32 hash)
internal internal
pure pure
returns (bytes32) returns (bytes32)
...@@ -66,7 +66,7 @@ library ECDSA { ...@@ -66,7 +66,7 @@ library ECDSA {
// 32 is the length in bytes of hash, // 32 is the length in bytes of hash,
// enforced by the type signature above // enforced by the type signature above
return keccak256( return keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash) abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
); );
} }
} }
...@@ -10,23 +10,23 @@ library MerkleProof { ...@@ -10,23 +10,23 @@ library MerkleProof {
/** /**
* @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves * @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves
* and each pair of pre-images are sorted. * and each pair of pre-images are sorted.
* @param _proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree * @param proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree
* @param _root Merkle root * @param root Merkle root
* @param _leaf Leaf of Merkle tree * @param leaf Leaf of Merkle tree
*/ */
function verify( function verify(
bytes32[] _proof, bytes32[] proof,
bytes32 _root, bytes32 root,
bytes32 _leaf bytes32 leaf
) )
internal internal
pure pure
returns (bool) returns (bool)
{ {
bytes32 computedHash = _leaf; bytes32 computedHash = leaf;
for (uint256 i = 0; i < _proof.length; i++) { for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = _proof[i]; bytes32 proofElement = proof[i];
if (computedHash < proofElement) { if (computedHash < proofElement) {
// Hash(current computed hash + current element of the proof) // Hash(current computed hash + current element of the proof)
...@@ -38,6 +38,6 @@ library MerkleProof { ...@@ -38,6 +38,6 @@ library MerkleProof {
} }
// Check if the computed hash (root) is equal to the provided root // Check if the computed hash (root) is equal to the provided root
return computedHash == _root; return computedHash == root;
} }
} }
...@@ -15,15 +15,15 @@ contract ERC20TokenMetadata is IERC20 { ...@@ -15,15 +15,15 @@ contract ERC20TokenMetadata is IERC20 {
contract ERC20WithMetadata is ERC20TokenMetadata { contract ERC20WithMetadata is ERC20TokenMetadata {
string private tokenURI_ = ""; string private _tokenURI = "";
constructor(string _tokenURI) constructor(string tokenURI)
public public
{ {
tokenURI_ = _tokenURI; _tokenURI = tokenURI;
} }
function tokenURI() external view returns (string) { function tokenURI() external view returns (string) {
return tokenURI_; return _tokenURI;
} }
} }
...@@ -33,34 +33,34 @@ contract SignatureBouncer is SignerRole { ...@@ -33,34 +33,34 @@ contract SignatureBouncer is SignerRole {
// Function selectors are 4 bytes long, as documented in // Function selectors are 4 bytes long, as documented in
// https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector // https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector
uint256 private constant METHOD_ID_SIZE = 4; uint256 private constant _METHOD_ID_SIZE = 4;
// Signature size is 65 bytes (tightly packed v + r + s), but gets padded to 96 bytes // Signature size is 65 bytes (tightly packed v + r + s), but gets padded to 96 bytes
uint256 private constant SIGNATURE_SIZE = 96; uint256 private constant _SIGNATURE_SIZE = 96;
/** /**
* @dev requires that a valid signature of a signer was provided * @dev requires that a valid signature of a signer was provided
*/ */
modifier onlyValidSignature(bytes _signature) modifier onlyValidSignature(bytes signature)
{ {
require(_isValidSignature(msg.sender, _signature)); require(_isValidSignature(msg.sender, signature));
_; _;
} }
/** /**
* @dev requires that a valid signature with a specifed method of a signer was provided * @dev requires that a valid signature with a specifed method of a signer was provided
*/ */
modifier onlyValidSignatureAndMethod(bytes _signature) modifier onlyValidSignatureAndMethod(bytes signature)
{ {
require(_isValidSignatureAndMethod(msg.sender, _signature)); require(_isValidSignatureAndMethod(msg.sender, signature));
_; _;
} }
/** /**
* @dev requires that a valid signature with a specifed method and params of a signer was provided * @dev requires that a valid signature with a specifed method and params of a signer was provided
*/ */
modifier onlyValidSignatureAndData(bytes _signature) modifier onlyValidSignatureAndData(bytes signature)
{ {
require(_isValidSignatureAndData(msg.sender, _signature)); require(_isValidSignatureAndData(msg.sender, signature));
_; _;
} }
...@@ -68,14 +68,14 @@ contract SignatureBouncer is SignerRole { ...@@ -68,14 +68,14 @@ contract SignatureBouncer is SignerRole {
* @dev is the signature of `this + sender` from a signer? * @dev is the signature of `this + sender` from a signer?
* @return bool * @return bool
*/ */
function _isValidSignature(address _address, bytes _signature) function _isValidSignature(address account, bytes signature)
internal internal
view view
returns (bool) returns (bool)
{ {
return _isValidDataHash( return _isValidDataHash(
keccak256(abi.encodePacked(address(this), _address)), keccak256(abi.encodePacked(address(this), account)),
_signature signature
); );
} }
...@@ -83,39 +83,39 @@ contract SignatureBouncer is SignerRole { ...@@ -83,39 +83,39 @@ contract SignatureBouncer is SignerRole {
* @dev is the signature of `this + sender + methodId` from a signer? * @dev is the signature of `this + sender + methodId` from a signer?
* @return bool * @return bool
*/ */
function _isValidSignatureAndMethod(address _address, bytes _signature) function _isValidSignatureAndMethod(address account, bytes signature)
internal internal
view view
returns (bool) returns (bool)
{ {
bytes memory data = new bytes(METHOD_ID_SIZE); bytes memory data = new bytes(_METHOD_ID_SIZE);
for (uint i = 0; i < data.length; i++) { for (uint i = 0; i < data.length; i++) {
data[i] = msg.data[i]; data[i] = msg.data[i];
} }
return _isValidDataHash( return _isValidDataHash(
keccak256(abi.encodePacked(address(this), _address, data)), keccak256(abi.encodePacked(address(this), account, data)),
_signature signature
); );
} }
/** /**
* @dev is the signature of `this + sender + methodId + params(s)` from a signer? * @dev is the signature of `this + sender + methodId + params(s)` from a signer?
* @notice the _signature parameter of the method being validated must be the "last" parameter * @notice the signature parameter of the method being validated must be the "last" parameter
* @return bool * @return bool
*/ */
function _isValidSignatureAndData(address _address, bytes _signature) function _isValidSignatureAndData(address account, bytes signature)
internal internal
view view
returns (bool) returns (bool)
{ {
require(msg.data.length > SIGNATURE_SIZE); require(msg.data.length > _SIGNATURE_SIZE);
bytes memory data = new bytes(msg.data.length - SIGNATURE_SIZE); bytes memory data = new bytes(msg.data.length - _SIGNATURE_SIZE);
for (uint i = 0; i < data.length; i++) { for (uint i = 0; i < data.length; i++) {
data[i] = msg.data[i]; data[i] = msg.data[i];
} }
return _isValidDataHash( return _isValidDataHash(
keccak256(abi.encodePacked(address(this), _address, data)), keccak256(abi.encodePacked(address(this), account, data)),
_signature signature
); );
} }
...@@ -124,14 +124,14 @@ contract SignatureBouncer is SignerRole { ...@@ -124,14 +124,14 @@ contract SignatureBouncer is SignerRole {
* and then recover the signature and check it against the signer role * and then recover the signature and check it against the signer role
* @return bool * @return bool
*/ */
function _isValidDataHash(bytes32 _hash, bytes _signature) function _isValidDataHash(bytes32 hash, bytes signature)
internal internal
view view
returns (bool) returns (bool)
{ {
address signer = _hash address signer = hash
.toEthSignedMessageHash() .toEthSignedMessageHash()
.recover(_signature); .recover(signature);
return isSigner(signer); return isSigner(signer);
} }
} }
...@@ -21,107 +21,107 @@ contract TokenVesting is Ownable { ...@@ -21,107 +21,107 @@ contract TokenVesting is Ownable {
event Revoked(); event Revoked();
// beneficiary of tokens after they are released // beneficiary of tokens after they are released
address private beneficiary_; address private _beneficiary;
uint256 private cliff_; uint256 private _cliff;
uint256 private start_; uint256 private _start;
uint256 private duration_; uint256 private _duration;
bool private revocable_; bool private _revocable;
mapping (address => uint256) private released_; mapping (address => uint256) private _released;
mapping (address => bool) private revoked_; mapping (address => bool) private _revoked;
/** /**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the * @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all * beneficiary, gradually in a linear fashion until start + duration. By then all
* of the balance will have vested. * of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred * @param beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliffDuration duration in seconds of the cliff in which tokens will begin to vest * @param cliffDuration duration in seconds of the cliff in which tokens will begin to vest
* @param _start the time (as Unix time) at which point vesting starts * @param start the time (as Unix time) at which point vesting starts
* @param _duration duration in seconds of the period in which the tokens will vest * @param duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not * @param revocable whether the vesting is revocable or not
*/ */
constructor( constructor(
address _beneficiary, address beneficiary,
uint256 _start, uint256 start,
uint256 _cliffDuration, uint256 cliffDuration,
uint256 _duration, uint256 duration,
bool _revocable bool revocable
) )
public public
{ {
require(_beneficiary != address(0)); require(beneficiary != address(0));
require(_cliffDuration <= _duration); require(cliffDuration <= duration);
beneficiary_ = _beneficiary; _beneficiary = beneficiary;
revocable_ = _revocable; _revocable = revocable;
duration_ = _duration; _duration = duration;
cliff_ = _start.add(_cliffDuration); _cliff = start.add(cliffDuration);
start_ = _start; _start = start;
} }
/** /**
* @return the beneficiary of the tokens. * @return the beneficiary of the tokens.
*/ */
function beneficiary() public view returns(address) { function beneficiary() public view returns(address) {
return beneficiary_; return _beneficiary;
} }
/** /**
* @return the cliff time of the token vesting. * @return the cliff time of the token vesting.
*/ */
function cliff() public view returns(uint256) { function cliff() public view returns(uint256) {
return cliff_; return _cliff;
} }
/** /**
* @return the start time of the token vesting. * @return the start time of the token vesting.
*/ */
function start() public view returns(uint256) { function start() public view returns(uint256) {
return start_; return _start;
} }
/** /**
* @return the duration of the token vesting. * @return the duration of the token vesting.
*/ */
function duration() public view returns(uint256) { function duration() public view returns(uint256) {
return duration_; return _duration;
} }
/** /**
* @return true if the vesting is revocable. * @return true if the vesting is revocable.
*/ */
function revocable() public view returns(bool) { function revocable() public view returns(bool) {
return revocable_; return _revocable;
} }
/** /**
* @return the amount of the token released. * @return the amount of the token released.
*/ */
function released(address _token) public view returns(uint256) { function released(address token) public view returns(uint256) {
return released_[_token]; return _released[token];
} }
/** /**
* @return true if the token is revoked. * @return true if the token is revoked.
*/ */
function revoked(address _token) public view returns(bool) { function revoked(address token) public view returns(bool) {
return revoked_[_token]; return _revoked[token];
} }
/** /**
* @notice Transfers vested tokens to beneficiary. * @notice Transfers vested tokens to beneficiary.
* @param _token ERC20 token which is being vested * @param token ERC20 token which is being vested
*/ */
function release(IERC20 _token) public { function release(IERC20 token) public {
uint256 unreleased = releasableAmount(_token); uint256 unreleased = releasableAmount(token);
require(unreleased > 0); require(unreleased > 0);
released_[_token] = released_[_token].add(unreleased); _released[token] = _released[token].add(unreleased);
_token.safeTransfer(beneficiary_, unreleased); token.safeTransfer(_beneficiary, unreleased);
emit Released(unreleased); emit Released(unreleased);
} }
...@@ -129,46 +129,46 @@ contract TokenVesting is Ownable { ...@@ -129,46 +129,46 @@ contract TokenVesting is Ownable {
/** /**
* @notice Allows the owner to revoke the vesting. Tokens already vested * @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner. * remain in the contract, the rest are returned to the owner.
* @param _token ERC20 token which is being vested * @param token ERC20 token which is being vested
*/ */
function revoke(IERC20 _token) public onlyOwner { function revoke(IERC20 token) public onlyOwner {
require(revocable_); require(_revocable);
require(!revoked_[_token]); require(!_revoked[token]);
uint256 balance = _token.balanceOf(address(this)); uint256 balance = token.balanceOf(address(this));
uint256 unreleased = releasableAmount(_token); uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased); uint256 refund = balance.sub(unreleased);
revoked_[_token] = true; _revoked[token] = true;
_token.safeTransfer(owner(), refund); token.safeTransfer(owner(), refund);
emit Revoked(); emit Revoked();
} }
/** /**
* @dev Calculates the amount that has already vested but hasn't been released yet. * @dev Calculates the amount that has already vested but hasn't been released yet.
* @param _token ERC20 token which is being vested * @param token ERC20 token which is being vested
*/ */
function releasableAmount(IERC20 _token) public view returns (uint256) { function releasableAmount(IERC20 token) public view returns (uint256) {
return vestedAmount(_token).sub(released_[_token]); return vestedAmount(token).sub(_released[token]);
} }
/** /**
* @dev Calculates the amount that has already vested. * @dev Calculates the amount that has already vested.
* @param _token ERC20 token which is being vested * @param token ERC20 token which is being vested
*/ */
function vestedAmount(IERC20 _token) public view returns (uint256) { function vestedAmount(IERC20 token) public view returns (uint256) {
uint256 currentBalance = _token.balanceOf(this); uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released_[_token]); uint256 totalBalance = currentBalance.add(_released[token]);
if (block.timestamp < cliff_) { if (block.timestamp < _cliff) {
return 0; return 0;
} else if (block.timestamp >= start_.add(duration_) || revoked_[_token]) { } else if (block.timestamp >= _start.add(_duration) || _revoked[token]) {
return totalBalance; return totalBalance;
} else { } else {
return totalBalance.mul(block.timestamp.sub(start_)).div(duration_); return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
} }
} }
} }
...@@ -38,22 +38,22 @@ contract SampleCrowdsaleToken is ERC20Mintable { ...@@ -38,22 +38,22 @@ contract SampleCrowdsaleToken is ERC20Mintable {
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale { contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
constructor( constructor(
uint256 _openingTime, uint256 openingTime,
uint256 _closingTime, uint256 closingTime,
uint256 _rate, uint256 rate,
address _wallet, address wallet,
uint256 _cap, uint256 cap,
ERC20Mintable _token, ERC20Mintable token,
uint256 _goal uint256 goal
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
CappedCrowdsale(_cap) CappedCrowdsale(cap)
TimedCrowdsale(_openingTime, _closingTime) TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(_goal) RefundableCrowdsale(goal)
{ {
//As goal needs to be met for a successful crowdsale //As goal needs to be met for a successful crowdsale
//the value needs to less or equal than a cap which is limit for accepted funds //the value needs to less or equal than a cap which is limit for accepted funds
require(_goal <= _cap); require(goal <= cap);
} }
} }
...@@ -10,7 +10,7 @@ import "./IERC165.sol"; ...@@ -10,7 +10,7 @@ import "./IERC165.sol";
*/ */
contract ERC165 is IERC165 { contract ERC165 is IERC165 {
bytes4 private constant InterfaceId_ERC165 = 0x01ffc9a7; bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
/** /**
* 0x01ffc9a7 === * 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)')) * bytes4(keccak256('supportsInterface(bytes4)'))
...@@ -19,7 +19,7 @@ contract ERC165 is IERC165 { ...@@ -19,7 +19,7 @@ contract ERC165 is IERC165 {
/** /**
* @dev a mapping of interface id to whether or not it's supported * @dev a mapping of interface id to whether or not it's supported
*/ */
mapping(bytes4 => bool) internal supportedInterfaces_; mapping(bytes4 => bool) internal _supportedInterfaces;
/** /**
* @dev A contract implementing SupportsInterfaceWithLookup * @dev A contract implementing SupportsInterfaceWithLookup
...@@ -28,27 +28,27 @@ contract ERC165 is IERC165 { ...@@ -28,27 +28,27 @@ contract ERC165 is IERC165 {
constructor() constructor()
public public
{ {
_registerInterface(InterfaceId_ERC165); _registerInterface(_InterfaceId_ERC165);
} }
/** /**
* @dev implement supportsInterface(bytes4) using a lookup table * @dev implement supportsInterface(bytes4) using a lookup table
*/ */
function supportsInterface(bytes4 _interfaceId) function supportsInterface(bytes4 interfaceId)
external external
view view
returns (bool) returns (bool)
{ {
return supportedInterfaces_[_interfaceId]; return _supportedInterfaces[interfaceId];
} }
/** /**
* @dev private method for registering an interface * @dev private method for registering an interface
*/ */
function _registerInterface(bytes4 _interfaceId) function _registerInterface(bytes4 interfaceId)
internal internal
{ {
require(_interfaceId != 0xffffffff); require(interfaceId != 0xffffffff);
supportedInterfaces_[_interfaceId] = true; _supportedInterfaces[interfaceId] = true;
} }
} }
...@@ -8,9 +8,9 @@ pragma solidity ^0.4.24; ...@@ -8,9 +8,9 @@ pragma solidity ^0.4.24;
*/ */
library ERC165Checker { library ERC165Checker {
// As per the EIP-165 spec, no interface should ever match 0xffffffff // As per the EIP-165 spec, no interface should ever match 0xffffffff
bytes4 private constant InterfaceId_Invalid = 0xffffffff; bytes4 private constant _InterfaceId_Invalid = 0xffffffff;
bytes4 private constant InterfaceId_ERC165 = 0x01ffc9a7; bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
/** /**
* 0x01ffc9a7 === * 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)')) * bytes4(keccak256('supportsInterface(bytes4)'))
...@@ -19,59 +19,59 @@ library ERC165Checker { ...@@ -19,59 +19,59 @@ library ERC165Checker {
/** /**
* @notice Query if a contract supports ERC165 * @notice Query if a contract supports ERC165
* @param _address The address of the contract to query for support of ERC165 * @param account The address of the contract to query for support of ERC165
* @return true if the contract at _address implements ERC165 * @return true if the contract at account implements ERC165
*/ */
function supportsERC165(address _address) function supportsERC165(address account)
internal internal
view view
returns (bool) returns (bool)
{ {
// Any contract that implements ERC165 must explicitly indicate support of // Any contract that implements ERC165 must explicitly indicate support of
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
return supportsERC165Interface(_address, InterfaceId_ERC165) && return supportsERC165Interface(account, _InterfaceId_ERC165) &&
!supportsERC165Interface(_address, InterfaceId_Invalid); !supportsERC165Interface(account, _InterfaceId_Invalid);
} }
/** /**
* @notice Query if a contract implements an interface, also checks support of ERC165 * @notice Query if a contract implements an interface, also checks support of ERC165
* @param _address The address of the contract to query for support of an interface * @param account The address of the contract to query for support of an interface
* @param _interfaceId The interface identifier, as specified in ERC-165 * @param interfaceId The interface identifier, as specified in ERC-165
* @return true if the contract at _address indicates support of the interface with * @return true if the contract at account indicates support of the interface with
* identifier _interfaceId, false otherwise * identifier interfaceId, false otherwise
* @dev Interface identification is specified in ERC-165. * @dev Interface identification is specified in ERC-165.
*/ */
function supportsInterface(address _address, bytes4 _interfaceId) function supportsInterface(address account, bytes4 interfaceId)
internal internal
view view
returns (bool) returns (bool)
{ {
// query support of both ERC165 as per the spec and support of _interfaceId // query support of both ERC165 as per the spec and support of _interfaceId
return supportsERC165(_address) && return supportsERC165(account) &&
supportsERC165Interface(_address, _interfaceId); supportsERC165Interface(account, interfaceId);
} }
/** /**
* @notice Query if a contract implements interfaces, also checks support of ERC165 * @notice Query if a contract implements interfaces, also checks support of ERC165
* @param _address The address of the contract to query for support of an interface * @param account The address of the contract to query for support of an interface
* @param _interfaceIds A list of interface identifiers, as specified in ERC-165 * @param interfaceIds A list of interface identifiers, as specified in ERC-165
* @return true if the contract at _address indicates support all interfaces in the * @return true if the contract at account indicates support all interfaces in the
* _interfaceIds list, false otherwise * interfaceIds list, false otherwise
* @dev Interface identification is specified in ERC-165. * @dev Interface identification is specified in ERC-165.
*/ */
function supportsInterfaces(address _address, bytes4[] _interfaceIds) function supportsInterfaces(address account, bytes4[] interfaceIds)
internal internal
view view
returns (bool) returns (bool)
{ {
// query support of ERC165 itself // query support of ERC165 itself
if (!supportsERC165(_address)) { if (!supportsERC165(account)) {
return false; return false;
} }
// query support of each interface in _interfaceIds // query support of each interface in _interfaceIds
for (uint256 i = 0; i < _interfaceIds.length; i++) { for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!supportsERC165Interface(_address, _interfaceIds[i])) { if (!supportsERC165Interface(account, interfaceIds[i])) {
return false; return false;
} }
} }
...@@ -82,47 +82,47 @@ library ERC165Checker { ...@@ -82,47 +82,47 @@ library ERC165Checker {
/** /**
* @notice Query if a contract implements an interface, does not check ERC165 support * @notice Query if a contract implements an interface, does not check ERC165 support
* @param _address The address of the contract to query for support of an interface * @param account The address of the contract to query for support of an interface
* @param _interfaceId The interface identifier, as specified in ERC-165 * @param interfaceId The interface identifier, as specified in ERC-165
* @return true if the contract at _address indicates support of the interface with * @return true if the contract at account indicates support of the interface with
* identifier _interfaceId, false otherwise * identifier interfaceId, false otherwise
* @dev Assumes that _address contains a contract that supports ERC165, otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise
* the behavior of this method is undefined. This precondition can be checked * the behavior of this method is undefined. This precondition can be checked
* with the `supportsERC165` method in this library. * with the `supportsERC165` method in this library.
* Interface identification is specified in ERC-165. * Interface identification is specified in ERC-165.
*/ */
function supportsERC165Interface(address _address, bytes4 _interfaceId) function supportsERC165Interface(address account, bytes4 interfaceId)
private private
view view
returns (bool) returns (bool)
{ {
// success determines whether the staticcall succeeded and result determines // success determines whether the staticcall succeeded and result determines
// whether the contract at _address indicates support of _interfaceId // whether the contract at account indicates support of _interfaceId
(bool success, bool result) = callERC165SupportsInterface( (bool success, bool result) = callERC165SupportsInterface(
_address, _interfaceId); account, interfaceId);
return (success && result); return (success && result);
} }
/** /**
* @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw
* @param _address The address of the contract to query for support of an interface * @param account The address of the contract to query for support of an interface
* @param _interfaceId The interface identifier, as specified in ERC-165 * @param interfaceId The interface identifier, as specified in ERC-165
* @return success true if the STATICCALL succeeded, false otherwise * @return success true if the STATICCALL succeeded, false otherwise
* @return result true if the STATICCALL succeeded and the contract at _address * @return result true if the STATICCALL succeeded and the contract at account
* indicates support of the interface with identifier _interfaceId, false otherwise * indicates support of the interface with identifier interfaceId, false otherwise
*/ */
function callERC165SupportsInterface( function callERC165SupportsInterface(
address _address, address account,
bytes4 _interfaceId bytes4 interfaceId
) )
private private
view view
returns (bool success, bool result) returns (bool success, bool result)
{ {
bytes memory encodedParams = abi.encodeWithSelector( bytes memory encodedParams = abi.encodeWithSelector(
InterfaceId_ERC165, _InterfaceId_ERC165,
_interfaceId interfaceId
); );
// solium-disable-next-line security/no-inline-assembly // solium-disable-next-line security/no-inline-assembly
...@@ -135,7 +135,7 @@ library ERC165Checker { ...@@ -135,7 +135,7 @@ library ERC165Checker {
success := staticcall( success := staticcall(
30000, // 30k gas 30000, // 30k gas
_address, // To addr account, // To addr
encodedParams_data, encodedParams_data,
encodedParams_size, encodedParams_size,
output, output,
...@@ -146,4 +146,3 @@ library ERC165Checker { ...@@ -146,4 +146,3 @@ library ERC165Checker {
} }
} }
} }
...@@ -9,11 +9,11 @@ interface IERC165 { ...@@ -9,11 +9,11 @@ interface IERC165 {
/** /**
* @notice Query if a contract implements an interface * @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165 * @param interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function * @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas. * uses less than 30,000 gas.
*/ */
function supportsInterface(bytes4 _interfaceId) function supportsInterface(bytes4 interfaceId)
external external
view view
returns (bool); returns (bool);
......
...@@ -11,21 +11,21 @@ contract Pausable is PauserRole { ...@@ -11,21 +11,21 @@ contract Pausable is PauserRole {
event Paused(); event Paused();
event Unpaused(); event Unpaused();
bool private paused_ = false; bool private _paused = false;
/** /**
* @return true if the contract is paused, false otherwise. * @return true if the contract is paused, false otherwise.
*/ */
function paused() public view returns(bool) { function paused() public view returns(bool) {
return paused_; return _paused;
} }
/** /**
* @dev Modifier to make a function callable only when the contract is not paused. * @dev Modifier to make a function callable only when the contract is not paused.
*/ */
modifier whenNotPaused() { modifier whenNotPaused() {
require(!paused_); require(!_paused);
_; _;
} }
...@@ -33,7 +33,7 @@ contract Pausable is PauserRole { ...@@ -33,7 +33,7 @@ contract Pausable is PauserRole {
* @dev Modifier to make a function callable only when the contract is paused. * @dev Modifier to make a function callable only when the contract is paused.
*/ */
modifier whenPaused() { modifier whenPaused() {
require(paused_); require(_paused);
_; _;
} }
...@@ -41,7 +41,7 @@ contract Pausable is PauserRole { ...@@ -41,7 +41,7 @@ contract Pausable is PauserRole {
* @dev called by the owner to pause, triggers stopped state * @dev called by the owner to pause, triggers stopped state
*/ */
function pause() public onlyPauser whenNotPaused { function pause() public onlyPauser whenNotPaused {
paused_ = true; _paused = true;
emit Paused(); emit Paused();
} }
...@@ -49,7 +49,7 @@ contract Pausable is PauserRole { ...@@ -49,7 +49,7 @@ contract Pausable is PauserRole {
* @dev called by the owner to unpause, returns to normal state * @dev called by the owner to unpause, returns to normal state
*/ */
function unpause() public onlyPauser whenPaused { function unpause() public onlyPauser whenPaused {
paused_ = false; _paused = false;
emit Unpaused(); emit Unpaused();
} }
} }
...@@ -6,16 +6,16 @@ pragma solidity ^0.4.24; ...@@ -6,16 +6,16 @@ pragma solidity ^0.4.24;
* @dev Assorted math operations * @dev Assorted math operations
*/ */
library Math { library Math {
function max(uint256 _a, uint256 _b) internal pure returns (uint256) { function max(uint256 a, uint256 b) internal pure returns (uint256) {
return _a >= _b ? _a : _b; return a >= b ? a : b;
} }
function min(uint256 _a, uint256 _b) internal pure returns (uint256) { function min(uint256 a, uint256 b) internal pure returns (uint256) {
return _a < _b ? _a : _b; return a < b ? a : b;
} }
function average(uint256 _a, uint256 _b) internal pure returns (uint256) { function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (_a + _b) / 2 can overflow, so we distribute // (a + b) / 2 can overflow, so we distribute
return (_a / 2) + (_b / 2) + ((_a % 2 + _b % 2) / 2); return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
} }
} }
...@@ -10,16 +10,16 @@ library SafeMath { ...@@ -10,16 +10,16 @@ library SafeMath {
/** /**
* @dev Multiplies two numbers, reverts on overflow. * @dev Multiplies two numbers, reverts on overflow.
*/ */
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested. // benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) { if (a == 0) {
return 0; return 0;
} }
uint256 c = _a * _b; uint256 c = a * b;
require(c / _a == _b); require(c / a == b);
return c; return c;
} }
...@@ -27,10 +27,10 @@ library SafeMath { ...@@ -27,10 +27,10 @@ library SafeMath {
/** /**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero. * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/ */
function div(uint256 _a, uint256 _b) internal pure returns (uint256) { function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(_b > 0); // Solidity only automatically asserts when dividing by 0 require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = _a / _b; uint256 c = a / b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold // assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c; return c;
} }
...@@ -38,9 +38,9 @@ library SafeMath { ...@@ -38,9 +38,9 @@ library SafeMath {
/** /**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/ */
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(_b <= _a); require(b <= a);
uint256 c = _a - _b; uint256 c = a - b;
return c; return c;
} }
...@@ -48,9 +48,9 @@ library SafeMath { ...@@ -48,9 +48,9 @@ library SafeMath {
/** /**
* @dev Adds two numbers, reverts on overflow. * @dev Adds two numbers, reverts on overflow.
*/ */
function add(uint256 _a, uint256 _b) internal pure returns (uint256) { function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = _a + _b; uint256 c = a + b;
require(c >= _a); require(c >= a);
return c; return c;
} }
......
...@@ -7,14 +7,14 @@ import "../crowdsale/emission/AllowanceCrowdsale.sol"; ...@@ -7,14 +7,14 @@ import "../crowdsale/emission/AllowanceCrowdsale.sol";
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale { contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
constructor ( constructor (
uint256 _rate, uint256 rate,
address _wallet, address wallet,
IERC20 _token, IERC20 token,
address _tokenWallet address tokenWallet
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
AllowanceCrowdsale(_tokenWallet) AllowanceCrowdsale(tokenWallet)
{ {
} }
......
...@@ -9,13 +9,13 @@ contract AutoIncrementingImpl { ...@@ -9,13 +9,13 @@ contract AutoIncrementingImpl {
uint256 public theId; uint256 public theId;
// use whatever key you want to track your counters // use whatever key you want to track your counters
mapping(string => AutoIncrementing.Counter) private counters; mapping(string => AutoIncrementing.Counter) private _counters;
function doThing(string _key) function doThing(string key)
public public
returns (uint256) returns (uint256)
{ {
theId = counters[_key].nextId(); theId = _counters[key].nextId();
return theId; return theId;
} }
} }
...@@ -7,14 +7,14 @@ import "../crowdsale/validation/CappedCrowdsale.sol"; ...@@ -7,14 +7,14 @@ import "../crowdsale/validation/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale { contract CappedCrowdsaleImpl is CappedCrowdsale {
constructor ( constructor (
uint256 _rate, uint256 rate,
address _wallet, address wallet,
IERC20 _token, IERC20 token,
uint256 _cap uint256 cap
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
CappedCrowdsale(_cap) CappedCrowdsale(cap)
{ {
} }
......
...@@ -4,15 +4,15 @@ import "../access/roles/CapperRole.sol"; ...@@ -4,15 +4,15 @@ import "../access/roles/CapperRole.sol";
contract CapperRoleMock is CapperRole { contract CapperRoleMock is CapperRole {
function removeCapper(address _account) public { function removeCapper(address account) public {
_removeCapper(_account); _removeCapper(account);
} }
function onlyCapperMock() public view onlyCapper { function onlyCapperMock() public view onlyCapper {
} }
// Causes a compilation error if super._removeCapper is not internal // Causes a compilation error if super._removeCapper is not internal
function _removeCapper(address _account) internal { function _removeCapper(address account) internal {
super._removeCapper(_account); super._removeCapper(account);
} }
} }
...@@ -6,13 +6,13 @@ import "../payment/ConditionalEscrow.sol"; ...@@ -6,13 +6,13 @@ import "../payment/ConditionalEscrow.sol";
// mock class using ConditionalEscrow // mock class using ConditionalEscrow
contract ConditionalEscrowMock is ConditionalEscrow { contract ConditionalEscrowMock is ConditionalEscrow {
mapping(address => bool) public allowed; mapping(address => bool) private _allowed;
function setAllowed(address _payee, bool _allowed) public { function setAllowed(address payee, bool allowed) public {
allowed[_payee] = _allowed; _allowed[payee] = allowed;
} }
function withdrawalAllowed(address _payee) public view returns (bool) { function withdrawalAllowed(address payee) public view returns (bool) {
return allowed[_payee]; return _allowed[payee];
} }
} }
...@@ -6,11 +6,11 @@ import "../token/ERC20/ERC20Detailed.sol"; ...@@ -6,11 +6,11 @@ import "../token/ERC20/ERC20Detailed.sol";
contract ERC20DetailedMock is ERC20, ERC20Detailed { contract ERC20DetailedMock is ERC20, ERC20Detailed {
constructor( constructor(
string _name, string name,
string _symbol, string symbol,
uint8 _decimals uint8 decimals
) )
ERC20Detailed(_name, _symbol, _decimals) ERC20Detailed(name, symbol, decimals)
public public
{} {}
} }
...@@ -7,19 +7,19 @@ import "../cryptography/ECDSA.sol"; ...@@ -7,19 +7,19 @@ import "../cryptography/ECDSA.sol";
contract ECDSAMock { contract ECDSAMock {
using ECDSA for bytes32; using ECDSA for bytes32;
function recover(bytes32 _hash, bytes _signature) function recover(bytes32 hash, bytes signature)
public public
pure pure
returns (address) returns (address)
{ {
return _hash.recover(_signature); return hash.recover(signature);
} }
function toEthSignedMessageHash(bytes32 _hash) function toEthSignedMessageHash(bytes32 hash)
public public
pure pure
returns (bytes32) returns (bytes32)
{ {
return _hash.toEthSignedMessageHash(); return hash.toEthSignedMessageHash();
} }
} }
...@@ -37,33 +37,33 @@ contract SupportsInterfaceWithLookupMock is IERC165 { ...@@ -37,33 +37,33 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
/** /**
* @dev implement supportsInterface(bytes4) using a lookup table * @dev implement supportsInterface(bytes4) using a lookup table
*/ */
function supportsInterface(bytes4 _interfaceId) function supportsInterface(bytes4 interfaceId)
external external
view view
returns (bool) returns (bool)
{ {
return supportedInterfaces[_interfaceId]; return supportedInterfaces[interfaceId];
} }
/** /**
* @dev private method for registering an interface * @dev private method for registering an interface
*/ */
function _registerInterface(bytes4 _interfaceId) function _registerInterface(bytes4 interfaceId)
internal internal
{ {
require(_interfaceId != 0xffffffff); require(interfaceId != 0xffffffff);
supportedInterfaces[_interfaceId] = true; supportedInterfaces[interfaceId] = true;
} }
} }
contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock { contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
constructor (bytes4[] _interfaceIds) constructor (bytes4[] interfaceIds)
public public
{ {
for (uint256 i = 0; i < _interfaceIds.length; i++) { for (uint256 i = 0; i < interfaceIds.length; i++) {
_registerInterface(_interfaceIds[i]); _registerInterface(interfaceIds[i]);
} }
} }
} }
...@@ -6,27 +6,27 @@ import "../introspection/ERC165Checker.sol"; ...@@ -6,27 +6,27 @@ import "../introspection/ERC165Checker.sol";
contract ERC165CheckerMock { contract ERC165CheckerMock {
using ERC165Checker for address; using ERC165Checker for address;
function supportsERC165(address _address) function supportsERC165(address account)
public public
view view
returns (bool) returns (bool)
{ {
return _address.supportsERC165(); return account.supportsERC165();
} }
function supportsInterface(address _address, bytes4 _interfaceId) function supportsInterface(address account, bytes4 interfaceId)
public public
view view
returns (bool) returns (bool)
{ {
return _address.supportsInterface(_interfaceId); return account.supportsInterface(interfaceId);
} }
function supportsInterfaces(address _address, bytes4[] _interfaceIds) function supportsInterfaces(address account, bytes4[] interfaceIds)
public public
view view
returns (bool) returns (bool)
{ {
return _address.supportsInterfaces(_interfaceIds); return account.supportsInterfaces(interfaceIds);
} }
} }
...@@ -4,9 +4,9 @@ import "../introspection/ERC165.sol"; ...@@ -4,9 +4,9 @@ import "../introspection/ERC165.sol";
contract ERC165Mock is ERC165 { contract ERC165Mock is ERC165 {
function registerInterface(bytes4 _interfaceId) function registerInterface(bytes4 interfaceId)
public public
{ {
_registerInterface(_interfaceId); _registerInterface(interfaceId);
} }
} }
...@@ -5,8 +5,8 @@ import "../token/ERC20/ERC20Burnable.sol"; ...@@ -5,8 +5,8 @@ import "../token/ERC20/ERC20Burnable.sol";
contract ERC20BurnableMock is ERC20Burnable { contract ERC20BurnableMock is ERC20Burnable {
constructor(address _initialAccount, uint256 _initialBalance) public { constructor(address initialAccount, uint256 initialBalance) public {
_mint(_initialAccount, _initialBalance); _mint(initialAccount, initialBalance);
} }
} }
...@@ -6,20 +6,20 @@ import "../token/ERC20/ERC20.sol"; ...@@ -6,20 +6,20 @@ import "../token/ERC20/ERC20.sol";
// mock class using ERC20 // mock class using ERC20
contract ERC20Mock is ERC20 { contract ERC20Mock is ERC20 {
constructor(address _initialAccount, uint256 _initialBalance) public { constructor(address initialAccount, uint256 initialBalance) public {
_mint(_initialAccount, _initialBalance); _mint(initialAccount, initialBalance);
} }
function mint(address _account, uint256 _amount) public { function mint(address account, uint256 amount) public {
_mint(_account, _amount); _mint(account, amount);
} }
function burn(address _account, uint256 _amount) public { function burn(address account, uint256 amount) public {
_burn(_account, _amount); _burn(account, amount);
} }
function burnFrom(address _account, uint256 _amount) public { function burnFrom(address account, uint256 amount) public {
_burnFrom(_account, _amount); _burnFrom(account, amount);
} }
} }
...@@ -7,8 +7,8 @@ import "./PauserRoleMock.sol"; ...@@ -7,8 +7,8 @@ import "./PauserRoleMock.sol";
// mock class using ERC20Pausable // mock class using ERC20Pausable
contract ERC20PausableMock is ERC20Pausable, PauserRoleMock { contract ERC20PausableMock is ERC20Pausable, PauserRoleMock {
constructor(address _initialAccount, uint _initialBalance) public { constructor(address initialAccount, uint initialBalance) public {
_mint(_initialAccount, _initialBalance); _mint(initialAccount, initialBalance);
} }
} }
...@@ -5,8 +5,8 @@ import "../drafts/ERC1046/TokenMetadata.sol"; ...@@ -5,8 +5,8 @@ import "../drafts/ERC1046/TokenMetadata.sol";
contract ERC20WithMetadataMock is ERC20, ERC20WithMetadata { contract ERC20WithMetadataMock is ERC20, ERC20WithMetadata {
constructor(string _tokenURI) public constructor(string tokenURI) public
ERC20WithMetadata(_tokenURI) ERC20WithMetadata(tokenURI)
{ {
} }
} }
...@@ -8,11 +8,11 @@ import "../token/ERC721/ERC721Basic.sol"; ...@@ -8,11 +8,11 @@ import "../token/ERC721/ERC721Basic.sol";
* This mock just provides a public mint and burn functions for testing purposes * This mock just provides a public mint and burn functions for testing purposes
*/ */
contract ERC721BasicMock is ERC721Basic { contract ERC721BasicMock is ERC721Basic {
function mint(address _to, uint256 _tokenId) public { function mint(address to, uint256 tokenId) public {
_mint(_to, _tokenId); _mint(to, tokenId);
} }
function burn(uint256 _tokenId) public { function burn(uint256 tokenId) public {
_burn(ownerOf(_tokenId), _tokenId); _burn(ownerOf(tokenId), tokenId);
} }
} }
...@@ -11,20 +11,20 @@ import "../token/ERC721/ERC721Burnable.sol"; ...@@ -11,20 +11,20 @@ import "../token/ERC721/ERC721Burnable.sol";
* and a public setter for metadata URI * and a public setter for metadata URI
*/ */
contract ERC721Mock is ERC721, ERC721Mintable, ERC721Burnable { contract ERC721Mock is ERC721, ERC721Mintable, ERC721Burnable {
constructor(string _name, string _symbol) public constructor(string name, string symbol) public
ERC721Mintable() ERC721Mintable()
ERC721(_name, _symbol) ERC721(name, symbol)
{} {}
function exists(uint256 _tokenId) public view returns (bool) { function exists(uint256 tokenId) public view returns (bool) {
return _exists(_tokenId); return _exists(tokenId);
} }
function setTokenURI(uint256 _tokenId, string _uri) public { function setTokenURI(uint256 tokenId, string uri) public {
_setTokenURI(_tokenId, _uri); _setTokenURI(tokenId, uri);
} }
function removeTokenFrom(address _from, uint256 _tokenId) public { function removeTokenFrom(address from, uint256 tokenId) public {
_removeTokenFrom(_from, _tokenId); _removeTokenFrom(from, tokenId);
} }
} }
...@@ -9,15 +9,15 @@ import "./PauserRoleMock.sol"; ...@@ -9,15 +9,15 @@ import "./PauserRoleMock.sol";
* This mock just provides a public mint, burn and exists functions for testing purposes * This mock just provides a public mint, burn and exists functions for testing purposes
*/ */
contract ERC721PausableMock is ERC721Pausable, PauserRoleMock { contract ERC721PausableMock is ERC721Pausable, PauserRoleMock {
function mint(address _to, uint256 _tokenId) public { function mint(address to, uint256 tokenId) public {
super._mint(_to, _tokenId); super._mint(to, tokenId);
} }
function burn(uint256 _tokenId) public { function burn(uint256 tokenId) public {
super._burn(ownerOf(_tokenId), _tokenId); super._burn(ownerOf(tokenId), tokenId);
} }
function exists(uint256 _tokenId) public view returns (bool) { function exists(uint256 tokenId) public view returns (bool) {
return super._exists(_tokenId); return super._exists(tokenId);
} }
} }
...@@ -4,8 +4,8 @@ import "../token/ERC721/IERC721Receiver.sol"; ...@@ -4,8 +4,8 @@ import "../token/ERC721/IERC721Receiver.sol";
contract ERC721ReceiverMock is IERC721Receiver { contract ERC721ReceiverMock is IERC721Receiver {
bytes4 internal retval_; bytes4 private _retval;
bool internal reverts_; bool private _reverts;
event Received( event Received(
address operator, address operator,
...@@ -15,28 +15,28 @@ contract ERC721ReceiverMock is IERC721Receiver { ...@@ -15,28 +15,28 @@ contract ERC721ReceiverMock is IERC721Receiver {
uint256 gas uint256 gas
); );
constructor(bytes4 _retval, bool _reverts) public { constructor(bytes4 retval, bool reverts) public {
retval_ = _retval; _retval = retval;
reverts_ = _reverts; _reverts = reverts;
} }
function onERC721Received( function onERC721Received(
address _operator, address operator,
address _from, address from,
uint256 _tokenId, uint256 tokenId,
bytes _data bytes data
) )
public public
returns(bytes4) returns(bytes4)
{ {
require(!reverts_); require(!_reverts);
emit Received( emit Received(
_operator, operator,
_from, from,
_tokenId, tokenId,
_data, data,
gasleft() // msg.gas was deprecated in solidityv0.4.21 gasleft() // msg.gas was deprecated in solidityv0.4.21
); );
return retval_; return _retval;
} }
} }
...@@ -7,15 +7,15 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol"; ...@@ -7,15 +7,15 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale { contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
constructor ( constructor (
uint256 _openingTime, uint256 openingTime,
uint256 _closingTime, uint256 closingTime,
uint256 _rate, uint256 rate,
address _wallet, address wallet,
IERC20 _token IERC20 token
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
TimedCrowdsale(_openingTime, _closingTime) TimedCrowdsale(openingTime, closingTime)
{ {
} }
......
...@@ -10,7 +10,7 @@ contract ForceEther { ...@@ -10,7 +10,7 @@ contract ForceEther {
constructor() public payable { } constructor() public payable { }
function destroyAndSend(address _recipient) public { function destroyAndSend(address recipient) public {
selfdestruct(_recipient); selfdestruct(recipient);
} }
} }
...@@ -7,17 +7,17 @@ import "../math/SafeMath.sol"; ...@@ -7,17 +7,17 @@ import "../math/SafeMath.sol";
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale { contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
constructor ( constructor (
uint256 _openingTime, uint256 openingTime,
uint256 _closingTime, uint256 closingTime,
address _wallet, address wallet,
IERC20 _token, IERC20 token,
uint256 _initialRate, uint256 initialRate,
uint256 _finalRate uint256 finalRate
) )
public public
Crowdsale(_initialRate, _wallet, _token) Crowdsale(initialRate, wallet, token)
TimedCrowdsale(_openingTime, _closingTime) TimedCrowdsale(openingTime, closingTime)
IncreasingPriceCrowdsale(_initialRate, _finalRate) IncreasingPriceCrowdsale(initialRate, finalRate)
{ {
} }
......
...@@ -9,12 +9,12 @@ contract IndividuallyCappedCrowdsaleImpl ...@@ -9,12 +9,12 @@ contract IndividuallyCappedCrowdsaleImpl
is IndividuallyCappedCrowdsale, CapperRoleMock { is IndividuallyCappedCrowdsale, CapperRoleMock {
constructor( constructor(
uint256 _rate, uint256 rate,
address _wallet, address wallet,
IERC20 _token IERC20 token
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
{ {
} }
} }
...@@ -5,15 +5,15 @@ import "../../contracts/math/Math.sol"; ...@@ -5,15 +5,15 @@ import "../../contracts/math/Math.sol";
contract MathMock { contract MathMock {
function max(uint256 _a, uint256 _b) public pure returns (uint256) { function max(uint256 a, uint256 b) public pure returns (uint256) {
return Math.max(_a, _b); return Math.max(a, b);
} }
function min(uint256 _a, uint256 _b) public pure returns (uint256) { function min(uint256 a, uint256 b) public pure returns (uint256) {
return Math.min(_a, _b); return Math.min(a, b);
} }
function average(uint256 _a, uint256 _b) public pure returns (uint256) { function average(uint256 a, uint256 b) public pure returns (uint256) {
return Math.average(_a, _b); return Math.average(a, b);
} }
} }
...@@ -6,14 +6,14 @@ import { MerkleProof } from "../cryptography/MerkleProof.sol"; ...@@ -6,14 +6,14 @@ import { MerkleProof } from "../cryptography/MerkleProof.sol";
contract MerkleProofWrapper { contract MerkleProofWrapper {
function verify( function verify(
bytes32[] _proof, bytes32[] proof,
bytes32 _root, bytes32 root,
bytes32 _leaf bytes32 leaf
) )
public public
pure pure
returns (bool) returns (bool)
{ {
return MerkleProof.verify(_proof, _root, _leaf); return MerkleProof.verify(proof, root, leaf);
} }
} }
...@@ -7,12 +7,12 @@ import "../crowdsale/emission/MintedCrowdsale.sol"; ...@@ -7,12 +7,12 @@ import "../crowdsale/emission/MintedCrowdsale.sol";
contract MintedCrowdsaleImpl is MintedCrowdsale { contract MintedCrowdsaleImpl is MintedCrowdsale {
constructor ( constructor (
uint256 _rate, uint256 rate,
address _wallet, address wallet,
ERC20Mintable _token ERC20Mintable token
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
{ {
} }
......
...@@ -4,15 +4,15 @@ import "../access/roles/MinterRole.sol"; ...@@ -4,15 +4,15 @@ import "../access/roles/MinterRole.sol";
contract MinterRoleMock is MinterRole { contract MinterRoleMock is MinterRole {
function removeMinter(address _account) public { function removeMinter(address account) public {
_removeMinter(_account); _removeMinter(account);
} }
function onlyMinterMock() public view onlyMinter { function onlyMinterMock() public view onlyMinter {
} }
// Causes a compilation error if super._removeMinter is not internal // Causes a compilation error if super._removeMinter is not internal
function _removeMinter(address _account) internal { function _removeMinter(address account) internal {
super._removeMinter(_account); super._removeMinter(account);
} }
} }
...@@ -4,15 +4,15 @@ import "../access/roles/PauserRole.sol"; ...@@ -4,15 +4,15 @@ import "../access/roles/PauserRole.sol";
contract PauserRoleMock is PauserRole { contract PauserRoleMock is PauserRole {
function removePauser(address _account) public { function removePauser(address account) public {
_removePauser(_account); _removePauser(account);
} }
function onlyPauserMock() public view onlyPauser { function onlyPauserMock() public view onlyPauser {
} }
// Causes a compilation error if super._removePauser is not internal // Causes a compilation error if super._removePauser is not internal
function _removePauser(address _account) internal { function _removePauser(address account) internal {
super._removePauser(_account); super._removePauser(account);
} }
} }
...@@ -7,15 +7,15 @@ import "../crowdsale/distribution/PostDeliveryCrowdsale.sol"; ...@@ -7,15 +7,15 @@ import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale { contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
constructor ( constructor (
uint256 _openingTime, uint256 openingTime,
uint256 _closingTime, uint256 closingTime,
uint256 _rate, uint256 rate,
address _wallet, address wallet,
IERC20 _token IERC20 token
) )
public public
TimedCrowdsale(_openingTime, _closingTime) TimedCrowdsale(openingTime, closingTime)
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
{ {
} }
......
...@@ -10,8 +10,8 @@ contract PullPaymentMock is PullPayment { ...@@ -10,8 +10,8 @@ contract PullPaymentMock is PullPayment {
constructor() public payable { } constructor() public payable { }
// test helper function to call asyncTransfer // test helper function to call asyncTransfer
function callTransfer(address _dest, uint256 _amount) public { function callTransfer(address dest, uint256 amount) public {
_asyncTransfer(_dest, _amount); _asyncTransfer(dest, amount);
} }
} }
...@@ -3,9 +3,9 @@ pragma solidity ^0.4.24; ...@@ -3,9 +3,9 @@ pragma solidity ^0.4.24;
contract ReentrancyAttack { contract ReentrancyAttack {
function callSender(bytes4 _data) public { function callSender(bytes4 data) public {
// solium-disable-next-line security/no-low-level-calls // solium-disable-next-line security/no-low-level-calls
require(msg.sender.call(abi.encodeWithSelector(_data))); require(msg.sender.call(abi.encodeWithSelector(data)));
} }
} }
...@@ -16,26 +16,26 @@ contract ReentrancyMock is ReentrancyGuard { ...@@ -16,26 +16,26 @@ contract ReentrancyMock is ReentrancyGuard {
count(); count();
} }
function countLocalRecursive(uint256 _n) public nonReentrant { function countLocalRecursive(uint256 n) public nonReentrant {
if (_n > 0) { if (n > 0) {
count(); count();
countLocalRecursive(_n - 1); countLocalRecursive(n - 1);
} }
} }
function countThisRecursive(uint256 _n) public nonReentrant { function countThisRecursive(uint256 n) public nonReentrant {
if (_n > 0) { if (n > 0) {
count(); count();
// solium-disable-next-line security/no-low-level-calls // solium-disable-next-line security/no-low-level-calls
bool result = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", _n - 1)); bool result = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
require(result == true); require(result == true);
} }
} }
function countAndCall(ReentrancyAttack _attacker) public nonReentrant { function countAndCall(ReentrancyAttack attacker) public nonReentrant {
count(); count();
bytes4 func = bytes4(keccak256("callback()")); bytes4 func = bytes4(keccak256("callback()"));
_attacker.callSender(func); attacker.callSender(func);
} }
function count() private { function count() private {
......
...@@ -7,17 +7,17 @@ import "../crowdsale/distribution/RefundableCrowdsale.sol"; ...@@ -7,17 +7,17 @@ import "../crowdsale/distribution/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale { contract RefundableCrowdsaleImpl is RefundableCrowdsale {
constructor ( constructor (
uint256 _openingTime, uint256 openingTime,
uint256 _closingTime, uint256 closingTime,
uint256 _rate, uint256 rate,
address _wallet, address wallet,
ERC20Mintable _token, ERC20Mintable token,
uint256 _goal uint256 goal
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
TimedCrowdsale(_openingTime, _closingTime) TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(_goal) RefundableCrowdsale(goal)
{ {
} }
......
...@@ -8,15 +8,15 @@ contract RolesMock { ...@@ -8,15 +8,15 @@ contract RolesMock {
Roles.Role private dummyRole; Roles.Role private dummyRole;
function add(address _account) public { function add(address account) public {
dummyRole.add(_account); dummyRole.add(account);
} }
function remove(address _account) public { function remove(address account) public {
dummyRole.remove(_account); dummyRole.remove(account);
} }
function has(address _account) public view returns (bool) { function has(address account) public view returns (bool) {
return dummyRole.has(_account); return dummyRole.has(account);
} }
} }
...@@ -61,35 +61,35 @@ contract ERC20SucceedingMock is IERC20 { ...@@ -61,35 +61,35 @@ contract ERC20SucceedingMock is IERC20 {
contract SafeERC20Helper { contract SafeERC20Helper {
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
IERC20 internal failing_; IERC20 private _failing;
IERC20 internal succeeding_; IERC20 private _succeeding;
constructor() public { constructor() public {
failing_ = new ERC20FailingMock(); _failing = new ERC20FailingMock();
succeeding_ = new ERC20SucceedingMock(); _succeeding = new ERC20SucceedingMock();
} }
function doFailingTransfer() public { function doFailingTransfer() public {
failing_.safeTransfer(address(0), 0); _failing.safeTransfer(address(0), 0);
} }
function doFailingTransferFrom() public { function doFailingTransferFrom() public {
failing_.safeTransferFrom(address(0), address(0), 0); _failing.safeTransferFrom(address(0), address(0), 0);
} }
function doFailingApprove() public { function doFailingApprove() public {
failing_.safeApprove(address(0), 0); _failing.safeApprove(address(0), 0);
} }
function doSucceedingTransfer() public { function doSucceedingTransfer() public {
succeeding_.safeTransfer(address(0), 0); _succeeding.safeTransfer(address(0), 0);
} }
function doSucceedingTransferFrom() public { function doSucceedingTransferFrom() public {
succeeding_.safeTransferFrom(address(0), address(0), 0); _succeeding.safeTransferFrom(address(0), address(0), 0);
} }
function doSucceedingApprove() public { function doSucceedingApprove() public {
succeeding_.safeApprove(address(0), 0); _succeeding.safeApprove(address(0), 0);
} }
} }
...@@ -6,20 +6,20 @@ import "../math/SafeMath.sol"; ...@@ -6,20 +6,20 @@ import "../math/SafeMath.sol";
contract SafeMathMock { contract SafeMathMock {
function mul(uint256 _a, uint256 _b) public pure returns (uint256) { function mul(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.mul(_a, _b); return SafeMath.mul(a, b);
} }
function div(uint256 _a, uint256 _b) public pure returns (uint256) { function div(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.div(_a, _b); return SafeMath.div(a, b);
} }
function sub(uint256 _a, uint256 _b) public pure returns (uint256) { function sub(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.sub(_a, _b); return SafeMath.sub(a, b);
} }
function add(uint256 _a, uint256 _b) public pure returns (uint256) { function add(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.add(_a, _b); return SafeMath.add(a, b);
} }
function mod(uint256 a, uint256 b) public pure returns (uint256) { function mod(uint256 a, uint256 b) public pure returns (uint256) {
......
...@@ -5,54 +5,54 @@ import "./SignerRoleMock.sol"; ...@@ -5,54 +5,54 @@ import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock { contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
function checkValidSignature(address _address, bytes _signature) function checkValidSignature(address account, bytes signature)
public public
view view
returns (bool) returns (bool)
{ {
return _isValidSignature(_address, _signature); return _isValidSignature(account, signature);
} }
function onlyWithValidSignature(bytes _signature) function onlyWithValidSignature(bytes signature)
public public
onlyValidSignature(_signature) onlyValidSignature(signature)
view view
{ {
} }
function checkValidSignatureAndMethod(address _address, bytes _signature) function checkValidSignatureAndMethod(address account, bytes signature)
public public
view view
returns (bool) returns (bool)
{ {
return _isValidSignatureAndMethod(_address, _signature); return _isValidSignatureAndMethod(account, signature);
} }
function onlyWithValidSignatureAndMethod(bytes _signature) function onlyWithValidSignatureAndMethod(bytes signature)
public public
onlyValidSignatureAndMethod(_signature) onlyValidSignatureAndMethod(signature)
view view
{ {
} }
function checkValidSignatureAndData( function checkValidSignatureAndData(
address _address, address account,
bytes, bytes,
uint, uint,
bytes _signature bytes signature
) )
public public
view view
returns (bool) returns (bool)
{ {
return _isValidSignatureAndData(_address, _signature); return _isValidSignatureAndData(account, signature);
} }
function onlyWithValidSignatureAndData(uint, bytes _signature) function onlyWithValidSignatureAndData(uint, bytes signature)
public public
onlyValidSignatureAndData(_signature) onlyValidSignatureAndData(signature)
view view
{ {
......
...@@ -4,15 +4,15 @@ import "../access/roles/SignerRole.sol"; ...@@ -4,15 +4,15 @@ import "../access/roles/SignerRole.sol";
contract SignerRoleMock is SignerRole { contract SignerRoleMock is SignerRole {
function removeSigner(address _account) public { function removeSigner(address account) public {
_removeSigner(_account); _removeSigner(account);
} }
function onlySignerMock() public view onlySigner { function onlySignerMock() public view onlySigner {
} }
// Causes a compilation error if super._removeSigner is not internal // Causes a compilation error if super._removeSigner is not internal
function _removeSigner(address _account) internal { function _removeSigner(address account) internal {
super._removeSigner(_account); super._removeSigner(account);
} }
} }
...@@ -7,15 +7,15 @@ import "../crowdsale/validation/TimedCrowdsale.sol"; ...@@ -7,15 +7,15 @@ import "../crowdsale/validation/TimedCrowdsale.sol";
contract TimedCrowdsaleImpl is TimedCrowdsale { contract TimedCrowdsaleImpl is TimedCrowdsale {
constructor ( constructor (
uint256 _openingTime, uint256 openingTime,
uint256 _closingTime, uint256 closingTime,
uint256 _rate, uint256 rate,
address _wallet, address wallet,
IERC20 _token IERC20 token
) )
public public
Crowdsale(_rate, _wallet, _token) Crowdsale(rate, wallet, token)
TimedCrowdsale(_openingTime, _closingTime) TimedCrowdsale(openingTime, closingTime)
{ {
} }
......
...@@ -16,11 +16,11 @@ contract CanReclaimToken is Ownable { ...@@ -16,11 +16,11 @@ contract CanReclaimToken is Ownable {
/** /**
* @dev Reclaim all ERC20 compatible tokens * @dev Reclaim all ERC20 compatible tokens
* @param _token ERC20 The address of the token contract * @param token ERC20 The address of the token contract
*/ */
function reclaimToken(IERC20 _token) external onlyOwner { function reclaimToken(IERC20 token) external onlyOwner {
uint256 balance = _token.balanceOf(this); uint256 balance = token.balanceOf(this);
_token.safeTransfer(owner(), balance); token.safeTransfer(owner(), balance);
} }
} }
...@@ -7,7 +7,7 @@ pragma solidity ^0.4.24; ...@@ -7,7 +7,7 @@ pragma solidity ^0.4.24;
* functions, this simplifies the implementation of "user permissions". * functions, this simplifies the implementation of "user permissions".
*/ */
contract Ownable { contract Ownable {
address private owner_; address private _owner;
event OwnershipRenounced(address indexed previousOwner); event OwnershipRenounced(address indexed previousOwner);
...@@ -22,14 +22,14 @@ contract Ownable { ...@@ -22,14 +22,14 @@ contract Ownable {
* account. * account.
*/ */
constructor() public { constructor() public {
owner_ = msg.sender; _owner = msg.sender;
} }
/** /**
* @return the address of the owner. * @return the address of the owner.
*/ */
function owner() public view returns(address) { function owner() public view returns(address) {
return owner_; return _owner;
} }
/** /**
...@@ -44,7 +44,7 @@ contract Ownable { ...@@ -44,7 +44,7 @@ contract Ownable {
* @return true if `msg.sender` is the owner of the contract. * @return true if `msg.sender` is the owner of the contract.
*/ */
function isOwner() public view returns(bool) { function isOwner() public view returns(bool) {
return msg.sender == owner_; return msg.sender == _owner;
} }
/** /**
...@@ -54,25 +54,25 @@ contract Ownable { ...@@ -54,25 +54,25 @@ contract Ownable {
* modifier anymore. * modifier anymore.
*/ */
function renounceOwnership() public onlyOwner { function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner_); emit OwnershipRenounced(_owner);
owner_ = address(0); _owner = address(0);
} }
/** /**
* @dev Allows the current owner to transfer control of the contract to a newOwner. * @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. * @param newOwner The address to transfer ownership to.
*/ */
function transferOwnership(address _newOwner) public onlyOwner { function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(_newOwner); _transferOwnership(newOwner);
} }
/** /**
* @dev Transfers control of the contract to a newOwner. * @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. * @param newOwner The address to transfer ownership to.
*/ */
function _transferOwnership(address _newOwner) internal { function _transferOwnership(address newOwner) internal {
require(_newOwner != address(0)); require(newOwner != address(0));
emit OwnershipTransferred(owner_, _newOwner); emit OwnershipTransferred(_owner, newOwner);
owner_ = _newOwner; _owner = newOwner;
} }
} }
...@@ -6,30 +6,30 @@ pragma solidity ^0.4.24; ...@@ -6,30 +6,30 @@ pragma solidity ^0.4.24;
* @dev A Secondary contract can only be used by its primary account (the one that created it) * @dev A Secondary contract can only be used by its primary account (the one that created it)
*/ */
contract Secondary { contract Secondary {
address private primary_; address private _primary;
/** /**
* @dev Sets the primary account to the one that is creating the Secondary contract. * @dev Sets the primary account to the one that is creating the Secondary contract.
*/ */
constructor() public { constructor() public {
primary_ = msg.sender; _primary = msg.sender;
} }
/** /**
* @dev Reverts if called from any account other than the primary. * @dev Reverts if called from any account other than the primary.
*/ */
modifier onlyPrimary() { modifier onlyPrimary() {
require(msg.sender == primary_); require(msg.sender == _primary);
_; _;
} }
function primary() public view returns (address) { function primary() public view returns (address) {
return primary_; return _primary;
} }
function transferPrimary(address _recipient) public onlyPrimary { function transferPrimary(address recipient) public onlyPrimary {
require(_recipient != address(0)); require(recipient != address(0));
primary_ = _recipient; _primary = recipient;
} }
} }
...@@ -11,12 +11,12 @@ contract ConditionalEscrow is Escrow { ...@@ -11,12 +11,12 @@ contract ConditionalEscrow is Escrow {
/** /**
* @dev Returns whether an address is allowed to withdraw their funds. To be * @dev Returns whether an address is allowed to withdraw their funds. To be
* implemented by derived contracts. * implemented by derived contracts.
* @param _payee The destination address of the funds. * @param payee The destination address of the funds.
*/ */
function withdrawalAllowed(address _payee) public view returns (bool); function withdrawalAllowed(address payee) public view returns (bool);
function withdraw(address _payee) public { function withdraw(address payee) public {
require(withdrawalAllowed(_payee)); require(withdrawalAllowed(payee));
super.withdraw(_payee); super.withdraw(payee);
} }
} }
...@@ -17,35 +17,35 @@ contract Escrow is Secondary { ...@@ -17,35 +17,35 @@ contract Escrow is Secondary {
event Deposited(address indexed payee, uint256 weiAmount); event Deposited(address indexed payee, uint256 weiAmount);
event Withdrawn(address indexed payee, uint256 weiAmount); event Withdrawn(address indexed payee, uint256 weiAmount);
mapping(address => uint256) private deposits_; mapping(address => uint256) private _deposits;
function depositsOf(address _payee) public view returns (uint256) { function depositsOf(address payee) public view returns (uint256) {
return deposits_[_payee]; return _deposits[payee];
} }
/** /**
* @dev Stores the sent amount as credit to be withdrawn. * @dev Stores the sent amount as credit to be withdrawn.
* @param _payee The destination address of the funds. * @param payee The destination address of the funds.
*/ */
function deposit(address _payee) public onlyPrimary payable { function deposit(address payee) public onlyPrimary payable {
uint256 amount = msg.value; uint256 amount = msg.value;
deposits_[_payee] = deposits_[_payee].add(amount); _deposits[payee] = _deposits[payee].add(amount);
emit Deposited(_payee, amount); emit Deposited(payee, amount);
} }
/** /**
* @dev Withdraw accumulated balance for a payee. * @dev Withdraw accumulated balance for a payee.
* @param _payee The address whose funds will be withdrawn and transferred to. * @param payee The address whose funds will be withdrawn and transferred to.
*/ */
function withdraw(address _payee) public onlyPrimary { function withdraw(address payee) public onlyPrimary {
uint256 payment = deposits_[_payee]; uint256 payment = _deposits[payee];
assert(address(this).balance >= payment); assert(address(this).balance >= payment);
deposits_[_payee] = 0; _deposits[payee] = 0;
_payee.transfer(payment); payee.transfer(payment);
emit Withdrawn(_payee, payment); emit Withdrawn(payee, payment);
} }
} }
...@@ -9,34 +9,34 @@ import "./Escrow.sol"; ...@@ -9,34 +9,34 @@ import "./Escrow.sol";
* contract and use _asyncTransfer instead of send or transfer. * contract and use _asyncTransfer instead of send or transfer.
*/ */
contract PullPayment { contract PullPayment {
Escrow private escrow; Escrow private _escrow;
constructor() public { constructor() public {
escrow = new Escrow(); _escrow = new Escrow();
} }
/** /**
* @dev Withdraw accumulated balance. * @dev Withdraw accumulated balance.
* @param _payee Whose balance will be withdrawn. * @param payee Whose balance will be withdrawn.
*/ */
function withdrawPayments(address _payee) public { function withdrawPayments(address payee) public {
escrow.withdraw(_payee); _escrow.withdraw(payee);
} }
/** /**
* @dev Returns the credit owed to an address. * @dev Returns the credit owed to an address.
* @param _dest The creditor's address. * @param dest The creditor's address.
*/ */
function payments(address _dest) public view returns (uint256) { function payments(address dest) public view returns (uint256) {
return escrow.depositsOf(_dest); return _escrow.depositsOf(dest);
} }
/** /**
* @dev Called by the payer to store the sent amount as credit to be pulled. * @dev Called by the payer to store the sent amount as credit to be pulled.
* @param _dest The destination address of the funds. * @param dest The destination address of the funds.
* @param _amount The amount to transfer. * @param amount The amount to transfer.
*/ */
function _asyncTransfer(address _dest, uint256 _amount) internal { function _asyncTransfer(address dest, uint256 amount) internal {
escrow.deposit.value(_amount)(_dest); _escrow.deposit.value(amount)(dest);
} }
} }
...@@ -16,40 +16,40 @@ contract RefundEscrow is Secondary, ConditionalEscrow { ...@@ -16,40 +16,40 @@ contract RefundEscrow is Secondary, ConditionalEscrow {
event Closed(); event Closed();
event RefundsEnabled(); event RefundsEnabled();
State private state_; State private _state;
address private beneficiary_; address private _beneficiary;
/** /**
* @dev Constructor. * @dev Constructor.
* @param _beneficiary The beneficiary of the deposits. * @param beneficiary The beneficiary of the deposits.
*/ */
constructor(address _beneficiary) public { constructor(address beneficiary) public {
require(_beneficiary != address(0)); require(beneficiary != address(0));
beneficiary_ = _beneficiary; _beneficiary = beneficiary;
state_ = State.Active; _state = State.Active;
} }
/** /**
* @return the current state of the escrow. * @return the current state of the escrow.
*/ */
function state() public view returns (State) { function state() public view returns (State) {
return state_; return _state;
} }
/** /**
* @return the beneficiary of the escrow. * @return the beneficiary of the escrow.
*/ */
function beneficiary() public view returns (address) { function beneficiary() public view returns (address) {
return beneficiary_; return _beneficiary;
} }
/** /**
* @dev Stores funds that may later be refunded. * @dev Stores funds that may later be refunded.
* @param _refundee The address funds will be sent to if a refund occurs. * @param refundee The address funds will be sent to if a refund occurs.
*/ */
function deposit(address _refundee) public payable { function deposit(address refundee) public payable {
require(state_ == State.Active); require(_state == State.Active);
super.deposit(_refundee); super.deposit(refundee);
} }
/** /**
...@@ -57,8 +57,8 @@ contract RefundEscrow is Secondary, ConditionalEscrow { ...@@ -57,8 +57,8 @@ contract RefundEscrow is Secondary, ConditionalEscrow {
* further deposits. * further deposits.
*/ */
function close() public onlyPrimary { function close() public onlyPrimary {
require(state_ == State.Active); require(_state == State.Active);
state_ = State.Closed; _state = State.Closed;
emit Closed(); emit Closed();
} }
...@@ -66,8 +66,8 @@ contract RefundEscrow is Secondary, ConditionalEscrow { ...@@ -66,8 +66,8 @@ contract RefundEscrow is Secondary, ConditionalEscrow {
* @dev Allows for refunds to take place, rejecting further deposits. * @dev Allows for refunds to take place, rejecting further deposits.
*/ */
function enableRefunds() public onlyPrimary { function enableRefunds() public onlyPrimary {
require(state_ == State.Active); require(_state == State.Active);
state_ = State.Refunding; _state = State.Refunding;
emit RefundsEnabled(); emit RefundsEnabled();
} }
...@@ -75,14 +75,14 @@ contract RefundEscrow is Secondary, ConditionalEscrow { ...@@ -75,14 +75,14 @@ contract RefundEscrow is Secondary, ConditionalEscrow {
* @dev Withdraws the beneficiary's funds. * @dev Withdraws the beneficiary's funds.
*/ */
function beneficiaryWithdraw() public { function beneficiaryWithdraw() public {
require(state_ == State.Closed); require(_state == State.Closed);
beneficiary_.transfer(address(this).balance); _beneficiary.transfer(address(this).balance);
} }
/** /**
* @dev Returns whether refundees can withdraw their deposits (be refunded). * @dev Returns whether refundees can withdraw their deposits (be refunded).
*/ */
function withdrawalAllowed(address _payee) public view returns (bool) { function withdrawalAllowed(address payee) public view returns (bool) {
return state_ == State.Refunding; return _state == State.Refunding;
} }
} }
...@@ -11,22 +11,22 @@ import "../math/SafeMath.sol"; ...@@ -11,22 +11,22 @@ import "../math/SafeMath.sol";
contract SplitPayment { contract SplitPayment {
using SafeMath for uint256; using SafeMath for uint256;
uint256 private totalShares_ = 0; uint256 private _totalShares = 0;
uint256 private totalReleased_ = 0; uint256 private _totalReleased = 0;
mapping(address => uint256) private shares_; mapping(address => uint256) private _shares;
mapping(address => uint256) private released_; mapping(address => uint256) private _released;
address[] private payees_; address[] private _payees;
/** /**
* @dev Constructor * @dev Constructor
*/ */
constructor(address[] _payees, uint256[] _shares) public payable { constructor(address[] payees, uint256[] shares) public payable {
require(_payees.length == _shares.length); require(payees.length == shares.length);
require(_payees.length > 0); require(payees.length > 0);
for (uint256 i = 0; i < _payees.length; i++) { for (uint256 i = 0; i < payees.length; i++) {
_addPayee(_payees[i], _shares[i]); _addPayee(payees[i], shares[i]);
} }
} }
...@@ -39,72 +39,72 @@ contract SplitPayment { ...@@ -39,72 +39,72 @@ contract SplitPayment {
* @return the total shares of the contract. * @return the total shares of the contract.
*/ */
function totalShares() public view returns(uint256) { function totalShares() public view returns(uint256) {
return totalShares_; return _totalShares;
} }
/** /**
* @return the total amount already released. * @return the total amount already released.
*/ */
function totalReleased() public view returns(uint256) { function totalReleased() public view returns(uint256) {
return totalReleased_; return _totalReleased;
} }
/** /**
* @return the shares of an account. * @return the shares of an account.
*/ */
function shares(address _account) public view returns(uint256) { function shares(address account) public view returns(uint256) {
return shares_[_account]; return _shares[account];
} }
/** /**
* @return the amount already released to an account. * @return the amount already released to an account.
*/ */
function released(address _account) public view returns(uint256) { function released(address account) public view returns(uint256) {
return released_[_account]; return _released[account];
} }
/** /**
* @return the address of a payee. * @return the address of a payee.
*/ */
function payee(uint256 index) public view returns(address) { function payee(uint256 index) public view returns(address) {
return payees_[index]; return _payees[index];
} }
/** /**
* @dev Release one of the payee's proportional payment. * @dev Release one of the payee's proportional payment.
* @param _payee Whose payments will be released. * @param account Whose payments will be released.
*/ */
function release(address _payee) public { function release(address account) public {
require(shares_[_payee] > 0); require(_shares[account] > 0);
uint256 totalReceived = address(this).balance.add(totalReleased_); uint256 totalReceived = address(this).balance.add(_totalReleased);
uint256 payment = totalReceived.mul( uint256 payment = totalReceived.mul(
shares_[_payee]).div( _shares[account]).div(
totalShares_).sub( _totalShares).sub(
released_[_payee] _released[account]
); );
require(payment != 0); require(payment != 0);
assert(address(this).balance >= payment); assert(address(this).balance >= payment);
released_[_payee] = released_[_payee].add(payment); _released[account] = _released[account].add(payment);
totalReleased_ = totalReleased_.add(payment); _totalReleased = _totalReleased.add(payment);
_payee.transfer(payment); account.transfer(payment);
} }
/** /**
* @dev Add a new payee to the contract. * @dev Add a new payee to the contract.
* @param _payee The address of the payee to add. * @param account The address of the payee to add.
* @param _shares The number of shares owned by the payee. * @param shares_ The number of shares owned by the payee.
*/ */
function _addPayee(address _payee, uint256 _shares) internal { function _addPayee(address account, uint256 shares_) internal {
require(_payee != address(0)); require(account != address(0));
require(_shares > 0); require(shares_ > 0);
require(shares_[_payee] == 0); require(_shares[account] == 0);
payees_.push(_payee); _payees.push(account);
shares_[_payee] = _shares; _shares[account] = shares_;
totalShares_ = totalShares_.add(_shares); _totalShares = _totalShares.add(shares_);
} }
} }
...@@ -13,27 +13,27 @@ contract ERC20Burnable is ERC20 { ...@@ -13,27 +13,27 @@ contract ERC20Burnable is ERC20 {
/** /**
* @dev Burns a specific amount of tokens. * @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. * @param value The amount of token to be burned.
*/ */
function burn(uint256 _value) public { function burn(uint256 value) public {
_burn(msg.sender, _value); _burn(msg.sender, value);
} }
/** /**
* @dev Burns a specific amount of tokens from the target address and decrements allowance * @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from * @param from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned * @param value uint256 The amount of token to be burned
*/ */
function burnFrom(address _from, uint256 _value) public { function burnFrom(address from, uint256 value) public {
_burnFrom(_from, _value); _burnFrom(from, value);
} }
/** /**
* @dev Overrides ERC20._burn in order for burn and burnFrom to emit * @dev Overrides ERC20._burn in order for burn and burnFrom to emit
* an additional Burn event. * an additional Burn event.
*/ */
function _burn(address _who, uint256 _value) internal { function _burn(address who, uint256 value) internal {
super._burn(_who, _value); super._burn(who, value);
emit TokensBurned(_who, _value); emit TokensBurned(who, value);
} }
} }
...@@ -9,38 +9,38 @@ import "./ERC20Mintable.sol"; ...@@ -9,38 +9,38 @@ import "./ERC20Mintable.sol";
*/ */
contract ERC20Capped is ERC20Mintable { contract ERC20Capped is ERC20Mintable {
uint256 private cap_; uint256 private _cap;
constructor(uint256 _cap) constructor(uint256 cap)
public public
{ {
require(_cap > 0); require(cap > 0);
cap_ = _cap; _cap = cap;
} }
/** /**
* @return the cap for the token minting. * @return the cap for the token minting.
*/ */
function cap() public view returns(uint256) { function cap() public view returns(uint256) {
return cap_; return _cap;
} }
/** /**
* @dev Function to mint tokens * @dev Function to mint tokens
* @param _to The address that will receive the minted tokens. * @param to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint. * @param amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mint( function mint(
address _to, address to,
uint256 _amount uint256 amount
) )
public public
returns (bool) returns (bool)
{ {
require(totalSupply().add(_amount) <= cap_); require(totalSupply().add(amount) <= _cap);
return super.mint(_to, _amount); return super.mint(to, amount);
} }
} }
...@@ -10,34 +10,34 @@ import "./IERC20.sol"; ...@@ -10,34 +10,34 @@ import "./IERC20.sol";
* just as on Ethereum all the operations are done in wei. * just as on Ethereum all the operations are done in wei.
*/ */
contract ERC20Detailed is IERC20 { contract ERC20Detailed is IERC20 {
string private name_; string private _name;
string private symbol_; string private _symbol;
uint8 private decimals_; uint8 private _decimals;
constructor(string _name, string _symbol, uint8 _decimals) public { constructor(string name, string symbol, uint8 decimals) public {
name_ = _name; _name = name;
symbol_ = _symbol; _symbol = symbol;
decimals_ = _decimals; _decimals = decimals;
} }
/** /**
* @return the name of the token. * @return the name of the token.
*/ */
function name() public view returns(string) { function name() public view returns(string) {
return name_; return _name;
} }
/** /**
* @return the symbol of the token. * @return the symbol of the token.
*/ */
function symbol() public view returns(string) { function symbol() public view returns(string) {
return symbol_; return _symbol;
} }
/** /**
* @return the number of decimals of the token. * @return the number of decimals of the token.
*/ */
function decimals() public view returns(uint8) { function decimals() public view returns(uint8) {
return decimals_; return _decimals;
} }
} }
...@@ -12,10 +12,10 @@ contract ERC20Mintable is ERC20, MinterRole { ...@@ -12,10 +12,10 @@ contract ERC20Mintable is ERC20, MinterRole {
event Minted(address indexed to, uint256 amount); event Minted(address indexed to, uint256 amount);
event MintingFinished(); event MintingFinished();
bool private mintingFinished_ = false; bool private _mintingFinished = false;
modifier onlyBeforeMintingFinished() { modifier onlyBeforeMintingFinished() {
require(!mintingFinished_); require(!_mintingFinished);
_; _;
} }
...@@ -23,26 +23,26 @@ contract ERC20Mintable is ERC20, MinterRole { ...@@ -23,26 +23,26 @@ contract ERC20Mintable is ERC20, MinterRole {
* @return true if the minting is finished. * @return true if the minting is finished.
*/ */
function mintingFinished() public view returns(bool) { function mintingFinished() public view returns(bool) {
return mintingFinished_; return _mintingFinished;
} }
/** /**
* @dev Function to mint tokens * @dev Function to mint tokens
* @param _to The address that will receive the minted tokens. * @param to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint. * @param amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mint( function mint(
address _to, address to,
uint256 _amount uint256 amount
) )
public public
onlyMinter onlyMinter
onlyBeforeMintingFinished onlyBeforeMintingFinished
returns (bool) returns (bool)
{ {
_mint(_to, _amount); _mint(to, amount);
emit Minted(_to, _amount); emit Minted(to, amount);
return true; return true;
} }
...@@ -56,7 +56,7 @@ contract ERC20Mintable is ERC20, MinterRole { ...@@ -56,7 +56,7 @@ contract ERC20Mintable is ERC20, MinterRole {
onlyBeforeMintingFinished onlyBeforeMintingFinished
returns (bool) returns (bool)
{ {
mintingFinished_ = true; _mintingFinished = true;
emit MintingFinished(); emit MintingFinished();
return true; return true;
} }
......
...@@ -11,58 +11,58 @@ import "../../lifecycle/Pausable.sol"; ...@@ -11,58 +11,58 @@ import "../../lifecycle/Pausable.sol";
contract ERC20Pausable is ERC20, Pausable { contract ERC20Pausable is ERC20, Pausable {
function transfer( function transfer(
address _to, address to,
uint256 _value uint256 value
) )
public public
whenNotPaused whenNotPaused
returns (bool) returns (bool)
{ {
return super.transfer(_to, _value); return super.transfer(to, value);
} }
function transferFrom( function transferFrom(
address _from, address from,
address _to, address to,
uint256 _value uint256 value
) )
public public
whenNotPaused whenNotPaused
returns (bool) returns (bool)
{ {
return super.transferFrom(_from, _to, _value); return super.transferFrom(from, to, value);
} }
function approve( function approve(
address _spender, address spender,
uint256 _value uint256 value
) )
public public
whenNotPaused whenNotPaused
returns (bool) returns (bool)
{ {
return super.approve(_spender, _value); return super.approve(spender, value);
} }
function increaseAllowance( function increaseAllowance(
address _spender, address spender,
uint _addedValue uint addedValue
) )
public public
whenNotPaused whenNotPaused
returns (bool success) returns (bool success)
{ {
return super.increaseAllowance(_spender, _addedValue); return super.increaseAllowance(spender, addedValue);
} }
function decreaseAllowance( function decreaseAllowance(
address _spender, address spender,
uint _subtractedValue uint subtractedValue
) )
public public
whenNotPaused whenNotPaused
returns (bool success) returns (bool success)
{ {
return super.decreaseAllowance(_spender, _subtractedValue); return super.decreaseAllowance(spender, subtractedValue);
} }
} }
...@@ -8,17 +8,17 @@ pragma solidity ^0.4.24; ...@@ -8,17 +8,17 @@ pragma solidity ^0.4.24;
interface IERC20 { interface IERC20 {
function totalSupply() external view returns (uint256); function totalSupply() external view returns (uint256);
function balanceOf(address _who) external view returns (uint256); function balanceOf(address who) external view returns (uint256);
function allowance(address _owner, address _spender) function allowance(address owner, address spender)
external view returns (uint256); external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool); function transfer(address to, uint256 value) external returns (bool);
function approve(address _spender, uint256 _value) function approve(address spender, uint256 value)
external returns (bool); external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) function transferFrom(address from, address to, uint256 value)
external returns (bool); external returns (bool);
event Transfer( event Transfer(
......
...@@ -12,33 +12,33 @@ import "./IERC20.sol"; ...@@ -12,33 +12,33 @@ import "./IERC20.sol";
*/ */
library SafeERC20 { library SafeERC20 {
function safeTransfer( function safeTransfer(
IERC20 _token, IERC20 token,
address _to, address to,
uint256 _value uint256 value
) )
internal internal
{ {
require(_token.transfer(_to, _value)); require(token.transfer(to, value));
} }
function safeTransferFrom( function safeTransferFrom(
IERC20 _token, IERC20 token,
address _from, address from,
address _to, address to,
uint256 _value uint256 value
) )
internal internal
{ {
require(_token.transferFrom(_from, _to, _value)); require(token.transferFrom(from, to, value));
} }
function safeApprove( function safeApprove(
IERC20 _token, IERC20 token,
address _spender, address spender,
uint256 _value uint256 value
) )
internal internal
{ {
require(_token.approve(_spender, _value)); require(token.approve(spender, value));
} }
} }
...@@ -12,47 +12,47 @@ contract TokenTimelock { ...@@ -12,47 +12,47 @@ contract TokenTimelock {
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
// ERC20 basic token contract being held // ERC20 basic token contract being held
IERC20 private token_; IERC20 private _token;
// beneficiary of tokens after they are released // beneficiary of tokens after they are released
address private beneficiary_; address private _beneficiary;
// timestamp when token release is enabled // timestamp when token release is enabled
uint256 private releaseTime_; uint256 private _releaseTime;
constructor( constructor(
IERC20 _token, IERC20 token,
address _beneficiary, address beneficiary,
uint256 _releaseTime uint256 releaseTime
) )
public public
{ {
// solium-disable-next-line security/no-block-members // solium-disable-next-line security/no-block-members
require(_releaseTime > block.timestamp); require(releaseTime > block.timestamp);
token_ = _token; _token = token;
beneficiary_ = _beneficiary; _beneficiary = beneficiary;
releaseTime_ = _releaseTime; _releaseTime = releaseTime;
} }
/** /**
* @return the token being held. * @return the token being held.
*/ */
function token() public view returns(IERC20) { function token() public view returns(IERC20) {
return token_; return _token;
} }
/** /**
* @return the beneficiary of the tokens. * @return the beneficiary of the tokens.
*/ */
function beneficiary() public view returns(address) { function beneficiary() public view returns(address) {
return beneficiary_; return _beneficiary;
} }
/** /**
* @return the time when the tokens are released. * @return the time when the tokens are released.
*/ */
function releaseTime() public view returns(uint256) { function releaseTime() public view returns(uint256) {
return releaseTime_; return _releaseTime;
} }
/** /**
...@@ -60,11 +60,11 @@ contract TokenTimelock { ...@@ -60,11 +60,11 @@ contract TokenTimelock {
*/ */
function release() public { function release() public {
// solium-disable-next-line security/no-block-members // solium-disable-next-line security/no-block-members
require(block.timestamp >= releaseTime_); require(block.timestamp >= _releaseTime);
uint256 amount = token_.balanceOf(address(this)); uint256 amount = _token.balanceOf(address(this));
require(amount > 0); require(amount > 0);
token_.safeTransfer(beneficiary_, amount); _token.safeTransfer(_beneficiary, amount);
} }
} }
...@@ -4,10 +4,10 @@ import "./ERC721.sol"; ...@@ -4,10 +4,10 @@ import "./ERC721.sol";
contract ERC721Burnable is ERC721 { contract ERC721Burnable is ERC721 {
function burn(uint256 _tokenId) function burn(uint256 tokenId)
public public
{ {
require(_isApprovedOrOwner(msg.sender, _tokenId)); require(_isApprovedOrOwner(msg.sender, tokenId));
_burn(ownerOf(_tokenId), _tokenId); _burn(ownerOf(tokenId), tokenId);
} }
} }
...@@ -12,10 +12,10 @@ contract ERC721Mintable is ERC721, MinterRole { ...@@ -12,10 +12,10 @@ contract ERC721Mintable is ERC721, MinterRole {
event Minted(address indexed to, uint256 tokenId); event Minted(address indexed to, uint256 tokenId);
event MintingFinished(); event MintingFinished();
bool private mintingFinished_ = false; bool private _mintingFinished = false;
modifier onlyBeforeMintingFinished() { modifier onlyBeforeMintingFinished() {
require(!mintingFinished_); require(!_mintingFinished);
_; _;
} }
...@@ -23,41 +23,41 @@ contract ERC721Mintable is ERC721, MinterRole { ...@@ -23,41 +23,41 @@ contract ERC721Mintable is ERC721, MinterRole {
* @return true if the minting is finished. * @return true if the minting is finished.
*/ */
function mintingFinished() public view returns(bool) { function mintingFinished() public view returns(bool) {
return mintingFinished_; return _mintingFinished;
} }
/** /**
* @dev Function to mint tokens * @dev Function to mint tokens
* @param _to The address that will receive the minted tokens. * @param to The address that will receive the minted tokens.
* @param _tokenId The token id to mint. * @param tokenId The token id to mint.
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mint( function mint(
address _to, address to,
uint256 _tokenId uint256 tokenId
) )
public public
onlyMinter onlyMinter
onlyBeforeMintingFinished onlyBeforeMintingFinished
returns (bool) returns (bool)
{ {
_mint(_to, _tokenId); _mint(to, tokenId);
emit Minted(_to, _tokenId); emit Minted(to, tokenId);
return true; return true;
} }
function mintWithTokenURI( function mintWithTokenURI(
address _to, address to,
uint256 _tokenId, uint256 tokenId,
string _tokenURI string tokenURI
) )
public public
onlyMinter onlyMinter
onlyBeforeMintingFinished onlyBeforeMintingFinished
returns (bool) returns (bool)
{ {
mint(_to, _tokenId); mint(to, tokenId);
_setTokenURI(_tokenId, _tokenURI); _setTokenURI(tokenId, tokenURI);
return true; return true;
} }
...@@ -71,7 +71,7 @@ contract ERC721Mintable is ERC721, MinterRole { ...@@ -71,7 +71,7 @@ contract ERC721Mintable is ERC721, MinterRole {
onlyBeforeMintingFinished onlyBeforeMintingFinished
returns (bool) returns (bool)
{ {
mintingFinished_ = true; _mintingFinished = true;
emit MintingFinished(); emit MintingFinished();
return true; return true;
} }
......
...@@ -10,33 +10,33 @@ import "../../lifecycle/Pausable.sol"; ...@@ -10,33 +10,33 @@ import "../../lifecycle/Pausable.sol";
**/ **/
contract ERC721Pausable is ERC721Basic, Pausable { contract ERC721Pausable is ERC721Basic, Pausable {
function approve( function approve(
address _to, address to,
uint256 _tokenId uint256 tokenId
) )
public public
whenNotPaused whenNotPaused
{ {
super.approve(_to, _tokenId); super.approve(to, tokenId);
} }
function setApprovalForAll( function setApprovalForAll(
address _to, address to,
bool _approved bool approved
) )
public public
whenNotPaused whenNotPaused
{ {
super.setApprovalForAll(_to, _approved); super.setApprovalForAll(to, approved);
} }
function transferFrom( function transferFrom(
address _from, address from,
address _to, address to,
uint256 _tokenId uint256 tokenId
) )
public public
whenNotPaused whenNotPaused
{ {
super.transferFrom(_from, _to, _tokenId); super.transferFrom(from, to, tokenId);
} }
} }
...@@ -10,14 +10,14 @@ import "./IERC721Basic.sol"; ...@@ -10,14 +10,14 @@ import "./IERC721Basic.sol";
contract IERC721Enumerable is IERC721Basic { contract IERC721Enumerable is IERC721Basic {
function totalSupply() public view returns (uint256); function totalSupply() public view returns (uint256);
function tokenOfOwnerByIndex( function tokenOfOwnerByIndex(
address _owner, address owner,
uint256 _index uint256 index
) )
public public
view view
returns (uint256 _tokenId); returns (uint256 tokenId);
function tokenByIndex(uint256 _index) public view returns (uint256); function tokenByIndex(uint256 index) public view returns (uint256);
} }
...@@ -26,9 +26,9 @@ contract IERC721Enumerable is IERC721Basic { ...@@ -26,9 +26,9 @@ contract IERC721Enumerable is IERC721Basic {
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/ */
contract IERC721Metadata is IERC721Basic { contract IERC721Metadata is IERC721Basic {
function name() external view returns (string _name); function name() external view returns (string);
function symbol() external view returns (string _symbol); function symbol() external view returns (string);
function tokenURI(uint256 _tokenId) public view returns (string); function tokenURI(uint256 tokenId) public view returns (string);
} }
......
...@@ -25,26 +25,26 @@ contract IERC721Basic is IERC165 { ...@@ -25,26 +25,26 @@ contract IERC721Basic is IERC165 {
bool approved bool approved
); );
function balanceOf(address _owner) public view returns (uint256 _balance); function balanceOf(address owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) public view returns (address _owner); function ownerOf(uint256 tokenId) public view returns (address owner);
function approve(address _to, uint256 _tokenId) public; function approve(address to, uint256 tokenId) public;
function getApproved(uint256 _tokenId) function getApproved(uint256 tokenId)
public view returns (address _operator); public view returns (address operator);
function setApprovalForAll(address _operator, bool _approved) public; function setApprovalForAll(address operator, bool approved) public;
function isApprovedForAll(address _owner, address _operator) function isApprovedForAll(address owner, address operator)
public view returns (bool); public view returns (bool);
function transferFrom(address _from, address _to, uint256 _tokenId) public; function transferFrom(address from, address to, uint256 tokenId) public;
function safeTransferFrom(address _from, address _to, uint256 _tokenId) function safeTransferFrom(address from, address to, uint256 tokenId)
public; public;
function safeTransferFrom( function safeTransferFrom(
address _from, address from,
address _to, address to,
uint256 _tokenId, uint256 tokenId,
bytes _data bytes data
) )
public; public;
} }
...@@ -15,17 +15,17 @@ contract IERC721Receiver { ...@@ -15,17 +15,17 @@ contract IERC721Receiver {
* returned can be obtained as `this.onERC721Received.selector`. This * returned can be obtained as `this.onERC721Received.selector`. This
* function MAY throw to revert and reject the transfer. * function MAY throw to revert and reject the transfer.
* Note: the ERC721 contract address is always the message sender. * Note: the ERC721 contract address is always the message sender.
* @param _operator The address which called `safeTransferFrom` function * @param operator The address which called `safeTransferFrom` function
* @param _from The address which previously owned the token * @param from The address which previously owned the token
* @param _tokenId The NFT identifier which is being transferred * @param tokenId The NFT identifier which is being transferred
* @param _data Additional data with no specified format * @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/ */
function onERC721Received( function onERC721Received(
address _operator, address operator,
address _from, address from,
uint256 _tokenId, uint256 tokenId,
bytes _data bytes data
) )
public public
returns(bytes4); returns(bytes4);
......
...@@ -10,10 +10,10 @@ library Address { ...@@ -10,10 +10,10 @@ library Address {
* Returns whether the target address is a contract * Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract, * @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes. * as the code is not actually created until after the constructor finishes.
* @param _account address of the account to check * @param account address of the account to check
* @return whether the target address is a contract * @return whether the target address is a contract
*/ */
function isContract(address _account) internal view returns (bool) { function isContract(address account) internal view returns (bool) {
uint256 size; uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address // XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address. // than to check the size of the code at that address.
...@@ -22,7 +22,7 @@ library Address { ...@@ -22,7 +22,7 @@ library Address {
// TODO Check this again before the Serenity release, because all addresses will be // TODO Check this again before the Serenity release, because all addresses will be
// contracts then. // contracts then.
// solium-disable-next-line security/no-inline-assembly // solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(_account) } assembly { size := extcodesize(account) }
return size > 0; return size > 0;
} }
......
...@@ -19,11 +19,11 @@ library AutoIncrementing { ...@@ -19,11 +19,11 @@ library AutoIncrementing {
uint256 prevId; // default: 0 uint256 prevId; // default: 0
} }
function nextId(Counter storage _counter) function nextId(Counter storage counter)
internal internal
returns (uint256) returns (uint256)
{ {
_counter.prevId = _counter.prevId + 1; counter.prevId = counter.prevId + 1;
return _counter.prevId; return counter.prevId;
} }
} }
...@@ -10,7 +10,7 @@ pragma solidity ^0.4.24; ...@@ -10,7 +10,7 @@ pragma solidity ^0.4.24;
contract ReentrancyGuard { contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation /// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private guardCounter = 1; uint256 private _guardCounter = 1;
/** /**
* @dev Prevents a contract from calling itself, directly or indirectly. * @dev Prevents a contract from calling itself, directly or indirectly.
...@@ -21,10 +21,10 @@ contract ReentrancyGuard { ...@@ -21,10 +21,10 @@ contract ReentrancyGuard {
* wrapper marked as `nonReentrant`. * wrapper marked as `nonReentrant`.
*/ */
modifier nonReentrant() { modifier nonReentrant() {
guardCounter += 1; _guardCounter += 1;
uint256 localCounter = guardCounter; uint256 localCounter = _guardCounter;
_; _;
require(localCounter == guardCounter); require(localCounter == _guardCounter);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment