support deploying with multiple arguments

This commit is contained in:
Iuri Matias 2015-06-19 23:21:03 -04:00
parent d728efe797
commit 7bb67dacc8
1 changed files with 3 additions and 7 deletions

View File

@ -37,14 +37,10 @@ module.exports = (grunt) ->
args = contractsConfig[className].args
contractObject = web3.eth.contract(contract.info.abiDefinition)
#contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code, gas: contractGasLimit, gasPrice: contractGasPrice})
#contractAddress = contractObject.new(150, {from: primaryAddress, data: contract.code, gas: contractGasLimit, gasPrice: contractGasPrice}).address
contractAddress = contractObject.new.apply(contractObject, [args, {from: primaryAddress, data: contract.code, gas: contractGasLimit, gasPrice: contractGasPrice}]).address
if (web3.eth.getCode(contractAddress) is "0x") {
console.log "contract #{className} was not deployed, try adjusting the gas costs"
exit
}
contractParams = args
contractParams.push({from: primaryAddress, data: contract.code, gas: contractGasLimit, gasPrice: contractGasPrice})
contractAddress = contractObject.new.apply(contractObject, contractParams).address
console.log "address is #{contractAddress}"