Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions server/migrations/2_deploy_contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@ module.exports = async function(deployer, network, accounts) {
deployer.deploy(ValidatorManagerContract).then(async () => {
const vmc = await ValidatorManagerContract.deployed();
console.log(`ValidatorManagerContract deployed at address: ${vmc.address}`);

await deployer.deploy(RootChain, vmc.address);
const root = await RootChain.deployed();
console.log(`RootChain deployed at address: ${root.address}`);

await deployer.deploy(CryptoCards, root.address);
const cards = await CryptoCards.deployed();
console.log(`CryptoCards deployed at address: ${cards.address}`);

await deployer.deploy(LoomToken, root.address);
const erc20 = await CryptoCards.deployed();
console.log(`Loom deployed at address: ${erc20.address}`);

await vmc.toggleToken(cards.address);
});
};

27 changes: 27 additions & 0 deletions server/migrations/3_deploy_root_chain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const CryptoCards = artifacts.require("CryptoCards");
const LoomToken = artifacts.require("LoomToken")
const RootChain = artifacts.require("RootChain");

module.exports = async function(deployer, network, accounts) {
let vmcAddress = '0x0000';
if (network !== "mainnet") {
vmcAddress = '0xf1ffd3f1598cd054f5031b2af219d85b0d443175';
}else {
const vmc = await ValidatorManagerContract.deployed();
vmcAddress = vmc.address;
}
console.log(`ValidatorManagerContract deployed at address: ${vmcAddress}`);


if (vmcAddress == "0x0000" ) {
throw "Invalid vmcAddress";
return
}

await deployer.deploy(RootChain, vmcAddress);
const root = await RootChain.deployed();
console.log(`RootChain deployed at address: ${root.address}`);
};



24 changes: 24 additions & 0 deletions server/migrations/4_deploy_cards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const CryptoCards = artifacts.require("CryptoCards");
const LoomToken = artifacts.require("LoomToken")
const RootChain = artifacts.require("RootChain");
const ValidatorManagerContract = artifacts.require("ValidatorManagerContract");

module.exports = async function(deployer, network, accounts) {
const vmc = await ValidatorManagerContract.deployed();
const root = await RootChain.deployed();


await deployer.deploy(CryptoCards, root.address);
const cards = await CryptoCards.deployed();
console.log(`CryptoCards deployed at address: ${cards.address}`);

// Main net configuration be careful !!!
if (network !== "mainnet") {
await deployer.deploy(LoomToken, root.address);
const erc20 = await LoomToken.deployed();
console.log(`Loom deployed at address: ${erc20.address}`);
}
};



14 changes: 14 additions & 0 deletions server/migrations/5_toggle_token.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const CryptoCards = artifacts.require("CryptoCards");
const LoomToken = artifacts.require("LoomToken")
const RootChain = artifacts.require("RootChain");
const ValidatorManagerContract = artifacts.require("ValidatorManagerContract");

module.exports = async function(deployer, network, accounts) {
const vmc = await ValidatorManagerContract.deployed();
const cards = await CryptoCards.deployed();

await vmc.toggleToken(cards.address);
};



4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"openzeppelin-solidity": "1.10.0",
"rlp": "^2.0.0",
"solium": "^1.1.7",
"truffle": "^4.1.11",
"truffle-hdwallet-provider": "0.0.3",
"truffle": "^v5.0.0-beta.0",
"truffle-hdwallet-provider": "https://github.com/loomnetwork/truffle-hdwallet-provider#web3-one",
"truffle-privatekey-provider": "0.0.5",
"web3-utils": "^1.0.0-beta.34"
},
Expand Down
31 changes: 29 additions & 2 deletions server/truffle-config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
const HDWalletProvider = require('truffle-hdwallet-provider')
const PrivateKeyProvider = require('truffle-privatekey-provider')
const fs = require("fs")

require('babel-register');
require('babel-polyfill');

const mnemonic = 'stumble story behind hurt patient ball whisper art swift tongue ice alien';

let mainnetMnemonic = '';
let infuraKey = process.env.INFURA_KEY; //TODO put into env var before merge

let filename = process.env.SECRET_FILE
if (filename == "") {
filename = "secrets.json"
}
if(fs.existsSync(filename)) {
secrets = JSON.parse(fs.readFileSync(filename, "utf8"))
mainnetMnemonic = secrets.mnemonic
console.log("Found mainnet mnemonic")
}

let ropstenProvider, kovanProvider, rinkebyProvider = {}
let ropstenProvider, kovanProvider, rinkebyProvider, mainnetProvider = {}

if (process.env.LIVE_NETWORKS) {
ropstenProvider = new HDWalletProvider(mnemonic, 'https://ropsten.infura.io/')
Expand Down Expand Up @@ -36,23 +50,36 @@ module.exports = {
network_id: '*',
host: 'localhost',
port: 8545,
skipDryRun: true
},
ropsten: {
network_id: 3,
provider: ropstenProvider,
gas: 4700036,
skipDryRun: true
},
kovan: {
network_id: 42,
provider: kovanProvider,
gas: 6.9e6,
skipDryRun: true
},
rinkeby: {
network_id: 4,
provider: rinkebyProvider,
gas: 6.9e6,
gasPrice: 15000000001
gasPrice: 15000000001,
skipDryRun: true
},
mainnet: {
network_id: 1,
provider: function() {
return new HDWalletProvider(mainnetMnemonic, 'https://mainnet.infura.io/' + infuraKey)
},
gas: 6.9e6,
gasPrice: 15000000001,
skipDryRun: true
},
coverage: {
host: "localhost",
network_id: "*",
Expand Down
Loading