Skip to content

Commit

Permalink
Rinkeby redeployment
Browse files Browse the repository at this point in the history
  • Loading branch information
protinam committed Dec 31, 2017
1 parent 8231fde commit 20f54d8
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 15 deletions.
18 changes: 15 additions & 3 deletions config.json
@@ -1,8 +1,20 @@
{
"deployed": {
"rinkeby": {
"TestToken": "0xb7dDCF6B64C05D76Adc497AE78AD83ba3883A294",
"TestDAO": "0x67B5587C4B0423542546C83D14A86E72e0C400Dc"
"TestToken": "0x93618108f1da9d029e36b3ecaa719dfea5d25824",
"TestDAO": "0x396fb19f1a0d02fe09072e4c6da0a2c390234498",
"Migrations": "0x5a7cc41534a3e7a15a4dfa95635a8a7cbbb728fa",
"MerkleProof": "0x7263368830f9097c02f9520b4ef31c5f7ac7d18f",
"WyvernToken": "0xffceb34985932fb7a1d9f2ff1738418cc444a59d",
"WyvernDAO": "0x571333b1feef2b11a80cebb01c4278a8f86c5076"
},
"development": {
"Migrations": "0x53b8d5aa98a776cfaecf9a919c4473d6095350fd",
"TestToken": "0xe8d706a97d47b28e40dbbce660bace9f46010d97",
"TestDAO": "0xf3e63599c359b6b5884931620e91f0eb100bac4c",
"MerkleProof": "0xcec7bc5980745ece878e0d5b5046af83a4fad0e5",
"WyvernToken": "0xd1735e2384b445b5865df1a6c95feb2a8a355eea",
"WyvernDAO": "0xcf87aae5acd7fe70b90766b142fa3f4c8c8bf92e"
}
}
}
}
2 changes: 1 addition & 1 deletion contracts/WyvernToken.sol
Expand Up @@ -22,7 +22,7 @@ contract WyvernToken is DelayedReleaseToken, UTXORedeemableToken, BurnableToken
string constant public symbol = "WYV";

/* Amount of tokens per Wyvern. */
uint constant public MULTIPLIER = 10;
uint constant public MULTIPLIER = 1;

/* Constant for conversion from satoshis to tokens. */
uint constant public SATS_TO_TOKENS = MULTIPLIER * (10 ** decimals) / (10 ** 8);
Expand Down
7 changes: 5 additions & 2 deletions migrations/1_initial_migration.js
@@ -1,7 +1,10 @@
/* global artifacts:false */

const Migrations = artifacts.require('./Migrations.sol')
const { setConfig } = require('./config.js')

module.exports = (deployer) => {
deployer.deploy(Migrations)
module.exports = (deployer, network) => {
return deployer.deploy(Migrations).then(() => {
setConfig('deployed.' + network + '.Migrations', Migrations.address)
})
}
6 changes: 5 additions & 1 deletion migrations/2_deploy_test_token_and_dao.js
Expand Up @@ -2,12 +2,16 @@

const TestToken = artifacts.require('./TestToken.sol')
const TestDAO = artifacts.require('./TestDAO.sol')
const { setConfig } = require('./config.js')

module.exports = (deployer, network) => {
if (network === 'rinkeby' || network === 'development' || network === 'kovan') {
deployer.deploy(TestToken)
.then(() => {
return deployer.deploy(TestDAO, TestToken.address)
setConfig('deployed.' + network + '.TestToken', TestToken.address)
return deployer.deploy(TestDAO, TestToken.address).then(() => {
setConfig('deployed.' + network + '.TestDAO', TestDAO.address)
})
})
}
}
20 changes: 12 additions & 8 deletions migrations/3_deploy_token_and_dao.js
Expand Up @@ -4,17 +4,21 @@ const MerkleProof = artifacts.require('./MerkleProof.sol')
const WyvernToken = artifacts.require('./WyvernToken.sol')
const WyvernDAO = artifacts.require('./WyvernDAO.sol')

const { setConfig } = require('./config.js')
const { utxoMerkleRoot, utxoAmount } = require('../test/aux.js')

module.exports = (deployer, network) => {
if (network === 'kovan' || network === 'rinkeby') return
deployer.deploy(MerkleProof)
deployer.link(MerkleProof, WyvernToken)
deployer.deploy(WyvernToken, utxoMerkleRoot, utxoAmount)
.then(() => {
return deployer.deploy(WyvernDAO, WyvernToken.address)
})
deployer.then(() => {
return deployer.deploy(MerkleProof).then(() => {
setConfig('deployed.' + network + '.MerkleProof', MerkleProof.address)
deployer.link(MerkleProof, WyvernToken)
return deployer.deploy(WyvernToken, utxoMerkleRoot, utxoAmount)
.then(() => {
setConfig('deployed.' + network + '.WyvernToken', WyvernToken.address)
return deployer.deploy(WyvernDAO, WyvernToken.address).then(() => {
setConfig('deployed.' + network + '.WyvernDAO', WyvernDAO.address)
})
})
}).then(() => {
WyvernToken.deployed()
.then(tokenInstance => {
return WyvernDAO.deployed()
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions migrations/config.js
@@ -0,0 +1,26 @@
const fs = require('fs')

const updateConfig = (func) => {
const previous = JSON.parse(fs.readFileSync('config.json'))
const updated = func(previous)
fs.writeFileSync('config.json', JSON.stringify(updated, null, 2))
}

const setConfig = (path, val) => {
path = path.split('.').reverse()
updateConfig(config => {
var ref = config
while (path.length > 1) {
const key = path.pop()
if (!ref[key]) ref[key] = {}
ref = ref[key]
}
ref[path.pop()] = val
return config
})
}

module.exports = {
setConfig: setConfig,
updateConfig: updateConfig
}

0 comments on commit 20f54d8

Please sign in to comment.