Typescript wrapper to use PoolTogether's Generic Minimal Proxy Factory for deploying contracts.
Note: this pattern does not work very well with Ownable contracts - because these must be constructed vs. initialized.
Import this package into your repo using:
yarn add -D @pooltogether/pooltogether-proxy-factory-package
Import in the deployments script:
import { factoryDeploy } from "@pooltogether/pooltogether-proxy-factory-package"
or using javascript:
const { factoryDeploy } = require("@pooltogether/pooltogether-proxy-factory-package")
Add the genericProxyFactory deployment (addresses) to namedAccounts
in hardhat.config.ts
:
...
namedAccounts: {
...
genericProxyFactory: {
1: "0x14e09c3319244a84e7c1E7B52634f5220FA96623",
4: "0x594069c560D260F90C21Be25fD2C8684efbb5628",
42: "0x713edC7728C4F0BCc135D48fF96282444d77E604",
137: "0xd1797D46C3E825fce5215a0259D3426a5c49455C",
80001: "0xd1797D46C3E825fce5215a0259D3426a5c49455C"
}
Pass the paramaters required:
interface DeploySettings {
implementationAddress: string
contractName: string
overWrite?: boolean // defaults to false
signer?: Signer
initializeData?: string
provider: Provider
}
The initialization data can be encoded as such:
const contractInterface = new ethers.utils.Interface(contractAbi)
const constructorArgs: string = contractInterface.encodeFunctionData(contractInterface.getFunction("functionName"),
[
arg1,
arg2
]
)
Note: if there is no Generic Proxy Factory for the target network, one will be deployed
Install the repo and dependencies by running:
yarn
To build the package, run:
yarn dev
To publish any changes to npm, build first and then run:
yarn publish
Run the unit tests locally with:
yarn test
Generate the test coverage report with:
yarn coverage