This commit is contained in:
Iuri Matias 2016-10-02 19:13:46 -04:00
parent d7656a111f
commit 58c0244a43
16 changed files with 77 additions and 201 deletions

View File

@ -0,0 +1,37 @@
{
"development": {
"networkType": "custom",
"genesisBlock": "config/development/genesis.json",
"datadir": ".embark/development/datadir",
"mineWhenNeeded": true,
"nodiscover": true,
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/development/password"
}
},
"testnet": {
"networkType": "testnet",
"rpcHost": "localhost",
"rpcPort": 8545
},
"livenet": {
"networkType": "livenet",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/production/password"
}
},
"privatenet": {
"networkType": "custom",
"rpcHost": "localhost",
"rpcPort": 8545,
"datadir": "yourdatadir",
"networkId": "123",
"nodes": []
}
}

View File

@ -1,6 +1,12 @@
{
"default": {
"gas": "auto",
"contracts": {
"SimpleStorage": {
"args": [
100
]
}
}
}
}

View File

@ -1,9 +0,0 @@
{
"development": {
"rpcHost": "localhost",
"rpcPort": 8101,
"account": {
"password": "config/development/password"
}
}
}

View File

@ -1,7 +0,0 @@
{
"development": {
"gas": "auto",
"contracts": {
}
}
}

View File

@ -0,0 +1 @@
prod_password

View File

@ -10,7 +10,7 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark-framework": "/Users/iurimatias/Projects/embark-framework",
"embark-framework": "iurimatias/embark-framework#embark2",
"mocha": "^2.2.5"
}
}

View File

@ -3,32 +3,30 @@ var Embark = require('embark-framework');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("MyContract", function() {
// Deploy all contrats using the development config
before(function(done) {
EmbarkSpec.sim.createAccounts(10, function() {
EmbarkSpec.sim.setBalance(web3.eth.accounts[0], 1000000000000000000000, function() {
EmbarkSpec.deployAll(done);
});
});
});
// example usage
//it("should set constructor value", function(done) {
// SimpleStorage.storedData(function(err, result) {
// assert.equal(result.toNumber(), 100);
// done();
// });
//});
//it("set storage value", function(done) {
// SimpleStorage.set(150, function() {
// SimpleStorage.get(function(err, result) {
// assert.equal(result.toNumber(), 150);
// done();
// });
// });
//});
})
//describe("SimpleStorage", function() {
// before(function(done) {
// var contractsConfig = {
// "SimpleStorage": {
// args: [100, '0x123']
// }
// };
// EmbarkSpec.deployAll(contractsConfig, done);
// });
//
// it("should set constructor value", function(done) {
// SimpleStorage.storedData(function(err, result) {
// assert.equal(result.toNumber(), 100);
// done();
// });
// });
//
// it("set storage value", function(done) {
// SimpleStorage.set(150, function() {
// SimpleStorage.get(function(err, result) {
// assert.equal(result.toNumber(), 150);
// done();
// });
// });
// });
//
//});

View File

