Initial commit: add .gitignore and README
Some checks failed
CI / lint-and-test (push) Has been cancelled
Some checks failed
CI / lint-and-test (push) Has been cancelled
This commit is contained in:
39
contracts/scripts/deploy.ts
Normal file
39
contracts/scripts/deploy.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { ethers } from "hardhat";
|
||||
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
|
||||
console.log("Deploying contracts with the account:", deployer.address);
|
||||
console.log("Account balance:", (await ethers.provider.getBalance(deployer.address)).toString());
|
||||
|
||||
// Deploy SubAccountFactory
|
||||
const SubAccountFactory = await ethers.getContractFactory("SubAccountFactory");
|
||||
const factory = await SubAccountFactory.deploy();
|
||||
await factory.waitForDeployment();
|
||||
const factoryAddress = await factory.getAddress();
|
||||
console.log("SubAccountFactory deployed to:", factoryAddress);
|
||||
|
||||
// Example: Deploy a TreasuryWallet with initial owners
|
||||
// In production, this would be done by the frontend when a user creates a treasury
|
||||
const owners = [deployer.address]; // Replace with actual owners
|
||||
const threshold = 1;
|
||||
|
||||
const TreasuryWallet = await ethers.getContractFactory("TreasuryWallet");
|
||||
const treasury = await TreasuryWallet.deploy(owners, threshold);
|
||||
await treasury.waitForDeployment();
|
||||
const treasuryAddress = await treasury.getAddress();
|
||||
console.log("TreasuryWallet deployed to:", treasuryAddress);
|
||||
|
||||
console.log("\nDeployment Summary:");
|
||||
console.log("===================");
|
||||
console.log("SubAccountFactory:", factoryAddress);
|
||||
console.log("Example TreasuryWallet:", treasuryAddress);
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user