fix all compilation errors

This commit is contained in:
Francisco Giordano
2019-01-18 17:14:53 -03:00
parent e808a64649
commit 877f07f0a9
36 changed files with 108 additions and 68 deletions

View File

@ -1,12 +1,14 @@
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "../Roles.sol";
/**
* @title WhitelistAdminRole
* @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts.
*/
contract WhitelistAdminRole {
contract WhitelistAdminRole is Initializable {
using Roles for Roles.Role;
event WhitelistAdminAdded(address indexed account);
@ -14,8 +16,10 @@ contract WhitelistAdminRole {
Roles.Role private _whitelistAdmins;
constructor () internal {
_addWhitelistAdmin(msg.sender);
function _initialize(address sender) internal initializer {
if (!isWhitelistAdmin(sender)) {
_addWhitelistAdmin(sender);
}
}
modifier onlyWhitelistAdmin() {

View File

@ -1,5 +1,7 @@
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "../Roles.sol";
import "./WhitelistAdminRole.sol";
@ -9,7 +11,7 @@ import "./WhitelistAdminRole.sol";
* crowdsale). This role is special in that the only accounts that can add it are WhitelistAdmins (who can also remove
* it), and not Whitelisteds themselves.
*/
contract WhitelistedRole is WhitelistAdminRole {
contract WhitelistedRole is Initializable, WhitelistAdminRole {
using Roles for Roles.Role;
event WhitelistedAdded(address indexed account);
@ -22,6 +24,10 @@ contract WhitelistedRole is WhitelistAdminRole {
_;
}
function _initialize(address sender) internal initializer {
WhitelistAdminRole._initialize(sender);
}
function isWhitelisted(address account) public view returns (bool) {
return _whitelisteds.has(account);
}

View File

@ -54,7 +54,7 @@ contract Crowdsale is Initializable, ReentrancyGuard {
* @param wallet Address where collected funds will be forwarded to
* @param token Address of the token being sold
*/
function initialize(uint256 rate, address wallet, IERC20 token) public initializer {
function initialize(uint256 rate, address payable wallet, IERC20 token) public initializer {
require(rate > 0);
require(wallet != address(0));
require(address(token) != address(0));
@ -128,7 +128,7 @@ contract Crowdsale is Initializable, ReentrancyGuard {
}
function _hasBeenInitialized() internal view returns (bool) {
return ((_rate > 0) && (_wallet != address(0)) && (_token != address(0)));
return ((_rate > 0) && (_wallet != address(0)) && (address(_token) != address(0)));
}
/**

View File

@ -7,7 +7,11 @@ import "../../access/roles/WhitelistedRole.sol";
* @title WhitelistCrowdsale
* @dev Crowdsale in which only whitelisted users can contribute.
*/
contract WhitelistCrowdsale is WhitelistedRole, Crowdsale {
contract WhitelistCrowdsale is Initializable, WhitelistedRole, Crowdsale {
function initialize(address sender) public initializer {
WhitelistedRole._initialize(sender);
}
/**
* @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no
* restriction is imposed on the account sending the transaction.

View File

@ -47,7 +47,7 @@ contract TokenVesting is Initializable, 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, address sender) public initializer {
function initialize(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable, address sender) public initializer {
Ownable.initialize(sender);
require(beneficiary != address(0));

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/ERC20Detailed.sol";
@ -12,8 +12,8 @@ import "../token/ERC20/ERC20Pausable.sol";
*/
contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
function initialize(
string name, string symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] minters, address[] pausers
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] memory minters, address[] memory pausers
) public initializer {
ERC20Detailed.initialize(name, symbol, decimals);
@ -35,7 +35,7 @@ contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Paus
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
for (uint256 i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}

View File

@ -25,13 +25,13 @@ contract ERC165 is Initializable, IERC165 {
* implement ERC165 itself
*/
function initialize() public initializer {
_registerInterface(_InterfaceId_ERC165);
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev implement supportsInterface(bytes4) using a lookup table
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
function supportsInterface(bytes4 interfaceId) public view returns (bool) {
return _supportedInterfaces[interfaceId];
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../token/ERC20/ERC20Capped.sol";
import "./MinterRoleMock.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../drafts/ERC20Migrator.sol";

View File

@ -8,7 +8,7 @@ import "./PauserRoleMock.sol";
* This mock just provides a public mint, burn and exists functions for testing purposes
*/
contract ERC721PausableMock is ERC721Pausable, PauserRoleMock {
constructor() {
constructor() public {
ERC721.initialize();
ERC721Pausable.initialize(msg.sender);
}

View File

@ -1,6 +1,6 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../payment/Escrow.sol";
import "../payment/escrow/Escrow.sol";
contract EscrowMock is Escrow {
constructor() public {

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
// @title Force Ether into a contract.
@ -10,7 +10,7 @@ contract ForceEther {
constructor() public payable { }
function destroyAndSend(address recipient) public {
function destroyAndSend(address payable recipient) public {
selfdestruct(recipient);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
contract MessageHelper {
@ -9,7 +9,7 @@ contract MessageHelper {
function showMessage(
bytes32 _message,
uint256 _number,
string _text
string memory _text
)
public
returns (bool)
@ -21,7 +21,7 @@ contract MessageHelper {
function buyMessage(
bytes32 _message,
uint256 _number,
string _text
string memory _text
)
public
payable
@ -39,9 +39,10 @@ contract MessageHelper {
require(false);
}
function call(address _to, bytes _data) public returns (bool) {
function call(address _to, bytes memory _data) public returns (bool) {
// solium-disable-next-line security/no-low-level-calls
if (_to.call(_data))
(bool success,) = _to.call(_data);
if (success)
return true;
else
return false;

View File

@ -3,7 +3,7 @@ pragma solidity ^0.5.0;
import "../ownership/Ownable.sol";
contract OwnableMock is Ownable {
constructor() {
constructor() public {
Ownable.initialize(msg.sender);
}
}

View File

@ -4,7 +4,7 @@ import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/PausableCrowdsale.sol";
contract PausableCrowdsaleImpl is PausableCrowdsale {
constructor (uint256 _rate, address payable _wallet, ERC20 _token) public Crowdsale(_rate, _wallet, _token) {
// solhint-disable-previous-line no-empty-blocks
constructor (uint256 _rate, address payable _wallet, ERC20 _token) public {
Crowdsale.initialize(_rate, _wallet, _token);
}
}

View File

@ -1,9 +1,9 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../payment/PaymentSplitter.sol";
contract PaymentSplitterMock is PaymentSplitter {
constructor(address[] payees, uint256[] shares) public {
constructor(address[] memory payees, uint256[] memory shares) public {
PaymentSplitter.initialize(payees, shares);
}
}

View File

@ -6,8 +6,6 @@ import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address payable wallet, IERC20 token)
public
TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token)
{
Crowdsale.initialize(rate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);

View File

@ -5,7 +5,7 @@ import "../payment/PullPayment.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
constructor () public payable {
PullPayment.initialize();
PullPayment._initialize();
}
// test helper function to call asyncTransfer

View File

@ -1,9 +1,9 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../payment/RefundEscrow.sol";
import "../payment/escrow/RefundEscrow.sol";
contract RefundEscrowMock is RefundEscrow {
constructor(address beneficiary) public {
constructor(address payable beneficiary) public {
RefundEscrow.initialize(beneficiary, msg.sender);
}
}

View File

@ -13,10 +13,9 @@ contract RefundablePostDeliveryCrowdsaleImpl is RefundablePostDeliveryCrowdsale
uint256 goal
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{
// solhint-disable-previous-line no-empty-blocks
Crowdsale.initialize(rate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
RefundableCrowdsale.initialize(goal);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../examples/SampleCrowdsale.sol";
@ -14,7 +14,7 @@ contract SampleCrowdsaleMock is SampleCrowdsale {
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
address payable wallet,
uint256 cap,
ERC20Mintable token,
uint256 goal

View File

@ -5,7 +5,7 @@ import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
constructor() public {
SignatureBouncer.initialize(msg.sender);
SignatureBouncer._initialize(msg.sender);
}
function checkValidSignature(address account, bytes memory signature)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../examples/SimpleToken.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../token/ERC20/TokenTimelock.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../drafts/TokenVesting.sol";

View File

@ -3,6 +3,10 @@ pragma solidity ^0.5.0;
import "../access/roles/WhitelistAdminRole.sol";
contract WhitelistAdminRoleMock is WhitelistAdminRole {
constructor () public {
WhitelistAdminRole._initialize(msg.sender);
}
function removeWhitelistAdmin(address account) public {
_removeWhitelistAdmin(account);
}

View File

@ -6,7 +6,8 @@ import "../crowdsale/Crowdsale.sol";
contract WhitelistCrowdsaleImpl is Crowdsale, WhitelistCrowdsale {
constructor (uint256 _rate, address payable _wallet, IERC20 _token) public Crowdsale(_rate, _wallet, _token) {
// solhint-disable-previous-line no-empty-blocks
constructor (uint256 _rate, address payable _wallet, IERC20 _token) public {
Crowdsale.initialize(_rate, _wallet, _token);
WhitelistCrowdsale.initialize(msg.sender);
}
}

View File

@ -1,5 +1,7 @@
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "../math/SafeMath.sol";
/**
@ -7,7 +9,7 @@ import "../math/SafeMath.sol";
* @dev This contract can be used when payments need to be received by a group
* of people and split proportionately to some number of shares they own.
*/
contract PaymentSplitter {
contract PaymentSplitter is Initializable {
using SafeMath for uint256;
event PayeeAdded(address account, uint256 shares);
@ -24,7 +26,7 @@ contract PaymentSplitter {
/**
* @dev Constructor
*/
constructor (address[] memory payees, uint256[] memory shares) public payable {
function initialize(address[] memory payees, uint256[] memory shares) public payable initializer {
require(payees.length == shares.length);
require(payees.length > 0);

View File

@ -7,7 +7,11 @@ import "./Escrow.sol";
* @dev Base abstract escrow to only allow withdrawal if a condition is met.
* @dev Intended usage: See Escrow.sol. Same usage guidelines apply here.
*/
contract ConditionalEscrow is Escrow {
contract ConditionalEscrow is Initializable, Escrow {
function initialize(address sender) public initializer {
Escrow.initialize(sender);
}
/**
* @dev Returns whether an address is allowed to withdraw their funds. To be
* implemented by derived contracts.

View File

@ -15,7 +15,7 @@ import "../../ownership/Secondary.sol";
* payment method should be its primary, and provide public methods redirecting
* to the escrow's deposit and withdraw.
*/
contract Escrow is Secondary {
contract Escrow is Initializable, Secondary {
using SafeMath for uint256;
event Deposited(address indexed payee, uint256 weiAmount);
@ -23,6 +23,10 @@ contract Escrow is Secondary {
mapping(address => uint256) private _deposits;
function initialize(address sender) public initializer {
Secondary.initialize(sender);
}
function depositsOf(address payee) public view returns (uint256) {
return _deposits[payee];
}

View File

@ -1,5 +1,7 @@
pragma solidity ^0.5.0;
import 'zos-lib/contracts/Initializable.sol';
import "./ConditionalEscrow.sol";
/**
@ -13,7 +15,7 @@ import "./ConditionalEscrow.sol";
* with RefundEscrow will be made through the primary contract. See the
* RefundableCrowdsale contract for an example of RefundEscrows use.
*/
contract RefundEscrow is ConditionalEscrow {
contract RefundEscrow is Initializable, ConditionalEscrow {
enum State { Active, Refunding, Closed }
event RefundsClosed();
@ -26,7 +28,9 @@ contract RefundEscrow is ConditionalEscrow {
* @dev Constructor.
* @param beneficiary The beneficiary of the deposits.
*/
constructor (address payable beneficiary) public {
function initialize(address payable beneficiary, address sender) public initializer {
ConditionalEscrow.initialize(sender);
require(beneficiary != address(0));
_beneficiary = beneficiary;
_state = State.Active;

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20Detailed.sol";
@ -12,11 +12,9 @@ import "./ERC20Pausable.sol";
*/
contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
function initialize(
string name, string symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] minters, address[] pausers
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] memory minters, address[] memory pausers
) public initializer {
require(initialSupply > 0);
ERC20Detailed.initialize(name, symbol, decimals);
// Mint the initial supply
@ -35,13 +33,13 @@ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pa
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
for (uint256 i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}
function initialize(
string name, string symbol, uint8 decimals, address[] minters, address[] pausers
string memory name, string memory symbol, uint8 decimals, address[] memory minters, address[] memory pausers
) public initializer {
ERC20Detailed.initialize(name, symbol, decimals);
@ -58,7 +56,7 @@ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pa
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
for (uint256 i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}

View File

@ -37,11 +37,11 @@ contract ERC721Enumerable is Initializable, ERC165, ERC721, IERC721Enumerable {
require(ERC721._hasBeenInitialized());
// register the supported interface to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721Enumerable);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
function _hasBeenInitialized() internal view returns (bool) {
return supportsInterface(_InterfaceId_ERC721Enumerable);
return supportsInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
/**

View File

@ -36,6 +36,9 @@ contract ERC721Metadata is Initializable, ERC165, ERC721, IERC721Metadata {
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
function _hasBeenInitialized() internal view returns (bool) {
return supportsInterface(_INTERFACE_ID_ERC721_METADATA);
}
/**
* @dev Gets the token name
* @return string representing the token name

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "./ERC721.sol";
@ -15,7 +15,7 @@ import "./ERC721Pausable.sol";
contract StandaloneERC721
is Initializable, ERC721, ERC721Enumerable, ERC721Metadata, ERC721MetadataMintable, ERC721Pausable
{
function initialize(string name, string symbol, address[] minters, address[] pausers) public initializer {
function initialize(string memory name, string memory symbol, address[] memory minters, address[] memory pausers) public initializer {
ERC721.initialize();
ERC721Enumerable.initialize();
ERC721Metadata.initialize(name, symbol);
@ -33,7 +33,7 @@ contract StandaloneERC721
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
for (uint256 i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}

8
package-lock.json generated
View File

@ -4900,10 +4900,18 @@
"integrity": "sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ==",
"dev": true,
"requires": {
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
"crypto-js": "^3.1.4",
"utf8": "^2.1.1",
"xhr2-cookies": "^1.1.0",
"xmlhttprequest": "*"
},
"dependencies": {
"bignumber.js": {
"version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
"from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git",
"dev": true
}
}
}
}