initial commit

This commit is contained in:
Iuri Matias 2018-07-08 19:31:23 +03:00
commit c21ea13284
21 changed files with 13094 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.embark/
node_modules/
dist/
config/production/password
config/livenet/password
chains.json

0
app/css/.gitkeep Normal file
View File

0
app/images/.gitkeep Normal file
View File

11
app/index.html Normal file
View File

@ -0,0 +1,11 @@
<html>
<head>
<title>Embark</title>
<link rel="stylesheet" href="css/app.css">
<script src="js/app.js"></script>
</head>
<body>
<h3>Welcome to Embark!</h3>
<p>See the <a href="http://embark.readthedocs.io/en/latest/index.html" target="_blank">Embark's documentation</a> to see what you can do with Embark!</p>
</body>
</html>

0
app/js/.gitkeep Normal file
View File

6
app/js/index.js Normal file
View File

@ -0,0 +1,6 @@
import EmbarkJS from 'Embark/EmbarkJS';
// import your contracts
// e.g if you have a contract named SimpleStorage:
//import SimpleStorage from 'Embark/contracts/SimpleStorage';

62
config/blockchain.js Normal file
View File

@ -0,0 +1,62 @@
module.exports = {
development: {
enabled: true,
networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId
networkId: "1337", // Network id used when networkType is custom
isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
genesisBlock: "config/development/genesis.json", // Genesis block to initiate on first creation of a development node
datadir: ".embark/development/datadir", // Data directory for the databases and keystore
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced)
// When set to "auto", Embark will automatically set the cors to the address of the webserver
proxy: true, // Proxy is used to present meaningful information about transactions
account: {
// "address": "", // When specified, uses that address instead of the default one for the network
password: "config/development/password" // Password to unlock the account
},
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
wsRPC: true, // Enable the WS-RPC server
wsOrigins: "auto", // Origins from which to accept websockets requests
// When set to "auto", Embark will automatically set the cors to the address of the webserver
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
wsPort: 8546, // WS-RPC server listening port (default: 8546)
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm", // Mnemonic used by the simulator to generate a wallet
simulatorBlocktime: 0 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
},
testnet: {
enabled: true,
networkType: "testnet",
syncMode: "light",
rpcHost: "localhost",
rpcPort: 8545,
rpcCorsDomain: "http://localhost:8000",
account: {
password: "config/testnet/password"
}
},
livenet: {
enabled: true,
networkType: "livenet",
syncMode: "light",
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: ""
}
};

13
config/communication.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
default: {
enabled: true,
provider: "whisper", // Communication provider. Currently, Embark only supports whisper
available_providers: ["whisper"], // Array of available providers
connection: {
host: "localhost", // Host of the blockchain node
port: 8546, // Port of the blockchain node
type: "ws" // Type of connection (ws or rpc)
}
}
};

44
config/contracts.js Normal file
View File

@ -0,0 +1,44 @@
module.exports = {
// default applies to all environments
default: {
// Blockchain node to deploy the contracts
deployment: {
host: "localhost", // Host of the blockchain node
port: 8545, // Port of the blockchain node
type: "rpc" // Type of connection (ws or rpc),
// Accounts to use instead of the default account to populate your wallet
/*,accounts: [
{
privateKey: "your_private_key",
balance: "5 ether" // You can set the balance of the account in the dev environment
// Balances are in Wei, but you can specify the unit with its name
},
{
privateKeyFile: "path/to/file" // You can put more than one key, separated by , or ;
},
{
mnemonic: "12 word mnemonic",
addressIndex: "0", // Optionnal. The index to start getting the address
numAddresses: "1", // Optionnal. The number of addresses to get
hdpath: "m/44'/60'/0'/0/" // Optionnal. HD derivation path
}
]*/
},
// order of connections the dapp should connect to
dappConnection: [
"$WEB3", // uses pre existing web3 object if available (e.g in Mist)
"ws://localhost:8546",
"http://localhost:8545"
],
gas: "auto",
contracts: {
"auction": {
"args": [
"0x4a17f35f0a9927fb4141aa91cbbc72c1b31598de",
100,
200
]
}
}
}
};

