Skip to content

Instantly share code, notes, and snippets.

@richardartoul
Created December 17, 2017 00:09
Show Gist options
  • Save richardartoul/be47af7d106b3008f3098a36c4370503 to your computer and use it in GitHub Desktop.
Save richardartoul/be47af7d106b3008f3098a36c4370503 to your computer and use it in GitHub Desktop.
Truffle SingleMessage migration script
var SingleMessage = artifacts.require('../contracts/SingleMessage.sol');
module.exports = function(deployer, network, accounts) {
return liveDeploy(deployer, accounts);
};
async function liveDeploy(deployer, accounts) {
const initialMessage = "Hello world!";
const initialPriceInWei = 1;
const maxLength = 200;
console.log("Contract arguments: ", {
initialMessage: initialMessage,
initialPriceInWei: initialPriceInWei,
maxLength: maxLength
});
return deployer.deploy(SingleMessage, initialMessage, initialPriceInWei, maxLength).then(async() => {
const contract = await SingleMessage.deployed();
const message = await contract.message.call();
const priceInWei = await contract.priceInWei.call();
const maxLength = await contract.maxLength.call();
console.log("public vars from contract: ", {
message: message,
priceInWei: priceInWei,
maxLength: maxLength
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment