Skip to content

Instantly share code, notes, and snippets.

@devonwesley
Last active December 20, 2017 02:23
Show Gist options
  • Save devonwesley/c80ba20502c778a94d472c8906a82fa6 to your computer and use it in GitHub Desktop.
Save devonwesley/c80ba20502c778a94d472c8906a82fa6 to your computer and use it in GitHub Desktop.
Function for blog series
function deployContractEvent(name, contract) {
const comfirmMsg = `
Contract: ${name.substring(1)}
Network: ${currentNetwork()}
Confirm to deploy with these settings.
`
if (!confirm(comfirmMsg)) return
const { bytecode, interface } = contract
const newContract = web3.eth.contract(JSON.parse(interface))
const options = { from: web3.eth.accounts[0], data: bytecode, gas: 1000000 }
newContract.new(options, newContractCallback(name))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment