Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new boilerplate and modify add command for create new boilerplate
- Loading branch information
Showing
70 changed files
with
47,799 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
{ | ||
"presets": [ | ||
"stage-2", | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"browsers": [ | ||
"> 1%", | ||
"last 5 versions", | ||
"Firefox >= 45", | ||
"iOS >=8", | ||
"Safari >=8", | ||
"ie >= 10" | ||
] | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"babel-plugin-transform-class-properties", | ||
"transform-async-to-generator", | ||
"transform-export-extensions", | ||
[ | ||
"transform-runtime", | ||
{ | ||
"polyfill": false, | ||
"regenerator": true | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/* | ||
**/vendor/*.js | ||
webpack.config.js | ||
truffle.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"modules": true | ||
} | ||
}, | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"rules": { | ||
"no-console": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pragma solidity ^0.4.23; | ||
|
||
contract HelloWorld { | ||
function sayHelloWorld() public pure returns (string) { | ||
return "Hello World"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
pragma solidity ^0.4.23; | ||
|
||
contract Migrations { | ||
address public owner; | ||
uint public last_completed_migration; | ||
|
||
constructor() public { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier restricted() { | ||
if (msg.sender == owner) _; | ||
} | ||
|
||
function setCompleted(uint completed) public restricted { | ||
last_completed_migration = completed; | ||
} | ||
|
||
function upgrade(address new_address) public restricted { | ||
Migrations upgraded = Migrations(new_address); | ||
upgraded.setCompleted(last_completed_migration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const HelloWorld = artifacts.require('../HelloWorld.sol'); | ||
|
||
contract('HelloWorld', function (accounts) { | ||
let hw; | ||
beforeEach('setup contract for each test', async function () { | ||
hw = await HelloWorld.new() | ||
}) | ||
|
||
it('should say Hello World', async function () { | ||
assert.equal(await hw.sayHelloWorld(), "Hello World") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const fs = require('fs'); | ||
const { execSync, } = require('child_process'); | ||
const KillPort = require('kill-port'); | ||
|
||
try { | ||
const files = fs.readdirSync(__dirname).filter(x => x !== 'index.js'); | ||
files.forEach((file) => { | ||
const filePath = `${__dirname}/${file}`; | ||
const result = execSync(`./node_modules/.bin/truffle test ${filePath}`); | ||
console.log(result.toString('utf8')); | ||
}); | ||
KillPort(8545); // default ganache-cli port, | ||
} catch (error) { | ||
console.log(error.stdout.toString('utf8')); | ||
KillPort(8545); // default ganache-cli port, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "React-truffle", | ||
"type": "React", | ||
"issued": "PortalNetwork", | ||
"ethereum": { | ||
"build_output_path": "./build/smart_contracts", | ||
"provider": "https://ropsten.infura.io/<Your Infura API Key>", | ||
"network_id": 3, | ||
"private_key": "", | ||
"develop_port": 8545 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var Migrations = artifacts.require("../contracts/Migrations.sol"); | ||
|
||
module.exports = function(deployer) { | ||
deployer.deploy(Migrations); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var HelloWorld = artifacts.require("../contracts/HelloWorld.sol"); | ||
|
||
module.exports = function(deployer) { | ||
deployer.deploy(HelloWorld); | ||
}; |
Oops, something went wrong.