Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- scripts/deploy.js +25 -0
- scripts/fund-dao.js +15 -0
scripts/deploy.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const hre = require("hardhat");
|
| 2 |
+
|
| 3 |
+
async function main() {
|
| 4 |
+
const [deployer] = await hre.ethers.getSigners();
|
| 5 |
+
const creator = process.env.YOUR_WALLET || deployer.address;
|
| 6 |
+
|
| 7 |
+
const Trigger = await hre.ethers.getContractFactory("Trigger");
|
| 8 |
+
const trigger = await Trigger.deploy(creator);
|
| 9 |
+
await trigger.waitForDeployment();
|
| 10 |
+
console.log("Trigger:", await trigger.getAddress());
|
| 11 |
+
|
| 12 |
+
const Treasury = await hre.ethers.getContractFactory("Treasury");
|
| 13 |
+
const treasury = await Treasury.deploy(await trigger.getAddress());
|
| 14 |
+
await treasury.waitForDeployment();
|
| 15 |
+
console.log("Treasury (DAO):", await treasury.getAddress());
|
| 16 |
+
|
| 17 |
+
const Splitter = await hre.ethers.getContractFactory("RevenueSplitter");
|
| 18 |
+
const splitter = await Splitter.deploy(await treasury.getAddress(), creator);
|
| 19 |
+
await splitter.waitForDeployment();
|
| 20 |
+
console.log("Splitter (10% to you):", await splitter.getAddress());
|
| 21 |
+
|
| 22 |
+
// Update env: DAO_TREASURY=...
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
main();
|
scripts/fund-dao.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const hre = require("hardhat");
|
| 2 |
+
|
| 3 |
+
async function main() {
|
| 4 |
+
const treasuryAddr = process.env.DAO_TREASURY;
|
| 5 |
+
const usdc = await hre.ethers.getContractAt("ERC20", "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
|
| 6 |
+
const amount = hre.ethers.parseUnits("1000", 6); // $1000
|
| 7 |
+
|
| 8 |
+
// Approve & fund (run with your private key)
|
| 9 |
+
await usdc.approve(treasuryAddr, amount);
|
| 10 |
+
const treasury = await hre.ethers.getContractAt("Treasury", treasuryAddr);
|
| 11 |
+
await treasury.fund(amount);
|
| 12 |
+
console.log("Funded $1000 → 1000 votes earned!");
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
main();
|