Skip to content

Instantly share code, notes, and snippets.

@Daltonic
Created June 23, 2023 16:03
Show Gist options
  • Save Daltonic/4f64140d171ddc04eb6b845ca220e451 to your computer and use it in GitHub Desktop.
Save Daltonic/4f64140d171ddc04eb6b845ca220e451 to your computer and use it in GitHub Desktop.
Dapp Cinemas
const { ethers } = require('hardhat')
const fs = require('fs')
async function main() {
const Contract = await ethers.getContractFactory('DappCinemas')
const contract = await Contract.deploy()
await contract.deployed()
// For demo purpose, you can remove before deployment to a live chain
const name = 'Spider-Man: Across the Spider-Verse'
const imageUrl =
'https://weliveentertainment.com/wp-content/uploads/2023/05/across-spider-verse-banner-4.jpg'
const genre = 'Animated, Action, Adventure, Comedy, Sci-Fi'
const description =
'Miles Morales returns for an epic adventure across the multiverse, teaming up with Gwen Stacy and a new team of Spider-People to face a new threat.'
await contract.addMovie(name, imageUrl, genre, description)
// Ends here...
const address = JSON.stringify({ address: contract.address }, null, 4)
fs.writeFile('./src/abis/contractAddress.json', address, 'utf8', (err) => {
if (err) {
console.error(err)
return
}
console.log('Deployed contract address', contract.address)
})
}
main().catch((error) => {
console.error(error)
process.exitCode = 1
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment