@pasosdejesus/m 0.37.4 → 0.37.5

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/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to `@pasosdejesus/m` are documented in this file.
4
4
 
5
+ ## [0.37.5] - 2026-10-24
6
+
7
+ ### Changed — template contracts without Hardhat (**`contract-test@0.3.2`**)
8
+
9
+ - `m:create` now generates `apps/contracts` without `hardhat`, `hardhat.config.ts` or
10
+ `prepadJ.sh`. The new `m-contracts.config.ts` holds the compiler pin, networks and explorer
11
+ endpoints.
12
+ - The template scripts use `contract:compile`, `contract:typechain`, `contract:test`,
13
+ `contract:node`, `contract:deploy`, `contract:verify` and `contract:clean`; the deploy/verify
14
+ wrappers no longer call `npx hardhat`.
15
+ - `contract:test` detects a contracts app by `contracts/`, `m-contracts.config.ts` or
16
+ `contracts.config.json`, so it no longer requires a Hardhat config.
17
+ - `contract:verify` uses the Blockscout v2 multipart route (`--api-version v2` for self-hosted
18
+ instances) and keeps the Etherscan v1 form for Basescan. Verified `MockUSDT` on Celo Sepolia.
19
+ - `m` asks for `@pasosdejesus/contract-test@^0.3.2`.
20
+
21
+ Pending in REQ/58: only the full template E2E without Hardhat installed.
22
+
5
23
  ## [0.37.4] - 2026-10-23
6
24
 
7
25
  ### Added — `hre` shim and `m:check` solc warnings (**`contract-test@0.3.1`**)
@@ -32,16 +32,17 @@
32
32
  │ │ ├── app/ # Next.js App Router pages and API routes
33
33
  │ │ ├── lib/ # Shared utilities (DB helpers, API clients)
34
34
  │ │ ├── db/migrations/ # Kysely migrations
35
- │ │ ├── abis/ # Contract ABIs (copied from Hardhat)
35
+ │ │ ├── abis/ # Contract ABIs (copied by contract:compile)
36
36
  │ │ ├── tests/ # Vitest test suite
37
37
  │ │ ├── .config/ # Kysely DB config → PostgreSQL
38
38
  │ │ ├── bin/m # m CLI (framework from @pasosdejesus/m)
39
39
  │ │ ├── Makefile
40
40
  │ │ └── pnpm-workspace.yaml
41
- │ └── hardhat/ # Solidity contracts (npm)
41
+ │ └── contracts/ # Solidity contracts (m pipeline)
42
42
  │ ├── contracts/ # Smart contracts
43
- │ ├── scripts/ # Deployment scripts
44
- │ ├── test/ # Contract tests
43
+ │ ├── bin/ # deploy/verify wrappers
44
+ │ ├── deployments/ # network addresses
45
+ │ ├── m-contracts.config.ts
45
46
  │ ├── Makefile
46
47
  │ └── sync-abis.mjs
47
48
  ├── apps/.env # Single source of truth for all configuration
@@ -141,6 +142,6 @@ cd apps/contracts && pnpm deploy --network celoSepolia
141
142
  | Database | PostgreSQL + Kysely | Type-safe queries |
142
143
  | Blockchain | Celo (L2) | Mainnet (42220), Sepolia testnet (11142220) |
143
144
  | Wallet | `bin/m eng:opwallet:*` | Private keys in `~/.m/wallets/`, chmod 600 |
144
- | Contracts | Hardhat + Solidity | Compiled in `apps/contracts/` |
145
+ | Contracts | `m contract:*` + Solidity | Compiled/deployed/verified in `apps/contracts/` |
145
146
  | Testing | Vitest | `fileParallelism: false` |
146
- | Package Manager | pnpm (nextjs), npm (hardhat) | |
147
+ | Package Manager | pnpm | |
@@ -29,12 +29,9 @@ doas pkg_add node
29
29
  npm install -g pnpm@11
