@pasosdejesus/m 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain/deployments.d.ts +40 -0
- package/dist/blockchain/deployments.d.ts.map +1 -0
- package/dist/blockchain/deployments.js +64 -0
- package/dist/debug/DebugConsole.d.ts +22 -0
- package/dist/debug/DebugConsole.d.ts.map +1 -0
- package/dist/debug/DebugConsole.js +79 -0
- package/dist/debug/Logger.d.ts +38 -0
- package/dist/debug/Logger.d.ts.map +1 -0
- package/dist/debug/Logger.js +94 -0
- package/dist/debug/index.d.ts +6 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +4 -0
- package/dist/debug/useLogger.d.ts +14 -0
- package/dist/debug/useLogger.d.ts.map +1 -0
- package/dist/debug/useLogger.js +23 -0
- package/dist/debug/utils.d.ts +10 -0
- package/dist/debug/utils.d.ts.map +1 -0
- package/dist/debug/utils.js +53 -0
- package/dist/e2e/assertions.d.ts +5 -0
- package/dist/e2e/assertions.d.ts.map +1 -0
- package/dist/e2e/assertions.js +18 -0
- package/dist/e2e/browser.d.ts +37 -0
- package/dist/e2e/browser.d.ts.map +1 -0
- package/dist/e2e/browser.js +97 -0
- package/dist/e2e/env.d.ts +18 -0
- package/dist/e2e/env.d.ts.map +1 -0
- package/dist/e2e/env.js +57 -0
- package/dist/e2e/index.d.ts +11 -0
- package/dist/e2e/index.d.ts.map +1 -0
- package/dist/e2e/index.js +8 -0
- package/dist/e2e/navigation.d.ts +4 -0
- package/dist/e2e/navigation.d.ts.map +1 -0
- package/dist/e2e/navigation.js +32 -0
- package/dist/e2e/siwe-mock.d.ts +11 -0
- package/dist/e2e/siwe-mock.d.ts.map +1 -0
- package/dist/e2e/siwe-mock.js +112 -0
- package/dist/e2e/siwe.d.ts +15 -0
- package/dist/e2e/siwe.d.ts.map +1 -0
- package/dist/e2e/siwe.js +85 -0
- package/dist/e2e/wallet-mock.d.ts +13 -0
- package/dist/e2e/wallet-mock.d.ts.map +1 -0
- package/dist/e2e/wallet-mock.js +91 -0
- package/dist/i18n/common-cli.d.ts +11 -0
- package/dist/i18n/common-cli.d.ts.map +1 -0
- package/dist/i18n/common-cli.js +22 -0
- package/dist/i18n/createTranslator.d.ts +28 -0
- package/dist/i18n/createTranslator.d.ts.map +1 -0
- package/dist/i18n/createTranslator.js +48 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/locales/cli.d.ts +3 -0
- package/dist/i18n/locales/cli.d.ts.map +1 -0
- package/dist/i18n/locales/cli.js +180 -0
- package/dist/i18n/types.d.ts +3 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +10 -0
- package/dist/m.d.ts +2 -0
- package/dist/m.d.ts.map +1 -0
- package/dist/m.js +334 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +7 -0
- package/dist/shadcn_components/cn.d.ts +13 -0
- package/dist/shadcn_components/cn.d.ts.map +1 -0
- package/dist/shadcn_components/cn.js +15 -0
- package/dist/shadcn_components/ui/accordion.d.ts +8 -0
- package/dist/shadcn_components/ui/accordion.d.ts.map +1 -0
- package/dist/shadcn_components/ui/accordion.js +14 -0
- package/dist/shadcn_components/ui/alert-dialog.d.ts +21 -0
- package/dist/shadcn_components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/shadcn_components/ui/alert-dialog.js +27 -0
- package/dist/shadcn_components/ui/alert.d.ts +9 -0
- package/dist/shadcn_components/ui/alert.d.ts.map +1 -0
- package/dist/shadcn_components/ui/alert.js +22 -0
- package/dist/shadcn_components/ui/avatar.d.ts +7 -0
- package/dist/shadcn_components/ui/avatar.d.ts.map +1 -0
- package/dist/shadcn_components/ui/avatar.js +12 -0
- package/dist/shadcn_components/ui/badge.d.ts +10 -0
- package/dist/shadcn_components/ui/badge.d.ts.map +1 -0
- package/dist/shadcn_components/ui/badge.js +22 -0
- package/dist/shadcn_components/ui/button.d.ts +11 -0
- package/dist/shadcn_components/ui/button.d.ts.map +1 -0
- package/dist/shadcn_components/ui/button.js +31 -0
- package/dist/shadcn_components/ui/card.d.ts +10 -0
- package/dist/shadcn_components/ui/card.d.ts.map +1 -0
- package/dist/shadcn_components/ui/card.js +24 -0
- package/dist/shadcn_components/ui/checkbox.d.ts +5 -0
- package/dist/shadcn_components/ui/checkbox.d.ts.map +1 -0
- package/dist/shadcn_components/ui/checkbox.js +9 -0
- package/dist/shadcn_components/ui/dialog.d.ts +20 -0
- package/dist/shadcn_components/ui/dialog.d.ts.map +1 -0
- package/dist/shadcn_components/ui/dialog.js +23 -0
- package/dist/shadcn_components/ui/dropdown-menu.d.ts +28 -0
- package/dist/shadcn_components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/shadcn_components/ui/dropdown-menu.js +36 -0
- package/dist/shadcn_components/ui/form.d.ts +24 -0
- package/dist/shadcn_components/ui/form.d.ts.map +1 -0
- package/dist/shadcn_components/ui/form.js +63 -0
- package/dist/shadcn_components/ui/input.d.ts +4 -0
- package/dist/shadcn_components/ui/input.d.ts.map +1 -0
- package/dist/shadcn_components/ui/input.js +6 -0
- package/dist/shadcn_components/ui/label.d.ts +6 -0
- package/dist/shadcn_components/ui/label.d.ts.map +1 -0
- package/dist/shadcn_components/ui/label.js +10 -0
- package/dist/shadcn_components/ui/menubar.d.ts +29 -0
- package/dist/shadcn_components/ui/menubar.d.ts.map +1 -0
- package/dist/shadcn_components/ui/menubar.js +46 -0
- package/dist/shadcn_components/ui/popover.d.ts +7 -0
- package/dist/shadcn_components/ui/popover.d.ts.map +1 -0
- package/dist/shadcn_components/ui/popover.js +10 -0
- package/dist/shadcn_components/ui/progress.d.ts +5 -0
- package/dist/shadcn_components/ui/progress.d.ts.map +1 -0
- package/dist/shadcn_components/ui/progress.js +8 -0
- package/dist/shadcn_components/ui/radio-group.d.ts +6 -0
- package/dist/shadcn_components/ui/radio-group.d.ts.map +1 -0
- package/dist/shadcn_components/ui/radio-group.js +15 -0
- package/dist/shadcn_components/ui/scroll-area.d.ts +6 -0
- package/dist/shadcn_components/ui/scroll-area.d.ts.map +1 -0
- package/dist/shadcn_components/ui/scroll-area.js +12 -0
- package/dist/shadcn_components/ui/select.d.ts +14 -0
- package/dist/shadcn_components/ui/select.d.ts.map +1 -0
- package/dist/shadcn_components/ui/select.js +27 -0
- package/dist/shadcn_components/ui/separator.d.ts +5 -0
- package/dist/shadcn_components/ui/separator.d.ts.map +1 -0
- package/dist/shadcn_components/ui/separator.js +8 -0
- package/dist/shadcn_components/ui/sheet.d.ts +26 -0
- package/dist/shadcn_components/ui/sheet.d.ts.map +1 -0
- package/dist/shadcn_components/ui/sheet.js +37 -0
- package/dist/shadcn_components/ui/skeleton.d.ts +3 -0
- package/dist/shadcn_components/ui/skeleton.d.ts.map +1 -0
- package/dist/shadcn_components/ui/skeleton.js +6 -0
- package/dist/shadcn_components/ui/slider.d.ts +5 -0
- package/dist/shadcn_components/ui/slider.d.ts.map +1 -0
- package/dist/shadcn_components/ui/slider.js +8 -0
- package/dist/shadcn_components/ui/switch.d.ts +5 -0
- package/dist/shadcn_components/ui/switch.d.ts.map +1 -0
- package/dist/shadcn_components/ui/switch.js +8 -0
- package/dist/shadcn_components/ui/table.d.ts +11 -0
- package/dist/shadcn_components/ui/table.d.ts.map +1 -0
- package/dist/shadcn_components/ui/table.js +20 -0
- package/dist/shadcn_components/ui/tabs.d.ts +8 -0
- package/dist/shadcn_components/ui/tabs.d.ts.map +1 -0
- package/dist/shadcn_components/ui/tabs.js +13 -0
- package/dist/shadcn_components/ui/textarea.d.ts +4 -0
- package/dist/shadcn_components/ui/textarea.d.ts.map +1 -0
- package/dist/shadcn_components/ui/textarea.js +8 -0
- package/dist/shadcn_components/ui/toast.d.ts +16 -0
- package/dist/shadcn_components/ui/toast.d.ts.map +1 -0
- package/dist/shadcn_components/ui/toast.js +34 -0
- package/dist/shadcn_components/ui/toaster.d.ts +2 -0
- package/dist/shadcn_components/ui/toaster.d.ts.map +1 -0
- package/dist/shadcn_components/ui/toaster.js +10 -0
- package/dist/shadcn_components/ui/tooltip.d.ts +8 -0
- package/dist/shadcn_components/ui/tooltip.d.ts.map +1 -0
- package/dist/shadcn_components/ui/tooltip.js +11 -0
- package/dist/shadcn_components/ui/use-toast.d.ts +45 -0
- package/dist/shadcn_components/ui/use-toast.d.ts.map +1 -0
- package/dist/shadcn_components/ui/use-toast.js +126 -0
- package/dist/tasks/context.d.ts +13 -0
- package/dist/tasks/context.d.ts.map +1 -0
- package/dist/tasks/context.js +310 -0
- package/dist/tasks/create.d.ts +2 -0
- package/dist/tasks/create.d.ts.map +1 -0
- package/dist/tasks/create.js +91 -0
- package/dist/tasks/db.d.ts +19 -0
- package/dist/tasks/db.d.ts.map +1 -0
- package/dist/tasks/db.js +791 -0
- package/dist/tasks/e2e.d.ts +2 -0
- package/dist/tasks/e2e.d.ts.map +1 -0
- package/dist/tasks/e2e.js +124 -0
- package/dist/tasks/edit.d.ts +7 -0
- package/dist/tasks/edit.d.ts.map +1 -0
- package/dist/tasks/edit.js +471 -0
- package/dist/tasks/engine.d.ts +2 -0
- package/dist/tasks/engine.d.ts.map +1 -0
- package/dist/tasks/engine.js +149 -0
- package/dist/tasks/env-diff.d.ts +2 -0
- package/dist/tasks/env-diff.d.ts.map +1 -0
- package/dist/tasks/env-diff.js +140 -0
- package/dist/tasks/fuzzy.d.ts +9 -0
- package/dist/tasks/fuzzy.d.ts.map +1 -0
- package/dist/tasks/fuzzy.js +153 -0
- package/dist/tasks/glob.d.ts +5 -0
- package/dist/tasks/glob.d.ts.map +1 -0
- package/dist/tasks/glob.js +57 -0
- package/dist/tasks/grep.d.ts +9 -0
- package/dist/tasks/grep.d.ts.map +1 -0
- package/dist/tasks/grep.js +93 -0
- package/dist/tasks/readfile.d.ts +2 -0
- package/dist/tasks/readfile.d.ts.map +1 -0
- package/dist/tasks/readfile.js +177 -0
- package/dist/tasks/update.d.ts +5 -0
- package/dist/tasks/update.d.ts.map +1 -0
- package/dist/tasks/update.js +200 -0
- package/dist/tasks/util.d.ts +12 -0
- package/dist/tasks/util.d.ts.map +1 -0
- package/dist/tasks/util.js +42 -0
- package/dist/tasks/wallet.d.ts +2 -0
- package/dist/tasks/wallet.d.ts.map +1 -0
- package/dist/tasks/wallet.js +697 -0
- package/dist/tasks/writefile.d.ts +2 -0
- package/dist/tasks/writefile.d.ts.map +1 -0
- package/dist/tasks/writefile.js +66 -0
- package/dist/templates/AGENTS.md.hbs +81 -0
- package/dist/templates/ARCHITECTURE.md.hbs +146 -0
- package/dist/templates/CONTRIBUTING.md.hbs +83 -0
- package/dist/templates/LICENCIA.md +21 -0
- package/dist/templates/LICENSE.md +15 -0
- package/dist/templates/Makefile +16 -0
- package/dist/templates/README.md.hbs +111 -0
- package/dist/templates/apps/.env.example.hbs +75 -0
- package/dist/templates/apps/hardhat/.prettierrc +16 -0
- package/dist/templates/apps/hardhat/MOCK_USDT_README.md +20 -0
- package/dist/templates/apps/hardhat/Makefile +13 -0
- package/dist/templates/apps/hardhat/README.md +129 -0
- package/dist/templates/apps/hardhat/bin/MusdtVerification +4 -0
- package/dist/templates/apps/hardhat/bin/approveDepositOwner +7 -0
- package/dist/templates/apps/hardhat/bin/contractVerification +9 -0
- package/dist/templates/apps/hardhat/bin/deployMockUSDT +7 -0
- package/dist/templates/apps/hardhat/bin/prepadJ.sh +14 -0
- package/dist/templates/apps/hardhat/bin/verifyMockUSDT +7 -0
- package/dist/templates/apps/hardhat/contracts/MockUSDT.sol +47 -0
- package/dist/templates/apps/hardhat/hardhat.config.ts +102 -0
- package/dist/templates/apps/hardhat/package.json +55 -0
- package/dist/templates/apps/hardhat/scripts/approveDepositOwner.ts +22 -0
- package/dist/templates/apps/hardhat/scripts/deployMockUSDT.ts +49 -0
- package/dist/templates/apps/hardhat/scripts/verifyDeployment.ts +93 -0
- package/dist/templates/apps/hardhat/scripts/verifyMockUSDT.ts +52 -0
- package/dist/templates/apps/hardhat/sync-abis.mjs +58 -0
- package/dist/templates/apps/hardhat/test/MockUSDT.test.ts +40 -0
- package/dist/templates/apps/hardhat/tsconfig.json +27 -0
- package/dist/templates/apps/nextjs/.config/kysely.config.ts +36 -0
- package/dist/templates/apps/nextjs/Makefile +24 -0
- package/dist/templates/apps/nextjs/README.md.hbs +76 -0
- package/dist/templates/apps/nextjs/abis/IERC20.json +74 -0
- package/dist/templates/apps/nextjs/abis/MockUSDT.json +242 -0
- package/dist/templates/apps/nextjs/abis/ReentrancyGuard.json +1 -0
- package/dist/templates/apps/nextjs/app/globals.css +3 -0
- package/dist/templates/apps/nextjs/app/layout.tsx.hbs +26 -0
- package/dist/templates/apps/nextjs/app/page.tsx.hbs +225 -0
- package/dist/templates/apps/nextjs/app/testui/page.tsx +371 -0
- package/dist/templates/apps/nextjs/bin/m +8 -0
- package/dist/templates/apps/nextjs/components.json +21 -0
- package/dist/templates/apps/nextjs/next-env.d.ts +5 -0
- package/dist/templates/apps/nextjs/next.config.ts +10 -0
- package/dist/templates/apps/nextjs/package.json.hbs +48 -0
- package/dist/templates/apps/nextjs/pnpm-workspace.yaml +13 -0
- package/dist/templates/apps/nextjs/postcss.config.mjs +6 -0
- package/dist/templates/apps/nextjs/tailwind.config.js +11 -0
- package/dist/templates/apps/nextjs/tests/helpers.ts +31 -0
- package/dist/templates/apps/nextjs/tests/index.test.ts +7 -0
- package/dist/templates/apps/nextjs/tests/setup-env.ts.hbs +8 -0
- package/dist/templates/apps/nextjs/tests/test-utils.example.test.ts +168 -0
- package/dist/templates/apps/nextjs/tsconfig.json +44 -0
- package/dist/templates/apps/nextjs/tsconfig.test.json +38 -0
- package/dist/templates/apps/nextjs/vitest.config.ts +13 -0
- package/dist/test-utils/fs-mocks.d.ts +32 -0
- package/dist/test-utils/fs-mocks.d.ts.map +1 -0
- package/dist/test-utils/fs-mocks.js +63 -0
- package/dist/test-utils/i18n-mock.d.ts +21 -0
- package/dist/test-utils/i18n-mock.d.ts.map +1 -0
- package/dist/test-utils/i18n-mock.js +29 -0
- package/dist/test-utils/index.d.ts +12 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +11 -0
- package/dist/test-utils/kysely-mocks.d.ts +298 -0
- package/dist/test-utils/kysely-mocks.d.ts.map +1 -0
- package/dist/test-utils/kysely-mocks.js +173 -0
- package/dist/test-utils/radix-mocks.d.ts +134 -0
- package/dist/test-utils/radix-mocks.d.ts.map +1 -0
- package/dist/test-utils/radix-mocks.js +175 -0
- package/dist/test-utils/rainbowkit-mocks.d.ts +80 -0
- package/dist/test-utils/rainbowkit-mocks.d.ts.map +1 -0
- package/dist/test-utils/rainbowkit-mocks.js +247 -0
- package/dist/test-utils/viem-mocks.d.ts +86 -0
- package/dist/test-utils/viem-mocks.d.ts.map +1 -0
- package/dist/test-utils/viem-mocks.js +54 -0
- package/dist/util/cli-parser.d.ts +20 -0
- package/dist/util/cli-parser.d.ts.map +1 -0
- package/dist/util/cli-parser.js +38 -0
- package/dist/util/colors.d.ts +5 -0
- package/dist/util/colors.d.ts.map +1 -0
- package/dist/util/colors.js +5 -0
- package/dist/util/locale.d.ts +3 -0
- package/dist/util/locale.d.ts.map +1 -0
- package/dist/util/locale.js +10 -0
- package/dist/wba/client.d.ts +19 -0
- package/dist/wba/client.d.ts.map +1 -0
- package/dist/wba/client.js +31 -0
- package/dist/wba/index.d.ts +4 -0
- package/dist/wba/index.d.ts.map +1 -0
- package/dist/wba/index.js +2 -0
- package/dist/wba/routes/event.d.ts +32 -0
- package/dist/wba/routes/event.d.ts.map +1 -0
- package/dist/wba/routes/event.js +42 -0
- package/dist/wba/routes/index.d.ts +3 -0
- package/dist/wba/routes/index.d.ts.map +1 -0
- package/dist/wba/routes/index.js +2 -0
- package/dist/wba/routes/summary.d.ts +44 -0
- package/dist/wba/routes/summary.d.ts.map +1 -0
- package/dist/wba/routes/summary.js +146 -0
- package/dist/wba/server.d.ts +18 -0
- package/dist/wba/server.d.ts.map +1 -0
- package/dist/wba/server.js +29 -0
- package/dist/wba/types.d.ts +68 -0
- package/dist/wba/types.d.ts.map +1 -0
- package/dist/wba/types.js +6 -0
- package/package.json +223 -0
- package/src/blockchain/README.md +80 -0
- package/src/debug/README.md +94 -0
- package/src/e2e/README.md +105 -0
- package/src/i18n/README.md +143 -0
- package/src/shadcn_components/README.md +125 -0
- package/src/tasks/README.md +69 -0
- package/src/test-utils/README.md +638 -0
- package/src/util/README.md +18 -0
- package/src/wba/README.md +175 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Learn.tg - Smart Contracts
|
|
2
|
+
|
|
3
|
+
This directory contains the Solidity smart contracts for the
|
|
4
|
+
platform, managed with Hardhat. These contracts handle ...
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
- **`MockUSDT.sol`**: A mock USDT contract for testing purposes in a
|
|
9
|
+
local or testnet environment.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- [Node.js](https://nodejs.org/) (>= 18)
|
|
14
|
+
- [Yarn](https://yarnpkg.com/)
|
|
15
|
+
- A Celo-compatible wallet with test funds. You can get Sepolia Celo
|
|
16
|
+
tokens from the [Celo Faucet](https://faucet.celo.org/celo-sepolia).
|
|
17
|
+
To get test cCop use https://app.mento.org/
|
|
18
|
+
|
|
19
|
+
## 1. Environment Configuration
|
|
20
|
+
|
|
21
|
+
First, create your environment file by copying the template:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
cp .env.example .env
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Next, edit the `.env` file with the following information:
|
|
28
|
+
|
|
29
|
+
- `NETWORK`: The network to deploy to. Use `celoSepolia` for the testnet
|
|
30
|
+
or `celo` for mainnet.
|
|
31
|
+
- `PRIVATE_KEY`: The private key of the wallet you will use for deployment.
|
|
32
|
+
- `BLOCKSCOUT_API_KEY`: Your API key from Blockscout for contract
|
|
33
|
+
verification. You can generate one in your account settings on the
|
|
34
|
+
[Celo Blockscout explorer](https://explorer.celo.org/).
|
|
35
|
+
- `DEPLOYED_AT`: This will hold the contract address after deployment.
|
|
36
|
+
Leave it blank for now.
|
|
37
|
+
|
|
38
|
+
**โ ๏ธ Security Warning:** Never use a wallet containing real funds for
|
|
39
|
+
development. Always generate and use a separate, dedicated wallet
|
|
40
|
+
for testing.
|
|
41
|
+
|
|
42
|
+
## 2. Platform-Specific Setup (adJ / OpenBSD)
|
|
43
|
+
|
|
44
|
+
Due to compatibility issues, Hardhat v3 does not work on adJ/OpenBSD
|
|
45
|
+
as of 2025. This project is configured to use Hardhat v2. If you are on
|
|
46
|
+
this platform, you must first run the following script to prepare the
|
|
47
|
+
environment:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
bin/prepadJ.sh
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 3. Development Workflow
|
|
54
|
+
|
|
55
|
+
Follow these steps to compile, deploy, and verify your contracts.
|
|
56
|
+
|
|
57
|
+
### Step 3.1: Install Dependencies
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
yarn install
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 3.2: Compile Contracts
|
|
64
|
+
|
|
65
|
+
This command compiles the Solidity contracts and automatically syncs the
|
|
66
|
+
ABIs with the Next.js frontend.
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
yarn build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Step 3.3: Deploy the Contract
|
|
73
|
+
|
|
74
|
+
Make sure your deployment wallet is funded. Then, run the deployment
|
|
75
|
+
script:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
bin/deploy*
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The script will output the contract address to the console. **Copy
|
|
82
|
+
this address.**
|
|
83
|
+
|
|
84
|
+
### Step 3.4: Update Environment File
|
|
85
|
+
|
|
86
|
+
Paste the copied contract address into the `DEPLOYED_AT` variable in
|
|
87
|
+
your `.env` file.
|
|
88
|
+
|
|
89
|
+
### Step 3.5: Verify Contract on Blockscout
|
|
90
|
+
|
|
91
|
+
This step publishes and verifies the contract's source code on the
|
|
92
|
+
blockchain explorer, which is a crucial trust and security signal.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
bin/contractVerification
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 4. Testing
|
|
99
|
+
|
|
100
|
+
The project uses Hardhat's built-in testing framework with Chai matchers.
|
|
101
|
+
The tests are located in the `test/` directory.
|
|
102
|
+
|
|
103
|
+
To run the entire test suite, execute the following command:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
yarn test
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This will compile your contracts, run the tests in an in-memory Hardhat
|
|
110
|
+
Network, and report the results in the console.
|
|
111
|
+
|
|
112
|
+
## ABI Synchronization
|
|
113
|
+
|
|
114
|
+
The contract ABIs (Application Binary Interfaces) are essential for the
|
|
115
|
+
frontend to interact with the smart contracts. This project is configured
|
|
116
|
+
to sync them automatically.
|
|
117
|
+
|
|
118
|
+
- **Automatic Sync:** ABIs are synced to `../nextjs/abis/` every time you
|
|
119
|
+
run `yarn build` (or `yarn compile`).
|
|
120
|
+
- **Manual Sync:** To sync the ABIs without recompiling, run
|
|
121
|
+
`yarn sync:abis`.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## 5. Practices
|
|
125
|
+
|
|
126
|
+
* Prefer a multisig
|
|
127
|
+
* For a project with only one owner prefer a contract with transferOwner
|
|
128
|
+
https://metaschool.so/articles/account-ownership-in-solidity
|
|
129
|
+
and setBackendAddress
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Load environment variables from the root .env file
|
|
4
|
+
. ../.env
|
|
5
|
+
|
|
6
|
+
# Run the verification script, which will read the necessary variables
|
|
7
|
+
# from the environment.
|
|
8
|
+
# The network is specified via the NETWORK variable in the .env file.
|
|
9
|
+
npx hardhat run scripts/verifyDeployment.ts --network $NEXT_PUBLIC_NETWORK
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
yarn install
|
|
4
|
+
mkdir -p tmpart
|
|
5
|
+
sed -e "s/freebsd/openbsd/g" node_modules/@nomicfoundation/solidity-analyzer/index.js > tmpart/index-sa.js
|
|
6
|
+
cp tmpart/index-sa.js node_modules/@nomicfoundation/solidity-analyzer/index.js
|
|
7
|
+
cd node_modules/@nomicfoundation/solidity-analyzer/
|
|
8
|
+
doas corepack enable
|
|
9
|
+
yarn
|
|
10
|
+
yarn build
|
|
11
|
+
cd ../../..
|
|
12
|
+
yarn
|
|
13
|
+
cp tmpart/index-sa.js node_modules/@nomicfoundation/solidity-analyzer/index.js
|
|
14
|
+
yarn build
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.24;
|
|
3
|
+
|
|
4
|
+
contract MockUSDT {
|
|
5
|
+
string public constant name = "Mock USDT";
|
|
6
|
+
string public constant symbol = "MUSDT";
|
|
7
|
+
uint8 public constant decimals = 6;
|
|
8
|
+
uint256 public totalSupply;
|
|
9
|
+
|
|
10
|
+
mapping(address => uint256) public balanceOf;
|
|
11
|
+
mapping(address => mapping(address => uint256)) public allowance;
|
|
12
|
+
|
|
13
|
+
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
14
|
+
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
15
|
+
|
|
16
|
+
function mint(address to, uint256 amount) external {
|
|
17
|
+
totalSupply += amount;
|
|
18
|
+
balanceOf[to] += amount;
|
|
19
|
+
emit Transfer(address(0), to, amount);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function transfer(address to, uint256 amount) external returns (bool) {
|
|
23
|
+
require(balanceOf[msg.sender] >= amount, "Insufficient balance");
|
|
24
|
+
balanceOf[msg.sender] -= amount;
|
|
25
|
+
balanceOf[to] += amount;
|
|
26
|
+
emit Transfer(msg.sender, to, amount);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
|
|
31
|
+
require(balanceOf[from] >= amount, "Insufficient balance");
|
|
32
|
+
require(allowance[from][msg.sender] >= amount, "Insufficient allowance");
|
|
33
|
+
|
|
34
|
+
balanceOf[from] -= amount;
|
|
35
|
+
balanceOf[to] += amount;
|
|
36
|
+
allowance[from][msg.sender] -= amount;
|
|
37
|
+
|
|
38
|
+
emit Transfer(from, to, amount);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function approve(address spender, uint256 amount) external returns (bool) {
|
|
43
|
+
allowance[msg.sender][spender] = amount;
|
|
44
|
+
emit Approval(msg.sender, spender, amount);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import '@nomicfoundation/hardhat-toolbox';
|
|
2
|
+
import '@nomicfoundation/hardhat-verify';
|
|
3
|
+
import { config as dotEnvConfig } from 'dotenv';
|
|
4
|
+
import { HardhatUserConfig } from 'hardhat/config';
|
|
5
|
+
import { task } from "hardhat/config";
|
|
6
|
+
import { task } from "hardhat/config";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
dotEnvConfig({ path: '../.env' });
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
task("check-transfer", "Check token transfer from tx hash")
|
|
13
|
+
.addParam("tx", "Transaction hash")
|
|
14
|
+
.addParam("token", "Token contract address")
|
|
15
|
+
.setAction(async (taskArgs, hre) => {
|
|
16
|
+
const { ethers } = hre;
|
|
17
|
+
const { tx, token } = taskArgs;
|
|
18
|
+
|
|
19
|
+
const receipt = await ethers.provider.getTransactionReceipt(tx);
|
|
20
|
+
if (!receipt) {
|
|
21
|
+
console.log("Transaction not found");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const TokenABI = [
|
|
26
|
+
"event Transfer(address indexed from, address indexed to, uint256 value)",
|
|
27
|
+
"function decimals() view returns (uint8)"
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const tokenContract = new ethers.Contract(token, TokenABI, ethers.provider);
|
|
31
|
+
const decimals = await tokenContract.decimals();
|
|
32
|
+
|
|
33
|
+
const transferEventTopic = ethers.id("Transfer(address,address,uint256)");
|
|
34
|
+
const transferLogs = receipt.logs.filter(log => log.topics[0] === transferEventTopic);
|
|
35
|
+
|
|
36
|
+
if (transferLogs.length === 0) {
|
|
37
|
+
console.log("No Transfer event found");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const log of transferLogs) {
|
|
42
|
+
const parsedLog = tokenContract.interface.parseLog(log);
|
|
43
|
+
console.log("Amount:", ethers.formatUnits(parsedLog.args.value, decimals));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const config: HardhatUserConfig = {
|
|
48
|
+
networks: {
|
|
49
|
+
celo: {
|
|
50
|
+
accounts: [process.env.PRIVATE_KEY ?? '0x0'],
|
|
51
|
+
url: 'https://forno.celo.org',
|
|
52
|
+
},
|
|
53
|
+
celoSepolia: {
|
|
54
|
+
accounts: [process.env.PRIVATE_KEY ?? '0x0'],
|
|
55
|
+
url: 'https://forno.celo-sepolia.celo-testnet.org/',
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
'base-sepolia': {
|
|
59
|
+
accounts: [process.env.PRIVATE_KEY ?? '0x0'],
|
|
60
|
+
url: 'https://sepolia.base.org',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
etherscan: {
|
|
64
|
+
apiKey: {
|
|
65
|
+
celoSepolia: process.env.BLOCKSCOUT_API_KEY ?? '',
|
|
66
|
+
celo: process.env.BLOCKSCOUT_API_KEY ?? '',
|
|
67
|
+
'base-sepolia': process.env.BASESCAN_API_KEY ?? '',
|
|
68
|
+
},
|
|
69
|
+
customChains: [
|
|
70
|
+
{
|
|
71
|
+
network: 'celoSepolia',
|
|
72
|
+
chainId: 11_142_220,
|
|
73
|
+
urls: {
|
|
74
|
+
apiURL: 'https://celo-sepolia.blockscout.com/api',
|
|
75
|
+
browserURL: 'https://celo-sepolia.blockscout.com/',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
chainId: 42_220,
|
|
80
|
+
network: 'celo',
|
|
81
|
+
urls: {
|
|
82
|
+
apiURL: 'https://celo.blockscout.com/api',
|
|
83
|
+
browserURL: 'https://celo.blockscout.com/',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
chainId: 84532,
|
|
88
|
+
network: 'base-sepolia',
|
|
89
|
+
urls: {
|
|
90
|
+
apiURL: 'https://api-sepolia.basescan.org/api',
|
|
91
|
+
browserURL: 'https://sepolia.basescan.org/',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
sourcify: {
|
|
97
|
+
enabled: false,
|
|
98
|
+
},
|
|
99
|
+
solidity: '0.8.24',
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default config;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stable-sl/hardhat",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
|
|
7
|
+
"@nomicfoundation/hardhat-ethers": "^3.0.0",
|
|
8
|
+
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
|
|
9
|
+
"@nomicfoundation/hardhat-network-helpers": "^1.0.11",
|
|
10
|
+
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
|
11
|
+
"@nomicfoundation/hardhat-verify": "^2.0.11",
|
|
12
|
+
"@nomiclabs/hardhat-ethers": "^2.2.3",
|
|
13
|
+
"@typechain/ethers-v6": "^0.5.0",
|
|
14
|
+
"@typechain/hardhat": "^9.1.0",
|
|
15
|
+
"@types/chai": "^5.2.3",
|
|
16
|
+
"@types/mocha": "^10.0.7",
|
|
17
|
+
"chai": "^4.2.0",
|
|
18
|
+
"ethers": "^6.15.0",
|
|
19
|
+
"hardhat": ">=2.27.0 <3.0.0",
|
|
20
|
+
"hardhat-gas-reporter": "^2.3.0",
|
|
21
|
+
"minimatch": "^10.1.1",
|
|
22
|
+
"solidity-coverage": "^0.8.1",
|
|
23
|
+
"ts-node": "^10.9.2",
|
|
24
|
+
"typechain": "^8.3.2",
|
|
25
|
+
"tsx": "^4.21.0",
|
|
26
|
+
"typescript": "^5.5.3"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@nomicfoundation/hardhat-ignition": "0.15.0",
|
|
30
|
+
"@openzeppelin/contracts": "^5.4.0",
|
|
31
|
+
"dotenv": "^17.2.3",
|
|
32
|
+
"viem": "^2.40.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"postinstall": "chmod +x sync-abis.mjs",
|
|
36
|
+
"compile": "hardhat clean && hardhat compile && node sync-abis.mjs",
|
|
37
|
+
"tsc": "node_modules/.bin/tsc -p . && mkdir -p dist/typechain-types/ && cp typechain-types/*.d.ts dist/typechain-types/",
|
|
38
|
+
"build": "pnpm compile && pnpm tsc",
|
|
39
|
+
"clean": "hardhat clean",
|
|
40
|
+
"run:node": "hardhat node",
|
|
41
|
+
"test": "hardhat test",
|
|
42
|
+
"deploy": "bin/deployLearnTGVaults",
|
|
43
|
+
"verify": "bin/verifyLearnTGVaults",
|
|
44
|
+
"contract-verification": "bin/contractVerification",
|
|
45
|
+
"deploy-mock-usdt": "bin/deployMockUsdt",
|
|
46
|
+
"verify-mock-usdt": "bin/verifyMockUSDT",
|
|
47
|
+
"deploy-celoubi": "bin/deployCeloUbi",
|
|
48
|
+
"verify-celoubi": "bin/verifyCeloUbi",
|
|
49
|
+
"contract-verification-celoubi": "bin/contractVerificationCeloUbi",
|
|
50
|
+
"prettier": "prettier --write 'contracts/**/*.sol' '**/*.ts'",
|
|
51
|
+
"sync:abis": "node sync-abis.mjs"
|
|
52
|
+
},
|
|
53
|
+
"author": "pasosdeJesus",
|
|
54
|
+
"packageManager": "pnpm@10.34.5"
|
|
55
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
// Get signers
|
|
5
|
+
const [deployer] = await ethers.getSigners();
|
|
6
|
+
|
|
7
|
+
// Attach to existing ERC-20 token contract
|
|
8
|
+
const tokenAddress = process.env.USDT_ADDRES;
|
|
9
|
+
const TokenABI = ["function approve(address spender, uint256 amount) returns (bool)"];
|
|
10
|
+
const token = new ethers.Contract(tokenAddress, TokenABI, deployer);
|
|
11
|
+
|
|
12
|
+
const spenderAddress = process.env.DEPLOYED_ADDRESS;
|
|
13
|
+
|
|
14
|
+
// Approve 1 token (adjust decimals as needed)
|
|
15
|
+
const amount = ethers.parseUnits("1000", 18);
|
|
16
|
+
|
|
17
|
+
console.log("Approving...");
|
|
18
|
+
const tx = await token.approve(spenderAddress, amount);
|
|
19
|
+
await tx.wait();
|
|
20
|
+
|
|
21
|
+
console.log("Approved! Transaction hash:", tx.hash);
|
|
22
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
// Get the contract factory for MockUSDT
|
|
5
|
+
const MockUSDT = await ethers.getContractFactory("MockUSDT");
|
|
6
|
+
|
|
7
|
+
console.log("Deploying MockUSDT token...");
|
|
8
|
+
|
|
9
|
+
// Deploy the contract
|
|
10
|
+
const mockUSDT = await MockUSDT.deploy();
|
|
11
|
+
|
|
12
|
+
// Wait for the deployment transaction to be mined
|
|
13
|
+
await mockUSDT.waitForDeployment();
|
|
14
|
+
|
|
15
|
+
const mockUSDTAddress = await mockUSDT.getAddress();
|
|
16
|
+
console.log("MockUSDT deployed to:", mockUSDTAddress);
|
|
17
|
+
|
|
18
|
+
// Mint 1,000,000 tokens to the deployer (owner)
|
|
19
|
+
// USDT has 6 decimals, so we need to multiply by 10^6
|
|
20
|
+
const deployer = (await ethers.getSigners())[0];
|
|
21
|
+
const deployerAddress = await deployer.getAddress();
|
|
22
|
+
const amount = ethers.parseUnits("10000000000", 6); // 10,000,000,000 tokens with 6 decimals
|
|
23
|
+
|
|
24
|
+
console.log("Minting 10,000,000,000 tokens to:", deployerAddress);
|
|
25
|
+
const tx = await mockUSDT.mint(deployerAddress, amount);
|
|
26
|
+
await tx.wait();
|
|
27
|
+
|
|
28
|
+
console.log("Minted 10,000,000,000 tokens to the owner's account");
|
|
29
|
+
|
|
30
|
+
// Verify the balance
|
|
31
|
+
const balance = await mockUSDT.balanceOf(deployerAddress);
|
|
32
|
+
console.log("Owner's balance:", ethers.formatUnits(balance, 6), "MUSDT");
|
|
33
|
+
|
|
34
|
+
// Also check the total supply
|
|
35
|
+
const totalSupply = await mockUSDT.totalSupply();
|
|
36
|
+
console.log("Total supply:", ethers.formatUnits(totalSupply, 6), "MUSDT");
|
|
37
|
+
|
|
38
|
+
// Save the deployment address to .env file
|
|
39
|
+
console.log("Deployment completed successfully!");
|
|
40
|
+
console.log("Add this line to your .env file:");
|
|
41
|
+
console.log(`MOCK_USDT_ADDRESS="${mockUSDTAddress}"`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// We recommend this pattern to be able to use async/await everywhere
|
|
45
|
+
// and properly handle errors.
|
|
46
|
+
main().catch((error) => {
|
|
47
|
+
console.error(error);
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
import dotenv from "dotenv"
|
|
3
|
+
dotenv.config({ path: '../.env' })
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
// Get the deployed contract
|
|
7
|
+
const learnTGVaults = await ethers.getContractAt(
|
|
8
|
+
"LearnTGVaults",
|
|
9
|
+
process.env.NEXT_PUBLIC_DEPLOYED_AT // The deployed address
|
|
10
|
+
);
|
|
11
|
+
console.log("๐ LearnTGVaults Verification");
|
|
12
|
+
console.log("=============================");
|
|
13
|
+
console.log("Contract address:", process.env.NEXT_PUBLIC_DEPLOYED_AT);
|
|
14
|
+
|
|
15
|
+
// Get the owner of the contract
|
|
16
|
+
const owner = await learnTGVaults.owner();
|
|
17
|
+
console.log("\n๐ค Contract owner:", owner);
|
|
18
|
+
|
|
19
|
+
// Get the USDT token address that the contract was initialized with
|
|
20
|
+
const usdtToken = await learnTGVaults.usdtToken();
|
|
21
|
+
console.log("๐ฐ Contract USDT token address:", usdtToken);
|
|
22
|
+
|
|
23
|
+
// Get the cCop token address that the contract was initialized with
|
|
24
|
+
const cCopToken = await learnTGVaults.cCopToken();
|
|
25
|
+
console.log("๐ถ Contract cCop token address:", cCopToken);
|
|
26
|
+
|
|
27
|
+
// Get the gooddollar token address that the contract was initialized with
|
|
28
|
+
const gooddollarToken = await learnTGVaults.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.NEXT_PUBLIC_USDT_DECIMALS ? parseInt(process.env.NEXT_PUBLIC_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`);
|
|
81
|
+
|
|
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");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main().catch((error) => {
|
|
91
|
+
console.error(error);
|
|
92
|
+
process.exitCode = 1;
|
|
93
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
// Get the MockUSDT address from environment variables
|
|
5
|
+
const mockUSDTAddress = process.env.MOCK_USDT_ADDRESS;
|
|
6
|
+
|
|
7
|
+
if (!mockUSDTAddress) {
|
|
8
|
+
throw new Error("MOCK_USDT_ADDRESS not found in environment variables");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Get the contract factory for MockUSDT
|
|
12
|
+
const MockUSDT = await ethers.getContractFactory("MockUSDT");
|
|
13
|
+
|
|
14
|
+
// Connect to the deployed contract
|
|
15
|
+
const mockUSDT = MockUSDT.attach(mockUSDTAddress);
|
|
16
|
+
|
|
17
|
+
console.log("Verifying MockUSDT deployment at:", mockUSDTAddress);
|
|
18
|
+
|
|
19
|
+
// Check token details
|
|
20
|
+
const name = await mockUSDT.name();
|
|
21
|
+
const symbol = await mockUSDT.symbol();
|
|
22
|
+
const decimals = await mockUSDT.decimals();
|
|
23
|
+
const totalSupply = await mockUSDT.totalSupply();
|
|
24
|
+
|
|
25
|
+
console.log("Token Name:", name);
|
|
26
|
+
console.log("Token Symbol:", symbol);
|
|
27
|
+
console.log("Decimals:", decimals);
|
|
28
|
+
console.log("Total Supply:", ethers.formatUnits(totalSupply, decimals), symbol);
|
|
29
|
+
|
|
30
|
+
// Check owner's balance
|
|
31
|
+
const deployer = (await ethers.getSigners())[0];
|
|
32
|
+
const deployerAddress = await deployer.getAddress();
|
|
33
|
+
const balance = await mockUSDT.balanceOf(deployerAddress);
|
|
34
|
+
|
|
35
|
+
console.log("Owner Address:", deployerAddress);
|
|
36
|
+
console.log("Owner Balance:", ethers.formatUnits(balance, decimals), symbol);
|
|
37
|
+
|
|
38
|
+
// Verify that the owner has tokens
|
|
39
|
+
const expectedBalance = ethers.parseUnits("10000000000", decimals);
|
|
40
|
+
if (balance > 0) {
|
|
41
|
+
console.log("โ Verification successful: Owner has tokens");
|
|
42
|
+
} else {
|
|
43
|
+
console.log("โ Verification failed: Owner does not have the expected balance");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// We recommend this pattern to be able to use async/await everywhere
|
|
48
|
+
// and properly handle errors.
|
|
49
|
+
main().catch((error) => {
|
|
50
|
+
console.error(error);
|
|
51
|
+
process.exitCode = 1;
|
|
52
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
|
|
6
|
+
// Configuration - directory files
|
|
7
|
+
const HARDHAT_ARTIFACTS_PATH = './artifacts/contracts'
|
|
8
|
+
const NEXTJS_ABI_PATH = '../nextjs/abis'
|
|
9
|
+
|
|
10
|
+
// Create the React ABI directory if it doesn't exist
|
|
11
|
+
if (!fs.existsSync(NEXTJS_ABI_PATH)) {
|
|
12
|
+
fs.mkdirSync(NEXTJS_ABI_PATH, { recursive: true })
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Function to walk through directories recursively
|
|
16
|
+
function walkDir(dir) {
|
|
17
|
+
let results = []
|
|
18
|
+
const list = fs.readdirSync(dir)
|
|
19
|
+
list.forEach(file => {
|
|
20
|
+
const filePath = path.join(dir, file)
|
|
21
|
+
const stat = fs.statSync(filePath)
|
|
22
|
+
if (stat && stat.isDirectory()) {
|
|
23
|
+
results = results.concat(walkDir(filePath))
|
|
24
|
+
} else {
|
|
25
|
+
// Ensure we only grab the main contract JSON, not the debug files
|
|
26
|
+
if (file.endsWith('.json') && !file.includes('.dbg.')) {
|
|
27
|
+
results.push(filePath)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
return results
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Main script
|
|
35
|
+
console.log("๐ Syncing ABIs to the frontend app...")
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
// Find all artifact JSON files from Hardhat compilation
|
|
39
|
+
const artifactFiles = walkDir(HARDHAT_ARTIFACTS_PATH)
|
|
40
|
+
|
|
41
|
+
artifactFiles.forEach(filepath => {
|
|
42
|
+
// Read and parse the artifact file
|
|
43
|
+
const artifact = JSON.parse(fs.readFileSync(filepath, 'utf8'))
|
|
44
|
+
const filename = path.basename(filepath)
|
|
45
|
+
const contractName = filename.replace('.json', '')
|
|
46
|
+
|
|
47
|
+
// Extract just the ABI and save it to the Next.js directory
|
|
48
|
+
const abiPath = path.join(NEXTJS_ABI_PATH, `${contractName}.json`)
|
|
49
|
+
fs.writeFileSync(abiPath, JSON.stringify(artifact.abi, null, 2))
|
|
50
|
+
console.log(`Copied ABI for ${contractName}`)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
console.log("โ
ABI sync complete!")
|
|
54
|
+
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("โ Error syncing ABIs:", error)
|
|
57
|
+
process.exit(1)
|
|
58
|
+
}
|