Skip to content

Commit c7c9b8b

Browse files
authored
Merge branch 'master' into remove-jshint
2 parents f3d8af6 + 99e4b08 commit c7c9b8b

File tree

5 files changed

+49
-43
lines changed

5 files changed

+49
-43
lines changed

contracts/crowdsale/emission/MintedCrowdsale.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ contract MintedCrowdsale is Crowdsale {
2222
)
2323
internal
2424
{
25-
require(MintableToken(token).mint(_beneficiary, _tokenAmount));
25+
// Potentially dangerous assumption about the type of the token.
26+
require(MintableToken(address(token)).mint(_beneficiary, _tokenAmount));
2627
}
2728
}

contracts/token/ERC721/ERC721Basic.sol

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,43 @@ import "../../introspection/ERC165.sol";
88
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
99
*/
1010
contract ERC721Basic is ERC165 {
11+
12+
bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd;
13+
/*
14+
* 0x80ac58cd ===
15+
* bytes4(keccak256('balanceOf(address)')) ^
16+
* bytes4(keccak256('ownerOf(uint256)')) ^
17+
* bytes4(keccak256('approve(address,uint256)')) ^
18+
* bytes4(keccak256('getApproved(uint256)')) ^
19+
* bytes4(keccak256('setApprovalForAll(address,bool)')) ^
20+
* bytes4(keccak256('isApprovedForAll(address,address)')) ^
21+
* bytes4(keccak256('transferFrom(address,address,uint256)')) ^
22+
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
23+
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
24+
*/
25+
26+
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
27+
/*
28+
* 0x4f558e79 ===
29+
* bytes4(keccak256('exists(uint256)'))
30+
*/
31+
32+
bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63;
33+
/**
34+
* 0x780e9d63 ===
35+
* bytes4(keccak256('totalSupply()')) ^
36+
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
37+
* bytes4(keccak256('tokenByIndex(uint256)'))
38+
*/
39+
40+
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
41+
/**
42+
* 0x5b5e139f ===
43+
* bytes4(keccak256('name()')) ^
44+
* bytes4(keccak256('symbol()')) ^
45+
* bytes4(keccak256('tokenURI(uint256)'))
46+
*/
47+
1148
event Transfer(
1249
address indexed _from,
1350
address indexed _to,

contracts/token/ERC721/ERC721BasicToken.sol

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,6 @@ import "../../introspection/SupportsInterfaceWithLookup.sol";
1313
*/
1414
contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
1515

16-
bytes4 private constant InterfaceId_ERC721 = 0x80ac58cd;
17-
/*
18-
* 0x80ac58cd ===
19-
* bytes4(keccak256('balanceOf(address)')) ^
20-
* bytes4(keccak256('ownerOf(uint256)')) ^
21-
* bytes4(keccak256('approve(address,uint256)')) ^
22-
* bytes4(keccak256('getApproved(uint256)')) ^
23-
* bytes4(keccak256('setApprovalForAll(address,bool)')) ^
24-
* bytes4(keccak256('isApprovedForAll(address,address)')) ^
25-
* bytes4(keccak256('transferFrom(address,address,uint256)')) ^
26-
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
27-
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
28-
*/
29-
30-
bytes4 private constant InterfaceId_ERC721Exists = 0x4f558e79;
31-
/*
32-
* 0x4f558e79 ===
33-
* bytes4(keccak256('exists(uint256)'))
34-
*/
35-
3616
using SafeMath for uint256;
3717
using AddressUtils for address;
3818

contracts/token/ERC721/ERC721Token.sol

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,6 @@ import "../../introspection/SupportsInterfaceWithLookup.sol";
1313
*/
1414
contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 {
1515

16-
bytes4 private constant InterfaceId_ERC721Enumerable = 0x780e9d63;
17-
/**
18-
* 0x780e9d63 ===
19-
* bytes4(keccak256('totalSupply()')) ^
20-
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
21-
* bytes4(keccak256('tokenByIndex(uint256)'))
22-
*/
23-
24-
bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
25-
/**
26-
* 0x5b5e139f ===
27-
* bytes4(keccak256('name()')) ^
28-
* bytes4(keccak256('symbol()')) ^
29-
* bytes4(keccak256('tokenURI(uint256)'))
30-
*/
31-
3216
// Token name
3317
string internal name_;
3418

test/library/ECRecovery.test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
hashMessage,
44
signMessage,
55
} from '../helpers/sign';
6+
import expectThrow from '../helpers/expectThrow';
67
const ECRecoveryMock = artifacts.require('ECRecoveryMock');
78

89
require('chai')
@@ -54,17 +55,20 @@ contract('ECRecovery', function (accounts) {
5455
const signature = signMessage(accounts[0], TEST_MESSAGE);
5556

5657
// Recover the signer address from the generated message and wrong signature.
57-
const addrRecovered = await ecrecovery.recover(hashMessage('Test'), signature);
58+
const addrRecovered = await ecrecovery.recover(hashMessage('Nope'), signature);
5859
assert.notEqual(accounts[0], addrRecovered);
5960
});
6061

61-
it('recover should fail when a wrong hash is sent', async function () {
62+
it('recover should revert when a small hash is sent', async function () {
6263
// Create the signature using account[0]
6364
let signature = signMessage(accounts[0], TEST_MESSAGE);
64-
65-
// Recover the signer address from the generated message and wrong signature.
66-
const addrRecovered = await ecrecovery.recover(hashMessage(TEST_MESSAGE).substring(2), signature);
67-
addrRecovered.should.eq('0x0000000000000000000000000000000000000000');
65+
try {
66+
await expectThrow(
67+
ecrecovery.recover(hashMessage(TEST_MESSAGE).substring(2), signature)
68+
);
69+
} catch (error) {
70+
// @TODO(shrugs) - remove this once we upgrade to solc^0.5
71+
}
6872
});
6973

7074
context('toEthSignedMessage', () => {

0 commit comments

Comments
 (0)