Skip to content

Instantly share code, notes, and snippets.

@stevenleeg
Last active August 23, 2018 12:56
Show Gist options
  • Save stevenleeg/3b8e78f99e6a377079bef6aa631c6e2b to your computer and use it in GitHub Desktop.
Save stevenleeg/3b8e78f99e6a377079bef6aa631c6e2b to your computer and use it in GitHub Desktop.
const TeifCoinCrowdsale = artifacts.require('./TeifCoinCrowdsale.sol');
const TeifCoin = artifacts.require('./TeifCoin.sol');
getBlockTimestamp = (block) => {
return new Promise((resolve, reject) => {
web3.eth.getBlock('latest', (err, block) => {
if (err) return reject(err);
resolve(block.timestamp);
});
});
};
module.exports = function(deployer, network, accounts) {
const rate = new web3.BigNumber(1);
const walletAddress = accounts[0];
return getBlockTimestamp('latest')
.then(ts => {
const openingTime = ts + 500;
const closingTime = ts + 86400 * 20;
return Promise.all([deployer.deploy(TeifCoin), openingTime, closingTime]);
})
.then(([token, openingTime, closingTime]) => {
return deployer.deploy(
TeifCoinCrowdsale,
openingTime,
closingTime,
rate,
walletAddress,
TeifCoin.address,
{from: walletAddress},
);
})
.then((crowdsale) => {
const token = TeifCoin.at(TeifCoin.address);
token.transferOwnership(crowdsale.address);
});
};
const HDWalletProvider = require('truffle-hdwallet-provider');
const INFURA_KEY = '...';
const MNEUMONIC = '...';
module.exports = {
networks: {
ropsten: {
provider: () => new HDWalletProvider(
MNEUMONIC,
//'http://127.0.0.1:8545', <- this one causes a timer error
`https://ropsten.infura.io/v3/${INFURA_KEY}`, // <- this one causes the migration to mysteriously end early
),
network_id: 3,
gas: 4612388,
},
development: {
network_id: '*',
host: 'localhost',
port: 8545,
network_id: '*',
},
},
};

Using Infura's Ropsten RPC

Using network 'ropsten'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0xfb24466079d2830f639ce23682da03d5a5121811972ffa7f5cf61020d4e901d5
  Migrations: 0x6590abdf5fff237325daeceec06f3a83637c08e9
Saving successful migration to network...
  ... 0xff5f397b8c847f2466fd066fdbee255da237814593744e20cb4622c519407a1e
Saving artifacts...
Running migration: 2_deploy_contracts.js
Saving successful migration to network...
  Deploying TeifCoin...
  ... 0xe8adfe99021200b886d07e61071ac95c82f388b98b9146f0a8556f7d56728b0c
  ... 0x49e92feab2ed5a05a93e6c0787145bea0fa764aeb40c0589e11ebb52255d1372
Saving artifacts...

... and the command exits without finishing the full migration.

Using 127.0.0.1 RPC

Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0x1800c21325bf4506724dade7d410ab5200f936450d7a8f9f61d8c6aafe244c38
  Migrations: 0x911a6996b07c151c4b376d3cfff225e646021b0a
Saving successful migration to network...
  ... 0xc6c94a6684f5aad21eddfc8de2014ca1e8644e26244c4768a5acb21d7a94fb82
Saving artifacts...
Running migration: 2_deploy_contracts.js
Saving successful migration to network...
1535028464 1536755964
  Replacing TeifCoin...
  ... 0xec49ea466951b00d3ac5086d3385629f98ebbce7168240d254b44bd87a543fcb
  ... 0x96bd514fcf8badaa06ec6a8e1ae8057c4610c6b9ec3301bac96dea9b0afb659b
Saving artifacts...
node[67981]: ../src/timer_wrap.cc:130:static void node::(anonymous namespace)::TimerWrap::Stop(const FunctionCallbackInfo<v8::Value> &): Assertion `HandleWrap::IsAlive(wrap)' failed.
 1: node::Abort() [/usr/local/bin/node]
 2: node::Assert(char const* const (*) [4]) [/usr/local/bin/node]
 3: node::(anonymous namespace)::TimerWrap::SetImmediateCallback(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
 5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 7: 0x240f902842fd
 8: 0x240f9033d196
fish: 'truffle migrate --reset' terminated by signal SIGABRT (Abort)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment