fix: script deployment store for libraries and proxy (#248)
This commit is contained in:
parent
69ebd36a5b
commit
d2f81ee98e
|
|
@ -25,7 +25,7 @@ const libraryDeployment = async (hre) => {
|
|||
const libContract = await hre.ethers.getContractFactory(lib);
|
||||
const libInstance = await libContract.deploy();
|
||||
await libInstance.deployed();
|
||||
deployStore(hre.network.name, lib, libInstance);
|
||||
await deployStore(hre.network.name, lib, libInstance, false);
|
||||
console.log(`Library "${lib}" deployed at ${libInstance.address}`);
|
||||
libraries[lib] = libInstance.address;
|
||||
}
|
||||
|
|
@ -70,7 +70,6 @@ module.exports = async (taskArgs, hre) => {
|
|||
`Contract ${CONTRACT_NAME} upgraded at "${deployResult.address}" by account "${deployResult.signer.address}"`
|
||||
);
|
||||
console.log('\x1b[0m');
|
||||
await deployStore(network, CONTRACT_NAME, deployResult);
|
||||
} catch (e) {
|
||||
if (
|
||||
e.message === 'new-proxy-instance' ||
|
||||
|
|
|
|||
|
|
@ -33,22 +33,16 @@ const getBuildData = async (contractName) => {
|
|||
};
|
||||
};
|
||||
|
||||
const deployStore = async (network, contractName, contract) => {
|
||||
const deployStore = async (network, contractName, contract, isProxy = true) => {
|
||||
const filePath = getDeployFilePath(network, contractName);
|
||||
|
||||
const { buildId, solcInput, abi, bytecode, metadata, storageLayout } =
|
||||
await getBuildData(contractName);
|
||||
|
||||
const implementationAddress = await getImplementationAddress(
|
||||
hre.network.provider,
|
||||
contract.address
|
||||
);
|
||||
|
||||
const data = {
|
||||
buildId,
|
||||
timestamp: new Date().toLocaleString('en-US'),
|
||||
address: contract.address,
|
||||
implementationAddress,
|
||||
transactionHash: contract.deployTransaction.hash,
|
||||
args: contract.deployTransaction.args,
|
||||
gasPrice: contract.deployTransaction.gasPrice.toNumber(),
|
||||
|
|
@ -58,6 +52,14 @@ const deployStore = async (network, contractName, contract) => {
|
|||
storageLayout,
|
||||
};
|
||||
|
||||
if (isProxy) {
|
||||
const implementationAddress = await getImplementationAddress(
|
||||
hre.network.provider,
|
||||
contract.address
|
||||
);
|
||||
data.implementationAddress = implementationAddress;
|
||||
}
|
||||
|
||||
try {
|
||||
const solcInputsFilePath =
|
||||
filePath.split('/').slice(0, -1).join('/') +
|
||||
|
|
|
|||
Loading…
Reference in New Issue