Skip to content

Instantly share code, notes, and snippets.

View DavidVotrubec's full-sized avatar

David Votrubec DavidVotrubec

View GitHub Profile
@DavidVotrubec
DavidVotrubec / deploy
Last active October 17, 2018 13:25
Codes for article on Medium - https://medium.com/p/6088f923d621/edit
myContract.deploy().send({from: accounts[1]})
@DavidVotrubec
DavidVotrubec / console
Last active October 15, 2018 12:36
Truffle console is better than truffle develop
truffle console --network ganache_cli
The full procedure is like this
- make sure that ganache_cli is running and truffle.js is configured properly
- truffle networks --clean // to reset old garbage
- truffle console --network ganache_cli
- migrate
- interact with your deploys smart contract via JS
- MySmartContract.deployed().then(function(instance) {... call your contract's instance methods ;});
module.exports = async function(deployer, _, accounts) {
let someContract = await SomeContract.deployed();
try {
// If this contract method fails, the migration does not stop
await someContract.someMethod(namehash(''), web3.utils.sha3("eth"), accounts[0]);
}
catch (err) {
console.log('Deploy step X failed', err);
throw new Error('Deploy step X failed');