30
30
  ```
31
31
 
32
- If using Hardhat on OpenBSD/adJ, run the preparation script (it needs `doas corepack enable` once and
33
- Rust/cargo to build the analyzer addon):
34
-
35
- ```bash
36
- cd apps/contracts && bin/prepadJ.sh
37
- ```
32
+ Contracts use the `m` pipeline (`contract:compile`, `contract:test`, `contract:typechain`,
33
+ `contract:node`, `contract:deploy`, `contract:verify`); no Hardhat setup is needed. See
34
+ `apps/contracts/README.md`.
38
35
 
39
36
  ### 2. Configure environment
40
37
 
@@ -1,4 +1,4 @@
1
- .PHONY: test checkdeploy type compile deploy-mock-usdt
1
+ .PHONY: test checkdeploy type compile clean node deploy-mock-usdt verify-mock-usdt
2
2
 
3
3
  test:
4
4
  pnpm test
@@ -12,5 +12,14 @@ type:
12
12
  compile:
13
13
  pnpm compile
14
14
 
15
+ clean:
16
+ pnpm clean
17
+
18
+ node:
19
+ pnpm run:node
20
+
15
21
  deploy-mock-usdt:
16
22
  pnpm deploy-mock-usdt
23
+
24
+ verify-mock-usdt:
25
+ pnpm verify-mock-usdt
@@ -1,6 +1,8 @@
1
- # Smart Contracts (Hardhat)
1
+ # Smart Contracts (without Hardhat)
2
2
 
3
- Smart contracts managed with Hardhat.
3
+ Solidity contracts compiled, tested, deployed and verified with the `m` CLI. On OpenBSD/adJ there
4
+ is no native `@nomicfoundation/edr` binary, so this app uses `@pasosdejesus/contract-test` and
5
+ `@pasosdejesus/edr` instead of Hardhat.
4
6
 
5
7
  ## Prerequisites
6
8
 
@@ -8,78 +10,55 @@ Smart contracts managed with Hardhat.
8
10
  - [pnpm](https://pnpm.io/)
9
11
  - A wallet with test funds for the target network.
10
12
 
11
- ## 1. Environment Configuration
13
+ ## Configuration
12
14
 
13
- Create your environment file:
15
+ Edit `m-contracts.config.ts`:
14
16
 
15
- ```sh
16
- cp .env.example .env
17
- ```
18
-
19
- Edit `.env` with your keys and network configuration.
20
-
21
- ## 2. Platform-Specific Setup (adJ / OpenBSD)
17
+ - `solidity`: compiler pin (the build uses the project's `solc` or `solc-js`; it never downloads
18
+ another version).
19
+ - `networks.<red>.url` / `chainId`: RPC endpoint and chain id.
20
+ - `explorer.<red>.apiUrl` / `apiKeyEnv`: Blockscout/Basescan verification endpoint and the
21
+ environment variable that holds the API key.
22
22
 
23
- On OpenBSD/adJ, Hardhat's native binary (`@nomicfoundation/edr`) is not
24
- available. This project uses `m contract:test` which falls back to
25
- `@ethereumjs/vm` via `@pasosdejesus/edr`. Run the preparation script:
23
+ Copy the environment template and fill the test values:
26
24
 
27
25
  ```sh
28
- bin/prepadJ.sh
26
+ cp .env.example .env
29
27
  ```
30
28
 
31
- ## 3. Development Workflow
32
-
33
- ### Install Dependencies
29
+ ## Development workflow
34
30
 
35
31
  ```sh
36
32
  pnpm install
