* Add IntelliJ IDE config to .gitignore * Fix variable name in ERC20 function comments * Fix typos in Arrays function comment * Fix typos in ownership test names * Fix typo in Pausable test name * Fix grammar in Ownable function comment * Fix grammar in Crowdsale contract comment * Fix typo in Counters contract comment * Fix typo in ERC721Enumerable comment * Fix typo in ERC721PausedToken test name * Fix typo in Crowdsale function comment * Fix typo in IncreasingPriceCrowdsale function comment * Fix grammar in IncreasingPriceCrowdsale test name * Fix typo in AllowanceCrowdsale test name * Fix typo in RefundEscrow function comment * Fix typo in ERC20Migrator contract comment * Fix typos in SignatureBouncer comments * Fix typo in SignedSafeMath test name * Fix typo in TokenVesting contract comment * Move Ownable comment from @notice section to @dev The Ownable contract has a comment explaining that renouncing ownership will prevent execution of functions with the onlyOwner modifier. This commit moves that comment to the @dev section and replaces it with a description suitable for a generic user. * Clarify purpose of ERC20 transfer function * Clarify registration of ERC721Enumerable interface * Clarify purpose of AllowanceCrowdsale test * Increase specificity of inheritance comments FinalizableCrowdsale and RefundableCrowsale both have comments indicating that they are extensions of the Crowdsale contract. This commit refines those comments to the most immediate ancestor ( TimedCrowdsale and RefundableCrowdsale respectively ) * Remove unused parameter in PaymentSplitter test * Rename parameter in SignatureBouncer functions The SignatureBouncer contract has modifiers to validate the message sender is authorised to perform an action. They pass msg.sender to internal functions as the variable `account`, but the function comments refer to the variable as `sender` This commit changes the variable name to `sender` * Clarify comments in SignatureBouncer functions The SignatureBouncer has comments that use the description `sender` to refer to the variable `account`. This commit updates the comments for consistency. Maintainer Note: this reverts changes in the previous commit, which renamed the variable `account` instead.
This commit is contained in:
committed by
Nicolás Venturo
parent
a1f168be96
commit
0dded493a0
3
.gitignore
vendored
3
.gitignore
vendored
@ -37,3 +37,6 @@ build/
|
||||
|
||||
# truffle
|
||||
.node-xmlhttprequest-*
|
||||
|
||||
# IntelliJ IDE
|
||||
.idea
|
||||
|
||||
@ -11,8 +11,8 @@ import "../utils/ReentrancyGuard.sol";
|
||||
* allowing investors to purchase tokens with ether. This contract implements
|
||||
* such functionality in its most fundamental form and can be extended to provide additional
|
||||
* functionality and/or custom behavior.
|
||||
* The external interface represents the basic interface for purchasing tokens, and conform
|
||||
* the base architecture for crowdsales. They are *not* intended to be modified / overridden.
|
||||
* The external interface represents the basic interface for purchasing tokens, and conforms
|
||||
* the base architecture for crowdsales. It is *not* intended to be modified / overridden.
|
||||
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
|
||||
* the methods to add functionality. Consider using 'super' where appropriate to concatenate
|
||||
* behavior.
|
||||
@ -65,7 +65,7 @@ contract Crowdsale is ReentrancyGuard {
|
||||
|
||||
/**
|
||||
* @dev fallback function ***DO NOT OVERRIDE***
|
||||
* Note that other contracts will transfer fund with a base gas stipend
|
||||
* Note that other contracts will transfer funds with a base gas stipend
|
||||
* of 2300, which is not enough to call buyTokens. Consider calling
|
||||
* buyTokens directly when purchasing tokens from a contract.
|
||||
*/
|
||||
|
||||
@ -5,7 +5,7 @@ import "../validation/TimedCrowdsale.sol";
|
||||
|
||||
/**
|
||||
* @title FinalizableCrowdsale
|
||||
* @dev Extension of Crowdsale with a one-off finalization action, where one
|
||||
* @dev Extension of TimedCrowdsale with a one-off finalization action, where one
|
||||
* can do extra work after finishing.
|
||||
*/
|
||||
contract FinalizableCrowdsale is TimedCrowdsale {
|
||||
|
||||
@ -6,8 +6,8 @@ import "../../payment/escrow/RefundEscrow.sol";
|
||||
|
||||
/**
|
||||
* @title RefundableCrowdsale
|
||||
* @dev Extension of Crowdsale contract that adds a funding goal, and the possibility of users getting a refund
|
||||
* if goal is not met.
|
||||
* @dev Extension of FinalizableCrowdsale contract that adds a funding goal, and the possibility of users
|
||||
* getting a refund if goal is not met.
|
||||
*
|
||||
* Deprecated, use RefundablePostDeliveryCrowdsale instead. Note that if you allow tokens to be traded before the goal
|
||||
* is met, then an attack is possible in which the attacker purchases tokens from the crowdsale and when they sees that
|
||||
|
||||
@ -28,7 +28,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
|
||||
}
|
||||
|
||||
/**
|
||||
* The base rate function is overridden to revert, since this crowdsale doens't use it, and
|
||||
* The base rate function is overridden to revert, since this crowdsale doesn't use it, and
|
||||
* all calls to it are a mistake.
|
||||
*/
|
||||
function rate() public view returns (uint256) {
|
||||
|
||||
@ -8,7 +8,7 @@ import "../math/SafeMath.sol";
|
||||
* @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
|
||||
* of elements in a mapping, issuing ERC721 ids, or counting request ids
|
||||
*
|
||||
* Include with `using Counter for Counter.Counter;`
|
||||
* Include with `using Counters for Counters.Counter;`
|
||||
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the SafeMath
|
||||
* overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
|
||||
* directly accessed.
|
||||
|
||||
@ -17,7 +17,7 @@ import "../math/Math.sol";
|
||||
* OpenZeppelin's ERC20Mintable, but the only functions that are needed are
|
||||
* `isMinter(address)` and `mint(address, amount)`. The migrator will check
|
||||
* that it is a minter for the token.
|
||||
* The balance from the legacy token will be transfered to the migrator, as it
|
||||
* The balance from the legacy token will be transferred to the migrator, as it
|
||||
* is migrated, and remain there forever.
|
||||
* Although this contract can be used in many different scenarios, the main
|
||||
* motivation was to provide a way to migrate ERC20 tokens into an upgradeable
|
||||
|
||||
@ -29,7 +29,7 @@ import "../cryptography/ECDSA.sol";
|
||||
* @notice A method that uses the `onlyValidSignatureAndData` modifier must make
|
||||
* the _signature parameter the "last" parameter. You cannot sign a message that
|
||||
* has its own signature in it so the last 128 bytes of msg.data (which
|
||||
* represents the length of the _signature data and the _signaature data itself)
|
||||
* represents the length of the _signature data and the _signature data itself)
|
||||
* is ignored when validating. Also non fixed sized parameters make constructing
|
||||
* the data in the signature much more complex.
|
||||
* See https://ethereum.stackexchange.com/a/50616 for more details.
|
||||
@ -56,7 +56,7 @@ contract SignatureBouncer is SignerRole {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev requires that a valid signature with a specifed method of a signer was provided
|
||||
* @dev requires that a valid signature with a specified method of a signer was provided
|
||||
*/
|
||||
modifier onlyValidSignatureAndMethod(bytes memory signature) {
|
||||
require(_isValidSignatureAndMethod(msg.sender, signature));
|
||||
@ -64,7 +64,7 @@ contract SignatureBouncer is SignerRole {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev requires that a valid signature with a specifed method and params of a signer was provided
|
||||
* @dev requires that a valid signature with a specified method and params of a signer was provided
|
||||
*/
|
||||
modifier onlyValidSignatureAndData(bytes memory signature) {
|
||||
require(_isValidSignatureAndData(msg.sender, signature));
|
||||
@ -72,7 +72,7 @@ contract SignatureBouncer is SignerRole {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev is the signature of `this + sender` from a signer?
|
||||
* @dev is the signature of `this + account` from a signer?
|
||||
* @return bool
|
||||
*/
|
||||
function _isValidSignature(address account, bytes memory signature) internal view returns (bool) {
|
||||
@ -80,7 +80,7 @@ contract SignatureBouncer is SignerRole {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev is the signature of `this + sender + methodId` from a signer?
|
||||
* @dev is the signature of `this + account + methodId` from a signer?
|
||||
* @return bool
|
||||
*/
|
||||
function _isValidSignatureAndMethod(address account, bytes memory signature) internal view returns (bool) {
|
||||
@ -92,7 +92,7 @@ contract SignatureBouncer is SignerRole {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev is the signature of `this + sender + methodId + params(s)` from a signer?
|
||||
* @dev is the signature of `this + account + methodId + params(s)` from a signer?
|
||||
* @notice the signature parameter of the method being validated must be the "last" parameter
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@ -12,7 +12,7 @@ import "../math/SafeMath.sol";
|
||||
*/
|
||||
contract TokenVesting is Ownable {
|
||||
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
|
||||
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree).Therefore,
|
||||
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
|
||||
// it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a
|
||||
// cliff period of a year and a duration of four years, are safe to use.
|
||||
// solhint-disable not-rely-on-time
|
||||
|
||||
@ -43,9 +43,10 @@ contract Ownable {
|
||||
|
||||
/**
|
||||
* @dev Allows the current owner to relinquish control of the contract.
|
||||
* @notice Renouncing to ownership will leave the contract without an owner.
|
||||
* It will not be possible to call the functions with the `onlyOwner`
|
||||
* modifier anymore.
|
||||
* @notice Renouncing ownership will leave the contract without an owner,
|
||||
* thereby removing any functionality that is only available to the owner.
|
||||
*/
|
||||
function renounceOwnership() public onlyOwner {
|
||||
emit OwnershipTransferred(_owner, address(0));
|
||||
|
||||
@ -83,7 +83,7 @@ contract RefundEscrow is ConditionalEscrow {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns whether refundees can withdraw their deposits (be refunded). The overriden function receives a
|
||||
* @dev Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a
|
||||
* 'payee' argument, but we ignore it here since the condition is global, not per-payee.
|
||||
*/
|
||||
function withdrawalAllowed(address) public view returns (bool) {
|
||||
|
||||
@ -51,7 +51,7 @@ contract ERC20 is IERC20 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfer token for a specified address
|
||||
* @dev Transfer token to a specified address
|
||||
* @param to The address to transfer to.
|
||||
* @param value The amount to be transferred.
|
||||
*/
|
||||
@ -90,7 +90,7 @@ contract ERC20 is IERC20 {
|
||||
|
||||
/**
|
||||
* @dev Increase the amount of tokens that an owner allowed to a spender.
|
||||
* approve should be called when allowed_[_spender] == 0. To increment
|
||||
* approve should be called when _allowed[msg.sender][spender] == 0. To increment
|
||||
* allowed value is better to use this function to avoid 2 calls (and wait until
|
||||
* the first transaction is mined)
|
||||
* From MonolithDAO Token.sol
|
||||
@ -105,7 +105,7 @@ contract ERC20 is IERC20 {
|
||||
|
||||
/**
|
||||
* @dev Decrease the amount of tokens that an owner allowed to a spender.
|
||||
* approve should be called when allowed_[_spender] == 0. To decrement
|
||||
* approve should be called when _allowed[msg.sender][spender] == 0. To decrement
|
||||
* allowed value is better to use this function to avoid 2 calls (and wait until
|
||||
* the first transaction is mined)
|
||||
* From MonolithDAO Token.sol
|
||||
|
||||
@ -33,7 +33,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
|
||||
* @dev Constructor function
|
||||
*/
|
||||
constructor () public {
|
||||
// register the supported interface to conform to ERC721 via ERC165
|
||||
// register the supported interface to conform to ERC721Enumerable via ERC165
|
||||
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
|
||||
}
|
||||
|
||||
@ -167,8 +167,8 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
|
||||
// This also deletes the contents at the last position of the array
|
||||
_ownedTokens[from].length--;
|
||||
|
||||
// Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occcupied by
|
||||
// lasTokenId, or just over the end of the array if the token was the last one).
|
||||
// Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by
|
||||
// lastTokenId, or just over the end of the array if the token was the last one).
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -9,8 +9,8 @@ import "../math/Math.sol";
|
||||
*/
|
||||
library Arrays {
|
||||
/**
|
||||
* @dev Upper bound search function which is kind of binary search algoritm. It searches sorted
|
||||
* array to find index of the element value. If element is found then returns it's index otherwise
|
||||
* @dev Upper bound search function which is kind of binary search algorithm. It searches sorted
|
||||
* array to find index of the element value. If element is found then returns its index otherwise
|
||||
* it returns index of first element which is greater than searched value. If searched element is
|
||||
* bigger than any array element function then returns first index after last element (i.e. all
|
||||
* values inside the array are smaller than the target). Complexity O(log n).
|
||||
|
||||
@ -54,7 +54,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
|
||||
});
|
||||
|
||||
describe('check remaining allowance', function () {
|
||||
it('should report correct allowace left', async function () {
|
||||
it('should report correct allowance left', async function () {
|
||||
const remainingAllowance = tokenAllowance.sub(expectedTokenAmount);
|
||||
await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
|
||||
(await this.crowdsale.remainingTokens()).should.be.bignumber.equal(remainingAllowance);
|
||||
@ -72,7 +72,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
|
||||
});
|
||||
});
|
||||
|
||||
describe('when token wallet is different from token address', function () {
|
||||
describe('when token wallet is the zero address', function () {
|
||||
it('creation reverts', async function () {
|
||||
this.token = await SimpleToken.new({ from: tokenWallet });
|
||||
await shouldFail.reverting(AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, ZERO_ADDRESS));
|
||||
|
||||
@ -31,7 +31,7 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser])
|
||||
));
|
||||
});
|
||||
|
||||
it('reverts with a final equal to the initial rate', async function () {
|
||||
it('reverts with a final rate equal to the initial rate', async function () {
|
||||
await shouldFail.reverting(IncreasingPriceCrowdsaleImpl.new(
|
||||
this.startTime, this.closingTime, wallet, this.token.address, initialRate, initialRate
|
||||
));
|
||||
|
||||
@ -19,7 +19,7 @@ contract('SignedSafeMath', function () {
|
||||
}
|
||||
|
||||
describe('add', function () {
|
||||
it('adds correctly if it does not overflow and the result is positve', async function () {
|
||||
it('adds correctly if it does not overflow and the result is positive', async function () {
|
||||
const a = new BN('1234');
|
||||
const b = new BN('5678');
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ contract('Pausable', function ([_, pauser, otherPauser, anyone, ...otherAccounts
|
||||
shouldBehaveLikePublicRole(pauser, otherPauser, otherAccounts, 'pauser');
|
||||
});
|
||||
|
||||
context('when unapused', function () {
|
||||
context('when unpaused', function () {
|
||||
beforeEach(async function () {
|
||||
(await this.pausable.paused()).should.equal(false);
|
||||
});
|
||||
|
||||
@ -16,7 +16,7 @@ function shouldBehaveLikeOwnable (owner, [anyone]) {
|
||||
(await this.ownable.isOwner({ from: anyone })).should.be.equal(true);
|
||||
});
|
||||
|
||||
it('should prevent non-owners from transfering', async function () {
|
||||
it('should prevent non-owners from transferring', async function () {
|
||||
await shouldFail.reverting(this.ownable.transferOwnership(anyone, { from: anyone }));
|
||||
});
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ contract('Secondary', function ([_, primary, newPrimary, anyone]) {
|
||||
(await this.secondary.primary()).should.equal(newPrimary);
|
||||
});
|
||||
|
||||
it('reverts when transfering to the null address', async function () {
|
||||
it('reverts when transferring to the null address', async function () {
|
||||
await shouldFail.reverting(this.secondary.transferPrimary(ZERO_ADDRESS, { from: primary }));
|
||||
});
|
||||
|
||||
|
||||
@ -84,19 +84,19 @@ contract('PaymentSplitter', function ([_, owner, payee1, payee2, payee3, nonpaye
|
||||
const initAmount1 = await balance.current(payee1);
|
||||
const { logs: logs1 } = await this.contract.release(payee1, { gasPrice: 0 });
|
||||
const profit1 = (await balance.current(payee1)).sub(initAmount1);
|
||||
profit1.should.be.bignumber.equal(ether('0.20', 'ether'));
|
||||
profit1.should.be.bignumber.equal(ether('0.20'));
|
||||
expectEvent.inLogs(logs1, 'PaymentReleased', { to: payee1, amount: profit1 });
|
||||
|
||||
const initAmount2 = await balance.current(payee2);
|
||||
const { logs: logs2 } = await this.contract.release(payee2, { gasPrice: 0 });
|
||||
const profit2 = (await balance.current(payee2)).sub(initAmount2);
|
||||
profit2.should.be.bignumber.equal(ether('0.10', 'ether'));
|
||||
profit2.should.be.bignumber.equal(ether('0.10'));
|
||||
expectEvent.inLogs(logs2, 'PaymentReleased', { to: payee2, amount: profit2 });
|
||||
|
||||
const initAmount3 = await balance.current(payee3);
|
||||
const { logs: logs3 } = await this.contract.release(payee3, { gasPrice: 0 });
|
||||
const profit3 = (await balance.current(payee3)).sub(initAmount3);
|
||||
profit3.should.be.bignumber.equal(ether('0.70', 'ether'));
|
||||
profit3.should.be.bignumber.equal(ether('0.70'));
|
||||
expectEvent.inLogs(logs3, 'PaymentReleased', { to: payee3, amount: profit3 });
|
||||
|
||||
// end balance should be zero
|
||||
|
||||
@ -55,7 +55,7 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) {
|
||||
});
|
||||
|
||||
describe('exists', function () {
|
||||
it('should return token existance', async function () {
|
||||
it('should return token existence', async function () {
|
||||
(await this.token.exists(firstTokenId)).should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user