-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 Use fixtures when deploying test contracts (#183)
- Loading branch information
1 parent
949a5fd
commit b894116
Showing
4 changed files
with
71 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { type DeployFunction } from 'hardhat-deploy/types' | ||
import assert from 'assert' | ||
|
||
/** | ||
* This deploy function will deploy and configure the Thrower contract | ||
* | ||
* @param env `HardhatRuntimeEnvironment` | ||
*/ | ||
const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network }) => { | ||
const [deployer] = await getUnnamedAccounts() | ||
assert(deployer, 'Missing deployer') | ||
|
||
await deployments.delete('Thrower') | ||
const throwerDeployment = await deployments.deploy('Thrower', { | ||
from: deployer, | ||
}) | ||
|
||
console.table({ | ||
Network: `${network.name}`, | ||
Thrower: throwerDeployment.address, | ||
}) | ||
} | ||
|
||
deploy.tags = ['Thrower'] | ||
|
||
export default deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { type DeployFunction } from 'hardhat-deploy/types' | ||
import assert from 'assert' | ||
|
||
/** | ||
* This deploy function will deploy and configure the TestProxy contract | ||
* | ||
* @param env `HardhatRuntimeEnvironment` | ||
*/ | ||
const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network }) => { | ||
const [deployer] = await getUnnamedAccounts() | ||
assert(deployer, 'Missing deployer') | ||
|
||
await deployments.delete('TestProxy') | ||
const testProxyDeployment = await deployments.deploy('TestProxy', { | ||
from: deployer, | ||
proxy: { | ||
owner: deployer, | ||
proxyContract: 'OptimizedTransparentProxy', | ||
execute: { | ||
init: { | ||
methodName: 'initialize', | ||
args: [], | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
||
console.table({ | ||
Network: `${network.name}`, | ||
TestProxy: testProxyDeployment.address, | ||
}) | ||
} | ||
|
||
deploy.tags = ['TestProxy'] | ||
|
||
export default deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters