-
Notifications
You must be signed in to change notification settings - Fork 282
Custom Deployments #273
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
base: master
Are you sure you want to change the base?
Custom Deployments #273
Changes from 1 commit
cf991ce
3901829
2eed04f
da68e95
8b724d9
8d7fba2
67b95de
fb3acd6
ca259db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import type { ContractFactory, ContractTransaction } from 'ethers'; | ||
import type { Deployment } from '@openzeppelin/upgrades-core'; | ||
import type { ContractFactory } from 'ethers'; | ||
export interface DeploymentExecutor { | ||
(factory: ContractFactory): Promise<HardhatDeployment>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason this does not already return a "CoreDeployment"? In other words why do we need a I think the existence of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I can't exactly recall why this was necessary, but I believe it had something to do with the transformation of the proxy deployment from const proxy = await ProxyFactory.deploy(impl, adminAddress, data); into const proxy = await deploy(ProxyFactory, [impl, adminAddress, data]); and its return values not matching up. Notice how we don't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, yes, I believe I recall why we needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd imagine the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I insist on this is that we currently have duplication of this layer across the Hardhat and Truffle plugins but we will want to merge those soon, and using the transaction hash is a more agnostic way to represent a deployment, instead of the Ethers-specific There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally fine with me. I prefer to return only the hash any way. Have made the necessary adjustments and it also made the code on our end much more attractive and easy to write. |
||
} | ||
|
||
export interface HardhatDeployment { | ||
address: string; | ||
deployTransaction: ContractTransaction; | ||
} | ||
|
||
export function defaultDeploy(factory: ContractFactory, args: unknown[]): Promise<HardhatDeployment> { | ||
return factory.deploy(...args); | ||
} | ||
|
||
export async function deploy(factory: ContractFactory): Promise<Deployment> { | ||
const { address, deployTransaction } = await factory.deploy(); | ||
const txHash = deployTransaction.hash; | ||
return { address, txHash }; | ||
export function intoCoreDeployment({ address, deployTransaction }: HardhatDeployment): Deployment { | ||
return { address, txHash: deployTransaction.hash }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a "tx executor" and not only a deployment executor.
I'm thinking that for
upgradeProxy
it should also take care of sending theupgrade
function call. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit, I will look into this!