33
+ pnpm build # sync MockUSDT, compile, typechain, sync ABIs
34
+ pnpm test # contract:test on @ethereumjs/vm
35
+ pnpm run:node # local JSON-RPC node (Hardhat accounts funded)
36
+ pnpm clean # remove artifacts/cache/typechain-types/dist
37
37
  ```
38
38
 
39
- ### Compile Contracts
40
-
41
- ```sh
42
- pnpm build
43
- ```
44
-
45
- ### Deploy
46
-
47
- ```sh
48
- # See scripts/ and bin/ for deployment helpers
49
- pnpm deploy
50
- ```
51
-
52
- ### Verify
53
-
54
- ```sh
55
- pnpm verify
56
- ```
57
-
58
- ## 4. Testing
39
+ ## Deploy and verify
59
40
 
60
- `pnpm test` runs `contract:test` from the `m` plugin: it compiles with Hardhat and runs the specs on
61
- `@ethereumjs/vm` via `@pasosdejesus/edr`, so it works on OpenBSD/adJ where the native Hardhat EDR
62
- binary does not exist.
41
+ `contract:deploy` uses viem. On a local node it uses the node's unlocked accounts; on a testnet it
42
+ signs with `PRIVATE_KEY` (or `--private-key`). `contract:verify` posts a standard-JSON request to
43
+ Blockscout/Basescan; `--dry-run` shows it without contacting the explorer.
63
44
 
64
45
  ```sh
