Files
defiQUG c94eb595f8
Some checks failed
CI / lint-and-test (push) Has been cancelled
Initial commit: add .gitignore and README
2026-02-09 21:51:53 -08:00

40 lines
1.4 KiB
TypeScript

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);
});