Skip to content

Commit 5830d19

Browse files
committed
Scripts to verify operation
1 parent 47c807b commit 5830d19

File tree

4 files changed

+917
-57
lines changed

4 files changed

+917
-57
lines changed

apps/hardhat/scripts/verifyDeployment.ts

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,86 @@ dotenv.config()
55
async function main() {
66
// Get the deployed contract
77
const learnTGVaults = await ethers.getContractAt(
8-
"LearnTGVaults",
8+
"LearnTGVaults",
99
process.env.DEPLOYED_AT // The deployed address
1010
);
11-
console.log("learnTGVaults at :", process.env.DEPLOYED_AT);
12-
11+
console.log("📜 LearnTGVaults Verification");
12+
console.log("=============================");
13+
console.log("Contract address:", process.env.DEPLOYED_AT);
14+
1315
// Get the owner of the contract
1416
const owner = await learnTGVaults.owner();
15-
console.log("Contract owner:", owner);
16-
17+
console.log("\n👤 Contract owner:", owner);
18+
1719
// Get the USDT token address that the contract was initialized with
1820
const usdtToken = await learnTGVaults.usdtToken();
19-
console.log("Contract USDT token address:", usdtToken);
20-
21+
console.log("💰 Contract USDT token address:", usdtToken);
22+
2123
// Get the cCop token address that the contract was initialized with
2224
const cCopToken = await learnTGVaults.cCopToken();
23-
console.log("Contract cCop token address:", cCopToken);
24-
25+
console.log("🔶 Contract cCop token address:", cCopToken);
26+
2527
// Get the gooddollar token address that the contract was initialized with
2628
const gooddollarToken = await learnTGVaults.gooddollarToken();
27-
console.log("Contract gooddollar token address:", gooddollarToken);
29+
console.log("💎 Contract gooddollar token address:", gooddollarToken);
30+
31+
// Get provider
32+
const provider = ethers.provider;
33+
34+
// Get USDT contract instance
35+
const usdtContract = await ethers.getContractAt("IERC20", usdtToken);
36+
const usdtDecimals = process.env.USDT_DECIMALS ? parseInt(process.env.USDT_DECIMALS) : 6;
37+
38+
console.log("\n📊 Balance Verification");
39+
console.log("=====================");
40+
41+
// 1. Check contract USDT balance
42+
const contractUSDTBalance = await usdtContract.balanceOf(learnTGVaults.target);
43+
const formattedContractUSDT = ethers.formatUnits(contractUSDTBalance, usdtDecimals);
44+
console.log(`1. LearnTGVaults USDT balance: ${formattedContractUSDT} USDT`);
45+
46+
// 2. Check contract CELO balance
47+
const contractCELOBalance = await provider.getBalance(learnTGVaults.target);
48+
const formattedContractCELO = ethers.formatEther(contractCELOBalance);
49+
console.log(`2. LearnTGVaults CELO balance: ${formattedContractCELO} CELO`);
50+
51+
// 3. Check owner USDT balance
52+
const ownerUSDTBalance = await usdtContract.balanceOf(owner);
53+
const formattedOwnerUSDT = ethers.formatUnits(ownerUSDTBalance, usdtDecimals);
54+
console.log(`3. Owner USDT balance: ${formattedOwnerUSDT} USDT`);
55+
56+
// 4. Check owner CELO balance
57+
const ownerCELOBalance = await provider.getBalance(owner);
58+
const formattedOwnerCELO = ethers.formatEther(ownerCELOBalance);
59+
console.log(`4. Owner CELO balance: ${formattedOwnerCELO} CELO`);
60+
61+
// 5. Check deployer account (from private key) balances if available
62+
if (process.env.PRIVATE_KEY) {
63+
const deployerWallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
64+
const deployerAddress = deployerWallet.address;
65+
const deployerUSDTBalance = await usdtContract.balanceOf(deployerAddress);
66+
const deployerCELOBalance = await provider.getBalance(deployerAddress);
67+
console.log(`\n🔑 Deployer account (from PRIVATE_KEY):`);
68+
console.log(` Address: ${deployerAddress}`);
69+
console.log(` USDT: ${ethers.formatUnits(deployerUSDTBalance, usdtDecimals)} USDT`);
70+
console.log(` CELO: ${ethers.formatEther(deployerCELOBalance)} CELO`);
71+
}
72+
73+
// 6. Check old Hardhat account #0 (common test account)
74+
const hardhatAccount0 = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
75+
const hardhatUSDTBalance = await usdtContract.balanceOf(hardhatAccount0);
76+
const hardhatCELOBalance = await provider.getBalance(hardhatAccount0);
77+
console.log(`\n🧪 Hardhat account #0 (common test):`);
78+
console.log(` Address: ${hardhatAccount0}`);
79+
console.log(` USDT: ${ethers.formatUnits(hardhatUSDTBalance, usdtDecimals)} USDT`);
80+
console.log(` CELO: ${ethers.formatEther(hardhatCELOBalance)} CELO`);
2881

29-
console.log("Contract deployed and verified successfully!");
82+
console.log("\n✅ Contract deployed and verified successfully!");
83+
console.log("\n📋 Summary:");
84+
console.log(" • LearnTGVaults contract is deployed and accessible");
85+
console.log(" • Verify contract has sufficient USDT for rewards");
86+
console.log(" • Verify contract has CELO for gas (if needed)");
87+
console.log(" • Owner and deployer accounts should have CELO for operations");
3088
}
3189

3290
main().catch((error) => {

0 commit comments

Comments
 (0)