Hi folks, is there any example of 'funding contract while deploying'?
Like a script in migration file...
Mar 30, 2021, 4:19 PM
I need to send eth to contract while creating it
i have a migration file, i deploy the contract with it, right..? I need to put a script in it to send eth when I'm migrating the contract to the provider. Transaction will occur from creator's address to the new created contract address , where is the polska in this?
Mar 30, 2021, 4:59 PM
const YourContract = artifacts.require("YourContract");
module.exports = (deployer, accounts) => {
if (accounts) {
// Create contract with 1 ether (contract must be payable)
deployer.deploy(YourContract, { from: accounts[0], value: "1000000000000000000" });
};
};
module.exports = (deployer, accounts) => {
if (accounts) {
// Create contract with 1 ether (contract must be payable)
deployer.deploy(YourContract, { from: accounts[0], value: "1000000000000000000" });
};
};
You should check stackoverflow more often :)
Mar 30, 2021, 5:19 PM
thank you, friend! 👍
I'll try this. you are right, I promise to check stackoverflow more, I don't know why this time the ones I found didn't work. so I had to pass by in here. thanks
I'll try this. you are right, I promise to check stackoverflow more, I don't know why this time the ones I found didn't work. so I had to pass by in here. thanks
Mar 30, 2021, 5:29 PM
Nvm. One guy send pic with hindi text. It was a joke about it. He ve deleted it
Mar 30, 2021, 6:23 PM
Aight bro, thanks. all good 👍
Mar 30, 2021, 6:39 PM