hua
54a7f5dc40
Co-authored-by: root <root@huahua.daoyoucloud.com> Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-authored-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: TomyJan <TomyJan6@gmail.com> Co-authored-by: luliangqiang <2650321653@qq.com> Co-authored-by: yoona <1486343814@qq.com> Co-authored-by: wjh <wwwjh0710@163.com> Reviewed-on: daoyoucloud/tachybase#1408 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: hua <1494133104@qq.com> Co-committed-by: hua <1494133104@qq.com>
30 lines
847 B
JavaScript
30 lines
847 B
JavaScript
// scripts/deploy.js
|
|
const hre = require('hardhat');
|
|
const fs = require('fs');
|
|
|
|
// npx hardhat compile
|
|
// npx hardhat run scripts/deploy.js
|
|
async function main() {
|
|
const [deployer] = await hre.ethers.getSigners();
|
|
console.log('Deploying contracts with the account:', deployer.address);
|
|
|
|
//部署DataStorage合约
|
|
const DataStorage = await hre.ethers.getContractFactory('DataStorage');
|
|
const dataStorage = await DataStorage.deploy();
|
|
console.log('DataStorage deployed to:', dataStorage.target);
|
|
|
|
// 将DataStorage合约地址保存到一个JSON文件中
|
|
const contractAddresses = {
|
|
DataStorage: dataStorage.target,
|
|
};
|
|
|
|
fs.writeFileSync('contract-addresses.json', JSON.stringify(contractAddresses, null, 2));
|
|
}
|
|
|
|
main()
|
|
.then(() => process.exit(0))
|
|
.catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|