Skip to content

Contract interaction in our Deploy scripts #702

Answered by krakxn
Benrockiee asked this question in Q&A
Discussion options

You must be logged in to vote

Their primary use itself is for deploying our contracts, here is an example:
This creates a contract factory SimpleStorageFactory of contract SimpleStorage.sol and then deploys the contract factory which essentially deploys our contract.

const SimpleStorageFactory = await ethers.getContractFactory(
        "SimpleStorage"
    )
    console.log("Deploying contract...")
    const simpleStorage = await SimpleStorageFactory.deploy()
    await simpleStorage.deployed()
    console.log(`Currently deployed to: ${simpleStorage.address}`)

Let me know if this helped, goodluck with your course!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alymurtazamemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
questioner-no-response No any response from questioner
2 participants