deploy script

sl
aniket-engg 4 years ago committed by Aniket
parent 8a7045ee2d
commit ac7147268c
  1. 32
      apps/remix-ide/src/app/editor/examples.js

@ -248,7 +248,37 @@ contract BallotTest {
}
}
`
var deploy = `js`
var deploy = `(async () => {
try {
console.log('Running...')
const contractName = 'Storage' // Change this for other contract
const constructorArgs = [] // Put constructor args (if any) here for your contract
// Note that the script needs the ABI which is generated from the compilation artifact.
// Make sure contract is compiled and artifacts are generated
const artifactsPath = \`browser/contracts/artifacts/\${contractName}.json\` // Change this for different path
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
const accounts = await web3.eth.getAccounts()
let contract = new web3.eth.Contract(metadata.abi)
contract = contract.deploy({
data: metadata.data.bytecode.object,
arguments: constructorArgs
})
const newContractInstance = await contract.send({
from: accounts[0],
gas: 1500000,
gasPrice: '30000000000'
})
console.log('Contract deployed at address: ', newContractInstance.options.address)
} catch (e) {
console.log(e.message)
}
})()`
var readme = `readme`
module.exports = {

Loading…
Cancel
Save