Unverified Commit 5471fc80 by Nicolás Venturo Committed by GitHub

Updated code style to 4 space indentation and 120 characters per line. (#1508)

* Updated code style to 4 spaces and 120 max characters per line.

* Update contracts/token/ERC721/ERC721Pausable.sol

Co-Authored-By: nventuro <nicolas.venturo@gmail.com>

* Update contracts/token/ERC721/IERC721.sol

Co-Authored-By: nventuro <nicolas.venturo@gmail.com>
parent 28133840
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
"extends": "solium:all", "extends": "solium:all",
"plugins": ["security"], "plugins": ["security"],
"rules": { "rules": {
"arg-overflow": "off",
"blank-lines": "off", "blank-lines": "off",
"error-reason": "off", "error-reason": "off",
"indentation": ["error", 2], "indentation": ["error", 4],
"lbrace": "off", "lbrace": "off",
"linebreak-style": ["error", "unix"], "linebreak-style": ["error", "unix"],
"max-len": ["error", 79], "max-len": ["error", 120],
"no-constant": ["error"], "no-constant": ["error"],
"no-empty-blocks": "off", "no-empty-blocks": "off",
"quotes": ["error", "double"], "quotes": ["error", "double"],
......
...@@ -33,11 +33,7 @@ library Roles { ...@@ -33,11 +33,7 @@ library Roles {
* @dev check if an account has this role * @dev check if an account has this role
* @return bool * @return bool
*/ */
function has(Role storage role, address account) function has(Role storage role, address account) internal view returns (bool) {
internal
view
returns (bool)
{
require(account != address(0)); require(account != address(0));
return role.bearer[account]; return role.bearer[account];
} }
......
...@@ -10,7 +10,7 @@ contract CapperRole { ...@@ -10,7 +10,7 @@ contract CapperRole {
Roles.Role private _cappers; Roles.Role private _cappers;
constructor() internal { constructor () internal {
_addCapper(msg.sender); _addCapper(msg.sender);
} }
......
...@@ -10,7 +10,7 @@ contract MinterRole { ...@@ -10,7 +10,7 @@ contract MinterRole {
Roles.Role private _minters; Roles.Role private _minters;
constructor() internal { constructor () internal {
_addMinter(msg.sender); _addMinter(msg.sender);
} }
......
...@@ -10,7 +10,7 @@ contract PauserRole { ...@@ -10,7 +10,7 @@ contract PauserRole {
Roles.Role private _pausers; Roles.Role private _pausers;
constructor() internal { constructor () internal {
_addPauser(msg.sender); _addPauser(msg.sender);
} }
......
...@@ -10,7 +10,7 @@ contract SignerRole { ...@@ -10,7 +10,7 @@ contract SignerRole {
Roles.Role private _signers; Roles.Role private _signers;
constructor() internal { constructor () internal {
_addSigner(msg.sender); _addSigner(msg.sender);
} }
......
...@@ -43,12 +43,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -43,12 +43,7 @@ contract Crowdsale is ReentrancyGuard {
* @param value weis paid for purchase * @param value weis paid for purchase
* @param amount amount of tokens purchased * @param amount amount of tokens purchased
*/ */
event TokensPurchased( event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
/** /**
* @param rate Number of token units a buyer gets per wei * @param rate Number of token units a buyer gets per wei
...@@ -58,7 +53,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -58,7 +53,7 @@ contract Crowdsale is ReentrancyGuard {
* @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) internal { constructor (uint256 rate, address wallet, IERC20 token) internal {
require(rate > 0); require(rate > 0);
require(wallet != address(0)); require(wallet != address(0));
require(token != address(0)); require(token != address(0));
...@@ -85,21 +80,21 @@ contract Crowdsale is ReentrancyGuard { ...@@ -85,21 +80,21 @@ contract Crowdsale is ReentrancyGuard {
/** /**
* @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;
} }
...@@ -117,7 +112,6 @@ contract Crowdsale is ReentrancyGuard { ...@@ -117,7 +112,6 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Recipient of the token purchase * @param beneficiary Recipient of the token purchase
*/ */
function buyTokens(address beneficiary) public nonReentrant payable { function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value; uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount); _preValidatePurchase(beneficiary, weiAmount);
...@@ -128,12 +122,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -128,12 +122,7 @@ contract Crowdsale is ReentrancyGuard {
_weiRaised = _weiRaised.add(weiAmount); _weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens); _processPurchase(beneficiary, tokens);
emit TokensPurchased( emit TokensPurchased(msg.sender, beneficiary, weiAmount, tokens);
msg.sender,
beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(beneficiary, weiAmount); _updatePurchasingState(beneficiary, weiAmount);
...@@ -153,13 +142,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -153,13 +142,7 @@ contract Crowdsale is ReentrancyGuard {
* @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, uint256 weiAmount) internal view {
address beneficiary,
uint256 weiAmount
)
internal
view
{
require(beneficiary != address(0)); require(beneficiary != address(0));
require(weiAmount != 0); require(weiAmount != 0);
} }
...@@ -169,13 +152,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -169,13 +152,7 @@ contract Crowdsale is ReentrancyGuard {
* @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, uint256 weiAmount) internal view {
address beneficiary,
uint256 weiAmount
)
internal
view
{
// optional override // optional override
} }
...@@ -184,12 +161,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -184,12 +161,7 @@ contract Crowdsale is ReentrancyGuard {
* @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, uint256 tokenAmount) internal {
address beneficiary,
uint256 tokenAmount
)
internal
{
_token.safeTransfer(beneficiary, tokenAmount); _token.safeTransfer(beneficiary, tokenAmount);
} }
...@@ -198,12 +170,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -198,12 +170,7 @@ contract Crowdsale is ReentrancyGuard {
* @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, uint256 tokenAmount) internal {
address beneficiary,
uint256 tokenAmount
)
internal
{
_deliverTokens(beneficiary, tokenAmount); _deliverTokens(beneficiary, tokenAmount);
} }
...@@ -212,12 +179,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -212,12 +179,7 @@ contract Crowdsale is ReentrancyGuard {
* @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, uint256 weiAmount) internal {
address beneficiary,
uint256 weiAmount
)
internal
{
// optional override // optional override
} }
...@@ -226,9 +188,7 @@ contract Crowdsale is ReentrancyGuard { ...@@ -226,9 +188,7 @@ contract Crowdsale is ReentrancyGuard {
* @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);
} }
......
...@@ -15,7 +15,7 @@ contract FinalizableCrowdsale is TimedCrowdsale { ...@@ -15,7 +15,7 @@ contract FinalizableCrowdsale is TimedCrowdsale {
event CrowdsaleFinalized(); event CrowdsaleFinalized();
constructor() internal { constructor () internal {
_finalized = false; _finalized = false;
} }
...@@ -45,6 +45,5 @@ contract FinalizableCrowdsale is TimedCrowdsale { ...@@ -45,6 +45,5 @@ contract FinalizableCrowdsale is TimedCrowdsale {
* should call super._finalization() to ensure the chain of finalization is * should call super._finalization() to ensure the chain of finalization is
* executed entirely. * executed entirely.
*/ */
function _finalization() internal { function _finalization() internal {}
}
} }
...@@ -12,7 +12,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale { ...@@ -12,7 +12,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
mapping(address => uint256) private _balances; mapping(address => uint256) private _balances;
constructor() internal {} constructor () internal {}
/** /**
* @dev Withdraw tokens only after crowdsale ends. * @dev Withdraw tokens only after crowdsale ends.
...@@ -29,7 +29,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale { ...@@ -29,7 +29,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
/** /**
* @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];
} }
...@@ -38,12 +38,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale { ...@@ -38,12 +38,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
* @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, uint256 tokenAmount) internal {
address beneficiary,
uint256 tokenAmount
)
internal
{
_balances[beneficiary] = _balances[beneficiary].add(tokenAmount); _balances[beneficiary] = _balances[beneficiary].add(tokenAmount);
} }
......
...@@ -35,7 +35,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -35,7 +35,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Constructor, creates RefundEscrow. * @dev Constructor, creates RefundEscrow.
* @param goal Funding goal * @param goal Funding goal
*/ */
constructor(uint256 goal) internal { constructor (uint256 goal) internal {
require(goal > 0); require(goal > 0);
_escrow = new RefundEscrow(wallet()); _escrow = new RefundEscrow(wallet());
_goal = goal; _goal = goal;
...@@ -44,7 +44,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -44,7 +44,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
/** /**
* @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;
} }
...@@ -87,5 +87,4 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -87,5 +87,4 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
function _forwardFunds() internal { function _forwardFunds() internal {
_escrow.deposit.value(msg.value)(msg.sender); _escrow.deposit.value(msg.value)(msg.sender);
} }
} }
...@@ -20,7 +20,7 @@ contract AllowanceCrowdsale is Crowdsale { ...@@ -20,7 +20,7 @@ contract AllowanceCrowdsale is Crowdsale {
* @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) internal { constructor (address tokenWallet) internal {
require(tokenWallet != address(0)); require(tokenWallet != address(0));
_tokenWallet = tokenWallet; _tokenWallet = tokenWallet;
} }
...@@ -28,7 +28,7 @@ contract AllowanceCrowdsale is Crowdsale { ...@@ -28,7 +28,7 @@ contract AllowanceCrowdsale is Crowdsale {
/** /**
* @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,10 +37,7 @@ contract AllowanceCrowdsale is Crowdsale { ...@@ -37,10 +37,7 @@ 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 Math.min( return Math.min(token().balanceOf(_tokenWallet), token().allowance(_tokenWallet, this));
token().balanceOf(_tokenWallet),
token().allowance(_tokenWallet, this)
);
} }
/** /**
...@@ -48,12 +45,7 @@ contract AllowanceCrowdsale is Crowdsale { ...@@ -48,12 +45,7 @@ contract AllowanceCrowdsale is Crowdsale {
* @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, uint256 tokenAmount) internal {
address beneficiary,
uint256 tokenAmount
)
internal
{
token().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount); token().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount);
} }
} }
...@@ -9,21 +9,15 @@ import "../../token/ERC20/ERC20Mintable.sol"; ...@@ -9,21 +9,15 @@ import "../../token/ERC20/ERC20Mintable.sol";
* Token ownership should be transferred to MintedCrowdsale for minting. * Token ownership should be transferred to MintedCrowdsale for minting.
*/ */
contract MintedCrowdsale is Crowdsale { contract MintedCrowdsale is Crowdsale {
constructor() internal {} constructor () internal {}
/** /**
* @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, uint256 tokenAmount) internal {
address beneficiary,
uint256 tokenAmount
)
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));
} }
} }
...@@ -20,7 +20,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale { ...@@ -20,7 +20,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @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) internal { constructor (uint256 initialRate, uint256 finalRate) internal {
require(finalRate > 0); require(finalRate > 0);
require(initialRate > finalRate); require(initialRate > finalRate);
_initialRate = initialRate; _initialRate = initialRate;
...@@ -31,14 +31,14 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale { ...@@ -31,14 +31,14 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* The base rate function is overridden to revert, since this crowdsale doens't use it, and * The base rate function is overridden to revert, since this crowdsale doens't use it, and
* all calls to it are a mistake. * all calls to it are a mistake.
*/ */
function rate() public view returns(uint256) { function rate() public view returns (uint256) {
revert(); revert();
} }
/** /**
* @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;
} }
...@@ -71,11 +71,8 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale { ...@@ -71,11 +71,8 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @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);
} }
} }
...@@ -16,7 +16,7 @@ contract CappedCrowdsale is Crowdsale { ...@@ -16,7 +16,7 @@ contract CappedCrowdsale is Crowdsale {
* @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) internal { constructor (uint256 cap) internal {
require(cap > 0); require(cap > 0);
_cap = cap; _cap = cap;
} }
...@@ -24,7 +24,7 @@ contract CappedCrowdsale is Crowdsale { ...@@ -24,7 +24,7 @@ contract CappedCrowdsale is Crowdsale {
/** /**
* @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;
} }
...@@ -41,15 +41,8 @@ contract CappedCrowdsale is Crowdsale { ...@@ -41,15 +41,8 @@ contract CappedCrowdsale is Crowdsale {
* @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, uint256 weiAmount) internal view {
address beneficiary,
uint256 weiAmount
)
internal
view
{
super._preValidatePurchase(beneficiary, weiAmount); super._preValidatePurchase(beneficiary, weiAmount);
require(weiRaised().add(weiAmount) <= _cap); require(weiRaised().add(weiAmount) <= _cap);
} }
} }
...@@ -14,7 +14,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { ...@@ -14,7 +14,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
mapping(address => uint256) private _contributions; mapping(address => uint256) private _contributions;
mapping(address => uint256) private _caps; mapping(address => uint256) private _caps;
constructor() internal {} constructor () internal {}
/** /**
* @dev Sets a specific beneficiary's maximum contribution. * @dev Sets a specific beneficiary's maximum contribution.
...@@ -39,9 +39,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { ...@@ -39,9 +39,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @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];
} }
...@@ -50,16 +48,9 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { ...@@ -50,16 +48,9 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @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, uint256 weiAmount) internal view {
address beneficiary,
uint256 weiAmount
)
internal
view
{
super._preValidatePurchase(beneficiary, weiAmount); super._preValidatePurchase(beneficiary, weiAmount);
require( require(_contributions[beneficiary].add(weiAmount) <= _caps[beneficiary]);
_contributions[beneficiary].add(weiAmount) <= _caps[beneficiary]);
} }
/** /**
...@@ -67,15 +58,8 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { ...@@ -67,15 +58,8 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @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, uint256 weiAmount) internal {
address beneficiary,
uint256 weiAmount
)
internal
{
super._updatePurchasingState(beneficiary, weiAmount); super._updatePurchasingState(beneficiary, weiAmount);
_contributions[beneficiary] = _contributions[beneficiary].add( _contributions[beneficiary] = _contributions[beneficiary].add(weiAmount);
weiAmount);
} }
} }
...@@ -26,7 +26,7 @@ contract TimedCrowdsale is Crowdsale { ...@@ -26,7 +26,7 @@ contract TimedCrowdsale is Crowdsale {
* @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) internal { constructor (uint256 openingTime, uint256 closingTime) internal {
// 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);
...@@ -38,14 +38,14 @@ contract TimedCrowdsale is Crowdsale { ...@@ -38,14 +38,14 @@ contract TimedCrowdsale is Crowdsale {
/** /**
* @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;
} }
...@@ -71,15 +71,7 @@ contract TimedCrowdsale is Crowdsale { ...@@ -71,15 +71,7 @@ contract TimedCrowdsale is Crowdsale {
* @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, uint256 weiAmount) internal onlyWhileOpen view {
address beneficiary,
uint256 weiAmount
)
internal
onlyWhileOpen
view
{
super._preValidatePurchase(beneficiary, weiAmount); super._preValidatePurchase(beneficiary, weiAmount);
} }
} }
...@@ -8,17 +8,12 @@ pragma solidity ^0.4.24; ...@@ -8,17 +8,12 @@ pragma solidity ^0.4.24;
*/ */
library ECDSA { 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 pure returns (address) {
internal
pure
returns (address)
{
bytes32 r; bytes32 r;
bytes32 s; bytes32 s;
uint8 v; uint8 v;
...@@ -57,15 +52,9 @@ library ECDSA { ...@@ -57,15 +52,9 @@ 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 pure returns (bytes32) {
internal
pure
returns (bytes32)
{
// 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)
);
} }
} }
...@@ -13,15 +13,7 @@ library MerkleProof { ...@@ -13,15 +13,7 @@ library MerkleProof {
* @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 root, bytes32 leaf) internal pure returns (bool) {
bytes32[] proof,
bytes32 root,
bytes32 leaf
)
internal
pure
returns (bool)
{
bytes32 computedHash = leaf; bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) { for (uint256 i = 0; i < proof.length; i++) {
......
...@@ -13,15 +13,11 @@ pragma solidity ^0.4.24; ...@@ -13,15 +13,11 @@ pragma solidity ^0.4.24;
* so it's not something you have to worry about.) * so it's not something you have to worry about.)
*/ */
library Counter { library Counter {
struct Counter { struct Counter {
uint256 current; // default: 0 uint256 current; // default: 0
} }
function next(Counter storage index) function next(Counter storage index) internal returns (uint256) {
internal
returns (uint256)
{
index.current += 1; index.current += 1;
return index.current; return index.current;
} }
......
...@@ -15,9 +15,7 @@ contract ERC20TokenMetadata is IERC20 { ...@@ -15,9 +15,7 @@ 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;
} }
......
...@@ -43,7 +43,7 @@ contract ERC20Migrator { ...@@ -43,7 +43,7 @@ contract ERC20Migrator {
/** /**
* @param legacyToken address of the old token contract * @param legacyToken address of the old token contract
*/ */
constructor(IERC20 legacyToken) public { constructor (IERC20 legacyToken) public {
require(legacyToken != address(0)); require(legacyToken != address(0));
_legacyToken = legacyToken; _legacyToken = legacyToken;
} }
......
...@@ -43,13 +43,12 @@ contract SignatureBouncer is SignerRole { ...@@ -43,13 +43,12 @@ contract SignatureBouncer is SignerRole {
// 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;
constructor() internal {} constructor () internal {}
/** /**
* @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));
_; _;
} }
...@@ -57,8 +56,7 @@ contract SignatureBouncer is SignerRole { ...@@ -57,8 +56,7 @@ contract SignatureBouncer is SignerRole {
/** /**
* @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));
_; _;
} }
...@@ -66,8 +64,7 @@ contract SignatureBouncer is SignerRole { ...@@ -66,8 +64,7 @@ contract SignatureBouncer is SignerRole {
/** /**
* @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));
_; _;
} }
...@@ -76,34 +73,20 @@ contract SignatureBouncer is SignerRole { ...@@ -76,34 +73,20 @@ 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 account, bytes signature) function _isValidSignature(address account, bytes signature) internal view returns (bool) {
internal return _isValidDataHash(keccak256(abi.encodePacked(address(this), account)), signature);
view
returns (bool)
{
return _isValidDataHash(
keccak256(abi.encodePacked(address(this), account)),
signature
);
} }
/** /**
* @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 account, bytes signature) function _isValidSignatureAndMethod(address account, bytes signature) internal view returns (bool) {
internal
view
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), account, data)), signature);
keccak256(abi.encodePacked(address(this), account, data)),
signature
);
} }
/** /**
...@@ -111,20 +94,15 @@ contract SignatureBouncer is SignerRole { ...@@ -111,20 +94,15 @@ contract SignatureBouncer is SignerRole {
* @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 account, bytes signature) function _isValidSignatureAndData(address account, bytes signature) internal view returns (bool) {
internal
view
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(
keccak256(abi.encodePacked(address(this), account, data)), return _isValidDataHash(keccak256(abi.encodePacked(address(this), account, data)), signature);
signature
);
} }
/** /**
...@@ -132,14 +110,8 @@ contract SignatureBouncer is SignerRole { ...@@ -132,14 +110,8 @@ 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 view returns (bool) {
internal address signer = hash.toEthSignedMessageHash().recover(signature);
view
returns (bool)
{
address signer = hash
.toEthSignedMessageHash()
.recover(signature);
return signer != address(0) && isSigner(signer); return signer != address(0) && isSigner(signer);
} }
......
...@@ -41,15 +41,7 @@ contract TokenVesting is Ownable { ...@@ -41,15 +41,7 @@ contract TokenVesting is Ownable {
* @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, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public {
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
)
public
{
require(beneficiary != address(0)); require(beneficiary != address(0));
require(cliffDuration <= duration); require(cliffDuration <= duration);
require(duration > 0); require(duration > 0);
...@@ -65,49 +57,49 @@ contract TokenVesting is Ownable { ...@@ -65,49 +57,49 @@ contract TokenVesting is Ownable {
/** /**
* @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];
} }
......
...@@ -12,7 +12,7 @@ import "../token/ERC20/ERC20Detailed.sol"; ...@@ -12,7 +12,7 @@ import "../token/ERC20/ERC20Detailed.sol";
* It is meant to be used in a crowdsale contract. * It is meant to be used in a crowdsale contract.
*/ */
contract SampleCrowdsaleToken is ERC20Mintable, ERC20Detailed { contract SampleCrowdsaleToken is ERC20Mintable, ERC20Detailed {
constructor() public ERC20Detailed("Sample Crowdsale Token", "SCT", 18) {} constructor () public ERC20Detailed("Sample Crowdsale Token", "SCT", 18) {}
} }
/** /**
...@@ -34,8 +34,7 @@ contract SampleCrowdsaleToken is ERC20Mintable, ERC20Detailed { ...@@ -34,8 +34,7 @@ contract SampleCrowdsaleToken is ERC20Mintable, ERC20Detailed {
// --elopio - 2018-05-10 // --elopio - 2018-05-10
// solium-disable-next-line max-len // solium-disable-next-line max-len
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,
......
...@@ -10,14 +10,12 @@ import "../token/ERC20/ERC20Detailed.sol"; ...@@ -10,14 +10,12 @@ import "../token/ERC20/ERC20Detailed.sol";
* `ERC20` functions. * `ERC20` functions.
*/ */
contract SimpleToken is ERC20, ERC20Detailed { contract SimpleToken is ERC20, ERC20Detailed {
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals())); uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
/** /**
* @dev Constructor that gives msg.sender all of existing tokens. * @dev Constructor that gives msg.sender all of existing tokens.
*/ */
constructor() public ERC20Detailed("SimpleToken", "SIM", 18) { constructor () public ERC20Detailed("SimpleToken", "SIM", 18) {
_mint(msg.sender, INITIAL_SUPPLY); _mint(msg.sender, INITIAL_SUPPLY);
} }
} }
...@@ -8,7 +8,6 @@ import "./IERC165.sol"; ...@@ -8,7 +8,6 @@ import "./IERC165.sol";
* @dev Implements ERC165 using a lookup table. * @dev Implements ERC165 using a lookup table.
*/ */
contract ERC165 is IERC165 { contract ERC165 is IERC165 {
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7; bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
/** /**
* 0x01ffc9a7 === * 0x01ffc9a7 ===
...@@ -24,29 +23,21 @@ contract ERC165 is IERC165 { ...@@ -24,29 +23,21 @@ contract ERC165 is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup * @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself * implement ERC165 itself
*/ */
constructor() constructor () internal {
internal
{
_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 view returns (bool) {
external
view
returns (bool)
{
return _supportedInterfaces[interfaceId]; return _supportedInterfaces[interfaceId];
} }
/** /**
* @dev internal method for registering an interface * @dev internal 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;
} }
......
...@@ -20,11 +20,7 @@ library ERC165Checker { ...@@ -20,11 +20,7 @@ library ERC165Checker {
* @param account 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 account implements ERC165 * @return true if the contract at account implements ERC165
*/ */
function _supportsERC165(address account) function _supportsERC165(address account) internal view returns (bool) {
internal
view
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(account, _InterfaceId_ERC165) && return _supportsERC165Interface(account, _InterfaceId_ERC165) &&
...@@ -39,11 +35,7 @@ library ERC165Checker { ...@@ -39,11 +35,7 @@ library ERC165Checker {
* 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 account, bytes4 interfaceId) function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
internal
view
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(account) && return _supportsERC165(account) &&
_supportsERC165Interface(account, interfaceId); _supportsERC165Interface(account, interfaceId);
...@@ -57,11 +49,7 @@ library ERC165Checker { ...@@ -57,11 +49,7 @@ library ERC165Checker {
* 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 _supportsAllInterfaces(address account, bytes4[] interfaceIds) function _supportsAllInterfaces(address account, bytes4[] interfaceIds) internal view returns (bool) {
internal
view
returns (bool)
{
// query support of ERC165 itself // query support of ERC165 itself
if (!_supportsERC165(account)) { if (!_supportsERC165(account)) {
return false; return false;
...@@ -89,15 +77,10 @@ library ERC165Checker { ...@@ -89,15 +77,10 @@ library ERC165Checker {
* 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 account, bytes4 interfaceId) function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
private
view
returns (bool)
{
// success determines whether the staticcall succeeded and result determines // success determines whether the staticcall succeeded and result determines
// whether the contract at account indicates support of _interfaceId // whether the contract at account indicates support of _interfaceId
(bool success, bool result) = _callERC165SupportsInterface( (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
account, interfaceId);
return (success && result); return (success && result);
} }
...@@ -110,18 +93,12 @@ library ERC165Checker { ...@@ -110,18 +93,12 @@ library ERC165Checker {
* @return result true if the STATICCALL succeeded and the contract at account * @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 account, bytes4 interfaceId)
address account,
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);
_InterfaceId_ERC165,
interfaceId
);
// solium-disable-next-line security/no-inline-assembly // solium-disable-next-line security/no-inline-assembly
assembly { assembly {
......
...@@ -5,15 +5,11 @@ pragma solidity ^0.4.24; ...@@ -5,15 +5,11 @@ pragma solidity ^0.4.24;
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/ */
interface IERC165 { 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 view returns (bool);
external
view
returns (bool);
} }
...@@ -12,14 +12,14 @@ contract Pausable is PauserRole { ...@@ -12,14 +12,14 @@ contract Pausable is PauserRole {
bool private _paused; bool private _paused;
constructor() internal { constructor () internal {
_paused = false; _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;
} }
......
...@@ -5,7 +5,6 @@ pragma solidity ^0.4.24; ...@@ -5,7 +5,6 @@ pragma solidity ^0.4.24;
* @dev Math operations with safety checks that revert on error * @dev Math operations with safety checks that revert on error
*/ */
library SafeMath { library SafeMath {
/** /**
* @dev Multiplies two numbers, reverts on overflow. * @dev Multiplies two numbers, reverts on overflow.
*/ */
...@@ -27,7 +26,8 @@ library SafeMath { ...@@ -27,7 +26,8 @@ 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 // Solidity only automatically asserts when dividing by 0
require(b > 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
......
...@@ -3,12 +3,7 @@ pragma solidity ^0.4.24; ...@@ -3,12 +3,7 @@ pragma solidity ^0.4.24;
import "../utils/Address.sol"; import "../utils/Address.sol";
contract AddressImpl { contract AddressImpl {
function isContract(address account) function isContract(address account) external view returns (bool) {
external
view
returns (bool)
{
return Address.isContract(account); return Address.isContract(account);
} }
} }
...@@ -4,17 +4,9 @@ import "../token/ERC20/IERC20.sol"; ...@@ -4,17 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol"; import "../crowdsale/emission/AllowanceCrowdsale.sol";
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale { contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
constructor (uint256 rate, address wallet, IERC20 token, address tokenWallet)
constructor (
uint256 rate,
address wallet,
IERC20 token,
address tokenWallet
)
public public
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
AllowanceCrowdsale(tokenWallet) AllowanceCrowdsale(tokenWallet)
{ {}
}
} }
...@@ -3,12 +3,11 @@ pragma solidity ^0.4.24; ...@@ -3,12 +3,11 @@ pragma solidity ^0.4.24;
import "../utils/Arrays.sol"; import "../utils/Arrays.sol";
contract ArraysImpl { contract ArraysImpl {
using Arrays for uint256[]; using Arrays for uint256[];
uint256[] private array; uint256[] private array;
constructor(uint256[] _array) public { constructor (uint256[] _array) public {
array = _array; array = _array;
} }
......
...@@ -4,17 +4,9 @@ import "../token/ERC20/IERC20.sol"; ...@@ -4,17 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol"; import "../crowdsale/validation/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale { contract CappedCrowdsaleImpl is CappedCrowdsale {
constructor (uint256 rate, address wallet, IERC20 token, uint256 cap)
constructor (
uint256 rate,
address wallet,
IERC20 token,
uint256 cap
)
public public
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
CappedCrowdsale(cap) CappedCrowdsale(cap)
{ {}
}
} }
...@@ -10,10 +10,7 @@ contract CounterImpl { ...@@ -10,10 +10,7 @@ contract CounterImpl {
// use whatever key you want to track your counters // use whatever key you want to track your counters
mapping(string => Counter.Counter) private _counters; mapping(string => Counter.Counter) private _counters;
function doThing(string key) function doThing(string key) public returns (uint256) {
public
returns (uint256)
{
theId = _counters[key].next(); theId = _counters[key].next();
return theId; return theId;
} }
......
...@@ -3,7 +3,5 @@ pragma solidity ^0.4.24; ...@@ -3,7 +3,5 @@ pragma solidity ^0.4.24;
import "../crowdsale/Crowdsale.sol"; import "../crowdsale/Crowdsale.sol";
contract CrowdsaleMock is Crowdsale { contract CrowdsaleMock is Crowdsale {
constructor(uint256 rate, address wallet, IERC20 token) public constructor (uint256 rate, address wallet, IERC20 token) public Crowdsale(rate, wallet, token) {}
Crowdsale(rate, wallet, token) {
}
} }
...@@ -4,12 +4,5 @@ import "../token/ERC20/ERC20.sol"; ...@@ -4,12 +4,5 @@ import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol"; import "../token/ERC20/ERC20Detailed.sol";
contract ERC20DetailedMock is ERC20, ERC20Detailed { contract ERC20DetailedMock is ERC20, ERC20Detailed {
constructor( constructor (string name, string symbol, uint8 decimals) ERC20Detailed(name, symbol, decimals) public {}
string name,
string symbol,
uint8 decimals
)
ERC20Detailed(name, symbol, decimals)
public
{}
} }
...@@ -5,19 +5,11 @@ import "../cryptography/ECDSA.sol"; ...@@ -5,19 +5,11 @@ 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 pure returns (address) {
public
pure
returns (address)
{
return hash.recover(signature); return hash.recover(signature);
} }
function toEthSignedMessageHash(bytes32 hash) function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
public
pure
returns (bytes32)
{
return hash.toEthSignedMessageHash(); return hash.toEthSignedMessageHash();
} }
} }
...@@ -11,7 +11,6 @@ import "../../introspection/IERC165.sol"; ...@@ -11,7 +11,6 @@ import "../../introspection/IERC165.sol";
* solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it * solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
*/ */
contract SupportsInterfaceWithLookupMock is IERC165 { contract SupportsInterfaceWithLookupMock is IERC165 {
bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7;
/** /**
* 0x01ffc9a7 === * 0x01ffc9a7 ===
...@@ -27,38 +26,28 @@ contract SupportsInterfaceWithLookupMock is IERC165 { ...@@ -27,38 +26,28 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup * @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself * implement ERC165 itself
*/ */
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 view returns (bool) {
external
view
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]);
} }
......
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
contract ERC165NotSupported { contract ERC165NotSupported {}
}
...@@ -5,27 +5,15 @@ import "../introspection/ERC165Checker.sol"; ...@@ -5,27 +5,15 @@ import "../introspection/ERC165Checker.sol";
contract ERC165CheckerMock { contract ERC165CheckerMock {
using ERC165Checker for address; using ERC165Checker for address;
function supportsERC165(address account) function supportsERC165(address account) public view returns (bool) {
public
view
returns (bool)
{
return account._supportsERC165(); return account._supportsERC165();
} }
function supportsInterface(address account, bytes4 interfaceId) function supportsInterface(address account, bytes4 interfaceId) public view returns (bool) {
public
view
returns (bool)
{
return account._supportsInterface(interfaceId); return account._supportsInterface(interfaceId);
} }
function supportsAllInterfaces(address account, bytes4[] interfaceIds) function supportsAllInterfaces(address account, bytes4[] interfaceIds) public view returns (bool) {
public
view
returns (bool)
{
return account._supportsAllInterfaces(interfaceIds); return account._supportsAllInterfaces(interfaceIds);
} }
} }
...@@ -3,9 +3,7 @@ pragma solidity ^0.4.24; ...@@ -3,9 +3,7 @@ pragma solidity ^0.4.24;
import "../introspection/ERC165.sol"; 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);
} }
} }
...@@ -3,9 +3,7 @@ pragma solidity ^0.4.24; ...@@ -3,9 +3,7 @@ pragma solidity ^0.4.24;
import "../token/ERC20/ERC20Burnable.sol"; 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);
} }
} }
...@@ -4,8 +4,7 @@ import "../token/ERC20/ERC20.sol"; ...@@ -4,8 +4,7 @@ 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);
} }
...@@ -20,5 +19,4 @@ contract ERC20Mock is ERC20 { ...@@ -20,5 +19,4 @@ contract ERC20Mock is ERC20 {
function burnFrom(address account, uint256 amount) public { function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount); _burnFrom(account, amount);
} }
} }
...@@ -5,9 +5,7 @@ import "./PauserRoleMock.sol"; ...@@ -5,9 +5,7 @@ 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);
} }
} }
...@@ -4,8 +4,5 @@ import "../token/ERC20/ERC20.sol"; ...@@ -4,8 +4,5 @@ import "../token/ERC20/ERC20.sol";
import "../drafts/ERC1046/TokenMetadata.sol"; 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)
{
}
} }
...@@ -10,13 +10,8 @@ import "../token/ERC721/ERC721Burnable.sol"; ...@@ -10,13 +10,8 @@ import "../token/ERC721/ERC721Burnable.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,
* and a public setter for metadata URI * and a public setter for metadata URI
*/ */
contract ERC721FullMock contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable { constructor (string name, string symbol) public ERC721Mintable() ERC721Full(name, symbol) {}
constructor(string name, string symbol) public
ERC721Mintable()
ERC721Full(name, symbol)
{}
function exists(uint256 tokenId) public view returns (bool) { function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId); return _exists(tokenId);
......
...@@ -8,13 +8,6 @@ import "../token/ERC721/ERC721Burnable.sol"; ...@@ -8,13 +8,6 @@ import "../token/ERC721/ERC721Burnable.sol";
/** /**
* @title ERC721MintableBurnableImpl * @title ERC721MintableBurnableImpl
*/ */
contract ERC721MintableBurnableImpl contract ERC721MintableBurnableImpl is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable { constructor () ERC721Mintable() ERC721Full("Test", "TEST") public {}
constructor()
ERC721Mintable()
ERC721Full("Test", "TEST")
public
{
}
} }
...@@ -6,36 +6,16 @@ contract ERC721ReceiverMock is IERC721Receiver { ...@@ -6,36 +6,16 @@ contract ERC721ReceiverMock is IERC721Receiver {
bytes4 private _retval; bytes4 private _retval;
bool private _reverts; bool private _reverts;
event Received( event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
address operator,
address from,
uint256 tokenId,
bytes data,
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 from, uint256 tokenId, bytes data) public returns (bytes4) {
address operator,
address from,
uint256 tokenId,
bytes data
)
public
returns(bytes4)
{
require(!_reverts); require(!_reverts);
emit Received( emit Received(operator, from, tokenId, data, gasleft());
operator,
from,
tokenId,
data,
gasleft() // msg.gas was deprecated in solidityv0.4.21
);
return _retval; return _retval;
} }
} }
...@@ -9,11 +9,7 @@ contract EventEmitter { ...@@ -9,11 +9,7 @@ contract EventEmitter {
event Address(address value); event Address(address value);
event Boolean(bool value); event Boolean(bool value);
event String(string value); event String(string value);
event LongUintBooleanString( event LongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue);
uint256 uintValue,
bool booleanValue,
string stringValue
);
function emitArgumentless() public { function emitArgumentless() public {
emit Argumentless(); emit Argumentless();
...@@ -47,11 +43,7 @@ contract EventEmitter { ...@@ -47,11 +43,7 @@ contract EventEmitter {
emit String(value); emit String(value);
} }
function emitLongUintBooleanString( function emitLongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue) public {
uint256 uintValue,
bool booleanValue,
string stringValue)
public {
emit LongUintBooleanString(uintValue, booleanValue, stringValue); emit LongUintBooleanString(uintValue, booleanValue, stringValue);
} }
......
...@@ -5,17 +5,9 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol"; ...@@ -5,17 +5,9 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale { contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
constructor ( constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
IERC20 token
)
public public
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime) TimedCrowdsale(openingTime, closingTime)
{ {}
}
} }
...@@ -4,7 +4,6 @@ import "../crowdsale/price/IncreasingPriceCrowdsale.sol"; ...@@ -4,7 +4,6 @@ import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
import "../math/SafeMath.sol"; import "../math/SafeMath.sol";
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale { contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
constructor ( constructor (
uint256 openingTime, uint256 openingTime,
uint256 closingTime, uint256 closingTime,
...@@ -17,7 +16,5 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale { ...@@ -17,7 +16,5 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
Crowdsale(initialRate, wallet, token) Crowdsale(initialRate, wallet, token)
TimedCrowdsale(openingTime, closingTime) TimedCrowdsale(openingTime, closingTime)
IncreasingPriceCrowdsale(initialRate, finalRate) IncreasingPriceCrowdsale(initialRate, finalRate)
{ {}
}
} }
...@@ -4,16 +4,7 @@ import "../token/ERC20/IERC20.sol"; ...@@ -4,16 +4,7 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol"; import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
import "./CapperRoleMock.sol"; import "./CapperRoleMock.sol";
contract IndividuallyCappedCrowdsaleImpl contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale, CapperRoleMock {
is IndividuallyCappedCrowdsale, CapperRoleMock { constructor (uint256 rate, address wallet, IERC20 token) public Crowdsale(rate, wallet, token)
{}
constructor(
uint256 rate,
address wallet,
IERC20 token
)
public
Crowdsale(rate, wallet, token)
{
}
} }
...@@ -3,16 +3,7 @@ pragma solidity ^0.4.24; ...@@ -3,16 +3,7 @@ pragma solidity ^0.4.24;
import { MerkleProof } from "../cryptography/MerkleProof.sol"; import { MerkleProof } from "../cryptography/MerkleProof.sol";
contract MerkleProofWrapper { contract MerkleProofWrapper {
function verify(bytes32[] proof, bytes32 root, bytes32 leaf) public pure returns (bool) {
function verify(
bytes32[] proof,
bytes32 root,
bytes32 leaf
)
public
pure
returns (bool)
{
return MerkleProof.verify(proof, root, leaf); return MerkleProof.verify(proof, root, leaf);
} }
} }
...@@ -4,15 +4,5 @@ import "../token/ERC20/ERC20Mintable.sol"; ...@@ -4,15 +4,5 @@ import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/emission/MintedCrowdsale.sol"; import "../crowdsale/emission/MintedCrowdsale.sol";
contract MintedCrowdsaleImpl is MintedCrowdsale { contract MintedCrowdsaleImpl is MintedCrowdsale {
constructor (uint256 rate, address wallet, ERC20Mintable token) public Crowdsale(rate, wallet, token) {}
constructor (
uint256 rate,
address wallet,
ERC20Mintable token
)
public
Crowdsale(rate, wallet, token)
{
}
} }
...@@ -2,5 +2,4 @@ pragma solidity ^0.4.24; ...@@ -2,5 +2,4 @@ pragma solidity ^0.4.24;
import "../ownership/Ownable.sol"; import "../ownership/Ownable.sol";
contract OwnableMock is Ownable { contract OwnableMock is Ownable {}
}
...@@ -8,7 +8,7 @@ contract PausableMock is Pausable, PauserRoleMock { ...@@ -8,7 +8,7 @@ contract PausableMock is Pausable, PauserRoleMock {
bool public drasticMeasureTaken; bool public drasticMeasureTaken;
uint256 public count; uint256 public count;
constructor() public { constructor () public {
drasticMeasureTaken = false; drasticMeasureTaken = false;
count = 0; count = 0;
} }
...@@ -20,5 +20,4 @@ contract PausableMock is Pausable, PauserRoleMock { ...@@ -20,5 +20,4 @@ contract PausableMock is Pausable, PauserRoleMock {
function drasticMeasure() external whenPaused { function drasticMeasure() external whenPaused {
drasticMeasureTaken = true; drasticMeasureTaken = true;
} }
} }
...@@ -4,18 +4,9 @@ import "../token/ERC20/IERC20.sol"; ...@@ -4,18 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol"; import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale { contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
IERC20 token
)
public public
TimedCrowdsale(openingTime, closingTime) TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
{ {}
}
} }
...@@ -4,12 +4,10 @@ import "../payment/PullPayment.sol"; ...@@ -4,12 +4,10 @@ import "../payment/PullPayment.sol";
// mock class using PullPayment // mock class using PullPayment
contract PullPaymentMock is PullPayment { 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);
} }
} }
...@@ -4,10 +4,9 @@ import "../utils/ReentrancyGuard.sol"; ...@@ -4,10 +4,9 @@ import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol"; import "./ReentrancyAttack.sol";
contract ReentrancyMock is ReentrancyGuard { contract ReentrancyMock is ReentrancyGuard {
uint256 public counter; uint256 public counter;
constructor() public { constructor () public {
counter = 0; counter = 0;
} }
...@@ -40,5 +39,4 @@ contract ReentrancyMock is ReentrancyGuard { ...@@ -40,5 +39,4 @@ contract ReentrancyMock is ReentrancyGuard {
function count() private { function count() private {
counter += 1; counter += 1;
} }
} }
...@@ -4,7 +4,6 @@ import "../token/ERC20/ERC20Mintable.sol"; ...@@ -4,7 +4,6 @@ import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol"; import "../crowdsale/distribution/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale { contract RefundableCrowdsaleImpl is RefundableCrowdsale {
constructor ( constructor (
uint256 openingTime, uint256 openingTime,
uint256 closingTime, uint256 closingTime,
...@@ -17,7 +16,5 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale { ...@@ -17,7 +16,5 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime) TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal) RefundableCrowdsale(goal)
{ {}
}
} }
...@@ -53,7 +53,7 @@ contract SafeERC20Helper { ...@@ -53,7 +53,7 @@ contract SafeERC20Helper {
IERC20 private _failing; IERC20 private _failing;
IERC20 private _succeeding; IERC20 private _succeeding;
constructor() public { constructor () public {
_failing = IERC20(new ERC20FailingMock()); _failing = IERC20(new ERC20FailingMock());
_succeeding = IERC20(new ERC20SucceedingMock()); _succeeding = IERC20(new ERC20SucceedingMock());
} }
......
...@@ -3,7 +3,6 @@ pragma solidity ^0.4.24; ...@@ -3,7 +3,6 @@ pragma solidity ^0.4.24;
import "../math/SafeMath.sol"; 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);
} }
......
...@@ -3,6 +3,5 @@ pragma solidity ^0.4.24; ...@@ -3,6 +3,5 @@ pragma solidity ^0.4.24;
import "../ownership/Secondary.sol"; import "../ownership/Secondary.sol";
contract SecondaryMock is Secondary { contract SecondaryMock is Secondary {
function onlyPrimaryMock() public view onlyPrimary { function onlyPrimaryMock() public view onlyPrimary {}
}
} }
...@@ -4,70 +4,25 @@ import "../drafts/SignatureBouncer.sol"; ...@@ -4,70 +4,25 @@ import "../drafts/SignatureBouncer.sol";
import "./SignerRoleMock.sol"; import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock { contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
function checkValidSignature(address account, bytes signature) function checkValidSignature(address account, bytes signature) public view returns (bool) {
public
view
returns (bool)
{
return _isValidSignature(account, signature); return _isValidSignature(account, signature);
} }
function onlyWithValidSignature(bytes signature) function onlyWithValidSignature(bytes signature) public onlyValidSignature(signature) view {}
public
onlyValidSignature(signature)
view
{
} function checkValidSignatureAndMethod(address account, bytes signature) public view returns (bool) {
function checkValidSignatureAndMethod(address account, bytes signature)
public
view
returns (bool)
{
return _isValidSignatureAndMethod(account, signature); return _isValidSignatureAndMethod(account, signature);
} }
function onlyWithValidSignatureAndMethod(bytes signature) function onlyWithValidSignatureAndMethod(bytes signature) public onlyValidSignatureAndMethod(signature) view {}
public
onlyValidSignatureAndMethod(signature)
view
{
} function checkValidSignatureAndData(address account, bytes, uint, bytes signature) public view returns (bool) {
function checkValidSignatureAndData(
address account,
bytes,
uint,
bytes signature
)
public
view
returns (bool)
{
return _isValidSignatureAndData(account, signature); return _isValidSignatureAndData(account, signature);
} }
function onlyWithValidSignatureAndData(uint, bytes signature) function onlyWithValidSignatureAndData(uint, bytes signature) public onlyValidSignatureAndData(signature) view {}
public
onlyValidSignatureAndData(signature)
view
{
} function theWrongMethod(bytes) public pure {}
function theWrongMethod(bytes) function tooShortMsgData() public onlyValidSignatureAndData("") view {}
public
pure
{
}
function tooShortMsgData()
public
onlyValidSignatureAndData("")
view
{
}
} }
...@@ -4,18 +4,9 @@ import "../token/ERC20/IERC20.sol"; ...@@ -4,18 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/TimedCrowdsale.sol"; import "../crowdsale/validation/TimedCrowdsale.sol";
contract TimedCrowdsaleImpl is TimedCrowdsale { contract TimedCrowdsaleImpl is TimedCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
IERC20 token
)
public public
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime) TimedCrowdsale(openingTime, closingTime)
{ {}
}
} }
...@@ -8,16 +8,13 @@ pragma solidity ^0.4.24; ...@@ -8,16 +8,13 @@ pragma solidity ^0.4.24;
contract Ownable { contract Ownable {
address private _owner; address private _owner;
event OwnershipTransferred( event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
address indexed previousOwner,
address indexed newOwner
);
/** /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender * @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. * account.
*/ */
constructor() internal { constructor () internal {
_owner = msg.sender; _owner = msg.sender;
emit OwnershipTransferred(address(0), _owner); emit OwnershipTransferred(address(0), _owner);
} }
...@@ -25,7 +22,7 @@ contract Ownable { ...@@ -25,7 +22,7 @@ contract Ownable {
/** /**
* @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;
} }
...@@ -40,7 +37,7 @@ contract Ownable { ...@@ -40,7 +37,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;
} }
......
...@@ -14,7 +14,7 @@ contract Secondary { ...@@ -14,7 +14,7 @@ contract Secondary {
/** /**
* @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() internal { constructor () internal {
_primary = msg.sender; _primary = msg.sender;
emit PrimaryTransferred(_primary); emit PrimaryTransferred(_primary);
} }
......
...@@ -24,7 +24,7 @@ contract PaymentSplitter { ...@@ -24,7 +24,7 @@ contract PaymentSplitter {
/** /**
* @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);
...@@ -43,35 +43,35 @@ contract PaymentSplitter { ...@@ -43,35 +43,35 @@ contract PaymentSplitter {
/** /**
* @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];
} }
...@@ -83,11 +83,7 @@ contract PaymentSplitter { ...@@ -83,11 +83,7 @@ contract PaymentSplitter {
require(_shares[account] > 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[account]).div(_totalShares).sub(_released[account]);
_shares[account]).div(
_totalShares).sub(
_released[account]
);
require(payment != 0); require(payment != 0);
......
...@@ -10,7 +10,7 @@ import "./escrow/Escrow.sol"; ...@@ -10,7 +10,7 @@ import "./escrow/Escrow.sol";
contract PullPayment { contract PullPayment {
Escrow private _escrow; Escrow private _escrow;
constructor() internal { constructor () internal {
_escrow = new Escrow(); _escrow = new Escrow();
} }
......
...@@ -26,7 +26,7 @@ contract RefundEscrow is ConditionalEscrow { ...@@ -26,7 +26,7 @@ contract RefundEscrow is ConditionalEscrow {
* @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;
......
...@@ -41,14 +41,7 @@ contract ERC20 is IERC20 { ...@@ -41,14 +41,7 @@ contract ERC20 is IERC20 {
* @param spender address The address which will spend the funds. * @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. * @return A uint256 specifying the amount of tokens still available for the spender.
*/ */
function allowance( function allowance(address owner, address spender) public view returns (uint256) {
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender]; return _allowed[owner][spender];
} }
...@@ -85,14 +78,7 @@ contract ERC20 is IERC20 { ...@@ -85,14 +78,7 @@ contract ERC20 is IERC20 {
* @param to address The address which you want to transfer to * @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred * @param value uint256 the amount of tokens to be transferred
*/ */
function transferFrom( function transferFrom(address from, address to, uint256 value) public returns (bool) {
address from,
address to,
uint256 value
)
public
returns (bool)
{
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value); _transfer(from, to, value);
return true; return true;
...@@ -107,17 +93,10 @@ contract ERC20 is IERC20 { ...@@ -107,17 +93,10 @@ contract ERC20 is IERC20 {
* @param spender The address which will spend the funds. * @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by. * @param addedValue The amount of tokens to increase the allowance by.
*/ */
function increaseAllowance( function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0)); require(spender != address(0));
_allowed[msg.sender][spender] = ( _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true; return true;
} }
...@@ -131,17 +110,10 @@ contract ERC20 is IERC20 { ...@@ -131,17 +110,10 @@ contract ERC20 is IERC20 {
* @param spender The address which will spend the funds. * @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by. * @param subtractedValue The amount of tokens to decrease the allowance by.
*/ */
function decreaseAllowance( function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0)); require(spender != address(0));
_allowed[msg.sender][spender] = ( _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true; return true;
} }
...@@ -199,8 +171,7 @@ contract ERC20 is IERC20 { ...@@ -199,8 +171,7 @@ contract ERC20 is IERC20 {
function _burnFrom(address account, uint256 value) internal { function _burnFrom(address account, uint256 value) internal {
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval. // this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub( _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
value);
_burn(account, value); _burn(account, value);
} }
} }
...@@ -7,7 +7,6 @@ import "./ERC20.sol"; ...@@ -7,7 +7,6 @@ import "./ERC20.sol";
* @dev Token that can be irreversibly burned (destroyed). * @dev Token that can be irreversibly burned (destroyed).
*/ */
contract ERC20Burnable is ERC20 { 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.
......
...@@ -7,12 +7,9 @@ import "./ERC20Mintable.sol"; ...@@ -7,12 +7,9 @@ import "./ERC20Mintable.sol";
* @dev Mintable token with a token cap. * @dev Mintable token with a token cap.
*/ */
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;
} }
...@@ -20,7 +17,7 @@ contract ERC20Capped is ERC20Mintable { ...@@ -20,7 +17,7 @@ contract ERC20Capped is ERC20Mintable {
/** /**
* @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;
} }
......
...@@ -13,7 +13,7 @@ contract ERC20Detailed is IERC20 { ...@@ -13,7 +13,7 @@ contract ERC20Detailed is IERC20 {
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;
...@@ -22,21 +22,21 @@ contract ERC20Detailed is IERC20 { ...@@ -22,21 +22,21 @@ contract ERC20Detailed is IERC20 {
/** /**
* @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;
} }
} }
...@@ -14,14 +14,7 @@ contract ERC20Mintable is ERC20, MinterRole { ...@@ -14,14 +14,7 @@ contract ERC20Mintable is ERC20, MinterRole {
* @param value The amount of tokens to mint. * @param value 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, uint256 value) public onlyMinter returns (bool) {
address to,
uint256 value
)
public
onlyMinter
returns (bool)
{
_mint(to, value); _mint(to, value);
return true; return true;
} }
......
...@@ -8,60 +8,23 @@ import "../../lifecycle/Pausable.sol"; ...@@ -8,60 +8,23 @@ import "../../lifecycle/Pausable.sol";
* @dev ERC20 modified with pausable transfers. * @dev ERC20 modified with pausable transfers.
**/ **/
contract ERC20Pausable is ERC20, Pausable { contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
function transfer(
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(to, value); return super.transfer(to, value);
} }
function transferFrom( function transferFrom(address from,address to, uint256 value) public whenNotPaused returns (bool) {
address from,
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(from, to, value); return super.transferFrom(from, to, value);
} }
function approve( function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
address spender,
uint256 value
)
public
whenNotPaused
returns (bool)
{
return super.approve(spender, value); return super.approve(spender, value);
} }
function increaseAllowance( function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
address spender,
uint addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseAllowance(spender, addedValue); return super.increaseAllowance(spender, addedValue);
} }
function decreaseAllowance( function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
address spender,
uint subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseAllowance(spender, subtractedValue); return super.decreaseAllowance(spender, subtractedValue);
} }
} }
...@@ -9,26 +9,15 @@ interface IERC20 { ...@@ -9,26 +9,15 @@ interface IERC20 {
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(address indexed from, address indexed to, uint256 value);
address indexed from,
address indexed to,
uint256 value
);
event Approval( event Approval(address indexed owner, address indexed spender, uint256 value);
address indexed owner,
address indexed spender,
uint256 value
);
} }
...@@ -10,37 +10,17 @@ import "../../math/SafeMath.sol"; ...@@ -10,37 +10,17 @@ import "../../math/SafeMath.sol";
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc. * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/ */
library SafeERC20 { library SafeERC20 {
using SafeMath for uint256; using SafeMath for uint256;
function safeTransfer( function safeTransfer(IERC20 token, address to, uint256 value) internal {
IERC20 token,
address to,
uint256 value
)
internal
{
require(token.transfer(to, value)); require(token.transfer(to, value));
} }
function safeTransferFrom( function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
IERC20 token,
address from,
address to,
uint256 value
)
internal
{
require(token.transferFrom(from, to, value)); require(token.transferFrom(from, to, value));
} }
function safeApprove( function safeApprove(IERC20 token, address spender, uint256 value) internal {
IERC20 token,
address spender,
uint256 value
)
internal
{
// safeApprove should only be called when setting an initial allowance, // safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use // or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
...@@ -48,24 +28,12 @@ library SafeERC20 { ...@@ -48,24 +28,12 @@ library SafeERC20 {
require(token.approve(spender, value)); require(token.approve(spender, value));
} }
function safeIncreaseAllowance( function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
IERC20 token,
address spender,
uint256 value
)
internal
{
uint256 newAllowance = token.allowance(address(this), spender).add(value); uint256 newAllowance = token.allowance(address(this), spender).add(value);
require(token.approve(spender, newAllowance)); require(token.approve(spender, newAllowance));
} }
function safeDecreaseAllowance( function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
IERC20 token,
address spender,
uint256 value
)
internal
{
uint256 newAllowance = token.allowance(address(this), spender).sub(value); uint256 newAllowance = token.allowance(address(this), spender).sub(value);
require(token.approve(spender, newAllowance)); require(token.approve(spender, newAllowance));
} }
......
...@@ -19,13 +19,7 @@ contract TokenTimelock { ...@@ -19,13 +19,7 @@ contract TokenTimelock {
// timestamp when token release is enabled // timestamp when token release is enabled
uint256 private _releaseTime; uint256 private _releaseTime;
constructor( constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
IERC20 token,
address beneficiary,
uint256 releaseTime
)
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;
...@@ -36,21 +30,21 @@ contract TokenTimelock { ...@@ -36,21 +30,21 @@ contract TokenTimelock {
/** /**
* @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;
} }
......
...@@ -11,7 +11,6 @@ import "../../introspection/ERC165.sol"; ...@@ -11,7 +11,6 @@ import "../../introspection/ERC165.sol";
* @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 ERC721 is ERC165, IERC721 { contract ERC721 is ERC165, IERC721 {
using SafeMath for uint256; using SafeMath for uint256;
using Address for address; using Address for address;
...@@ -45,9 +44,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -45,9 +44,7 @@ contract ERC721 is ERC165, IERC721 {
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
*/ */
constructor() constructor () public {
public
{
// register the supported interfaces to conform to ERC721 via ERC165 // register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721); _registerInterface(_InterfaceId_ERC721);
} }
...@@ -119,14 +116,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -119,14 +116,7 @@ contract ERC721 is ERC165, IERC721 {
* @param operator operator address which you want to query the approval of * @param operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner * @return bool whether the given operator is approved by the given owner
*/ */
function isApprovedForAll( function isApprovedForAll(address owner, address operator) public view returns (bool) {
address owner,
address operator
)
public
view
returns (bool)
{
return _operatorApprovals[owner][operator]; return _operatorApprovals[owner][operator];
} }
...@@ -138,13 +128,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -138,13 +128,7 @@ contract ERC721 is ERC165, IERC721 {
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
*/ */
function transferFrom( function transferFrom(address from, address to, uint256 tokenId) public {
address from,
address to,
uint256 tokenId
)
public
{
require(_isApprovedOrOwner(msg.sender, tokenId)); require(_isApprovedOrOwner(msg.sender, tokenId));
require(to != address(0)); require(to != address(0));
...@@ -167,13 +151,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -167,13 +151,7 @@ contract ERC721 is ERC165, IERC721 {
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
*/ */
function safeTransferFrom( function safeTransferFrom(address from, address to, uint256 tokenId) public {
address from,
address to,
uint256 tokenId
)
public
{
// solium-disable-next-line arg-overflow // solium-disable-next-line arg-overflow
safeTransferFrom(from, to, tokenId, ""); safeTransferFrom(from, to, tokenId, "");
} }
...@@ -190,14 +168,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -190,14 +168,7 @@ contract ERC721 is ERC165, IERC721 {
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check * @param _data bytes data to send along with a safe transfer check
*/ */
function safeTransferFrom( function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) public {
address from,
address to,
uint256 tokenId,
bytes _data
)
public
{
transferFrom(from, to, tokenId); transferFrom(from, to, tokenId);
// solium-disable-next-line arg-overflow // solium-disable-next-line arg-overflow
require(_checkOnERC721Received(from, to, tokenId, _data)); require(_checkOnERC721Received(from, to, tokenId, _data));
...@@ -220,23 +191,12 @@ contract ERC721 is ERC165, IERC721 { ...@@ -220,23 +191,12 @@ contract ERC721 is ERC165, IERC721 {
* @return bool whether the msg.sender is approved for the given token ID, * @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token * is an operator of the owner, or is the owner of the token
*/ */
function _isApprovedOrOwner( function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
address spender,
uint256 tokenId
)
internal
view
returns (bool)
{
address owner = ownerOf(tokenId); address owner = ownerOf(tokenId);
// Disable solium check because of // Disable solium check because of
// https://github.com/duaraghav8/Solium/issues/175 // https://github.com/duaraghav8/Solium/issues/175
// solium-disable-next-line operator-whitespace // solium-disable-next-line operator-whitespace
return ( return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender)
);
} }
/** /**
...@@ -298,20 +258,12 @@ contract ERC721 is ERC165, IERC721 { ...@@ -298,20 +258,12 @@ contract ERC721 is ERC165, IERC721 {
* @param _data bytes optional data to send along with the call * @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value * @return whether the call correctly returned the expected magic value
*/ */
function _checkOnERC721Received( function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes _data) internal returns (bool) {
address from,
address to,
uint256 tokenId,
bytes _data
)
internal
returns (bool)
{
if (!to.isContract()) { if (!to.isContract()) {
return true; return true;
} }
bytes4 retval = IERC721Receiver(to).onERC721Received(
msg.sender, from, tokenId, _data); bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data);
return (retval == _ERC721_RECEIVED); return (retval == _ERC721_RECEIVED);
} }
......
...@@ -7,14 +7,11 @@ import "./ERC721.sol"; ...@@ -7,14 +7,11 @@ import "./ERC721.sol";
* @dev ERC721 Token that can be irreversibly burned (destroyed). * @dev ERC721 Token that can be irreversibly burned (destroyed).
*/ */
contract ERC721Burnable is ERC721 { contract ERC721Burnable is ERC721 {
/** /**
* @dev Burns a specific ERC721 token. * @dev Burns a specific ERC721 token.
* @param tokenId uint256 id of the ERC721 token to be burned. * @param tokenId uint256 id of the ERC721 token to be burned.
*/ */
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);
} }
......
...@@ -32,7 +32,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable { ...@@ -32,7 +32,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
/** /**
* @dev Constructor function * @dev Constructor function
*/ */
constructor() public { constructor () public {
// register the supported interface to conform to ERC721 via ERC165 // register the supported interface to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721Enumerable); _registerInterface(_InterfaceId_ERC721Enumerable);
} }
...@@ -43,14 +43,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable { ...@@ -43,14 +43,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
* @param index uint256 representing the index to be accessed of the requested tokens list * @param index uint256 representing the index to be accessed of the requested tokens list
* @return uint256 token ID at the given index of the tokens list owned by the requested address * @return uint256 token ID at the given index of the tokens list owned by the requested address
*/ */
function tokenOfOwnerByIndex( function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
address owner,
uint256 index
)
public
view
returns (uint256)
{
require(index < balanceOf(owner)); require(index < balanceOf(owner));
return _ownedTokens[owner][index]; return _ownedTokens[owner][index];
} }
......
...@@ -11,8 +11,5 @@ import "./ERC721Metadata.sol"; ...@@ -11,8 +11,5 @@ import "./ERC721Metadata.sol";
* @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 ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata { contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
constructor(string name, string symbol) ERC721Metadata(name, symbol) constructor (string name, string symbol) ERC721Metadata(name, symbol) public {}
public
{
}
} }
...@@ -3,15 +3,7 @@ pragma solidity ^0.4.24; ...@@ -3,15 +3,7 @@ pragma solidity ^0.4.24;
import "./IERC721Receiver.sol"; import "./IERC721Receiver.sol";
contract ERC721Holder is IERC721Receiver { contract ERC721Holder is IERC721Receiver {
function onERC721Received( function onERC721Received(address, address, uint256, bytes) public returns (bytes4) {
address,
address,
uint256,
bytes
)
public
returns(bytes4)
{
return this.onERC721Received.selector; return this.onERC721Received.selector;
} }
} }
...@@ -25,7 +25,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata { ...@@ -25,7 +25,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
/** /**
* @dev Constructor function * @dev Constructor function
*/ */
constructor(string name, string symbol) public { constructor (string name, string symbol) public {
_name = name; _name = name;
_symbol = symbol; _symbol = symbol;
......
...@@ -16,15 +16,7 @@ contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole { ...@@ -16,15 +16,7 @@ contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole {
* @param tokenURI The token URI of the minted token. * @param tokenURI The token URI of the minted token.
* @return A boolean that indicates if the operation was successful. * @return A boolean that indicates if the operation was successful.
*/ */
function mintWithTokenURI( function mintWithTokenURI(address to, uint256 tokenId, string tokenURI) public onlyMinter returns (bool) {
address to,
uint256 tokenId,
string tokenURI
)
public
onlyMinter
returns (bool)
{
_mint(to, tokenId); _mint(to, tokenId);
_setTokenURI(tokenId, tokenURI); _setTokenURI(tokenId, tokenURI);
return true; return true;
......
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