genlayerlabs / genlayer-project-boilerplate
- среда, 19 августа 2026 г. в 00:00:08
This project includes the boilerplate code for a GenLayer use case implementation, specifically a football bets game.
npm install -g genlayercontracts/ # Python intelligent contracts
tests/
direct/ # Fast in-memory tests (no Studio required)
test_create_bet.py # Bet creation logic
test_resolve_bet.py # Bet resolution with web/LLM mocks
test_views.py # Read-only view methods
integration/ # Full tests against GenLayer Studio
test_football_bets.py
fixtures.py # Expected state fixtures
frontend/ # Next.js 15 app (TypeScript, TanStack Query, Radix UI)
deploy/ # TypeScript deployment scripts
gltest.config.yaml # Test runner network configuration
pyproject.toml # Python/pytest configuration
.github/workflows/ # CI pipeline
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtRun the GenVM linter to catch issues before deployment:
genvm-lint check contracts/football_bets.pyThe linter catches:
TreeMap, DynArray, u256, etc.)Direct mode tests run contracts in-memory without needing GenLayer Studio. They use mocks for web requests and LLM calls, giving you fast feedback (~milliseconds per test):
pytest tests/direct/ -vDirect mode features used in these tests:
direct_deploy("contracts/file.py") — deploy contract in memorydirect_vm.sender = address — set transaction senderdirect_vm.mock_web(pattern, response) — mock HTTP/render callsdirect_vm.mock_llm(pattern, response) — mock LLM responsesdirect_vm.expect_revert("message") — assert expected failuresdirect_vm.clear_mocks() — reset mocks between callsgenlayer networkgenlayer deploy (runs the script in /deploy/deployScript.ts)Integration tests deploy the contract to GenLayer Studio and test with real consensus:
gltest tests/integration/ -v -sThese require GenLayer Studio running (local or hosted).
frontend/.env.example to frontend/.envNEXT_PUBLIC_CONTRACT_ADDRESScd frontend
npm install
npm run devThe app will be available at http://localhost:3000/.
| Test Type | Command | Speed | Requires Studio |
|---|---|---|---|
| Lint | genvm-lint check contracts/*.py |
~250ms | No |
| Direct | pytest tests/direct/ -v |
~ms/test | No |
| Integration | gltest tests/integration/ -v -s |
~min/test | Yes |
Recommended workflow:
For AI coding agents (Claude Code, Cursor, etc.), the linter and direct tests provide the fast feedback loop needed for iterative development without requiring a running Studio instance.
For detailed information, see our documentation.
This project is licensed under the MIT License - see the LICENSE file for details.