Adding Truffle + changed State Machine image

This commit is contained in:
Gonçalo Sá 2017-05-02 01:22:11 +01:00
parent 3f8e8f4527
commit 86c5bb2261
10 changed files with 74 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.DS_Store
secrets.json

23
contracts/Migrations.sol Normal file
View File

@ -0,0 +1,23 @@
pragma solidity ^0.4.4;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
function Migrations() {
owner = msg.sender;
}
function setCompleted(uint completed) restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}

View File

@ -0,0 +1,5 @@
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};

View File

@ -0,0 +1,5 @@
let CodeBugBountyFactory = artifacts.require("./CodeBugBountyFactory.sol")
module.exports = function(deployer) {
deployer.deploy(CodeBugBountyFactory);
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 438 KiB

39
truffle.js Normal file
View File

@ -0,0 +1,39 @@
// Allows us to use ES6 in our migrations and tests.
require('babel-register')
const HDWalletProvider = require("truffle-hdwallet-provider")
const fs = require("fs")
// First read in the secrets.json to get our mnemonic
let secrets
let mnemonic
if(fs.existsSync("secrets.json")) {
secrets = JSON.parse(fs.readFileSync("secrets.json", "utf8"))
mnemonic = secrets.mnemonic
} else {
console.log("No secrets.json found. If you are trying to publish EPM " +
"this will fail. Otherwise, you can ignore this message!")
mnemonic = ""
}
//HD Wallet params
var providerUrlRopsten = "https://ropsten.infura.io"
var providerUrlKovan = "https://kovan.infura.io"
module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*'
},
ropsten: {
network_id: 3,
provider: new HDWalletProvider(mnemonic, providerUrlRopsten)
},
kovan: {
network_id: 4,
provider: new HDWalletProvider(mnemonic, providerUrlKovan)
}
}
}