Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve redundancy of contract deployment #555

Closed
baumstern opened this issue Dec 1, 2022 · 8 comments · Fixed by #565
Closed

Resolve redundancy of contract deployment #555

baumstern opened this issue Dec 1, 2022 · 8 comments · Fixed by #565
Assignees
Labels
enhancement New feature or request

Comments

@baumstern
Copy link
Member

    TODO: resolve redundacy

Originally posted by @gurrpi in #553 (comment)

@ctrlc03
Copy link
Collaborator

ctrlc03 commented Dec 1, 2022

Good shout, although I found that in between txs I had to pull fresh gas fee data to get it to work, so if we were to make an object like:

const deploymentOptions = {
    maxFeePerGas: gasFees['maxFeePerGas']
}

we would need to re update the object value every time we pull fresh data :/

Will need to think how to clean up that code

@baumstern
Copy link
Member Author

@ctrlc03
Copy link
Collaborator

ctrlc03 commented Dec 1, 2022

I think this can be unified in the cli. There might be reasons why one would only want to call one function at the time. Or maybe have a deployAll function as well that calls all of them

@baumstern
Copy link
Member Author

Good shout, although I found that in between txs I had to pull fresh gas fee data to get it to work. Will need to think how to clean up that code

Had thought to solve it by something like following:

function invokeDeploy(contractFactory) {
    const gasFees = await signer.provider.getFeeData()

	return await contractFactory.deploy({
        maxFeePerGas: gasFees['maxFeePerGas'],
    })
}

@ctrlc03
Copy link
Collaborator

ctrlc03 commented Dec 1, 2022

Good shout, although I found that in between txs I had to pull fresh gas fee data to get it to work. Will need to think how to clean up that code

Had thought to solve it by something like following:

function invokeDeploy(contractFactory) {
    const gasFees = await signer.provider.getFeeData()

	return await contractFactory.deploy({
        maxFeePerGas: gasFees['maxFeePerGas'],
    })
}

Nice this would definitely work

@baumstern
Copy link
Member Author

I think this can be unified in the cli. There might be reasons why one would only want to call one function at the time. Or maybe have a deployAll function as well that calls all of them

oh I intended to make just one function like following and call it from business logic:

function deployContract(name, args?) {
	const signer = await getDefaultSigner()
    const contractFactory = await ethers.getContractFactory('name', signer)
    const gasFees = await signer.provider.getFeeData()
    return await contractFactory.deploy({
        maxFeePerGas: gasFees['maxFeePerGas'],
    })
}

It would get rid of 50+ lines lol

@ctrlc03
Copy link
Collaborator

ctrlc03 commented Dec 1, 2022

I think this can be unified in the cli. There might be reasons why one would only want to call one function at the time. Or maybe have a deployAll function as well that calls all of them

oh I intended to make just one function like following and call it from business logic:

function deployContract(name, args?) {
	const signer = await getDefaultSigner()
    const contractFactory = await ethers.getContractFactory('name', signer)
    const gasFees = await signer.provider.getFeeData()
    return await contractFactory.deploy({
        maxFeePerGas: gasFees['maxFeePerGas'],
    })
}

It would get rid of 50+ lines lol

yea that's perfect will implement later

@ctrlc03 ctrlc03 self-assigned this Dec 1, 2022
@ctrlc03 ctrlc03 added 1 enhancement New feature or request labels Dec 1, 2022
@ctrlc03 ctrlc03 assigned baumstern and unassigned ctrlc03 Dec 1, 2022
@ctrlc03
Copy link
Collaborator

ctrlc03 commented Dec 5, 2022

We need to add the maxFeePerGas param to the deployment of pollFactory too, on my latest test deployment it failed while all others succeeded. Adding the following fixed it

{
        maxFeePerGas: gasFees['maxFeePerGas']
 }

@ctrlc03 ctrlc03 self-assigned this Dec 6, 2022
ctrlc03 pushed a commit that referenced this issue Dec 6, 2022
Refactored deployment scripts to be more concise

fix #555
baumstern pushed a commit that referenced this issue Dec 6, 2022
Refactored deployment scripts to be more concise

fix #555
@baumstern baumstern linked a pull request Dec 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants