Skip to content

Commit 3cdc4eb

Browse files
committed
Merge branch 'develop'
2 parents 1010606 + a73f086 commit 3cdc4eb

File tree

7 files changed

+73
-6
lines changed

7 files changed

+73
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Table of Contents
5555

5656
Installation
5757
======
58-
Requirements: geth (1.6.5 or higher), node (6.9.1 or higher is recommended) and npm
58+
Requirements: geth (1.6.5 or higher recommended, 1.6.0 or lower for whisper support), node (6.9.1 or higher is recommended) and npm
5959
Optional: testrpc (3.0 or higher) if using the simulator or the test functionality.
6060
Further: depending on the dapp stack you choose: [IPFS](https://ipfs.io/)
6161

boilerplate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "ISC",
1010
"homepage": "",
1111
"devDependencies": {
12-
"embark": "^2.5.0",
12+
"embark": "^2.5.1",
1313
"mocha": "^2.2.5"
1414
}
1515
}

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"license": "ISC",
1111
"homepage": "",
1212
"devDependencies": {
13-
"embark": "^2.5.0",
13+
"embark": "^2.5.1",
1414
"mocha": "^2.2.5"
1515
}
1616
}

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# The short X.Y version.
6161
version = u'2.5'
6262
# The full version, including alpha/beta/rc tags.
63-
release = u'2.5.0'
63+
release = u'2.5.1'
6464

6565
# The language for content autogenerated by Sphinx. Refer to documentation
6666
# for a list of supported languages.

lib/contracts/compiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class Compiler {
3232
function (extension, compiler, callback) {
3333
// TODO: warn about files it doesn't know how to compile
3434
let matchingFiles = contractFiles.filter(function (file) {
35-
return (file.filename.match(/\.[0-9a-z]+$/)[0] === extension);
35+
let fileMatch = file.filename.match(/\.[0-9a-z]+$/);
36+
return (fileMatch && (fileMatch[0] === extension));
3637
});
3738

3839
compiler.call(compiler, matchingFiles || [], function (err, compileResult) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "embark",
3-
"version": "2.5.0",
3+
"version": "2.5.1",
44
"description": "Embark is a framework that allows you to easily develop and deploy DApps",
55
"scripts": {
66
"test": "grunt jshint && mocha test/ --no-timeouts"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// https://github.com/nexusdev/erc20/blob/master/contracts/base.sol
2+
3+
pragma solidity ^0.4.2;
4+
contract Token {
5+
6+
event Transfer(address indexed from, address indexed to, uint value);
7+
event Approval( address indexed owner, address indexed spender, uint value);
8+
9+
mapping( address => uint ) _balances;
10+
mapping( address => mapping( address => uint ) ) _approvals;
11+
uint public _supply;
12+
//uint public _supply2;
13+
function Token( uint initial_balance ) {
14+
_balances[msg.sender] = initial_balance;
15+
_supply = initial_balance;
16+
}
17+
function totalSupply() constant returns (uint supply) {
18+
return _supply;
19+
}
20+
function balanceOf( address who ) constant returns (uint value) {
21+
return _balances[who];
22+
}
23+
function transfer( address to, uint value) returns (bool ok) {
24+
if( _balances[msg.sender] < value ) {
25+
throw;
26+
}
27+
if( !safeToAdd(_balances[to], value) ) {
28+
throw;
29+
}
30+
_balances[msg.sender] -= value;
31+
_balances[to] += value;
32+
Transfer( msg.sender, to, value );
33+
return true;
34+
}
35+
function transferFrom( address from, address to, uint value) returns (bool ok) {
36+
// if you don't have enough balance, throw
37+
if( _balances[from] < value ) {
38+
throw;
39+
}
40+
// if you don't have approval, throw
41+
if( _approvals[from][msg.sender] < value ) {
42+
throw;
43+
}
44+
if( !safeToAdd(_balances[to], value) ) {
45+
throw;
46+
}
47+
// transfer and return true
48+
_approvals[from][msg.sender] -= value;
49+
_balances[from] -= value;
50+
_balances[to] += value;
51+
Transfer( from, to, value );
52+
return true;
53+
}
54+
function approve(address spender, uint value) returns (bool ok) {
55+
// TODO: should increase instead
56+
_approvals[msg.sender][spender] = value;
57+
Approval( msg.sender, spender, value );
58+
return true;
59+
}
60+
function allowance(address owner, address spender) constant returns (uint _allowance) {
61+
return _approvals[owner][spender];
62+
}
63+
function safeToAdd(uint a, uint b) internal returns (bool) {
64+
return (a + b >= a);
65+
}
66+
}

0 commit comments

Comments
 (0)