Skip to content

Commit

Permalink
cleanup bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
3esmit committed Apr 23, 2018
0 parents commit 6750c66
Show file tree
Hide file tree
Showing 18 changed files with 565 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sol linguist-language=Solidity
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# embark
.embark/
chains.json

# egg-related
viper.egg-info/
build/
dist/
.eggs/

# pyenv
.python-version

# dotenv
.env

# virtualenv
.venv/
venv/
ENV/

# Coverage tests
.coverage
.cache/
coverage/
coverageEnv/
coverage.json

# node
node_modules/
npm-debug.log

# other
.vs/
bin/
56 changes: 56 additions & 0 deletions config/blockchain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"development": {
"enabled": true,
"networkType": "custom",
"genesisBlock": "config/development/genesis.json",
"datadir": ".embark/development/datadir",
"mineWhenNeeded": true,
"nodiscover": true,
"maxpeers": 0,
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/development/password"
},
"targetGasLimit": 8000000,
"wsOrigins": "http://localhost:8000",
"wsRPC": true,
"wsHost": "localhost",
"wsPort": 8546,
"simulatorMnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
"simulatorBlocktime": 0
},
"testnet": {
"enabled": true,
"networkType": "testnet",
"light": true,
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/testnet/password"
}
},
"livenet": {
"enabled": true,
"networkType": "livenet",
"light": true,
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/livenet/password"
}
},
"privatenet": {
"enabled": true,
"networkType": "custom",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"datadir": "yourdatadir",
"networkId": "123",
"bootnodes": ""
}
}
12 changes: 12 additions & 0 deletions config/communication.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"default": {
"enabled": true,
"provider": "whisper",
"available_providers": ["whisper", "orbit"],
"connection": {
"host": "localhost",
"port": 8546,
"type": "ws"
}
}
}
69 changes: 69 additions & 0 deletions config/contracts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"default": {
"versions": {
"web3.js": "1.0.0-beta",
"solc": "0.4.21"
},
"deployment": {
"host": "localhost",
"port": 8545,
"type": "rpc"
},
"dappConnection": [
"$WEB3",
"http://localhost:8545"
],
"gas": "auto",
"contracts": {
"Bounty": {"deploy": false},
"BountyFactory": {"deploy": false},
"BountyKernel": {"deploy": false},
"BountyManager": {"deploy": false},
"BountyManagerFactory": {"deploy": false},
"BountyManagerKernel": {"deploy": false},
"BountyManagerPreSigned": {"deploy": false},
"Controlled": { "deploy": false },
"ContributionWallet": {"deploy": false},
"DelayedUpdatableInstance": { "deploy": false },
"DelayedUpdatableInstanceStorage": { "deploy": false },
"DelegatedCall": { "deploy": false },
"DelegationProxy": {"deploy": false},
"DelegationProxyInterface": {"deploy": false},
"DelegationProxyKernel": {"deploy": false},
"DelegationProxyFactory": {"deploy": false},
"Democracy": {"deploy": false},
"DemocracyStorage": {"deploy": false},
"DevTokensHolder": {"deploy": false},
"DynamicCeiling": {"deploy": false},
"EmojiBoard": {"deploy": false},
"EmojiTable": {"deploy": false},
"ERC725": { "deploy": false },
"ERC735": { "deploy": false },
"Factory": { "deploy": false },
"FeeRecycler": {"deploy": false},
"FriendsRecovery": { "deploy": false },
"Identity": { "gas": 5000000 },
"IdentityFactory": { "deploy": false },
"IdentityKernel": { "gas": 5000000 },
"Instance": { "deploy": false },
"InstanceStorage": { "deploy": false },
"MessageDeliveryPayout": {"deploy": false},
"MiniMeToken": {"deploy": false},
"MiniMeTokenFactory": {"deploy": false},
"MultiSig": {"deploy": false},
"Ownable": {"deploy": false},
"Owned": {"deploy": false},
"ProposalManager": {"deploy": false},
"SGTExchanger": {"deploy": false},
"SNT": {"deploy": false},
"SNTPlaceHolder": {"deploy": false},
"StandardToken": {"deploy": false},
"StatusContribution": {"deploy": false},
"TestContract": { "deploy": false },
"TokenRegistry": {"deploy": false},
"TrustNetwork": {"deploy": false},
"UpdatableInstance": { "deploy": false },
"UpdatedIdentityKernel": { "deploy": false }
}
}
}
16 changes: 16 additions & 0 deletions config/development/genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"config": {
"homesteadBlock": 1
},
"nonce": "0x0000000000000042",
"difficulty": "0x0",
"alloc": {
"0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x7a1200"
}
1 change: 1 addition & 0 deletions config/development/password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev_password
20 changes: 20 additions & 0 deletions config/storage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"default": {
"versions": {
"ipfs-api": "17.2.4"
},
"enabled": true,
"ipfs_bin": "ipfs",
"provider": "ipfs",
"available_providers": ["ipfs"],
"host": "localhost",
"port": 5001
},
"development": {
"enabled": true,
"provider": "ipfs",
"host": "localhost",
"port": 5001,
"getUrl": "http://localhost:8080/ipfs/"
}
}
1 change: 1 addition & 0 deletions config/testnet/password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test_password
5 changes: 5 additions & 0 deletions config/webserver.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"enabled": true,
"host": "localhost",
"port": 8000
}
22 changes: 22 additions & 0 deletions contracts/common/Controlled.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pragma solidity ^0.4.8;

contract Controlled {
/// @notice The address of the controller is the only address that can call
/// a function with this modifier
modifier onlyController {
require(msg.sender == controller);
_;
}

address public controller;

function Controlled() public {
controller = msg.sender;
}

/// @notice Changes the controller of the contract
/// @param _newController The new controller of the contract
function changeController(address _newController) public onlyController {
controller = _newController;
}
}
36 changes: 36 additions & 0 deletions contracts/common/Owned.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pragma solidity ^0.4.21;

/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {

/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner);
_;
}

address public owner;

/// @notice The Constructor assigns the message sender to be `owner`
function Owned() public {
owner = msg.sender;
}

address public newOwner;

/// @notice `owner` can step down and assign some other address to this role
/// @param _newOwner The address of the new owner. 0x0 can be used to create
/// an unowned neutral vault, however that cannot be undone
function changeOwner(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}


function acceptOwnership() public {
if (msg.sender == newOwner) {
owner = newOwner;
}
}
}
46 changes: 46 additions & 0 deletions contracts/common/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
pragma solidity ^0.4.21;

/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}

function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}

function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}

function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}

function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}

function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}

function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}

function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
49 changes: 49 additions & 0 deletions contracts/token/ERC20Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pragma solidity ^0.4.11;

// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20

contract ERC20Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;

/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint256 balance);

/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);

/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);

/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);

/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);

event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
Loading

0 comments on commit 6750c66

Please sign in to comment.