65
- pnpm test # contract:test (m plugin)
66
- pnpm checkdeploy # contract:checkdeploy: deployment addresses and their use
46
+ pnpm deploy # MockUSDT on $NEXT_PUBLIC_NETWORK
47
+ pnpm verify # verify the saved deployment
48
+ pnpm deploy-mock-usdt
49
+ pnpm verify-mock-usdt
67
50
  ```
68
51
 
69
- If the platform has the native EDR binary and you prefer Hardhat's own runner:
70
- `npx hardhat test`.
52
+ The addresses are written to `deployments/<Contract>/<network>.json`, which
53
+ `@pasosdejesus/m/blockchain/deployments` reads at runtime.
71
54
 
72
- `contract:checkdeploy` validates `deployments/**/*.json` (non-zero 40-hex address, matching
73
- network, expected fields) and that the sources read addresses with
74
- `@pasosdejesus/m/blockchain/deployments` instead of literals; `make check` at the workspace root runs
75
- it after `m:check`.
55
+ > Real-value deployments must be authorized by the operator; use testnets for development.
76
56
 
77
- ## ABI Synchronization
57
+ ## ABI synchronization
78
58
 
79
- ABIs are synced to `../web/abis/` automatically on `pnpm build`.
80
- Manual sync: `pnpm sync:abis`.
59
+ `pnpm build` copies the ABIs to `../web/abis/`. Manual sync: `pnpm sync:abis`.
81
60
 
82
- ## Best Practices
61
+ ## Best practices
83
62
 
84
63
  - Prefer a multisig for production deployments.
85
- - Use dedicated test wallets — never use production keys for development.
64
+ - Use dedicated test wallets; never use production keys for development.
@@ -1,4 +1,5 @@
1
1
  #!/bin/sh
2
-
3
- . .env
4
- npx hardhat verify --network celoSepolia $MOCK_USDT_ADDRESS
2
+ set -e
3
+ [ -f ../.env ] && . ../.env
4
+ : "${NEXT_PUBLIC_NETWORK:?NEXT_PUBLIC_NETWORK is not set}"
5
+ exec ../web/bin/m contract:verify --contract MockUSDT --network "$NEXT_PUBLIC_NETWORK" "$@"
@@ -1,9 +1,6 @@
1
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
2
+ set -e
3
+ [ -f ../.env ] && . ../.env
4
+ : "${NEXT_PUBLIC_NETWORK:?NEXT_PUBLIC_NETWORK is not set}"
5
+ : "${CONTRACT:?CONTRACT is not set}"
6
+ exec ../web/bin/m contract:verify --contract "$CONTRACT" --network "$NEXT_PUBLIC_NETWORK" "$@"
@@ -1,7 +1,5 @@
1
1
  #!/bin/sh
2
-
3
- # Load environment variables from the root .env file
4
- . ../.env
5
-
6
- # Run the deployment script for MockUSDT
7
- npx hardhat run scripts/deployMockUSDT.ts --network $NEXT_PUBLIC_NETWORK
2
+ set -e
3
+ [ -f ../.env ] && . ../.env
4
+ : "${NEXT_PUBLIC_NETWORK:?NEXT_PUBLIC_NETWORK is not set}"
5
+ exec ../web/bin/m contract:deploy --contract MockUSDT --network "$NEXT_PUBLIC_NETWORK" "$@"
@@ -1,7 +1,5 @@
1
1
  #!/bin/sh
2
-
3
- # Load environment variables from the root .env file
4
- . ../.env
5
-
6
- # Run the verification script for MockUSDT
7
- npx hardhat run scripts/verifyMockUSDT.ts --network $NEXT_PUBLIC_NETWORK
2
+ set -e
3
+ [ -f ../.env ] && . ../.env
4
+ : "${NEXT_PUBLIC_NETWORK:?NEXT_PUBLIC_NETWORK is not set}"
5
+ exec ../web/bin/m contract:verify --contract MockUSDT --network "$NEXT_PUBLIC_NETWORK" "$@"
@@ -0,0 +1,41 @@
1
+ /**
2
+ * m-contracts.config.ts — configuracion de contratos sin Hardhat.
3
+ *
4
+ * `contract:compile` lee `solidity`; `contract:deploy` lee `networks.<red>.url`
5
+ * y `chainId`; `contract:verify` lee `explorer.<red>.apiUrl`. Los valores se
6
+ * leen con expresiones regulares, así que este archivo debe ser un objeto
7
+ * literal (sin funciones ni imports).
8
+ */
9
+ const config = {
10
+ solidity: '0.8.24',
11
+ networks: {
12
+ celo: {
13
+ url: 'https://forno.celo.org',
14
+ chainId: 42220,
15
+ },
16
+ celoSepolia: {
17
+ url: 'https://forno.celo-sepolia.celo-testnet.org/',
18
+ chainId: 11142220,
19
+ },
20
+ 'base-sepolia': {
21
+ url: 'https://sepolia.base.org',
22
+ chainId: 84532,
23
+ },
24
+ },
25
+ explorer: {
26
+ celo: {
27
+ apiUrl: 'https://celo.blockscout.com/api',
28
+ apiKeyEnv: 'BLOCKSCOUT_API_KEY',
29
+ },
30
+ celoSepolia: {
31
+ apiUrl: 'https://celo-sepolia.blockscout.com/api',
32
+ apiKeyEnv: 'BLOCKSCOUT_API_KEY',
33
+ },
34
+ 'base-sepolia': {
35
+ apiUrl: 'https://api-sepolia.basescan.org/api',
36
+ apiKeyEnv: 'BASESCAN_API_KEY',
37
+ },
38
+ },
39
+ }
40
+
41
+ export default config
@@ -3,52 +3,30 @@
3
3
  "license": "MIT",
4
4
  "version": "1.0.0",
5
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
6
  "@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
7
  "@pasosdejesus/usdt": "catalog:",
18
- "chai": "^4.2.0",
19
- "ethers": "^6.15.0",
20
- "hardhat": ">=2.27.0 <3.0.0",
21
- "hardhat-gas-reporter": "^2.3.0",
22
- "minimatch": "^10.1.1",
23
- "solidity-coverage": "^0.8.1",
24
- "ts-node": "^10.9.2",
25
- "typechain": "^8.3.2",
26
8
  "tsx": "^4.21.0",
9
+ "typechain": "^8.3.2",
27
10
  "typescript": "catalog:"
28
11
  },
29
12
  "dependencies": {
30
- "@nomicfoundation/hardhat-ignition": "0.15.0",
31
13
  "@openzeppelin/contracts": "^5.4.0",
32
14
  "dotenv": "catalog:",
33
15
  "viem": "catalog:"
34
16
  },
35
17
  "scripts": {
36
18
  "postinstall": "chmod +x sync-abis.mjs",
37
- "compile": "node scripts/sync-usdt.mjs && hardhat clean && hardhat compile && node sync-abis.mjs",
38
- "tsc": "node_modules/.bin/tsc -p . && mkdir -p dist/typechain-types/ && cp typechain-types/*.d.ts dist/typechain-types/",
19
+ "compile": "node scripts/sync-usdt.mjs && ../web/bin/m contract:compile && ../web/bin/m contract:typechain && node sync-abis.mjs",
20
+ "tsc": "node_modules/.bin/tsc -p .",
39
21
  "build": "pnpm compile && pnpm tsc",
40
- "clean": "hardhat clean",
41
- "run:node": "hardhat node",
22
+ "clean": "../web/bin/m contract:clean",
23
+ "run:node": "../web/bin/m contract:node",
42
24
  "test": "../web/bin/m contract:test",
43
25
  "checkdeploy": "../web/bin/m contract:checkdeploy",
44
- "deploy": "bin/deployLearnTGVaults",
45
- "verify": "bin/verifyLearnTGVaults",
46
- "contract-verification": "bin/contractVerification",
47
- "deploy-mock-usdt": "bin/deployMockUsdt",
48
- "verify-mock-usdt": "bin/verifyMockUSDT",
49
- "deploy-celoubi": "bin/deployCeloUbi",
50
- "verify-celoubi": "bin/verifyCeloUbi",
51
- "contract-verification-celoubi": "bin/contractVerificationCeloUbi",
26
+ "deploy": "../web/bin/m contract:deploy --contract MockUSDT --network $NEXT_PUBLIC_NETWORK",
27
+ "verify": "../web/bin/m contract:verify --contract MockUSDT --network $NEXT_PUBLIC_NETWORK",
28
+ "deploy-mock-usdt": "../web/bin/m contract:deploy --contract MockUSDT --network $NEXT_PUBLIC_NETWORK",
29
+ "verify-mock-usdt": "../web/bin/m contract:verify --contract MockUSDT --network $NEXT_PUBLIC_NETWORK",
52
30
  "prettier": "prettier --write 'contracts/**/*.sol' '**/*.ts'",
53
31
  "sync:abis": "node sync-abis.mjs"
54
32
  },
@@ -2,8 +2,8 @@
2
2
  // sync-usdt.mjs — copia MockUSDT.sol desde el motor usdt (@pasosdejesus/usdt,
3
3
  // https://gitlab.com/pasosdeJesus/m/-/work_items/35 §15.6) a <cwd>/contracts/_usdt_mock.sol.
4
4
  //
5
- // Hardhat no resuelve el link: externo del paquete (HH411 "is not installed"),
6
- // así que el build copia el .sol y compila el artifact localmente. La fuente
5
+ // `contract:compile` resuelve `node_modules` pero el paquete no expone el .sol
6
+ // como import estable, así que el build copia la fuente y compila el artifact localmente. La fuente
7
7
  // canónica es el motor; contracts/_usdt_mock.sol es un archivo GENERADO
8
8
  // (derivado, no se edita a mano).
9
9
  //
@@ -4,7 +4,7 @@ import fs from 'fs'
4
4
  import path from 'path'
5
5
 
6
6
  // Configuration - directory files
7
- const HARDHAT_ARTIFACTS_PATH = './artifacts/contracts'
7
+ const ARTIFACTS_PATH = './artifacts/contracts'
8
8
  const WEB_ABI_PATH = '../web/abis'
9
9
 
10
10
  // Create the React ABI directory if it doesn't exist
@@ -35,8 +35,8 @@ function walkDir(dir) {
35
35
  console.log("Syncing ABIs to the frontend app...")
36
36
 
37
37
  try {
38
- // Find all artifact JSON files from Hardhat compilation
39
- const artifactFiles = walkDir(HARDHAT_ARTIFACTS_PATH)
38
+ // Find all artifact JSON files from contract:compile
39
+ const artifactFiles = walkDir(ARTIFACTS_PATH)
40
40
 
41
41
  artifactFiles.forEach(filepath => {
42
42
  // Read and parse the artifact file
@@ -19,7 +19,7 @@
19
19
  "./test",
20
20
  "./deploy",
21
21
  "./types",
22
- "hardhat.config.ts"
22
+ "m-contracts.config.ts"
23
23
  ],
24
24
  "exclude": [
25
25
  "./node_modules/*"
package/man/man1/m.1 CHANGED
@@ -1,5 +1,5 @@
1
1
  .\" $OpenBSD$
2
- .Dd $Mdocdate: October 24 2026 $
2
+ .Dd $Mdocdate: October 27 2026 $
3
3
  .Dt M 1
4
4
  .Os
5
5
  .Sh NAME
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pasosdejesus/m",
3
- "version": "0.37.4",
3
+ "version": "0.37.5",
4
4
  "description": "Motor para crear y gestionar proyectos al estilo Pasos de Jesus.",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -173,7 +173,7 @@
173
173
  "picocolors": "^1.1.1"
174
174
  },
175
175
  "optionalDependencies": {
176
- "@pasosdejesus/contract-test": "^0.3.1",
176
+ "@pasosdejesus/contract-test": "^0.3.2",
177
177
  "@pasosdejesus/edr": "^0.2.1"
178
178
  },
179
179
  "devDependencies": {
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
-
3
- # Load environment variables from the root .env file
4
- . ../.env
5
-
6
- # Run the script to approve the deposit owner
7
- npx hardhat run scripts/approveDepositOwner.ts --network $NEXT_PUBLIC_NETWORK
@@ -1,94 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # prepadJ.sh — OpenBSD/adJ Hardhat compatibility (pnpm workspace version)
4
- #
5
- # Compiles the @nomicfoundation/solidity-analyzer native addon for OpenBSD.
6
- # Without it, `hardhat compile` fails because the platform has no prebuilt
7
- # binary (Unsupported OS: openbsd).
8
- #
9
- # Prerequisites:
10
- # corepack (ships with Node) and Rust/cargo (the addon is built from source).
11
- # `doas corepack enable` is optional: it only exposes `yarn` directly; this
12
- # script calls `corepack yarn`, so it works without the global shim.
13
- #
14
- # Usage:
15
- # cd apps/contracts
16
- # sh bin/prepadJ.sh
17
- #
18
- set -e
19
-
20
- APP=$(cd "$(dirname "$0")/.." && pwd)
21
- ROOT=$(cd "$APP/../.." && pwd)
22
-
23
- echo "=== prepadJ: OpenBSD Hardhat compatibility (pnpm workspace) ==="
24
-
25
- # The virtual store lives at the workspace root; older layouts kept it in the app.
26
- SOLA_DIR=""
27
- for STORE in "$ROOT/node_modules/.pnpm" "$APP/node_modules/.pnpm" "$APP/../node_modules/.pnpm"; do
28
- [ -d "$STORE" ] || continue
29
- FOUND=$(find "$STORE" -maxdepth 1 -name "@nomicfoundation+solidity-analyzer@*" -type d | head -1)
30
- if [ -n "$FOUND" ]; then
31
- SOLA_DIR="$FOUND"
32
- break
33
- fi
34
- done
35
- if [ -z "$SOLA_DIR" ]; then
36
- echo "ERROR: solidity-analyzer not found. Run: pnpm install"
37
- exit 1
38
- fi
39
- SOLA_SRC="$SOLA_DIR/node_modules/@nomicfoundation/solidity-analyzer"
40
- echo "solidity-analyzer: $SOLA_SRC"
41
-
42
- if [ -f "$SOLA_SRC/solidity-analyzer.openbsd-x64.node" ]; then
43
- echo "Native addon already exists — skipping build"
44
- exit 0
45
- fi
46
-
47
- sed -e 's/freebsd/openbsd/g' "$SOLA_SRC/index.js" > /tmp/sa-index.js
48
- # Break the hard link first: writing over it would patch the shared pnpm store.
49
- rm -f "$SOLA_SRC/index.js"
50
- cp /tmp/sa-index.js "$SOLA_SRC/index.js"
51
- echo "Patched index.js (freebsd → openbsd)"
52
-
53
- TMPDIR=$(mktemp -d /tmp/sa-build.XXXXXX)
54
- echo "Building in temp directory: $TMPDIR"
55
- cp -r "$SOLA_SRC"/* "$TMPDIR"/
56
- cp "$SOLA_SRC"/.yarnrc.yml "$TMPDIR"/ 2>/dev/null || true
57
- cp "$SOLA_SRC"/.yarnrc "$TMPDIR"/ 2>/dev/null || true
58
- cp "$SOLA_SRC"/Cargo.toml "$TMPDIR"/ 2>/dev/null || true
59
- cp -r "$SOLA_SRC"/src "$TMPDIR"/ 2>/dev/null || true
60
- cp -r "$SOLA_SRC"/build.rs "$TMPDIR"/ 2>/dev/null || true
61
-
62
- cd "$TMPDIR"
63
- echo "Installing dependencies (corepack yarn)..."
64
- COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack yarn
65
- echo "Building native addon..."
66
- COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack yarn build
67
-
68
- NODE_FILE=$(ls *.node 2>/dev/null | head -1)
69
- if [ -z "$NODE_FILE" ]; then
70
- NODE_FILE=$(find . -name "*.node" -type f | head -1)
71
- fi
72
- if [ -z "$NODE_FILE" ]; then
73
- echo "ERROR: No .node file produced. Check build output."
74
- exit 1
75
- fi
76
- NODE_FILE_ABS="$TMPDIR/$NODE_FILE"
77
-
78
- cd "$APP"
79
- cp "$NODE_FILE_ABS" "$SOLA_SRC/"
80
- echo "Copied $NODE_FILE to $SOLA_SRC"
81
-
82
- rm -rf "$TMPDIR"
83
-
84
- echo "=== prepadJ: Verifying with pnpm build ==="
85
- # `hardhat compile` loads the config, which rejects a short account key. When the
86
- # project has no `.env` yet, use a throwaway 32-byte key so the check does not
87
- # depend on the operator's secrets.
88
- if [ -z "${PRIVATE_KEY:-}" ] && [ ! -f "$ROOT/apps/.env" ] && [ ! -f "$APP/.env" ]; then
89
- echo "No .env yet: verifying with a throwaway PRIVATE_KEY"
90
- PRIVATE_KEY="0x1111111111111111111111111111111111111111111111111111111111111111"
91
- export PRIVATE_KEY
92
- fi
93
- pnpm build
94
- echo "=== prepadJ: Done ==="
@@ -1,102 +0,0 @@
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
-
7
-
8
- dotEnvConfig({ path: '../.env' });
9
-
10
-
11
- task("check-transfer", "Check token transfer from tx hash")
12
- .addParam("tx", "Transaction hash")
13
- .addParam("token", "Token contract address")
14
- .setAction(async (taskArgs, hre) => {
15
- const { ethers } = hre;
16
- const { tx, token } = taskArgs;
17
-
18
- const receipt = await ethers.provider.getTransactionReceipt(tx);
19
- if (!receipt) {
20
- console.log("Transaction not found");
21
- return;
22
- }
23
-
24
- const TokenABI = [
25
- "event Transfer(address indexed from, address indexed to, uint256 value)",
26
- "function decimals() view returns (uint8)"
27
- ];
28
-
29
- const tokenContract = new ethers.Contract(token, TokenABI, ethers.provider);
30
- const decimals = await tokenContract.decimals();
31
-
32
- const transferEventTopic = ethers.id("Transfer(address,address,uint256)");
33
- const transferLogs = receipt.logs.filter(log => log.topics[0] === transferEventTopic);
34
-
35
- if (transferLogs.length === 0) {
36
- console.log("No Transfer event found");
37
- return;
38
- }
39
-
40
- for (const log of transferLogs) {
41
- const parsedLog = tokenContract.interface.parseLog(log);
42
- if (!parsedLog) continue;
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;
@@ -1,22 +0,0 @@
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
- }
@@ -1,49 +0,0 @@
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
- });
@@ -1,93 +0,0 @@
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("\nContract 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("\nBalance 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(`\nDeployer 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(`\nHardhat 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[OK] Contract deployed and verified successfully!");
83
- console.log("\nSummary:");
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
- });
@@ -1,52 +0,0 @@
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
- });