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 libContract = await hre.ethers.getContractFactory(lib);
|
||||||
const libInstance = await libContract.deploy();
|
const libInstance = await libContract.deploy();
|
||||||
await libInstance.deployed();
|
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}`);
|
console.log(`Library "${lib}" deployed at ${libInstance.address}`);
|
||||||
libraries[lib] = 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}"`
|
`Contract ${CONTRACT_NAME} upgraded at "${deployResult.address}" by account "${deployResult.signer.address}"`
|
||||||
);
|
);
|
||||||
console.log('\x1b[0m');
|
console.log('\x1b[0m');
|
||||||
await deployStore(network, CONTRACT_NAME, deployResult);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
e.message === 'new-proxy-instance' ||
|
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 filePath = getDeployFilePath(network, contractName);
|
||||||
|
|
||||||
const { buildId, solcInput, abi, bytecode, metadata, storageLayout } =
|
const { buildId, solcInput, abi, bytecode, metadata, storageLayout } =
|
||||||
await getBuildData(contractName);
|
await getBuildData(contractName);
|
||||||
|
|
||||||
const implementationAddress = await getImplementationAddress(
|
|
||||||
hre.network.provider,
|
|
||||||
contract.address
|
|
||||||
);
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
buildId,
|
buildId,
|
||||||
timestamp: new Date().toLocaleString('en-US'),
|
timestamp: new Date().toLocaleString('en-US'),
|
||||||
address: contract.address,
|
address: contract.address,
|
||||||
implementationAddress,
|
|
||||||
transactionHash: contract.deployTransaction.hash,
|
transactionHash: contract.deployTransaction.hash,
|
||||||
args: contract.deployTransaction.args,
|
args: contract.deployTransaction.args,
|
||||||
gasPrice: contract.deployTransaction.gasPrice.toNumber(),
|
gasPrice: contract.deployTransaction.gasPrice.toNumber(),
|
||||||
|
|
@ -58,6 +52,14 @@ const deployStore = async (network, contractName, contract) => {
|
||||||
storageLayout,
|
storageLayout,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (isProxy) {
|
||||||
|
const implementationAddress = await getImplementationAddress(
|
||||||
|
hre.network.provider,
|
||||||
|
contract.address
|
||||||
|
);
|
||||||
|
data.implementationAddress = implementationAddress;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const solcInputsFilePath =
|
const solcInputsFilePath =
|
||||||
filePath.split('/').slice(0, -1).join('/') +
|
filePath.split('/').slice(0, -1).join('/') +
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue