Commit bd2f1773 by Matt Condon

fix: solium errors - function-order only

parent e60aee61
...@@ -35,12 +35,6 @@ contract Bounty is PullPayment, Destructible { ...@@ -35,12 +35,6 @@ contract Bounty is PullPayment, Destructible {
} }
/** /**
* @dev Internal function to deploy the target contract.
* @return A target contract address
*/
function deployContract() internal returns(address);
/**
* @dev Sends the contract funds to the researcher that proved the contract is broken. * @dev Sends the contract funds to the researcher that proved the contract is broken.
* @param target contract * @param target contract
*/ */
...@@ -53,6 +47,12 @@ contract Bounty is PullPayment, Destructible { ...@@ -53,6 +47,12 @@ contract Bounty is PullPayment, Destructible {
claimed = true; claimed = true;
} }
/**
* @dev Internal function to deploy the target contract.
* @return A target contract address
*/
function deployContract() internal returns(address);
} }
......
...@@ -18,13 +18,6 @@ contract CappedCrowdsale is Crowdsale { ...@@ -18,13 +18,6 @@ contract CappedCrowdsale is Crowdsale {
cap = _cap; cap = _cap;
} }
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap;
}
// overriding Crowdsale#hasEnded to add cap logic // overriding Crowdsale#hasEnded to add cap logic
// @return true if crowdsale event has ended // @return true if crowdsale event has ended
function hasEnded() public view returns (bool) { function hasEnded() public view returns (bool) {
...@@ -32,4 +25,11 @@ contract CappedCrowdsale is Crowdsale { ...@@ -32,4 +25,11 @@ contract CappedCrowdsale is Crowdsale {
return super.hasEnded() || capReached; return super.hasEnded() || capReached;
} }
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap;
}
} }
...@@ -54,22 +54,11 @@ contract Crowdsale { ...@@ -54,22 +54,11 @@ contract Crowdsale {
wallet = _wallet; wallet = _wallet;
} }
// creates the token to be sold.
// override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) {
return new MintableToken();
}
// fallback function can be used to buy tokens // fallback function can be used to buy tokens
function () external payable { function () external payable {
buyTokens(msg.sender); buyTokens(msg.sender);
} }
// Override this method to have a way to add business logic to your crowdsale when buying
function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
return weiAmount.mul(rate);
}
// low level token purchase function // low level token purchase function
function buyTokens(address beneficiary) public payable { function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0)); require(beneficiary != address(0));
...@@ -89,6 +78,22 @@ contract Crowdsale { ...@@ -89,6 +78,22 @@ contract Crowdsale {
forwardFunds(); forwardFunds();
} }
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
// creates the token to be sold.
// override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) {
return new MintableToken();
}
// Override this method to have a way to add business logic to your crowdsale when buying
function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
return weiAmount.mul(rate);
}
// send ether to the fund collection wallet // send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms // override to create custom fund forwarding mechanisms
function forwardFunds() internal { function forwardFunds() internal {
...@@ -102,10 +107,4 @@ contract Crowdsale { ...@@ -102,10 +107,4 @@ contract Crowdsale {
return withinPeriod && nonZeroPurchase; return withinPeriod && nonZeroPurchase;
} }
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
} }
...@@ -27,13 +27,6 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -27,13 +27,6 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
goal = _goal; goal = _goal;
} }
// We're overriding the fund forwarding from Crowdsale.
// In addition to sending the funds, we want to call
// the RefundVault deposit function
function forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
}
// if crowdsale is unsuccessful, investors can claim refunds here // if crowdsale is unsuccessful, investors can claim refunds here
function claimRefund() public { function claimRefund() public {
require(isFinalized); require(isFinalized);
...@@ -42,6 +35,10 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -42,6 +35,10 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
vault.refund(msg.sender); vault.refund(msg.sender);
} }
function goalReached() public view returns (bool) {
return weiRaised >= goal;
}
// vault finalization task, called when owner calls finalize() // vault finalization task, called when owner calls finalize()
function finalization() internal { function finalization() internal {
if (goalReached()) { if (goalReached()) {
...@@ -53,8 +50,11 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -53,8 +50,11 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
super.finalization(); super.finalization();
} }
function goalReached() public view returns (bool) { // We're overriding the fund forwarding from Crowdsale.
return weiRaised >= goal; // In addition to sending the funds, we want to call
// the RefundVault deposit function
function forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
} }
} }
...@@ -12,8 +12,8 @@ contract ReentrancyMock is ReentrancyGuard { ...@@ -12,8 +12,8 @@ contract ReentrancyMock is ReentrancyGuard {
counter = 0; counter = 0;
} }
function count() private { function callback() external nonReentrant {
counter += 1; count();
} }
function countLocalRecursive(uint256 n) public nonReentrant { function countLocalRecursive(uint256 n) public nonReentrant {
...@@ -38,8 +38,8 @@ contract ReentrancyMock is ReentrancyGuard { ...@@ -38,8 +38,8 @@ contract ReentrancyMock is ReentrancyGuard {
attacker.callSender(func); attacker.callSender(func);
} }
function callback() external nonReentrant { function count() private {
count(); counter += 1;
} }
} }
...@@ -37,30 +37,6 @@ contract RBAC { ...@@ -37,30 +37,6 @@ contract RBAC {
} }
/** /**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
RoleRemoved(addr, roleName);
}
/**
* @dev reverts if addr does not have role * @dev reverts if addr does not have role
* @param addr address * @param addr address
* @param roleName the name of the role * @param roleName the name of the role
...@@ -112,6 +88,30 @@ contract RBAC { ...@@ -112,6 +88,30 @@ contract RBAC {
} }
/** /**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
RoleRemoved(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr) * @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role * @param roleName the name of the role
* // reverts * // reverts
......
...@@ -16,16 +16,6 @@ contract PullPayment { ...@@ -16,16 +16,6 @@ contract PullPayment {
uint256 public totalPayments; uint256 public totalPayments;
/** /**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
/**
* @dev withdraw accumulated balance, called by payee. * @dev withdraw accumulated balance, called by payee.
*/ */
function withdrawPayments() public { function withdrawPayments() public {
...@@ -40,4 +30,14 @@ contract PullPayment { ...@@ -40,4 +30,14 @@ contract PullPayment {
assert(payee.send(payment)); assert(payee.send(payment));
} }
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
} }
...@@ -30,19 +30,9 @@ contract SplitPayment { ...@@ -30,19 +30,9 @@ contract SplitPayment {
} }
/** /**
* @dev Add a new payee to the contract. * @dev payable fallback
* @param _payee The address of the payee to add.
* @param _shares The number of shares owned by the payee.
*/ */
function addPayee(address _payee, uint256 _shares) internal { function () public payable {}
require(_payee != address(0));
require(_shares > 0);
require(shares[_payee] == 0);
payees.push(_payee);
shares[_payee] = _shares;
totalShares = totalShares.add(_shares);
}
/** /**
* @dev Claim your share of the balance. * @dev Claim your share of the balance.
...@@ -65,7 +55,17 @@ contract SplitPayment { ...@@ -65,7 +55,17 @@ contract SplitPayment {
} }
/** /**
* @dev payable fallback * @dev Add a new payee to the contract.
* @param _payee The address of the payee to add.
* @param _shares The number of shares owned by the payee.
*/ */
function () public payable {} function addPayee(address _payee, uint256 _shares) internal {
require(_payee != address(0));
require(_shares > 0);
require(shares[_payee] == 0);
payees.push(_payee);
shares[_payee] = _shares;
totalShares = totalShares.add(_shares);
}
} }
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