DeploymentSaver
Inherits: ChainAwareReader, ChainAwareWriter
Functions
checkBeforeDeploying
function checkBeforeDeploying(string memory contractName) internal view returns (address deployedAt);
checkBeforeDeploying
function checkBeforeDeploying(
string memory contractName,
string memory contractAlias
)
internal
view
returns (address deployedAt);
deployAndSave
Deploys a contract and saves the deployment JSON, if the contract hasn't been deployed yet.
See deployAndSaveAs
below for more details.
function deployAndSave(
string memory contractName,
bytes memory constructorArgs,
function(string memory, bytes memory) internal returns (address) deployCodeFunc
)
internal
returns (address deployedAt);
deployAndSaveAs
Deploys a contract and saves the deployment JSON, if the contract hasn't been deployed yet. Needs to be passed a generic function that deploys the contract, that follows this signature: deployCodeFunc(string memory contractName, bytes memory constructorArgs) internal returns (address deployedAt);
- Example: cbDeploy() and cbDeployCreate2() could be used here, as they follow the signature. Or anything else that could deploy raw bytecode of any contract, most likely using assembly/factory approach.
- Note: contract should be configured outside of
deployCodeFunc
.
function deployAndSaveAs(
string memory contractName,
string memory contractAlias,
bytes memory constructorArgs,
function(string memory, bytes memory) internal returns (address) deployCodeFunc
)
internal
returns (address deployedAt);
deployAndSave
Deploys a contract and saves the deployment JSON, if the contract hasn't been deployed yet.
See deployAndSaveAs
below for more details.
function deployAndSave(
string memory contractName,
function() internal returns (address, bytes memory) deployContractFunc
)
internal
returns (address deployedAt);
deployAndSaveAs
Deploys a contract and saves the deployment JSON, if the contract hasn't been deployed yet. Needs to be passed a contract-specific function that deploys the contract, that follows this signature: deployContractFunc() internal returns (address deployedAt, bytes memory constructorArgs);
- Example: use anything that deploys a specific contract, most likely using
new Contract(...);
approach. - Note: contract should be configured outside of
deployContractFunc
.
function deployAndSaveAs(
string memory contractName,
string memory contractAlias,
function() internal returns (address, bytes memory) deployContractFunc
)
internal
returns (address deployedAt);
serializeDeploymentData
Produces a JSON string that can be used to save a contract deployment. Note: contract ABI is not included in the output.
function serializeDeploymentData(
address deployedAt,
bytes memory constructorArgs
)
internal
returns (string memory data);
saveDeployment
Saves the deployment JSON for a contract on a given chain under the specified alias. Example: contractName = "LinkedPool", contractAlias = "LinkedPool.USDC" Note: writes the JSON file to the FRESH deployments directory. The written file needs to be moved to the correct location outside of the deployment script. Note: will not include the ABI in the output JSON.
function saveDeployment(
string memory contractAlias,
address deployedAt,
bytes memory constructorArgs
)
internal
withIndent;