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 @@
"extends": "solium:all",
"plugins": ["security"],
"rules": {
"arg-overflow": "off",
"blank-lines": "off",
"error-reason": "off",
"indentation": ["error", 2],
"indentation": ["error", 4],
"lbrace": "off",
"linebreak-style": ["error", "unix"],
"max-len": ["error", 79],
"max-len": ["error", 120],
"no-constant": ["error"],
"no-empty-blocks": "off",
"quotes": ["error", "double"],
......
......@@ -33,11 +33,7 @@ library Roles {
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account)
internal
view
returns (bool)
{
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0));
return role.bearer[account];
}
......
......@@ -10,7 +10,7 @@ contract CapperRole {
Roles.Role private _cappers;
constructor() internal {
constructor () internal {
_addCapper(msg.sender);
}
......
......@@ -10,7 +10,7 @@ contract MinterRole {
Roles.Role private _minters;
constructor() internal {
constructor () internal {
_addMinter(msg.sender);
}
......
......@@ -10,7 +10,7 @@ contract PauserRole {
Roles.Role private _pausers;
constructor() internal {
constructor () internal {
_addPauser(msg.sender);
}
......
......@@ -10,7 +10,7 @@ contract SignerRole {
Roles.Role private _signers;
constructor() internal {
constructor () internal {
_addSigner(msg.sender);
}
......
......@@ -43,12 +43,7 @@ contract Crowdsale is ReentrancyGuard {
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokensPurchased(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
/**
* @param rate Number of token units a buyer gets per wei
......@@ -58,7 +53,7 @@ contract Crowdsale is ReentrancyGuard {
* @param wallet Address where collected funds will be forwarded to
* @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(wallet != address(0));
require(token != address(0));
......@@ -85,21 +80,21 @@ contract Crowdsale is ReentrancyGuard {
/**
* @return the token being sold.
*/
function token() public view returns(IERC20) {
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the address where funds are collected.
*/
function wallet() public view returns(address) {
function wallet() public view returns (address) {
return _wallet;
}
/**
* @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;
}
......@@ -117,7 +112,6 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Recipient of the token purchase
*/
function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
......@@ -128,12 +122,7 @@ contract Crowdsale is ReentrancyGuard {
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPurchased(
msg.sender,
beneficiary,
weiAmount,
tokens
);
emit TokensPurchased(msg.sender, beneficiary, weiAmount, tokens);
_updatePurchasingState(beneficiary, weiAmount);
......@@ -153,13 +142,7 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Address performing the token purchase
* @param weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
{
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
require(beneficiary != address(0));
require(weiAmount != 0);
}
......@@ -169,13 +152,7 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Address performing the token purchase
* @param weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
{
function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// optional override
}
......@@ -184,12 +161,7 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Address performing the token purchase
* @param tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
{
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
_token.safeTransfer(beneficiary, tokenAmount);
}
......@@ -198,12 +170,7 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Address receiving the tokens
* @param tokenAmount Number of tokens to be purchased
*/
function _processPurchase(
address beneficiary,
uint256 tokenAmount
)
internal
{
function _processPurchase(address beneficiary, uint256 tokenAmount) internal {
_deliverTokens(beneficiary, tokenAmount);
}
......@@ -212,12 +179,7 @@ contract Crowdsale is ReentrancyGuard {
* @param beneficiary Address receiving the tokens
* @param weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(
address beneficiary,
uint256 weiAmount
)
internal
{
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
// optional override
}
......@@ -226,9 +188,7 @@ contract Crowdsale is ReentrancyGuard {
* @param weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 weiAmount)
internal view returns (uint256)
{
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) {
return weiAmount.mul(_rate);
}
......
......@@ -15,7 +15,7 @@ contract FinalizableCrowdsale is TimedCrowdsale {
event CrowdsaleFinalized();
constructor() internal {
constructor () internal {
_finalized = false;
}
......@@ -45,6 +45,5 @@ contract FinalizableCrowdsale is TimedCrowdsale {
* should call super._finalization() to ensure the chain of finalization is
* executed entirely.
*/
function _finalization() internal {
}
function _finalization() internal {}
}
......@@ -12,7 +12,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
mapping(address => uint256) private _balances;
constructor() internal {}
constructor () internal {}
/**
* @dev Withdraw tokens only after crowdsale ends.
......@@ -29,7 +29,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
/**
* @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];
}
......@@ -38,12 +38,7 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
* @param beneficiary Token purchaser
* @param tokenAmount Amount of tokens purchased
*/
function _processPurchase(
address beneficiary,
uint256 tokenAmount
)
internal
{
function _processPurchase(address beneficiary, uint256 tokenAmount) internal {
_balances[beneficiary] = _balances[beneficiary].add(tokenAmount);
}
......
......@@ -35,7 +35,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Constructor, creates RefundEscrow.
* @param goal Funding goal
*/
constructor(uint256 goal) internal {
constructor (uint256 goal) internal {
require(goal > 0);
_escrow = new RefundEscrow(wallet());
_goal = goal;
......@@ -44,7 +44,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
/**
* @return minimum amount of funds to be raised in wei.
*/
function goal() public view returns(uint256) {
function goal() public view returns (uint256) {
return _goal;
}
......@@ -87,5 +87,4 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
function _forwardFunds() internal {
_escrow.deposit.value(msg.value)(msg.sender);
}
}
......@@ -20,7 +20,7 @@ contract AllowanceCrowdsale is Crowdsale {
* @dev Constructor, takes token wallet address.
* @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));
_tokenWallet = tokenWallet;
}
......@@ -28,7 +28,7 @@ contract AllowanceCrowdsale is Crowdsale {
/**
* @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;
}
......@@ -37,10 +37,7 @@ contract AllowanceCrowdsale is Crowdsale {
* @return Amount of tokens left in the allowance
*/
function remainingTokens() public view returns (uint256) {
return Math.min(
token().balanceOf(_tokenWallet),
token().allowance(_tokenWallet, this)
);
return Math.min(token().balanceOf(_tokenWallet), token().allowance(_tokenWallet, this));
}
/**
......@@ -48,12 +45,7 @@ contract AllowanceCrowdsale is Crowdsale {
* @param beneficiary Token purchaser
* @param tokenAmount Amount of tokens purchased
*/
function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
{
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
token().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount);
}
}
......@@ -9,21 +9,15 @@ import "../../token/ERC20/ERC20Mintable.sol";
* Token ownership should be transferred to MintedCrowdsale for minting.
*/
contract MintedCrowdsale is Crowdsale {
constructor() internal {}
constructor () internal {}
/**
* @dev Overrides delivery by minting tokens upon purchase.
* @param beneficiary Token purchaser
* @param tokenAmount Number of tokens to be minted
*/
function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
{
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
// Potentially dangerous assumption about the type of the token.
require(
ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
require(ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
}
}
......@@ -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 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(initialRate > finalRate);
_initialRate = initialRate;
......@@ -31,14 +31,14 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* The base rate function is overridden to revert, since this crowdsale doens't use it, and
* all calls to it are a mistake.
*/
function rate() public view returns(uint256) {
function rate() public view returns (uint256) {
revert();
}
/**
* @return the initial rate of the crowdsale.
*/
function initialRate() public view returns(uint256) {
function initialRate() public view returns (uint256) {
return _initialRate;
}
......@@ -71,11 +71,8 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @param weiAmount The value in wei to be converted into tokens
* @return The number of tokens _weiAmount wei will buy at present time
*/
function _getTokenAmount(uint256 weiAmount)
internal view returns (uint256)
{
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) {
uint256 currentRate = getCurrentRate();
return currentRate.mul(weiAmount);
}
}
......@@ -16,7 +16,7 @@ contract CappedCrowdsale is Crowdsale {
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param cap Max amount of wei to be contributed
*/
constructor(uint256 cap) internal {
constructor (uint256 cap) internal {
require(cap > 0);
_cap = cap;
}
......@@ -24,7 +24,7 @@ contract CappedCrowdsale is Crowdsale {
/**
* @return the cap of the crowdsale.
*/
function cap() public view returns(uint256) {
function cap() public view returns (uint256) {
return _cap;
}
......@@ -41,15 +41,8 @@ contract CappedCrowdsale is Crowdsale {
* @param beneficiary Token purchaser
* @param weiAmount Amount of wei contributed
*/
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
{
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
super._preValidatePurchase(beneficiary, weiAmount);
require(weiRaised().add(weiAmount) <= _cap);
}
}
......@@ -14,7 +14,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
mapping(address => uint256) private _contributions;
mapping(address => uint256) private _caps;
constructor() internal {}
constructor () internal {}
/**
* @dev Sets a specific beneficiary's maximum contribution.
......@@ -39,9 +39,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @param beneficiary Address of contributor
* @return Beneficiary contribution so far
*/
function getContribution(address beneficiary)
public view returns (uint256)
{
function getContribution(address beneficiary) public view returns (uint256) {
return _contributions[beneficiary];
}
......@@ -50,16 +48,9 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @param beneficiary Token purchaser
* @param weiAmount Amount of wei contributed
*/
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
{
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
super._preValidatePurchase(beneficiary, weiAmount);
require(
_contributions[beneficiary].add(weiAmount) <= _caps[beneficiary]);
require(_contributions[beneficiary].add(weiAmount) <= _caps[beneficiary]);
}
/**
......@@ -67,15 +58,8 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @param beneficiary Token purchaser
* @param weiAmount Amount of wei contributed
*/
function _updatePurchasingState(
address beneficiary,
uint256 weiAmount
)
internal
{
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
super._updatePurchasingState(beneficiary, weiAmount);
_contributions[beneficiary] = _contributions[beneficiary].add(
weiAmount);
_contributions[beneficiary] = _contributions[beneficiary].add(weiAmount);
}
}
......@@ -26,7 +26,7 @@ contract TimedCrowdsale is Crowdsale {
* @param openingTime Crowdsale opening 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
require(openingTime >= block.timestamp);
require(closingTime > openingTime);
......@@ -38,14 +38,14 @@ contract TimedCrowdsale is Crowdsale {
/**
* @return the crowdsale opening time.
*/
function openingTime() public view returns(uint256) {
function openingTime() public view returns (uint256) {
return _openingTime;
}
/**
* @return the crowdsale closing time.
*/
function closingTime() public view returns(uint256) {
function closingTime() public view returns (uint256) {
return _closingTime;
}
......@@ -71,15 +71,7 @@ contract TimedCrowdsale is Crowdsale {
* @param beneficiary Token purchaser
* @param weiAmount Amount of wei contributed
*/
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
onlyWhileOpen
view
{
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal onlyWhileOpen view {
super._preValidatePurchase(beneficiary, weiAmount);
}
}
......@@ -8,17 +8,12 @@ pragma solidity ^0.4.24;
*/
library ECDSA {
/**
* @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 signature bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes signature)
internal
pure
returns (address)
{
function recover(bytes32 hash, bytes signature) internal pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
......@@ -57,15 +52,9 @@ library ECDSA {
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* and hash the result
*/
function toEthSignedMessageHash(bytes32 hash)
internal
pure
returns (bytes32)
{
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
}
......@@ -13,15 +13,7 @@ library MerkleProof {
* @param root Merkle root
* @param leaf Leaf of Merkle tree
*/
function verify(
bytes32[] proof,
bytes32 root,
bytes32 leaf
)
internal
pure
returns (bool)
{
function verify(bytes32[] proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
......
......@@ -13,15 +13,11 @@ pragma solidity ^0.4.24;
* so it's not something you have to worry about.)
*/
library Counter {
struct Counter {
uint256 current; // default: 0
}
function next(Counter storage index)
internal
returns (uint256)
{
function next(Counter storage index) internal returns (uint256) {
index.current += 1;
return index.current;
}
......
......@@ -15,9 +15,7 @@ contract ERC20TokenMetadata is IERC20 {
contract ERC20WithMetadata is ERC20TokenMetadata {
string private _tokenURI;
constructor(string tokenURI)
public
{
constructor (string tokenURI) public {
_tokenURI = tokenURI;
}
......
......@@ -43,7 +43,7 @@ contract ERC20Migrator {
/**
* @param legacyToken address of the old token contract
*/
constructor(IERC20 legacyToken) public {
constructor (IERC20 legacyToken) public {
require(legacyToken != address(0));
_legacyToken = legacyToken;
}
......
......@@ -43,13 +43,12 @@ contract SignatureBouncer is SignerRole {
// Signature size is 65 bytes (tightly packed v + r + s), but gets padded to 96 bytes
uint256 private constant _SIGNATURE_SIZE = 96;
constructor() internal {}
constructor () internal {}
/**
* @dev requires that a valid signature of a signer was provided
*/
modifier onlyValidSignature(bytes signature)
{
modifier onlyValidSignature(bytes signature) {
require(_isValidSignature(msg.sender, signature));
_;
}
......@@ -57,8 +56,7 @@ contract SignatureBouncer is SignerRole {
/**
* @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));
_;
}
......@@ -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
*/
modifier onlyValidSignatureAndData(bytes signature)
{
modifier onlyValidSignatureAndData(bytes signature) {
require(_isValidSignatureAndData(msg.sender, signature));
_;
}
......@@ -76,34 +73,20 @@ contract SignatureBouncer is SignerRole {
* @dev is the signature of `this + sender` from a signer?
* @return bool
*/
function _isValidSignature(address account, bytes signature)
internal
view
returns (bool)
{
return _isValidDataHash(
keccak256(abi.encodePacked(address(this), account)),
signature
);
function _isValidSignature(address account, bytes signature) internal view returns (bool) {
return _isValidDataHash(keccak256(abi.encodePacked(address(this), account)), signature);
}
/**
* @dev is the signature of `this + sender + methodId` from a signer?
* @return bool
*/
function _isValidSignatureAndMethod(address account, bytes signature)
internal
view
returns (bool)
{
function _isValidSignatureAndMethod(address account, bytes signature) internal view returns (bool) {
bytes memory data = new bytes(_METHOD_ID_SIZE);
for (uint i = 0; i < data.length; i++) {
data[i] = msg.data[i];
}
return _isValidDataHash(
keccak256(abi.encodePacked(address(this), account, data)),
signature
);
return _isValidDataHash(keccak256(abi.encodePacked(address(this), account, data)), signature);
}
/**
......@@ -111,20 +94,15 @@ contract SignatureBouncer is SignerRole {
* @notice the signature parameter of the method being validated must be the "last" parameter
* @return bool
*/
function _isValidSignatureAndData(address account, bytes signature)
internal
view
returns (bool)
{
function _isValidSignatureAndData(address account, bytes signature) internal view returns (bool) {
require(msg.data.length > _SIGNATURE_SIZE);
bytes memory data = new bytes(msg.data.length - _SIGNATURE_SIZE);
for (uint i = 0; i < data.length; i++) {
data[i] = msg.data[i];
}
return _isValidDataHash(
keccak256(abi.encodePacked(address(this), account, data)),
signature
);
return _isValidDataHash(keccak256(abi.encodePacked(address(this), account, data)), signature);
}
/**
......@@ -132,14 +110,8 @@ contract SignatureBouncer is SignerRole {
* and then recover the signature and check it against the signer role
* @return bool
*/
function _isValidDataHash(bytes32 hash, bytes signature)
internal
view
returns (bool)
{
address signer = hash
.toEthSignedMessageHash()
.recover(signature);
function _isValidDataHash(bytes32 hash, bytes signature) internal view returns (bool) {
address signer = hash.toEthSignedMessageHash().recover(signature);
return signer != address(0) && isSigner(signer);
}
......
......@@ -41,15 +41,7 @@ contract TokenVesting is Ownable {
* @param duration duration in seconds of the period in which the tokens will vest
* @param revocable whether the vesting is revocable or not
*/
constructor(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
)
public
{
constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public {
require(beneficiary != address(0));
require(cliffDuration <= duration);
require(duration > 0);
......@@ -65,49 +57,49 @@ contract TokenVesting is Ownable {
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view returns(address) {
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the cliff time of the token vesting.
*/
function cliff() public view returns(uint256) {
function cliff() public view returns (uint256) {
return _cliff;
}
/**
* @return the start time of the token vesting.
*/
function start() public view returns(uint256) {
function start() public view returns (uint256) {
return _start;
}
/**
* @return the duration of the token vesting.
*/
function duration() public view returns(uint256) {
function duration() public view returns (uint256) {
return _duration;
}
/**
* @return true if the vesting is revocable.
*/
function revocable() public view returns(bool) {
function revocable() public view returns (bool) {
return _revocable;
}
/**
* @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 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];
}
......
......@@ -12,7 +12,7 @@ import "../token/ERC20/ERC20Detailed.sol";
* It is meant to be used in a crowdsale contract.
*/
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 {
// --elopio - 2018-05-10
// solium-disable-next-line max-len
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
constructor(
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
......
......@@ -10,14 +10,12 @@ import "../token/ERC20/ERC20Detailed.sol";
* `ERC20` functions.
*/
contract SimpleToken is ERC20, ERC20Detailed {
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
/**
* @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);
}
}
......@@ -8,7 +8,6 @@ import "./IERC165.sol";
* @dev Implements ERC165 using a lookup table.
*/
contract ERC165 is IERC165 {
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
/**
* 0x01ffc9a7 ===
......@@ -24,29 +23,21 @@ contract ERC165 is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself
*/
constructor()
internal
{
constructor () internal {
_registerInterface(_InterfaceId_ERC165);
}
/**
* @dev implement supportsInterface(bytes4) using a lookup table
*/
function supportsInterface(bytes4 interfaceId)
external
view
returns (bool)
{
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev internal method for registering an interface
*/
function _registerInterface(bytes4 interfaceId)
internal
{
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff);
_supportedInterfaces[interfaceId] = true;
}
......
......@@ -20,11 +20,7 @@ library ERC165Checker {
* @param account The address of the contract to query for support of ERC165
* @return true if the contract at account implements ERC165
*/
function _supportsERC165(address account)
internal
view
returns (bool)
{
function _supportsERC165(address account) internal view returns (bool) {
// Any contract that implements ERC165 must explicitly indicate support of
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
return _supportsERC165Interface(account, _InterfaceId_ERC165) &&
......@@ -39,11 +35,7 @@ library ERC165Checker {
* identifier interfaceId, false otherwise
* @dev Interface identification is specified in ERC-165.
*/
function _supportsInterface(address account, bytes4 interfaceId)
internal
view
returns (bool)
{
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC165 as per the spec and support of _interfaceId
return _supportsERC165(account) &&
_supportsERC165Interface(account, interfaceId);
......@@ -57,11 +49,7 @@ library ERC165Checker {
* interfaceIds list, false otherwise
* @dev Interface identification is specified in ERC-165.
*/
function _supportsAllInterfaces(address account, bytes4[] interfaceIds)
internal
view
returns (bool)
{
function _supportsAllInterfaces(address account, bytes4[] interfaceIds) internal view returns (bool) {
// query support of ERC165 itself
if (!_supportsERC165(account)) {
return false;
......@@ -89,15 +77,10 @@ library ERC165Checker {
* with the `supportsERC165` method in this library.
* Interface identification is specified in ERC-165.
*/
function _supportsERC165Interface(address account, bytes4 interfaceId)
private
view
returns (bool)
{
function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
// success determines whether the staticcall succeeded and result determines
// whether the contract at account indicates support of _interfaceId
(bool success, bool result) = _callERC165SupportsInterface(
account, interfaceId);
(bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
return (success && result);
}
......@@ -110,18 +93,12 @@ library ERC165Checker {
* @return result true if the STATICCALL succeeded and the contract at account
* indicates support of the interface with identifier interfaceId, false otherwise
*/
function _callERC165SupportsInterface(
address account,
bytes4 interfaceId
)
function _callERC165SupportsInterface(address account, bytes4 interfaceId)
private
view
returns (bool success, bool result)
{
bytes memory encodedParams = abi.encodeWithSelector(
_InterfaceId_ERC165,
interfaceId
);
bytes memory encodedParams = abi.encodeWithSelector(_InterfaceId_ERC165,interfaceId);
// solium-disable-next-line security/no-inline-assembly
assembly {
......
......@@ -5,15 +5,11 @@ pragma solidity ^0.4.24;
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 interfaceId)
external
view
returns (bool);
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
......@@ -12,14 +12,14 @@ contract Pausable is PauserRole {
bool private _paused;
constructor() internal {
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns(bool) {
function paused() public view returns (bool) {
return _paused;
}
......
......@@ -5,7 +5,6 @@ pragma solidity ^0.4.24;
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
......@@ -27,7 +26,8 @@ library SafeMath {
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
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;
// 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;
import "../utils/Address.sol";
contract AddressImpl {
function isContract(address account)
external
view
returns (bool)
{
function isContract(address account) external view returns (bool) {
return Address.isContract(account);
}
}
......@@ -4,17 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol";
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
constructor (
uint256 rate,
address wallet,
IERC20 token,
address tokenWallet
)
constructor (uint256 rate, address wallet, IERC20 token, address tokenWallet)
public
Crowdsale(rate, wallet, token)
AllowanceCrowdsale(tokenWallet)
{
}
{}
}
......@@ -3,12 +3,11 @@ pragma solidity ^0.4.24;
import "../utils/Arrays.sol";
contract ArraysImpl {
using Arrays for uint256[];
uint256[] private array;
constructor(uint256[] _array) public {
constructor (uint256[] _array) public {
array = _array;
}
......
......@@ -4,17 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale {
constructor (
uint256 rate,
address wallet,
IERC20 token,
uint256 cap
)
constructor (uint256 rate, address wallet, IERC20 token, uint256 cap)
public
Crowdsale(rate, wallet, token)
CappedCrowdsale(cap)
{
}
{}
}
......@@ -10,10 +10,7 @@ contract CounterImpl {
// use whatever key you want to track your counters
mapping(string => Counter.Counter) private _counters;
function doThing(string key)
public
returns (uint256)
{
function doThing(string key) public returns (uint256) {
theId = _counters[key].next();
return theId;
}
......
......@@ -3,7 +3,5 @@ pragma solidity ^0.4.24;
import "../crowdsale/Crowdsale.sol";
contract CrowdsaleMock is Crowdsale {
constructor(uint256 rate, address wallet, IERC20 token) public
Crowdsale(rate, wallet, token) {
}
constructor (uint256 rate, address wallet, IERC20 token) public Crowdsale(rate, wallet, token) {}
}
......@@ -4,12 +4,5 @@ import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
contract ERC20DetailedMock is ERC20, ERC20Detailed {
constructor(
string name,
string symbol,
uint8 decimals
)
ERC20Detailed(name, symbol, decimals)
public
{}
constructor (string name, string symbol, uint8 decimals) ERC20Detailed(name, symbol, decimals) public {}
}
......@@ -5,19 +5,11 @@ import "../cryptography/ECDSA.sol";
contract ECDSAMock {
using ECDSA for bytes32;
function recover(bytes32 hash, bytes signature)
public
pure
returns (address)
{
function recover(bytes32 hash, bytes signature) public pure returns (address) {
return hash.recover(signature);
}
function toEthSignedMessageHash(bytes32 hash)
public
pure
returns (bytes32)
{
function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
return hash.toEthSignedMessageHash();
}
}
......@@ -11,7 +11,6 @@ import "../../introspection/IERC165.sol";
* solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
*/
contract SupportsInterfaceWithLookupMock is IERC165 {
bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7;
/**
* 0x01ffc9a7 ===
......@@ -27,38 +26,28 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself
*/
constructor()
public
{
constructor () public {
_registerInterface(InterfaceId_ERC165);
}
/**
* @dev implement supportsInterface(bytes4) using a lookup table
*/
function supportsInterface(bytes4 interfaceId)
external
view
returns (bool)
{
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev private method for registering an interface
*/
function _registerInterface(bytes4 interfaceId)
internal
{
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff);
_supportedInterfaces[interfaceId] = true;
}
}
contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
constructor (bytes4[] interfaceIds)
public
{
constructor (bytes4[] interfaceIds) public {
for (uint256 i = 0; i < interfaceIds.length; i++) {
_registerInterface(interfaceIds[i]);
}
......
pragma solidity ^0.4.24;
contract ERC165NotSupported {
}
contract ERC165NotSupported {}
......@@ -5,27 +5,15 @@ import "../introspection/ERC165Checker.sol";
contract ERC165CheckerMock {
using ERC165Checker for address;
function supportsERC165(address account)
public
view
returns (bool)
{
function supportsERC165(address account) public view returns (bool) {
return account._supportsERC165();
}
function supportsInterface(address account, bytes4 interfaceId)
public
view
returns (bool)
{
function supportsInterface(address account, bytes4 interfaceId) public view returns (bool) {
return account._supportsInterface(interfaceId);
}
function supportsAllInterfaces(address account, bytes4[] interfaceIds)
public
view
returns (bool)
{
function supportsAllInterfaces(address account, bytes4[] interfaceIds) public view returns (bool) {
return account._supportsAllInterfaces(interfaceIds);
}
}
......@@ -3,9 +3,7 @@ pragma solidity ^0.4.24;
import "../introspection/ERC165.sol";
contract ERC165Mock is ERC165 {
function registerInterface(bytes4 interfaceId)
public
{
function registerInterface(bytes4 interfaceId) public {
_registerInterface(interfaceId);
}
}
......@@ -3,9 +3,7 @@ pragma solidity ^0.4.24;
import "../token/ERC20/ERC20Burnable.sol";
contract ERC20BurnableMock is ERC20Burnable {
constructor(address initialAccount, uint256 initialBalance) public {
constructor (address initialAccount, uint256 initialBalance) public {
_mint(initialAccount, initialBalance);
}
}
......@@ -4,8 +4,7 @@ import "../token/ERC20/ERC20.sol";
// mock class using ERC20
contract ERC20Mock is ERC20 {
constructor(address initialAccount, uint256 initialBalance) public {
constructor (address initialAccount, uint256 initialBalance) public {
_mint(initialAccount, initialBalance);
}
......@@ -20,5 +19,4 @@ contract ERC20Mock is ERC20 {
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
}
......@@ -5,9 +5,7 @@ import "./PauserRoleMock.sol";
// mock class using ERC20Pausable
contract ERC20PausableMock is ERC20Pausable, PauserRoleMock {
constructor(address initialAccount, uint initialBalance) public {
constructor (address initialAccount, uint initialBalance) public {
_mint(initialAccount, initialBalance);
}
}
......@@ -4,8 +4,5 @@ import "../token/ERC20/ERC20.sol";
import "../drafts/ERC1046/TokenMetadata.sol";
contract ERC20WithMetadataMock is ERC20, ERC20WithMetadata {
constructor(string tokenURI) public
ERC20WithMetadata(tokenURI)
{
}
constructor (string tokenURI) public ERC20WithMetadata(tokenURI) {}
}
......@@ -10,13 +10,8 @@ import "../token/ERC721/ERC721Burnable.sol";
* This mock just provides a public mint and burn functions for testing purposes,
* and a public setter for metadata URI
*/
contract ERC721FullMock
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor(string name, string symbol) public
ERC721Mintable()
ERC721Full(name, symbol)
{}
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor (string name, string symbol) public ERC721Mintable() ERC721Full(name, symbol) {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
......
......@@ -8,13 +8,6 @@ import "../token/ERC721/ERC721Burnable.sol";
/**
* @title ERC721MintableBurnableImpl
*/
contract ERC721MintableBurnableImpl
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor()
ERC721Mintable()
ERC721Full("Test", "TEST")
public
{
}
contract ERC721MintableBurnableImpl is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor () ERC721Mintable() ERC721Full("Test", "TEST") public {}
}
......@@ -6,36 +6,16 @@ contract ERC721ReceiverMock is IERC721Receiver {
bytes4 private _retval;
bool private _reverts;
event Received(
address operator,
address from,
uint256 tokenId,
bytes data,
uint256 gas
);
event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
constructor(bytes4 retval, bool reverts) public {
constructor (bytes4 retval, bool reverts) public {
_retval = retval;
_reverts = reverts;
}
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes data
)
public
returns(bytes4)
{
function onERC721Received(address operator, address from, uint256 tokenId, bytes data) public returns (bytes4) {
require(!_reverts);
emit Received(
operator,
from,
tokenId,
data,
gasleft() // msg.gas was deprecated in solidityv0.4.21
);
emit Received(operator, from, tokenId, data, gasleft());
return _retval;
}
}
......@@ -9,11 +9,7 @@ contract EventEmitter {
event Address(address value);
event Boolean(bool value);
event String(string value);
event LongUintBooleanString(
uint256 uintValue,
bool booleanValue,
string stringValue
);
event LongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue);
function emitArgumentless() public {
emit Argumentless();
......@@ -47,11 +43,7 @@ contract EventEmitter {
emit String(value);
}
function emitLongUintBooleanString(
uint256 uintValue,
bool booleanValue,
string stringValue)
public {
function emitLongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue) public {
emit LongUintBooleanString(uintValue, booleanValue, stringValue);
}
......
......@@ -5,17 +5,9 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
IERC20 token
)
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
{
}
{}
}
......@@ -4,7 +4,6 @@ import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
import "../math/SafeMath.sol";
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
......@@ -17,7 +16,5 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
Crowdsale(initialRate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
IncreasingPriceCrowdsale(initialRate, finalRate)
{
}
{}
}
......@@ -4,16 +4,7 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
import "./CapperRoleMock.sol";
contract IndividuallyCappedCrowdsaleImpl
is IndividuallyCappedCrowdsale, CapperRoleMock {
constructor(
uint256 rate,
address wallet,
IERC20 token
)
public
Crowdsale(rate, wallet, token)
{
}
contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale, CapperRoleMock {
constructor (uint256 rate, address wallet, IERC20 token) public Crowdsale(rate, wallet, token)
{}
}
......@@ -3,16 +3,7 @@ pragma solidity ^0.4.24;
import { MerkleProof } from "../cryptography/MerkleProof.sol";
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);
}
}
......@@ -4,15 +4,5 @@ import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/emission/MintedCrowdsale.sol";
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;
import "../ownership/Ownable.sol";
contract OwnableMock is Ownable {
}
contract OwnableMock is Ownable {}
......@@ -8,7 +8,7 @@ contract PausableMock is Pausable, PauserRoleMock {
bool public drasticMeasureTaken;
uint256 public count;
constructor() public {
constructor () public {
drasticMeasureTaken = false;
count = 0;
}
......@@ -20,5 +20,4 @@ contract PausableMock is Pausable, PauserRoleMock {
function drasticMeasure() external whenPaused {
drasticMeasureTaken = true;
}
}
......@@ -4,18 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
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
TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token)
{
}
{}
}
......@@ -4,12 +4,10 @@ import "../payment/PullPayment.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
constructor() public payable { }
constructor () public payable { }
// test helper function to call asyncTransfer
function callTransfer(address dest, uint256 amount) public {
_asyncTransfer(dest, amount);
}
}
......@@ -4,10 +4,9 @@ import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
contract ReentrancyMock is ReentrancyGuard {
uint256 public counter;
constructor() public {
constructor () public {
counter = 0;
}
......@@ -40,5 +39,4 @@ contract ReentrancyMock is ReentrancyGuard {
function count() private {
counter += 1;
}
}
......@@ -4,7 +4,6 @@ import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
......@@ -17,7 +16,5 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{
}
{}
}
......@@ -53,7 +53,7 @@ contract SafeERC20Helper {
IERC20 private _failing;
IERC20 private _succeeding;
constructor() public {
constructor () public {
_failing = IERC20(new ERC20FailingMock());
_succeeding = IERC20(new ERC20SucceedingMock());
}
......
......@@ -3,7 +3,6 @@ pragma solidity ^0.4.24;
import "../math/SafeMath.sol";
contract SafeMathMock {
function mul(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.mul(a, b);
}
......
......@@ -3,6 +3,5 @@ pragma solidity ^0.4.24;
import "../ownership/Secondary.sol";
contract SecondaryMock is Secondary {
function onlyPrimaryMock() public view onlyPrimary {
}
function onlyPrimaryMock() public view onlyPrimary {}
}
......@@ -4,70 +4,25 @@ import "../drafts/SignatureBouncer.sol";
import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
function checkValidSignature(address account, bytes signature)
public
view
returns (bool)
{
function checkValidSignature(address account, bytes signature) public view returns (bool) {
return _isValidSignature(account, signature);
}
function onlyWithValidSignature(bytes signature)
public
onlyValidSignature(signature)
view
{
function onlyWithValidSignature(bytes signature) 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);
}
function onlyWithValidSignatureAndMethod(bytes signature)
public
onlyValidSignatureAndMethod(signature)
view
{
function onlyWithValidSignatureAndMethod(bytes signature) 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);
}
function onlyWithValidSignatureAndData(uint, bytes signature)
public
onlyValidSignatureAndData(signature)
view
{
function onlyWithValidSignatureAndData(uint, bytes signature) public onlyValidSignatureAndData(signature) view {}
}
function theWrongMethod(bytes) public pure {}
function theWrongMethod(bytes)
public
pure
{
}
function tooShortMsgData()
public
onlyValidSignatureAndData("")
view
{
}
function tooShortMsgData() public onlyValidSignatureAndData("") view {}
}
......@@ -4,18 +4,9 @@ import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/TimedCrowdsale.sol";
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
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
{
}
{}
}
......@@ -8,16 +8,13 @@ pragma solidity ^0.4.24;
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
......@@ -25,7 +22,7 @@ contract Ownable {
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
function owner() public view returns (address) {
return _owner;
}
......@@ -40,7 +37,7 @@ contract Ownable {
/**
* @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;
}
......
......@@ -14,7 +14,7 @@ contract Secondary {
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor() internal {
constructor () internal {
_primary = msg.sender;
emit PrimaryTransferred(_primary);
}
......
......@@ -24,7 +24,7 @@ contract PaymentSplitter {
/**
* @dev Constructor
*/
constructor(address[] payees, uint256[] shares) public payable {
constructor (address[] payees, uint256[] shares) public payable {
require(payees.length == shares.length);
require(payees.length > 0);
......@@ -43,35 +43,35 @@ contract PaymentSplitter {
/**
* @return the total shares of the contract.
*/
function totalShares() public view returns(uint256) {
function totalShares() public view returns (uint256) {
return _totalShares;
}
/**
* @return the total amount already released.
*/
function totalReleased() public view returns(uint256) {
function totalReleased() public view returns (uint256) {
return _totalReleased;
}
/**
* @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 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 the address of a payee.
*/
function payee(uint256 index) public view returns(address) {
function payee(uint256 index) public view returns (address) {
return _payees[index];
}
......@@ -83,11 +83,7 @@ contract PaymentSplitter {
require(_shares[account] > 0);
uint256 totalReceived = address(this).balance.add(_totalReleased);
uint256 payment = totalReceived.mul(
_shares[account]).div(
_totalShares).sub(
_released[account]
);
uint256 payment = totalReceived.mul(_shares[account]).div(_totalShares).sub(_released[account]);
require(payment != 0);
......
......@@ -10,7 +10,7 @@ import "./escrow/Escrow.sol";
contract PullPayment {
Escrow private _escrow;
constructor() internal {
constructor () internal {
_escrow = new Escrow();
}
......
......@@ -26,7 +26,7 @@ contract RefundEscrow is ConditionalEscrow {
* @dev Constructor.
* @param beneficiary The beneficiary of the deposits.
*/
constructor(address beneficiary) public {
constructor (address beneficiary) public {
require(beneficiary != address(0));
_beneficiary = beneficiary;
_state = State.Active;
......
......@@ -41,14 +41,7 @@ contract ERC20 is IERC20 {
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
......@@ -85,14 +78,7 @@ contract ERC20 is IERC20 {
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
......@@ -107,17 +93,10 @@ contract ERC20 is IERC20 {
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
......@@ -131,17 +110,10 @@ contract ERC20 is IERC20 {
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
......@@ -199,8 +171,7 @@ contract ERC20 is IERC20 {
function _burnFrom(address account, uint256 value) internal {
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
}
}
......@@ -7,7 +7,6 @@ import "./ERC20.sol";
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
......
......@@ -7,12 +7,9 @@ import "./ERC20Mintable.sol";
* @dev Mintable token with a token cap.
*/
contract ERC20Capped is ERC20Mintable {
uint256 private _cap;
constructor(uint256 cap)
public
{
constructor (uint256 cap) public {
require(cap > 0);
_cap = cap;
}
......@@ -20,7 +17,7 @@ contract ERC20Capped is ERC20Mintable {
/**
* @return the cap for the token minting.
*/
function cap() public view returns(uint256) {
function cap() public view returns (uint256) {
return _cap;
}
......
......@@ -13,7 +13,7 @@ contract ERC20Detailed is IERC20 {
string private _symbol;
uint8 private _decimals;
constructor(string name, string symbol, uint8 decimals) public {
constructor (string name, string symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
......@@ -22,21 +22,21 @@ contract ERC20Detailed is IERC20 {
/**
* @return the name of the token.
*/
function name() public view returns(string) {
function name() public view returns (string) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string) {
function symbol() public view returns (string) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
function decimals() public view returns (uint8) {
return _decimals;
}
}
......@@ -14,14 +14,7 @@ contract ERC20Mintable is ERC20, MinterRole {
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 value
)
public
onlyMinter
returns (bool)
{
function mint(address to, uint256 value) public onlyMinter returns (bool) {
_mint(to, value);
return true;
}
......
......@@ -8,60 +8,23 @@ import "../../lifecycle/Pausable.sol";
* @dev ERC20 modified with pausable transfers.
**/
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);
}
function transferFrom(
address from,
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
function transferFrom(address from,address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(
address spender,
uint256 value
)
public
whenNotPaused
returns (bool)
{
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(
address spender,
uint addedValue
)
public
whenNotPaused
returns (bool success)
{
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(
address spender,
uint subtractedValue
)
public
whenNotPaused
returns (bool success)
{
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
......@@ -9,26 +9,15 @@ interface IERC20 {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
......@@ -10,37 +10,17 @@ import "../../math/SafeMath.sol";
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
)
internal
{
function safeTransfer(IERC20 token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
)
internal
{
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
require(token.transferFrom(from, to, value));
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
)
internal
{
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
......@@ -48,24 +28,12 @@ library SafeERC20 {
require(token.approve(spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
)
internal
{
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
require(token.approve(spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
)
internal
{
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
require(token.approve(spender, newAllowance));
}
......
......@@ -19,13 +19,7 @@ contract TokenTimelock {
// timestamp when token release is enabled
uint256 private _releaseTime;
constructor(
IERC20 token,
address beneficiary,
uint256 releaseTime
)
public
{
constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
// solium-disable-next-line security/no-block-members
require(releaseTime > block.timestamp);
_token = token;
......@@ -36,21 +30,21 @@ contract TokenTimelock {
/**
* @return the token being held.
*/
function token() public view returns(IERC20) {
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view returns(address) {
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the time when the tokens are released.
*/
function releaseTime() public view returns(uint256) {
function releaseTime() public view returns (uint256) {
return _releaseTime;
}
......
......@@ -11,7 +11,6 @@ import "../../introspection/ERC165.sol";
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721 is ERC165, IERC721 {
using SafeMath for uint256;
using Address for address;
......@@ -45,9 +44,7 @@ contract ERC721 is ERC165, IERC721 {
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
*/
constructor()
public
{
constructor () public {
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721);
}
......@@ -119,14 +116,7 @@ contract ERC721 is ERC165, IERC721 {
* @param operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(
address owner,
address operator
)
public
view
returns (bool)
{
function isApprovedForAll(address owner, address operator) public view returns (bool) {
return _operatorApprovals[owner][operator];
}
......@@ -138,13 +128,7 @@ contract ERC721 is ERC165, IERC721 {
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function transferFrom(
address from,
address to,
uint256 tokenId
)
public
{
function transferFrom(address from, address to, uint256 tokenId) public {
require(_isApprovedOrOwner(msg.sender, tokenId));
require(to != address(0));
......@@ -167,13 +151,7 @@ contract ERC721 is ERC165, IERC721 {
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
)
public
{
function safeTransferFrom(address from, address to, uint256 tokenId) public {
// solium-disable-next-line arg-overflow
safeTransferFrom(from, to, tokenId, "");
}
......@@ -190,14 +168,7 @@ contract ERC721 is ERC165, IERC721 {
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes _data
)
public
{
function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) public {
transferFrom(from, to, tokenId);
// solium-disable-next-line arg-overflow
require(_checkOnERC721Received(from, to, tokenId, _data));
......@@ -220,23 +191,12 @@ contract ERC721 is ERC165, IERC721 {
* @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
*/
function _isApprovedOrOwner(
address spender,
uint256 tokenId
)
internal
view
returns (bool)
{
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
address owner = ownerOf(tokenId);
// Disable solium check because of
// https://github.com/duaraghav8/Solium/issues/175
// solium-disable-next-line operator-whitespace
return (
spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender)
);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
......@@ -298,20 +258,12 @@ contract ERC721 is ERC165, IERC721 {
* @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes _data
)
internal
returns (bool)
{
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes _data) internal returns (bool) {
if (!to.isContract()) {
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);
}
......
......@@ -7,14 +7,11 @@ import "./ERC721.sol";
* @dev ERC721 Token that can be irreversibly burned (destroyed).
*/
contract ERC721Burnable is ERC721 {
/**
* @dev Burns a specific ERC721 token.
* @param tokenId uint256 id of the ERC721 token to be burned.
*/
function burn(uint256 tokenId)
public
{
function burn(uint256 tokenId) public {
require(_isApprovedOrOwner(msg.sender, tokenId));
_burn(ownerOf(tokenId), tokenId);
}
......
......@@ -32,7 +32,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
/**
* @dev Constructor function
*/
constructor() public {
constructor () public {
// register the supported interface to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721Enumerable);
}
......@@ -43,14 +43,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
* @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
*/
function tokenOfOwnerByIndex(
address owner,
uint256 index
)
public
view
returns (uint256)
{
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner));
return _ownedTokens[owner][index];
}
......
......@@ -11,8 +11,5 @@ import "./ERC721Metadata.sol";
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
constructor(string name, string symbol) ERC721Metadata(name, symbol)
public
{
}
constructor (string name, string symbol) ERC721Metadata(name, symbol) public {}
}
......@@ -3,15 +3,7 @@ pragma solidity ^0.4.24;
import "./IERC721Receiver.sol";
contract ERC721Holder is IERC721Receiver {
function onERC721Received(
address,
address,
uint256,
bytes
)
public
returns(bytes4)
{
function onERC721Received(address, address, uint256, bytes) public returns (bytes4) {
return this.onERC721Received.selector;
}
}
......@@ -25,7 +25,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
/**
* @dev Constructor function
*/
constructor(string name, string symbol) public {
constructor (string name, string symbol) public {
_name = name;
_symbol = symbol;
......
......@@ -16,15 +16,7 @@ contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole {
* @param tokenURI The token URI of the minted token.
* @return A boolean that indicates if the operation was successful.
*/
function mintWithTokenURI(
address to,
uint256 tokenId,
string tokenURI
)
public
onlyMinter
returns (bool)
{
function mintWithTokenURI(address to, uint256 tokenId, string tokenURI) public onlyMinter returns (bool) {
_mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
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