@ -1,16 +1,11 @@
contract SimpleStorage {
uint public storedData;
address public foo;
function SimpleStorage(uint initialValue, address addr) {
function SimpleStorage(uint initialValue) {
storedData = initialValue;
foo = addr;
}
function set(uint x) {
//for (uint same3=0; same3 < 3; same3++) {
// storedData = same3;
//}
storedData = x;
}

View File

@ -1,19 +0,0 @@
contract token {
mapping (address => uint) public coinBalanceOf;
event CoinTransfer(address sender, address receiver, uint amount);
/* Initializes contract with initial supply tokens to the creator of the contract */
function token(uint supply) {
if (supply == 0) supply = 10000;
coinBalanceOf[msg.sender] = supply;
}
/* Very simple trade function */
function sendCoin(address receiver, uint amount) returns(bool sufficient) {
if (coinBalanceOf[msg.sender] < amount) return false;
coinBalanceOf[msg.sender] -= amount;
coinBalanceOf[receiver] += amount;
CoinTransfer(msg.sender, receiver, amount);
return true;
}
}

View File

@ -1,65 +1,2 @@
{
"0x4d12c61541655bbf65aea06b4813a7a0f3317cb470623258f4e3909746f23cd6": {
"name": "development",
"contracts": {
"2ac097aa929aece4724cc229cc7bd26c7dfa153f3274b5623936cb4a4dc12fa1": {
"address": "0x123",
"name": "token"
},
"577bcb0c85129a6ff9e4dcde08f04e6f094e94c74a4423fc90e5947df9a21b82": {
"address": "0xaa5b04650f2705ef87d566cdfd0e45bfc19f43ce",
"name": "SimpleStorage"
},
"e0d35d6564373021d9749a7a8815cf58cc5ca7b7edaf4740c1913898561531c3": {
"address": "0xdad08a3a58bb903ccebfbf1a4e55e45e7ec8d0e4",
"name": "SimpleStorage2"
}
}
},
"0x8839bd592160ddb23170ad76688c12a73ce41d41a6437163de0fb080bbface0a": {
"name": "development",
"contracts": {
"2ac097aa929aece4724cc229cc7bd26c7dfa153f3274b5623936cb4a4dc12fa1": {
"address": "0x123",
"name": "token"
},
"577bcb0c85129a6ff9e4dcde08f04e6f094e94c74a4423fc90e5947df9a21b82": {
"address": "0xc0008e20eb48abf2e3bacc3be0ee4f3b7ae42cfe",
"name": "SimpleStorage"
},
"e0d35d6564373021d9749a7a8815cf58cc5ca7b7edaf4740c1913898561531c3": {
"address": "0x1246646162a64c6dbb6fd285a6bbffdfc093aa56",
"name": "SimpleStorage2"
}
}
},
"0xb6cfeab83614da04c03db0fb8a6787a45d0be8d576fcc6f8f457a5a816d22ab3": {
"name": "development",
"contracts": {
"2ac097aa929aece4724cc229cc7bd26c7dfa153f3274b5623936cb4a4dc12fa1": {
"address": "0x123",
"name": "token"
},
"577bcb0c85129a6ff9e4dcde08f04e6f094e94c74a4423fc90e5947df9a21b82": {
"address": "0xb81f1e90ac9e4eb49271c8bbf574dde2b8380078",
"name": "SimpleStorage"
},
"708fa6b699f419627ab3c4c2d9c82f8f1a6fab03c122d0a9ee55d2d0d0ad1e4b": {
"address": "0x176a7f21ecdb8f88559b5a1e444821b2f9c5cf96",
"name": "token"
},
"e0d35d6564373021d9749a7a8815cf58cc5ca7b7edaf4740c1913898561531c3": {
"address": "0x5f6dc5474cd23ff54f37cfa12c78726c2fa1bce6",
"name": "SimpleStorage2"
},
"f3765f8b702ccb44eb19f1adecbf5a216175713fbd41d9fae100d8e3dfc5e74f": {
"address": "0x6ecb595483da2c264ea5e039743340ebce8af0da",
"name": "SimpleStorage"
},
"f3e14e1cd853fc03ed37f669b211591ef53a6e1b5e82e8bf08d04eed8dc6a12e": {
"address": "0x391ae9a75817e11d4dcb208431d3196fd50f1cc6",
"name": "SimpleStorage"
}
}
}
}
}

View File

@ -2,26 +2,9 @@
"default": {
"gas": "auto",
"contracts": {
"token": {
"address": "0x123",
"args": [
100
]
},
"SimpleStorage": {
"args": [
100,
"$token"
],
"onDeploy": [
"SimpleStorage.set(150)"
]
},
"SimpleStorage2": {
"instanceOf": "SimpleStorage",
"args": [
100,
"$token"
100
]
}
}

View File

@ -1,9 +0,0 @@
{
"development": {
"rpcHost": "localhost",
"rpcPort": 8545,
"account": {
"password": "config/development/password"
}
}
}

View File

@ -1,12 +0,0 @@
{
"development": {
"gas": "auto",
"contracts": {
"SimpleStorage": {
"args": [
100
]
}
}
}
}

View File

@ -10,7 +10,7 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark-framework": "/Users/iurimatias/Projects/embark-framework",
"embark-framework": "iurimatias/embark-framework#embark2",
"mocha": "^2.2.5"
}
}

View File

@ -1,23 +0,0 @@
var assert = require('assert');
//var Embark = require('embark-framework');
var Embark = require('../../lib/index.js');
var EmbarkSpec = Embark.initTests();
describe("SimpleStorage", function() {
before(function(done) {
var contractsConfig = {
"token": {
args: [1000]
}
};
EmbarkSpec.deployAll(contractsConfig, done);
});
it("should get balance", function(done) {
token.coinBalanceOf(EmbarkSpec.web3.eth.defaultAccount, function(err, result) {
assert.equal(result.toNumber(), 1000);
done();
});
});
});

View File

@ -1,12 +1,10 @@
var assert = require('assert');
//var Embark = require('embark-framework');
var Embark = require('../../lib/index.js');
var Embark = require('embark-framework');
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
describe("SimpleStorage", function() {
before(function(done) {
//EmbarkSpec.deployContract('SimpleStorage', [100], done);
var contractsConfig = {
"SimpleStorage": {
args: [100, '0x123']