View File

@ -0,0 +1,18 @@
{
"config": {
"homesteadBlock": 0,
"byzantiumBlock": 0,
"daoForkSupport": true
},
"nonce": "0x0000000000000042",
"difficulty": "0x0",
"alloc": {
"0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x7a1200"
}

View File

@ -0,0 +1 @@
dev_password

6
config/namesystem.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
default: {
available_providers: ["ens"],
provider: "ens"
}
};

35
config/storage.js Normal file
View File

@ -0,0 +1,35 @@
module.exports = {
default: {
enabled: true,
ipfs_bin: "ipfs",
provider: "ipfs",
available_providers: ["ipfs"],
upload: {
host: "localhost",
port: 5001
},
dappConnection: [
{
provider: "ipfs",
host: "localhost",
port: 5001,
getUrl: "http://localhost:8080/ipfs/"
}
]
// Configuration to start Swarm in the same terminal as `embark run`
/*,account: {
address: "YOUR_ACCOUNT_ADDRESS", // Address of account accessing Swarm
password: "PATH/TO/PASSWORD/FILE" // File containing the password of the account
},
swarmPath: "PATH/TO/SWARM/EXECUTABLE" // Path to swarm executable (default: swarm)*/
},
development: {
enabled: true,
provider: "ipfs",
upload: {
host: "localhost",
port: 5001,
getUrl: "http://localhost:8080/ipfs/"
}
}
};

1
config/testnet/password Normal file
View File

@ -0,0 +1 @@
test_password

5
config/webserver.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
enabled: true,
host: "localhost",
port: 8000
};

0
contracts/.gitkeep Normal file
View File

35
contracts/auction.bbo Normal file
View File

@ -0,0 +1,35 @@
contract auction
(address _beneficiary
,uint256 _bidding_time
,address => bool _bids
,uint256 _highest_bid)
{
default
{
if (now(block) > _bidding_time)
return then become auction_done(_beneficiary, _bids, _highest_bid);
if (value(msg) < _highest_bid)
abort;
bid new_bid =
deploy bid(sender(msg), value(msg), this) with value(msg)
reentrance { abort; }; // failure throws.
_bids[sender(msg)] = true;
return then become
auction(_beneficiary, _bidding_time, _bids, value(msg));
}
}
contract auction_done
(address _bene,
address => bool _bids,
uint256 _highest_bid)
{
}
contract bid
(address _sender
,uint256 _value
,address _auction
)
{
}

20
embark.json Normal file
View File

@ -0,0 +1,20 @@
{
"contracts": ["contracts/**"],
"app": {
"css/app.css": ["app/css/**"],
"js/app.js": ["app/js/index.js"],
"images/": ["app/images/**"],
"index.html": "app/index.html"
},
"buildDir": "dist/",
"config": "config/",
"versions": {
"web3": "1.0.0-beta",
"solc": "0.4.24",
"ipfs-api": "17.2.4",
"p-iteration": "1.1.7"
},
"plugins": {
"embark-bamboo": {}
}
}

12792
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "embark-bamboo-template",
"version": "0.0.1",
"description": "",
"scripts": {
"test": "embark test"
},
"author": "",
"license": "ISC",
"homepage": "",
"devDependencies": {},
"dependencies": {
"embark": "^3.1.5",
"embark-bamboo": "^1.0.0"
}
}

23
test/contract_spec.js Normal file
View File

@ -0,0 +1,23 @@
/*global contract, config, it, assert */
const Auction = require('Embark/contracts/auction');
config({
contracts: {
"auction": {
args: [
"0x4a17f35f0a9927fb4141aa91cbbc72c1b31598de",
100,
200
]
}
}
});
describe("Auction", function() {
this.timeout(0);
it("should deploy using the plugin", async function() {
assert.ok(Auction.address);
});
});