Skip to content

Commit 6b40c91

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 5f88845 + 1186520 commit 6b40c91

File tree

6 files changed

+44
-13
lines changed

6 files changed

+44
-13
lines changed

contracts/crowdsale/distribution/RefundableCrowdsale.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
5050

5151
/**
5252
* @dev Investors can claim refunds here if crowdsale is unsuccessful
53-
* @param beneficiary Whose refund will be claimed.
53+
* @param refundee Whose refund will be claimed.
5454
*/
55-
function claimRefund(address beneficiary) public {
55+
function claimRefund(address refundee) public {
5656
require(finalized());
5757
require(!goalReached());
5858

59-
_escrow.withdraw(beneficiary);
59+
_escrow.withdraw(refundee);
6060
}
6161

6262
/**

contracts/examples/SimpleToken.sol

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
pragma solidity ^0.4.24;
22

33
import "../token/ERC20/ERC20.sol";
4+
import "../token/ERC20/ERC20Detailed.sol";
45

56
/**
67
* @title SimpleToken
78
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
89
* Note they can later distribute these tokens as they wish using `transfer` and other
910
* `ERC20` functions.
1011
*/
11-
contract SimpleToken is ERC20 {
12+
contract SimpleToken is ERC20, ERC20Detailed {
1213

13-
string public constant name = "SimpleToken";
14-
string public constant symbol = "SIM";
15-
uint8 public constant decimals = 18;
16-
17-
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
14+
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
1815

1916
/**
2017
* @dev Constructor that gives msg.sender all of existing tokens.
2118
*/
22-
constructor() public {
19+
constructor() public ERC20Detailed("SimpleToken", "SIM", 18) {
2320
_mint(msg.sender, INITIAL_SUPPLY);
2421
}
2522

contracts/token/ERC20/ERC20.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ contract ERC20 is IERC20 {
171171
* @param value The amount that will be created.
172172
*/
173173
function _mint(address account, uint256 value) internal {
174-
require(account != 0);
174+
require(account != address(0));
175175
_totalSupply = _totalSupply.add(value);
176176
_balances[account] = _balances[account].add(value);
177177
emit Transfer(address(0), account, value);
@@ -184,7 +184,7 @@ contract ERC20 is IERC20 {
184184
* @param value The amount that will be burnt.
185185
*/
186186
function _burn(address account, uint256 value) internal {
187-
require(account != 0);
187+
require(account != address(0));
188188
require(value <= _balances[account]);
189189

190190
_totalSupply = _totalSupply.sub(value);

contracts/token/ERC721/ERC721Burnable.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ pragma solidity ^0.4.24;
22

33
import "./ERC721.sol";
44

5+
/**
6+
* @title ERC721 Burnable Token
7+
* @dev ERC721 Token that can be irreversibly burned (destroyed).
8+
*/
59
contract ERC721Burnable is ERC721 {
10+
11+
/**
12+
* @dev Burns a specific ERC721 token.
13+
* @param tokenId uint256 id of the ERC721 token to be burned.
14+
*/
615
function burn(uint256 tokenId)
716
public
817
{

contracts/token/ERC721/ERC721Enumerable.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import "./IERC721Enumerable.sol";
44
import "./ERC721.sol";
55
import "../../introspection/ERC165.sol";
66

7+
/**
8+
* @title ERC-721 Non-Fungible Token with optional enumeration extension logic
9+
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
10+
*/
711
contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
812
// Mapping from owner to list of owned token IDs
913
mapping(address => uint256[]) private _ownedTokens;

test/math/SafeMath.test.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,20 @@ contract('SafeMath', function () {
5353
(await this.safeMath.mul(a, b)).should.be.bignumber.equal(a.times(b));
5454
});
5555

56-
it('handles a zero product correctly', async function () {
56+
it('handles a zero product correctly (first number as zero)', async function () {
5757
const a = new BigNumber(0);
5858
const b = new BigNumber(5678);
5959

6060
(await this.safeMath.mul(a, b)).should.be.bignumber.equal(a.times(b));
6161
});
6262

63+
it('handles a zero product correctly (second number as zero)', async function () {
64+
const a = new BigNumber(5678);
65+
const b = new BigNumber(0);
66+
67+
(await this.safeMath.mul(a, b)).should.be.bignumber.equal(a.times(b));
68+
});
69+
6370
it('throws a revert error on multiplication overflow', async function () {
6471
const a = MAX_UINT256;
6572
const b = new BigNumber(2);
@@ -76,6 +83,20 @@ contract('SafeMath', function () {
7683
(await this.safeMath.div(a, b)).should.be.bignumber.equal(a.div(b));
7784
});
7885

86+
it('divides zero correctly', async function () {
87+
const a = new BigNumber(0);
88+
const b = new BigNumber(5678);
89+
90+
(await this.safeMath.div(a, b)).should.be.bignumber.equal(0);
91+
});
92+
93+
it('returns complete number result on non-even division', async function () {
94+
const a = new BigNumber(7000);
95+
const b = new BigNumber(5678);
96+
97+
(await this.safeMath.div(a, b)).should.be.bignumber.equal(1);
98+
});
99+
79100
it('throws a revert error on zero division', async function () {
80101
const a = new BigNumber(5678);
81102
const b = new BigNumber(0);

0 commit comments

Comments
 (0)