Skip to content

Commit

Permalink
Merge pull request #25 from MyBitFoundation/develop
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
0xdewy committed Nov 29, 2018
2 parents 2637036 + 49b1da8 commit be16d08
Show file tree
Hide file tree
Showing 10 changed files with 799 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
- image: circleci/node:9.6.1
steps:
- checkout
- run: yarn
- run: npm install
- run:
name: testrpc
command: yarn blockchain
Expand Down
1 change: 1 addition & 0 deletions coverage.json

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions migrations/2_deploy_trust.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
const fs = require('fs');
const bn = require('bignumber.js');
const SafeMath = artifacts.require("./SafeMath.sol");
const Token = artifacts.require("./token/ERC20.sol");
const Trust = artifacts.require("./Trust.sol");
const TrustFactory = artifacts.require("./TrustFactory.sol");
const MyBitBurner = artifacts.require("./MyBitBurner.sol");

module.exports = function(deployer, network, accounts) {
const WEI = 10**18;
const tokenSupply = 100000000*WEI; // 100 million

var myb, erc20, trust, trustFactory, burner

deployer.then(function(){

return deployer.deploy(SafeMath);

}).then(function(){

//Link safemath library
deployer.link(SafeMath,
Token,
Trust,
MyBitBurner);

return Token.new(tokenSupply, "MyBit", 18, "MYB");

}).then(function(instance) {

myb = instance;
for(var i=1; i<accounts.length; i++){
myb.transfer(accounts[i], 10000*WEI);
}

return Token.new(tokenSupply, "TestERC20", 18, "ERC20");

}).then(function(instance) {

erc20 = instance;
for(var i=1; i<accounts.length; i++){
erc20.transfer(accounts[i], 10000*WEI);
}

return MyBitBurner.new(myb.address);

}).then(function(instance) {

burner = instance;
return TrustFactory.new(burner.address);

}).then(function(instance) {

trustFactory = instance;

}).then(function() {
var addresses = {
"MyBitToken" : myb.address,
"ERC20Token" : erc20.address,
"MyBitBurner" : burner.address,
"TrustFactory" : trustFactory.address
}

var contracts_json = JSON.stringify(addresses, null, 4);
var accounts_json = JSON.stringify(accounts, null, 4);
fs.writeFile('networks/' + network + '/contracts.json', contracts_json, (err) => {
if (err) throw err;
console.log('Contracts Saved');
});
fs.writeFile('networks/' + network + '/accounts.json', accounts_json, (err) => {
if (err) throw err;
console.log('Accounts Saved');
});

instanceList = [erc20, burner, trustFactory];

for(var i=0; i<instanceList.length; i++){
var instanceName = instanceList[i].constructor._json.contractName;
var instance_json = JSON.stringify(instanceList[i].abi, null, 4);
fs.writeFile('networks/' + network + '/' + instanceName + '.json', instance_json, (err) => {
if (err) throw err;
});
}
});
};

0 comments on commit be16d08

Please sign in to comment.