Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
27653502
Commit
27653502
authored
Jul 31, 2018
by
Leo Arias
Committed by
Nicolás Venturo
Jul 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefix all parameters with underscore (#1133)
parent
1200969e
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
191 additions
and
191 deletions
+191
-191
AddressUtils.sol
contracts/AddressUtils.sol
+3
-3
Bounty.sol
contracts/Bounty.sol
+4
-4
ECRecovery.sol
contracts/ECRecovery.sol
+10
-10
SignatureBouncer.sol
contracts/access/SignatureBouncer.sol
+2
-2
Roles.sol
contracts/access/rbac/Roles.sol
+8
-8
RBACWithAdmin.sol
contracts/examples/RBACWithAdmin.sol
+8
-8
SimpleSavingsWallet.sol
contracts/examples/SimpleSavingsWallet.sol
+5
-5
TokenDestructible.sol
contracts/lifecycle/TokenDestructible.sol
+4
-4
Math.sol
contracts/math/Math.sol
+8
-8
SafeMath.sol
contracts/math/SafeMath.sol
+15
-15
BasicTokenMock.sol
contracts/mocks/BasicTokenMock.sol
+3
-3
BurnableTokenMock.sol
contracts/mocks/BurnableTokenMock.sol
+3
-3
ECRecoveryMock.sol
contracts/mocks/ECRecoveryMock.sol
+4
-4
ERC223TokenMock.sol
contracts/mocks/ERC223TokenMock.sol
+3
-3
MathMock.sol
contracts/mocks/MathMock.sol
+8
-8
MessageHelper.sol
contracts/mocks/MessageHelper.sol
+12
-12
PausableTokenMock.sol
contracts/mocks/PausableTokenMock.sol
+2
-2
PullPaymentMock.sol
contracts/mocks/PullPaymentMock.sol
+2
-2
ReentrancyAttack.sol
contracts/mocks/ReentrancyAttack.sol
+2
-2
ReentrancyMock.sol
contracts/mocks/ReentrancyMock.sol
+8
-8
SafeMathMock.sol
contracts/mocks/SafeMathMock.sol
+8
-8
StandardBurnableTokenMock.sol
contracts/mocks/StandardBurnableTokenMock.sol
+3
-3
StandardTokenMock.sol
contracts/mocks/StandardTokenMock.sol
+3
-3
CanReclaimToken.sol
contracts/ownership/CanReclaimToken.sol
+4
-4
Contactable.sol
contracts/ownership/Contactable.sol
+3
-3
HasNoContracts.sol
contracts/ownership/HasNoContracts.sol
+3
-3
HasNoTokens.sol
contracts/ownership/HasNoTokens.sol
+7
-7
Heritable.sol
contracts/ownership/Heritable.sol
+6
-6
ERC20.sol
contracts/token/ERC20/ERC20.sol
+3
-3
ERC20Basic.sol
contracts/token/ERC20/ERC20Basic.sol
+2
-2
RBACMintableToken.sol
contracts/token/ERC20/RBACMintableToken.sol
+6
-6
SafeERC20.sol
contracts/token/ERC20/SafeERC20.sol
+9
-9
TokenVesting.sol
contracts/token/ERC20/TokenVesting.sol
+20
-20
No files found.
contracts/AddressUtils.sol
View file @
27653502
...
@@ -10,10 +10,10 @@ library AddressUtils {
...
@@ -10,10 +10,10 @@ library AddressUtils {
* Returns whether the target address is a contract
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* as the code is not actually created until after the constructor finishes.
* @param addr address to check
* @param
_
addr address to check
* @return whether the target address is a contract
* @return whether the target address is a contract
*/
*/
function isContract(address addr) internal view returns (bool) {
function isContract(address
_
addr) internal view returns (bool) {
uint256 size;
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// than to check the size of the code at that address.
...
@@ -22,7 +22,7 @@ library AddressUtils {
...
@@ -22,7 +22,7 @@ library AddressUtils {
// TODO Check this again before the Serenity release, because all addresses will be
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// contracts then.
// solium-disable-next-line security/no-inline-assembly
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(addr) }
assembly { size := extcodesize(
_
addr) }
return size > 0;
return size > 0;
}
}
...
...
contracts/Bounty.sol
View file @
27653502
...
@@ -36,13 +36,13 @@ contract Bounty is PullPayment, Destructible {
...
@@ -36,13 +36,13 @@ contract Bounty is PullPayment, Destructible {
/**
/**
* @dev Transfers the contract funds to the researcher that proved the contract is broken.
* @dev Transfers the contract funds to the researcher that proved the contract is broken.
* @param target contract
* @param
_
target contract
*/
*/
function claim(Target target) public {
function claim(Target
_
target) public {
address researcher = researchers[target];
address researcher = researchers[
_
target];
require(researcher != address(0));
require(researcher != address(0));
// Check Target contract invariants
// Check Target contract invariants
require(!target.checkInvariant());
require(!
_
target.checkInvariant());
asyncTransfer(researcher, address(this).balance);
asyncTransfer(researcher, address(this).balance);
claimed = true;
claimed = true;
}
}
...
...
contracts/ECRecovery.sol
View file @
27653502
...
@@ -12,10 +12,10 @@ library ECRecovery {
...
@@ -12,10 +12,10 @@ library ECRecovery {
/**
/**
* @dev Recover signer address from a message by using their signature
* @dev Recover signer address from a message by using their signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param
_
hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
* @param
_
sig bytes signature, the signature is generated using web3.eth.sign()
*/
*/
function recover(bytes32
hash, bytes
sig)
function recover(bytes32
_hash, bytes _
sig)
internal
internal
pure
pure
returns (address)
returns (address)
...
@@ -25,7 +25,7 @@ library ECRecovery {
...
@@ -25,7 +25,7 @@ library ECRecovery {
uint8 v;
uint8 v;
// Check the signature length
// Check the signature length
if (sig.length != 65) {
if (
_
sig.length != 65) {
return (address(0));
return (address(0));
}
}
...
@@ -34,9 +34,9 @@ library ECRecovery {
...
@@ -34,9 +34,9 @@ library ECRecovery {
// currently is to use assembly.
// currently is to use assembly.
// solium-disable-next-line security/no-inline-assembly
// solium-disable-next-line security/no-inline-assembly
assembly {
assembly {
r := mload(add(sig, 32))
r := mload(add(
_
sig, 32))
s := mload(add(sig, 64))
s := mload(add(
_
sig, 64))
v := byte(0, mload(add(sig, 96)))
v := byte(0, mload(add(
_
sig, 96)))
}
}
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
...
@@ -49,7 +49,7 @@ library ECRecovery {
...
@@ -49,7 +49,7 @@ library ECRecovery {
return (address(0));
return (address(0));
} else {
} else {
// solium-disable-next-line arg-overflow
// solium-disable-next-line arg-overflow
return ecrecover(hash, v, r, s);
return ecrecover(
_
hash, v, r, s);
}
}
}
}
...
@@ -58,7 +58,7 @@ library ECRecovery {
...
@@ -58,7 +58,7 @@ library ECRecovery {
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* and hash the result
* and hash the result
*/
*/
function toEthSignedMessageHash(bytes32 hash)
function toEthSignedMessageHash(bytes32
_
hash)
internal
internal
pure
pure
returns (bytes32)
returns (bytes32)
...
@@ -66,7 +66,7 @@ library ECRecovery {
...
@@ -66,7 +66,7 @@ library ECRecovery {
// 32 is the length in bytes of hash,
// 32 is the length in bytes of hash,
// enforced by the type signature above
// enforced by the type signature above
return keccak256(
return keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
abi.encodePacked("\x19Ethereum Signed Message:\n32",
_
hash)
);
);
}
}
}
}
contracts/access/SignatureBouncer.sol
View file @
27653502
...
@@ -146,12 +146,12 @@ contract SignatureBouncer is Ownable, RBAC {
...
@@ -146,12 +146,12 @@ contract SignatureBouncer is Ownable, RBAC {
* and then recover the signature and check it against the bouncer role
* and then recover the signature and check it against the bouncer role
* @return bool
* @return bool
*/
*/
function isValidDataHash(bytes32 hash, bytes _sig)
function isValidDataHash(bytes32
_
hash, bytes _sig)
internal
internal
view
view
returns (bool)
returns (bool)
{
{
address signer = hash
address signer =
_
hash
.toEthSignedMessageHash()
.toEthSignedMessageHash()
.recover(_sig);
.recover(_sig);
return hasRole(signer, ROLE_BOUNCER);
return hasRole(signer, ROLE_BOUNCER);
...
...
contracts/access/rbac/Roles.sol
View file @
27653502
...
@@ -15,41 +15,41 @@ library Roles {
...
@@ -15,41 +15,41 @@ library Roles {
/**
/**
* @dev give an address access to this role
* @dev give an address access to this role
*/
*/
function add(Role storage
role, address
addr)
function add(Role storage
_role, address _
addr)
internal
internal
{
{
role.bearer[
addr] = true;
_role.bearer[_
addr] = true;
}
}
/**
/**
* @dev remove an address' access to this role
* @dev remove an address' access to this role
*/
*/
function remove(Role storage
role, address
addr)
function remove(Role storage
_role, address _
addr)
internal
internal
{
{
role.bearer[
addr] = false;
_role.bearer[_
addr] = false;
}
}
/**
/**
* @dev check if an address has this role
* @dev check if an address has this role
* // reverts
* // reverts
*/
*/
function check(Role storage
role, address
addr)
function check(Role storage
_role, address _
addr)
view
view
internal
internal
{
{
require(has(
role,
addr));
require(has(
_role, _
addr));
}
}
/**
/**
* @dev check if an address has this role
* @dev check if an address has this role
* @return bool
* @return bool
*/
*/
function has(Role storage
role, address
addr)
function has(Role storage
_role, address _
addr)
view
view
internal
internal
returns (bool)
returns (bool)
{
{
return
role.bearer[
addr];
return
_role.bearer[_
addr];
}
}
}
}
contracts/examples/RBACWithAdmin.sol
View file @
27653502
...
@@ -42,25 +42,25 @@ contract RBACWithAdmin is RBAC {
...
@@ -42,25 +42,25 @@ contract RBACWithAdmin is RBAC {
/**
/**
* @dev add a role to an address
* @dev add a role to an address
* @param addr address
* @param
_
addr address
* @param roleName the name of the role
* @param
_
roleName the name of the role
*/
*/
function adminAddRole(address
addr, string
roleName)
function adminAddRole(address
_addr, string _
roleName)
onlyAdmin
onlyAdmin
public
public
{
{
addRole(
addr,
roleName);
addRole(
_addr, _
roleName);
}
}
/**
/**
* @dev remove a role from an address
* @dev remove a role from an address
* @param addr address
* @param
_
addr address
* @param roleName the name of the role
* @param
_
roleName the name of the role
*/
*/
function adminRemoveRole(address
addr, string
roleName)
function adminRemoveRole(address
_addr, string _
roleName)
onlyAdmin
onlyAdmin
public
public
{
{
removeRole(
addr,
roleName);
removeRole(
_addr, _
roleName);
}
}
}
}
contracts/examples/SimpleSavingsWallet.sol
View file @
27653502
...
@@ -31,10 +31,10 @@ contract SimpleSavingsWallet is Heritable {
...
@@ -31,10 +31,10 @@ contract SimpleSavingsWallet is Heritable {
/**
/**
* @dev wallet can send funds
* @dev wallet can send funds
*/
*/
function sendTo(address
payee, uint256
amount) public onlyOwner {
function sendTo(address
_payee, uint256 _
amount) public onlyOwner {
require(
payee != address(0) &&
payee != address(this));
require(
_payee != address(0) && _
payee != address(this));
require(amount > 0);
require(
_
amount > 0);
payee.transfer(
amount);
_payee.transfer(_
amount);
emit Sent(
payee,
amount, address(this).balance);
emit Sent(
_payee, _
amount, address(this).balance);
}
}
}
}
contracts/lifecycle/TokenDestructible.sol
View file @
27653502
...
@@ -16,16 +16,16 @@ contract TokenDestructible is Ownable {
...
@@ -16,16 +16,16 @@ contract TokenDestructible is Ownable {
/**
/**
* @notice Terminate contract and refund to owner
* @notice Terminate contract and refund to owner
* @param tokens List of addresses of ERC20 or ERC20Basic token contracts to
* @param
_
tokens List of addresses of ERC20 or ERC20Basic token contracts to
refund.
refund.
* @notice The called token contracts could try to re-enter this contract. Only
* @notice The called token contracts could try to re-enter this contract. Only
supply token contracts you trust.
supply token contracts you trust.
*/
*/
function destroy(address[] tokens) onlyOwner public {
function destroy(address[]
_
tokens) onlyOwner public {
// Transfer tokens to owner
// Transfer tokens to owner
for (uint256 i = 0; i < tokens.length; i++) {
for (uint256 i = 0; i <
_
tokens.length; i++) {
ERC20Basic token = ERC20Basic(tokens[i]);
ERC20Basic token = ERC20Basic(
_
tokens[i]);
uint256 balance = token.balanceOf(this);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
token.transfer(owner, balance);
}
}
...
...
contracts/math/Math.sol
View file @
27653502
...
@@ -6,19 +6,19 @@ pragma solidity ^0.4.24;
...
@@ -6,19 +6,19 @@ pragma solidity ^0.4.24;
* @dev Assorted math operations
* @dev Assorted math operations
*/
*/
library Math {
library Math {
function max64(uint64
a, uint64
b) internal pure returns (uint64) {
function max64(uint64
_a, uint64 _
b) internal pure returns (uint64) {
return
a >= b ? a :
b;
return
_a >= _b ? _a : _
b;
}
}
function min64(uint64
a, uint64
b) internal pure returns (uint64) {
function min64(uint64
_a, uint64 _
b) internal pure returns (uint64) {
return
a < b ? a :
b;
return
_a < _b ? _a : _
b;
}
}
function max256(uint256
a, uint256
b) internal pure returns (uint256) {
function max256(uint256
_a, uint256 _
b) internal pure returns (uint256) {
return
a >= b ? a :
b;
return
_a >= _b ? _a : _
b;
}
}
function min256(uint256
a, uint256
b) internal pure returns (uint256) {
function min256(uint256
_a, uint256 _
b) internal pure returns (uint256) {
return
a < b ? a :
b;
return
_a < _b ? _a : _
b;
}
}
}
}
contracts/math/SafeMath.sol
View file @
27653502
...
@@ -10,43 +10,43 @@ library SafeMath {
...
@@ -10,43 +10,43 @@ library SafeMath {
/**
/**
* @dev Multiplies two numbers, throws on overflow.
* @dev Multiplies two numbers, throws on overflow.
*/
*/
function mul(uint256
a, uint256
b) internal pure returns (uint256 c) {
function mul(uint256
_a, uint256 _
b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
if (
_
a == 0) {
return 0;
return 0;
}
}
c =
a *
b;
c =
_a * _
b;
assert(c /
a ==
b);
assert(c /
_a == _
b);
return c;
return c;
}
}
/**
/**
* @dev Integer division of two numbers, truncating the quotient.
* @dev Integer division of two numbers, truncating the quotient.
*/
*/
function div(uint256
a, uint256
b) internal pure returns (uint256) {
function div(uint256
_a, uint256 _
b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// assert(
_
b > 0); // Solidity automatically throws when dividing by 0
// uint256 c =
a /
b;
// uint256 c =
_a / _
b;
// assert(
a == b * c + a %
b); // There is no case in which this doesn't hold
// assert(
_a == _b * c + _a % _
b); // There is no case in which this doesn't hold
return
a /
b;
return
_a / _
b;
}
}
/**
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
*/
function sub(uint256
a, uint256
b) internal pure returns (uint256) {
function sub(uint256
_a, uint256 _
b) internal pure returns (uint256) {
assert(
b <=
a);
assert(
_b <= _
a);
return
a -
b;
return
_a - _
b;
}
}
/**
/**
* @dev Adds two numbers, throws on overflow.
* @dev Adds two numbers, throws on overflow.
*/
*/
function add(uint256
a, uint256
b) internal pure returns (uint256 c) {
function add(uint256
_a, uint256 _
b) internal pure returns (uint256 c) {
c =
a +
b;
c =
_a + _
b;
assert(c >= a);
assert(c >=
_
a);
return c;
return c;
}
}
}
}
contracts/mocks/BasicTokenMock.sol
View file @
27653502
...
@@ -7,9 +7,9 @@ import "../token/ERC20/BasicToken.sol";
...
@@ -7,9 +7,9 @@ import "../token/ERC20/BasicToken.sol";
// mock class using BasicToken
// mock class using BasicToken
contract BasicTokenMock is BasicToken {
contract BasicTokenMock is BasicToken {
constructor(address
initialAccount, uint256
initialBalance) public {
constructor(address
_initialAccount, uint256 _
initialBalance) public {
balances[
initialAccount] =
initialBalance;
balances[
_initialAccount] = _
initialBalance;
totalSupply_ = initialBalance;
totalSupply_ =
_
initialBalance;
}
}
}
}
contracts/mocks/BurnableTokenMock.sol
View file @
27653502
...
@@ -5,9 +5,9 @@ import "../token/ERC20/BurnableToken.sol";
...
@@ -5,9 +5,9 @@ import "../token/ERC20/BurnableToken.sol";
contract BurnableTokenMock is BurnableToken {
contract BurnableTokenMock is BurnableToken {
constructor(address
initialAccount, uint
initialBalance) public {
constructor(address
_initialAccount, uint _
initialBalance) public {
balances[
initialAccount] =
initialBalance;
balances[
_initialAccount] = _
initialBalance;
totalSupply_ = initialBalance;
totalSupply_ =
_
initialBalance;
}
}
}
}
contracts/mocks/ECRecoveryMock.sol
View file @
27653502
...
@@ -7,19 +7,19 @@ import "../ECRecovery.sol";
...
@@ -7,19 +7,19 @@ import "../ECRecovery.sol";
contract ECRecoveryMock {
contract ECRecoveryMock {
using ECRecovery for bytes32;
using ECRecovery for bytes32;
function recover(bytes32
hash, bytes
sig)
function recover(bytes32
_hash, bytes _
sig)
public
public
pure
pure
returns (address)
returns (address)
{
{
return
hash.recover(
sig);
return
_hash.recover(_
sig);
}
}
function toEthSignedMessageHash(bytes32 hash)
function toEthSignedMessageHash(bytes32
_
hash)
public
public
pure
pure
returns (bytes32)
returns (bytes32)
{
{
return hash.toEthSignedMessageHash();
return
_
hash.toEthSignedMessageHash();
}
}
}
}
contracts/mocks/ERC223TokenMock.sol
View file @
27653502
...
@@ -10,9 +10,9 @@ contract ERC223ContractInterface {
...
@@ -10,9 +10,9 @@ contract ERC223ContractInterface {
contract ERC223TokenMock is BasicToken {
contract ERC223TokenMock is BasicToken {
constructor(address
initialAccount, uint256
initialBalance) public {
constructor(address
_initialAccount, uint256 _
initialBalance) public {
balances[
initialAccount] =
initialBalance;
balances[
_initialAccount] = _
initialBalance;
totalSupply_ = initialBalance;
totalSupply_ =
_
initialBalance;
}
}
// ERC223 compatible transfer function (except the name)
// ERC223 compatible transfer function (except the name)
...
...
contracts/mocks/MathMock.sol
View file @
27653502
...
@@ -8,19 +8,19 @@ contract MathMock {
...
@@ -8,19 +8,19 @@ contract MathMock {
uint64 public result64;
uint64 public result64;
uint256 public result256;
uint256 public result256;
function max64(uint64
a, uint64
b) public {
function max64(uint64
_a, uint64 _
b) public {
result64 = Math.max64(
a,
b);
result64 = Math.max64(
_a, _
b);
}
}
function min64(uint64
a, uint64
b) public {
function min64(uint64
_a, uint64 _
b) public {
result64 = Math.min64(
a,
b);
result64 = Math.min64(
_a, _
b);
}
}
function max256(uint256
a, uint256
b) public {
function max256(uint256
_a, uint256 _
b) public {
result256 = Math.max256(
a,
b);
result256 = Math.max256(
_a, _
b);
}
}
function min256(uint256
a, uint256
b) public {
function min256(uint256
_a, uint256 _
b) public {
result256 = Math.min256(
a,
b);
result256 = Math.min256(
_a, _
b);
}
}
}
}
contracts/mocks/MessageHelper.sol
View file @
27653502
...
@@ -7,30 +7,30 @@ contract MessageHelper {
...
@@ -7,30 +7,30 @@ contract MessageHelper {
event Buy(bytes32 b32, uint256 number, string text, uint256 value);
event Buy(bytes32 b32, uint256 number, string text, uint256 value);
function showMessage(
function showMessage(
bytes32 message,
bytes32
_
message,
uint256 number,
uint256
_
number,
string text
string
_
text
)
)
public
public
returns (bool)
returns (bool)
{
{
emit Show(
message, number,
text);
emit Show(
_message, _number, _
text);
return true;
return true;
}
}
function buyMessage(
function buyMessage(
bytes32 message,
bytes32
_
message,
uint256 number,
uint256
_
number,
string text
string
_
text
)
)
public
public
payable
payable
returns (bool)
returns (bool)
{
{
emit Buy(
emit Buy(
message,
_
message,
number,
_
number,
text,
_
text,
msg.value);
msg.value);
return true;
return true;
}
}
...
@@ -39,9 +39,9 @@ contract MessageHelper {
...
@@ -39,9 +39,9 @@ contract MessageHelper {
require(false);
require(false);
}
}
function call(address
to, bytes
data) public returns (bool) {
function call(address
_to, bytes _
data) public returns (bool) {
// solium-disable-next-line security/no-low-level-calls
// solium-disable-next-line security/no-low-level-calls
if (
to.call(
data))
if (
_to.call(_
data))
return true;
return true;
else
else
return false;
return false;
...
...
contracts/mocks/PausableTokenMock.sol
View file @
27653502
...
@@ -6,8 +6,8 @@ import "../token/ERC20/PausableToken.sol";
...
@@ -6,8 +6,8 @@ import "../token/ERC20/PausableToken.sol";
// mock class using PausableToken
// mock class using PausableToken
contract PausableTokenMock is PausableToken {
contract PausableTokenMock is PausableToken {
constructor(address
initialAccount, uint
initialBalance) public {
constructor(address
_initialAccount, uint _
initialBalance) public {
balances[
initialAccount] =
initialBalance;
balances[
_initialAccount] = _
initialBalance;
}
}
}
}
contracts/mocks/PullPaymentMock.sol
View file @
27653502
...
@@ -10,8 +10,8 @@ contract PullPaymentMock is PullPayment {
...
@@ -10,8 +10,8 @@ contract PullPaymentMock is PullPayment {
constructor() public payable { }
constructor() public payable { }
// test helper function to call asyncTransfer
// test helper function to call asyncTransfer
function callTransfer(address
dest, uint256
amount) public {
function callTransfer(address
_dest, uint256 _
amount) public {
asyncTransfer(
dest,
amount);
asyncTransfer(
_dest, _
amount);
}
}
}
}
contracts/mocks/ReentrancyAttack.sol
View file @
27653502
...
@@ -3,9 +3,9 @@ pragma solidity ^0.4.24;
...
@@ -3,9 +3,9 @@ pragma solidity ^0.4.24;
contract ReentrancyAttack {
contract ReentrancyAttack {
function callSender(bytes4 data) public {
function callSender(bytes4
_
data) public {
// solium-disable-next-line security/no-low-level-calls
// solium-disable-next-line security/no-low-level-calls
require(msg.sender.call(abi.encodeWithSelector(data)));
require(msg.sender.call(abi.encodeWithSelector(
_
data)));
}
}
}
}
contracts/mocks/ReentrancyMock.sol
View file @
27653502
...
@@ -16,26 +16,26 @@ contract ReentrancyMock is ReentrancyGuard {
...
@@ -16,26 +16,26 @@ contract ReentrancyMock is ReentrancyGuard {
count();
count();
}
}
function countLocalRecursive(uint256 n) public nonReentrant {
function countLocalRecursive(uint256
_
n) public nonReentrant {
if (n > 0) {
if (
_
n > 0) {
count();
count();
countLocalRecursive(n - 1);
countLocalRecursive(
_
n - 1);
}
}
}
}
function countThisRecursive(uint256 n) public nonReentrant {
function countThisRecursive(uint256
_
n) public nonReentrant {
if (n > 0) {
if (
_
n > 0) {
count();
count();
// solium-disable-next-line security/no-low-level-calls
// solium-disable-next-line security/no-low-level-calls
bool result = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
bool result = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)",
_
n - 1));
require(result == true);
require(result == true);
}
}
}
}
function countAndCall(ReentrancyAttack attacker) public nonReentrant {
function countAndCall(ReentrancyAttack
_
attacker) public nonReentrant {
count();
count();
bytes4 func = bytes4(keccak256("callback()"));
bytes4 func = bytes4(keccak256("callback()"));
attacker.callSender(func);
_
attacker.callSender(func);
}
}
function count() private {
function count() private {
...
...
contracts/mocks/SafeMathMock.sol
View file @
27653502
...
@@ -6,19 +6,19 @@ import "../math/SafeMath.sol";
...
@@ -6,19 +6,19 @@ import "../math/SafeMath.sol";
contract SafeMathMock {
contract SafeMathMock {
function mul(uint256
a, uint256
b) public pure returns (uint256) {
function mul(uint256
_a, uint256 _
b) public pure returns (uint256) {
return SafeMath.mul(
a,
b);
return SafeMath.mul(
_a, _
b);
}
}
function div(uint256
a, uint256
b) public pure returns (uint256) {
function div(uint256
_a, uint256 _
b) public pure returns (uint256) {
return SafeMath.div(
a,
b);
return SafeMath.div(
_a, _
b);
}
}
function sub(uint256
a, uint256
b) public pure returns (uint256) {
function sub(uint256
_a, uint256 _
b) public pure returns (uint256) {
return SafeMath.sub(
a,
b);
return SafeMath.sub(
_a, _
b);
}
}
function add(uint256
a, uint256
b) public pure returns (uint256) {
function add(uint256
_a, uint256 _
b) public pure returns (uint256) {
return SafeMath.add(
a,
b);
return SafeMath.add(
_a, _
b);
}
}
}
}
contracts/mocks/StandardBurnableTokenMock.sol
View file @
27653502
...
@@ -5,9 +5,9 @@ import "../token/ERC20/StandardBurnableToken.sol";
...
@@ -5,9 +5,9 @@ import "../token/ERC20/StandardBurnableToken.sol";
contract StandardBurnableTokenMock is StandardBurnableToken {
contract StandardBurnableTokenMock is StandardBurnableToken {
constructor(address
initialAccount, uint
initialBalance) public {
constructor(address
_initialAccount, uint _
initialBalance) public {
balances[
initialAccount] =
initialBalance;
balances[
_initialAccount] = _
initialBalance;
totalSupply_ = initialBalance;
totalSupply_ =
_
initialBalance;
}
}
}
}
contracts/mocks/StandardTokenMock.sol
View file @
27653502
...
@@ -6,9 +6,9 @@ import "../token/ERC20/StandardToken.sol";
...
@@ -6,9 +6,9 @@ import "../token/ERC20/StandardToken.sol";
// mock class using StandardToken
// mock class using StandardToken
contract StandardTokenMock is StandardToken {
contract StandardTokenMock is StandardToken {
constructor(address
initialAccount, uint256
initialBalance) public {
constructor(address
_initialAccount, uint256 _
initialBalance) public {
balances[
initialAccount] =
initialBalance;
balances[
_initialAccount] = _
initialBalance;
totalSupply_ = initialBalance;
totalSupply_ =
_
initialBalance;
}
}
}
}
contracts/ownership/CanReclaimToken.sol
View file @
27653502
...
@@ -16,11 +16,11 @@ contract CanReclaimToken is Ownable {
...
@@ -16,11 +16,11 @@ contract CanReclaimToken is Ownable {
/**
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
* @param
_
token ERC20Basic The address of the token contract
*/
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
function reclaimToken(ERC20Basic
_
token) external onlyOwner {
uint256 balance = token.balanceOf(this);
uint256 balance =
_
token.balanceOf(this);
token.safeTransfer(owner, balance);
_
token.safeTransfer(owner, balance);
}
}
}
}
contracts/ownership/Contactable.sol
View file @
27653502
...
@@ -14,9 +14,9 @@ contract Contactable is Ownable {
...
@@ -14,9 +14,9 @@ contract Contactable is Ownable {
/**
/**
* @dev Allows the owner to set a string with their contact information.
* @dev Allows the owner to set a string with their contact information.
* @param info The contact information to attach to the contract.
* @param
_
info The contact information to attach to the contract.
*/
*/
function setContactInformation(string info) onlyOwner public {
function setContactInformation(string
_
info) onlyOwner public {
contactInformation = info;
contactInformation =
_
info;
}
}
}
}
contracts/ownership/HasNoContracts.sol
View file @
27653502
...
@@ -13,10 +13,10 @@ contract HasNoContracts is Ownable {
...
@@ -13,10 +13,10 @@ contract HasNoContracts is Ownable {
/**
/**
* @dev Reclaim ownership of Ownable contracts
* @dev Reclaim ownership of Ownable contracts
* @param contractAddr The address of the Ownable to be reclaimed.
* @param
_
contractAddr The address of the Ownable to be reclaimed.
*/
*/
function reclaimContract(address contractAddr) external onlyOwner {
function reclaimContract(address
_
contractAddr) external onlyOwner {
Ownable contractInst = Ownable(contractAddr);
Ownable contractInst = Ownable(
_
contractAddr);
contractInst.transferOwnership(owner);
contractInst.transferOwnership(owner);
}
}
}
}
contracts/ownership/HasNoTokens.sol
View file @
27653502
...
@@ -14,14 +14,14 @@ contract HasNoTokens is CanReclaimToken {
...
@@ -14,14 +14,14 @@ contract HasNoTokens is CanReclaimToken {
/**
/**
* @dev Reject all ERC223 compatible tokens
* @dev Reject all ERC223 compatible tokens
* @param
from_
address The address that is transferring the tokens
* @param
_from
address The address that is transferring the tokens
* @param
value_
uint256 the amount of the specified token
* @param
_value
uint256 the amount of the specified token
* @param
data_
Bytes The data passed from the caller.
* @param
_data
Bytes The data passed from the caller.
*/
*/
function tokenFallback(address
from_, uint256 value_, bytes data_
) external pure {
function tokenFallback(address
_from, uint256 _value, bytes _data
) external pure {
from_
;
_from
;
value_
;
_value
;
data_
;
_data
;
revert();
revert();
}
}
...
...
contracts/ownership/Heritable.sol
View file @
27653502
...
@@ -50,11 +50,11 @@ contract Heritable is Ownable {
...
@@ -50,11 +50,11 @@ contract Heritable is Ownable {
setHeartbeatTimeout(_heartbeatTimeout);
setHeartbeatTimeout(_heartbeatTimeout);
}
}
function setHeir(address newHeir) public onlyOwner {
function setHeir(address
_
newHeir) public onlyOwner {
require(newHeir != owner);
require(
_
newHeir != owner);
heartbeat();
heartbeat();
emit HeirChanged(owner, newHeir);
emit HeirChanged(owner,
_
newHeir);
heir_ = newHeir;
heir_ =
_
newHeir;
}
}
/**
/**
...
@@ -113,11 +113,11 @@ contract Heritable is Ownable {
...
@@ -113,11 +113,11 @@ contract Heritable is Ownable {
timeOfDeath_ = 0;
timeOfDeath_ = 0;
}
}
function setHeartbeatTimeout(uint256 newHeartbeatTimeout)
function setHeartbeatTimeout(uint256
_
newHeartbeatTimeout)
internal onlyOwner
internal onlyOwner
{
{
require(ownerLives());
require(ownerLives());
heartbeatTimeout_ = newHeartbeatTimeout;
heartbeatTimeout_ =
_
newHeartbeatTimeout;
}
}
function ownerLives() internal view returns (bool) {
function ownerLives() internal view returns (bool) {
...
...
contracts/token/ERC20/ERC20.sol
View file @
27653502
...
@@ -8,13 +8,13 @@ import "./ERC20Basic.sol";
...
@@ -8,13 +8,13 @@ import "./ERC20Basic.sol";
* @dev see https://github.com/ethereum/EIPs/issues/20
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
*/
contract ERC20 is ERC20Basic {
contract ERC20 is ERC20Basic {
function allowance(address
owner, address
spender)
function allowance(address
_owner, address _
spender)
public view returns (uint256);
public view returns (uint256);
function transferFrom(address
from, address to, uint256
value)
function transferFrom(address
_from, address _to, uint256 _
value)
public returns (bool);
public returns (bool);
function approve(address
spender, uint256
value) public returns (bool);
function approve(address
_spender, uint256 _
value) public returns (bool);
event Approval(
event Approval(
address indexed owner,
address indexed owner,
address indexed spender,
address indexed spender,
...
...
contracts/token/ERC20/ERC20Basic.sol
View file @
27653502
...
@@ -8,7 +8,7 @@ pragma solidity ^0.4.24;
...
@@ -8,7 +8,7 @@ pragma solidity ^0.4.24;
*/
*/
contract ERC20Basic {
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function balanceOf(address
_
who) public view returns (uint256);
function transfer(address
to, uint256
value) public returns (bool);
function transfer(address
_to, uint256 _
value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
}
contracts/token/ERC20/RBACMintableToken.sol
View file @
27653502
...
@@ -25,17 +25,17 @@ contract RBACMintableToken is MintableToken, RBAC {
...
@@ -25,17 +25,17 @@ contract RBACMintableToken is MintableToken, RBAC {
/**
/**
* @dev add a minter role to an address
* @dev add a minter role to an address
* @param minter address
* @param
_
minter address
*/
*/
function addMinter(address minter) onlyOwner public {
function addMinter(address
_
minter) onlyOwner public {
addRole(minter, ROLE_MINTER);
addRole(
_
minter, ROLE_MINTER);
}
}
/**
/**
* @dev remove a minter role from an address
* @dev remove a minter role from an address
* @param minter address
* @param
_
minter address
*/
*/
function removeMinter(address minter) onlyOwner public {
function removeMinter(address
_
minter) onlyOwner public {
removeRole(minter, ROLE_MINTER);
removeRole(
_
minter, ROLE_MINTER);
}
}
}
}
contracts/token/ERC20/SafeERC20.sol
View file @
27653502
...
@@ -11,22 +11,22 @@ import "./ERC20.sol";
...
@@ -11,22 +11,22 @@ import "./ERC20.sol";
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
*/
library SafeERC20 {
library SafeERC20 {
function safeTransfer(ERC20Basic
token, address to, uint256
value) internal {
function safeTransfer(ERC20Basic
_token, address _to, uint256 _
value) internal {
require(
token.transfer(to,
value));
require(
_token.transfer(_to, _
value));
}
}
function safeTransferFrom(
function safeTransferFrom(
ERC20 token,
ERC20
_
token,
address from,
address
_
from,
address to,
address
_
to,
uint256 value
uint256
_
value
)
)
internal
internal
{
{
require(
token.transferFrom(from, to,
value));
require(
_token.transferFrom(_from, _to, _
value));
}
}
function safeApprove(ERC20
token, address spender, uint256
value) internal {
function safeApprove(ERC20
_token, address _spender, uint256 _
value) internal {
require(
token.approve(spender,
value));
require(
_token.approve(_spender, _
value));
}
}
}
}
contracts/token/ERC20/TokenVesting.sol
View file @
27653502
...
@@ -64,16 +64,16 @@ contract TokenVesting is Ownable {
...
@@ -64,16 +64,16 @@ contract TokenVesting is Ownable {
/**
/**
* @notice Transfers vested tokens to beneficiary.
* @notice Transfers vested tokens to beneficiary.
* @param token ERC20 token which is being vested
* @param
_
token ERC20 token which is being vested
*/
*/
function release(ERC20Basic token) public {
function release(ERC20Basic
_
token) public {
uint256 unreleased = releasableAmount(token);
uint256 unreleased = releasableAmount(
_
token);
require(unreleased > 0);
require(unreleased > 0);
released[
token] = released[
token].add(unreleased);
released[
_token] = released[_
token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
_
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
emit Released(unreleased);
}
}
...
@@ -81,43 +81,43 @@ contract TokenVesting is Ownable {
...
@@ -81,43 +81,43 @@ contract TokenVesting is Ownable {
/**
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
* @param
_
token ERC20 token which is being vested
*/
*/
function revoke(ERC20Basic token) public onlyOwner {
function revoke(ERC20Basic
_
token) public onlyOwner {
require(revocable);
require(revocable);
require(!revoked[token]);
require(!revoked[
_
token]);
uint256 balance = token.balanceOf(this);
uint256 balance =
_
token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 unreleased = releasableAmount(
_
token);
uint256 refund = balance.sub(unreleased);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
revoked[
_
token] = true;
token.safeTransfer(owner, refund);
_
token.safeTransfer(owner, refund);
emit Revoked();
emit Revoked();
}
}
/**
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
* @param
_
token ERC20 token which is being vested
*/
*/
function releasableAmount(ERC20Basic token) public view returns (uint256) {
function releasableAmount(ERC20Basic
_
token) public view returns (uint256) {
return vestedAmount(
token).sub(released[
token]);
return vestedAmount(
_token).sub(released[_
token]);
}
}
/**
/**
* @dev Calculates the amount that has already vested.
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
* @param
_
token ERC20 token which is being vested
*/
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
function vestedAmount(ERC20Basic
_
token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 currentBalance =
_
token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
uint256 totalBalance = currentBalance.add(released[
_
token]);
if (block.timestamp < cliff) {
if (block.timestamp < cliff) {
return 0;
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
} else if (block.timestamp >= start.add(duration) || revoked[
_
token]) {
return totalBalance;
return totalBalance;
} else {
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment