diff --git a/README.md b/README.md index 1ec0a88..dc78ab4 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ const config: HardhatUserConfig = { export default config; ``` -`contractName` property is optional and only needed if configuration includes multiple instances of one contract +`contractName` property is optional and only needed if configuration contract key is not the same as contract name **note**: dependant contract must be located above @@ -73,9 +73,7 @@ npx hardhat deploy-bundle --no-compile true ## Configuration -By default, hardhat-sol-bundler supports only deployment runtime accessability. - -- To deploy only modified contracts, add `lockFile` property to deployment +- To deploy only modified contracts, add `lockFile` property to deployment: ```ts const deployment = { @@ -86,7 +84,24 @@ const deployment = { }; ``` -- To verify deployed contracts during runtime. +- To deploy contract as a proxy: + +```ts +import { SupportedProxies } from "@dgma/hardhat-sol-bundler"; + +const deployment = { + lockFile: "deployment-lock.json", + config: { + TestContract: { + proxy: { + type: SupportedProxies.CUSTOM + } + } + }, +}; +``` + +- To verify deployed contracts during runtime: ```ts // no need @nomicfoundation/hardhat-verify if you use @nomicfoundation/hardhat-toolbox diff --git a/package-lock.json b/package-lock.json index ad1fc4a..7631d16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dgma/hardhat-sol-bundler", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dgma/hardhat-sol-bundler", - "version": "0.5.0", + "version": "0.5.1", "license": "SEE LICENSE IN LICENSE", "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.6", diff --git a/package.json b/package.json index ed9e92b..4417327 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dgma/hardhat-sol-bundler", - "version": "0.5.0", + "version": "0.5.1", "description": "Declarative deployment tool for smart contracts", "main": "src/index.js", "types": "src/index.d.ts", diff --git a/src/deploy/constants.ts b/src/deploy/constants.ts index d931ea6..ef175bd 100644 --- a/src/deploy/constants.ts +++ b/src/deploy/constants.ts @@ -1,4 +1,5 @@ export const SupportedProxies = { TRANSPARENT: "transparent", UUPS: "uups", + CUSTOM: "custom", } as const; diff --git a/src/deploy/deploy.ts b/src/deploy/deploy.ts index 655161c..441bd44 100644 --- a/src/deploy/deploy.ts +++ b/src/deploy/deploy.ts @@ -7,7 +7,6 @@ import { type IGlobalState, type IDeployingContractState, type ProxyUnsafeAllow, - type ProxyType, } from "./types"; import { getDeployment, @@ -18,13 +17,16 @@ import { type ContractState = stateFabric.IState; type GlobalState = stateFabric.IState; +type ClassicProxyTypes = + | typeof SupportedProxies.TRANSPARENT + | typeof SupportedProxies.UUPS; async function deployOrUpdateClassic( hre: HardhatRuntimeEnvironment, state: GlobalState, contractState: ContractState, unsafeAllow: ProxyUnsafeAllow[], - kind: ProxyType = SupportedProxies.TRANSPARENT, + kind: ClassicProxyTypes = SupportedProxies.TRANSPARENT, ) { const contractLockData = state.value().ctx[contractState.value().key]; const factory = contractState.value().factory!; @@ -54,7 +56,6 @@ async function deployOrUpdateClassic( contractState.update((prevState) => ({ ...prevState, contract, - proxy: SupportedProxies.TRANSPARENT, })); }