Update docs to be more clear about deployer function arguments
See original GitHub issueI’m trying to deploy contracts to ganache, using truffle migrate
. One of my contracts requiring to get accounts addresses as constructor parameter
When I try to use
module.exports = function(deployer, network, accounts) {
// Use the accounts within your migrations.
}
and trying deploy like this:
module.exports = function(deployer, accounts) {
// deployer.deploy(SimpleStorage);
deployer.deploy(KNS).then(function() {
console.log(accounts);
console.log(accounts[0]);
return deployer.deploy(SuperFactory, KNS.address,accounts[0],accounts[0]);
});
};
it falis with invalid address.
console.log(accounts)
just print me string
ganache
Expected Behavior
migration successful, or at least console.log
should return me Promise of accounts array
(the same way as I would invoke web3.eth.getAccounts()
)
I also should note, that when I’m invoking web3.eth.getAccounts() manually - it works fine, but when I’m trying to get accounts from module.exports
it returns me that ganache
string and nothing else
Current Behavior
accounts contain simple string ganache
and nothing else
Possible Solution
Check out accounts from module.exports or check out ganache accounts accesability.
Your Environment
Truffle v.5.1.12
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Oh, I just found where bug is
module exports always think, that second parameter is a network, and third parameter is accounts.
If I don’t need network parameter for deploy and only need accounts – I should cast it as third parameter to module.exports
Yep! I’ll update this issue accordingly! Thanks @JackBekket