[a] Added applyArgumentPlugins before _determineArguments in ContractDeployer for plugins that calculate arguments dynamically.

[m] Made possible for deploy:contract:beforeDeploy plugin to modify arguments list.
This commit is contained in:
hodlbank 2018-10-02 21:30:42 +00:00 committed by Pascal Precht
parent 10bf3e4412
commit e13c0b3724
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 6 additions and 1 deletions

View File

@ -116,6 +116,11 @@ class ContractDeployer {
next();
});
},
function applyArgumentPlugins(next) {
self.plugins.emitAndRunActionsForEvent('deploy:contract:arguments', {contract: contract}, (_params) => {
next();
});
},
function _determineArguments(next) {
self.determineArguments(params || contract.args, contract, accounts, (err, realArgs) => {
if (err) {
@ -189,7 +194,6 @@ class ContractDeployer {
deployContract(contract, callback) {
let self = this;
let contractParams = (contract.realArgs || contract.args).slice();
let deployObject;
async.waterfall([
@ -239,6 +243,7 @@ class ContractDeployer {
function createDeployObject(next) {
let contractCode = contract.code;
let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition});
let contractParams = (contract.realArgs || contract.args).slice();
try {
const dataCode = contractCode.startsWith('0x') ? contractCode : "0x" + contractCode;