164 lines
8.0 KiB
Markdown
164 lines
8.0 KiB
Markdown
# Ressources — apprendre Solidity & Hardhat (Tokenizer)
|
||
|
||
> Liens **officiels** et parcours suggérés pour le projet **FGC42Forge** (BEP-20, BSC Testnet, Hardhat).
|
||
> Priorité : comprendre ce que tu déploies, pas tout lire d’un coup.
|
||
|
||
---
|
||
|
||
## Parcours suggéré (ordre)
|
||
|
||
| Phase | Quand | Objectif | Section ci-dessous |
|
||
|-------|--------|----------|-------------------|
|
||
| **A** | Avant / pendant étape 2 | Solidity : types, fonctions, `constructor` | § 1 |
|
||
| **B** | Étapes 2–3 | Hardhat : compile, test, config réseau | § 2 |
|
||
| **C** | Étape 3 | ERC-20 / OpenZeppelin, `Ownable` | § 3 |
|
||
| **D** | Étape 4+ | Deploy, verify BscScan, gas | § 4 |
|
||
| **E** | Optionnel | Approfondir Web3 / BNB | § 5 |
|
||
|
||
Croiser avec : [02-web3-comprendre.md](02-web3-comprendre.md) · [03-hardhat-et-alternatives.md](03-hardhat-et-alternatives.md) · [decisions-projet.md](decisions-projet.md).
|
||
|
||
---
|
||
|
||
## 1. Solidity — bases
|
||
|
||
### Documentation officielle (référence)
|
||
|
||
| Ressource | URL | À utiliser pour |
|
||
|-----------|-----|-----------------|
|
||
| **Solidity docs** (EN, référence) | https://docs.soliditylang.org/ | Syntaxe, types, visibilité, modifiers, erreurs |
|
||
| **By example** (courts extraits) | https://docs.soliditylang.org/en/latest/by-example.html | `mapping`, `modifier`, `events` |
|
||
| **Structure d’un contrat** | https://docs.soliditylang.org/en/latest/structure-of-a-contract.html | `state variables`, `functions`, `constructor` |
|
||
| **Sécurité (patterns)** | https://docs.soliditylang.org/en/latest/security-considerations.html | Bonnes pratiques (soutenance) |
|
||
|
||
### Chapitres utiles pour Tokenizer (lecture ciblée)
|
||
|
||
| Chapitre / thème | Pourquoi pour FGC42Forge |
|
||
|------------------|---------------------------|
|
||
| **Types** (`uint256`, `address`) | Soldes, adresses owner / holders |
|
||
| **Fonctions** (`public`, `view`, `pure`) | `balanceOf`, `transfer` (via ERC20) |
|
||
| **`constructor`** | Mint initial de la supply au deploy |
|
||
| **`modifier`** | Comprendre `onlyOwner` (OpenZeppelin) |
|
||
| **`require` / revert** | Tests « non-owner ne peut pas mint » |
|
||
| **Héritage** | `contract FGC42Forge is ERC20, Ownable` |
|
||
|
||
### Tutoriels / cours (gratuits)
|
||
|
||
| Ressource | URL | Note |
|
||
|-----------|-----|------|
|
||
| **Ethereum.org — Solidity** | https://ethereum.org/fr/developers/docs/programming-languages/solidity/ | Point d’entrée FR, liens vers la doc |
|
||
| **Ethereum.org — smart contracts** | https://ethereum.org/fr/developers/docs/smart-contracts/ | Concepts avant le code |
|
||
| **CryptoZombies** (jeu, EN) | https://cryptozombies.io/ | Solidity ludique — chapitres 1–3 suffisent pour démarrer |
|
||
| **OpenZeppelin — Learn** | https://docs.openzeppelin.com/learn/ | Articles ERC-20, access control (EN) |
|
||
|
||
### Vidéos (optionnel, EN souvent)
|
||
|
||
Chercher sur YouTube : *「Solidity tutorial 2024」* + *「ERC20 OpenZeppelin」* — privilégier chaînes qui montrent **testnet**, pas mainnet avec argent réel.
|
||
|
||
---
|
||
|
||
## 2. Hardhat — bases
|
||
|
||
### Documentation officielle
|
||
|
||
| Ressource | URL | À utiliser pour |
|
||
|-----------|-----|-----------------|
|
||
| **Hardhat — Getting started** | https://hardhat.org/hardhat-runner/docs/getting-started | Install, premier `compile` |
|
||
| **Configuration** | https://hardhat.org/hardhat-runner/docs/config | `networks.bscTestnet`, `solidity` version |
|
||
| **Testing contracts** | https://hardhat.org/hardhat-runner/docs/guides/test-contracts | Écrire tests étape 3 |
|
||
| **Deploying** | https://hardhat.org/hardhat-runner/docs/guides/deploying | Scripts → dossier `deployment/` |
|
||
| **Hardhat Network** | https://hardhat.org/hardhat-network/docs | `hardhat node` — tests sans tBNB |
|
||
| **Hardhat Toolbox** | https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox | Plugins inclus (`ethers`, verify, etc.) |
|
||
|
||
### Tutoriels alignés BSC / testnet
|
||
|
||
| Ressource | URL | Note |
|
||
|-----------|-----|------|
|
||
| **BNB Chain — dev docs** | https://docs.bnbchain.org/bnb-smart-chain/developers/ | Faucet, réseau, outils |
|
||
| **How to Create a BEP20 Token** (QuickNode) | https://www.quicknode.com/guides/smart-contract-development/how-to-create-and-deploy-a-bep-20-token | Proche du sujet Tokenizer (vérifie dates / versions) |
|
||
| **OpenZeppelin — ERC20 guide** | https://docs.openzeppelin.com/contracts/5.x/erc20 | Utilisation `ERC20` + `_mint` |
|
||
|
||
### Commandes à connaître (fiche mémo)
|
||
|
||
```bash
|
||
cd tokenizerRendu/code
|
||
npm install
|
||
npx hardhat compile # compile contracts/
|
||
npx hardhat test # tests/
|
||
npx hardhat node # chaîne locale (optionnel)
|
||
npx hardhat run scripts/deploy.js --network bscTestnet
|
||
```
|
||
|
||
---
|
||
|
||
## 3. ERC-20 / BEP-20 & OpenZeppelin (cœur du projet)
|
||
|
||
| Ressource | URL | Contenu |
|
||
|-----------|-----|---------|
|
||
| **OpenZeppelin ERC20** | https://docs.openzeppelin.com/contracts/5.x/erc20 | API : `transfer`, `approve`, `_mint`, `_burn` |
|
||
| **OpenZeppelin Ownable** | https://docs.openzeppelin.com/contracts/5.x/access-control#ownership-and-ownable | `owner()`, `onlyOwner` |
|
||
| **EIP-20 (standard)** | https://eips.ethereum.org/EIPS/eip-20 | Spec originale (= logique BEP-20) |
|
||
| **Doc projet — BEP-20** | [02-web3 § 6](02-web3-comprendre.md#6-standards-erc-20-et-bep-20) | Lien sujet 42 + BSC |
|
||
|
||
**Exercice mental :** lire la doc `ERC20` et lister quelles fonctions tu **exposes** dans FGC42Forge et lesquelles viennent **uniquement** du parent OpenZeppelin.
|
||
|
||
---
|
||
|
||
## 4. Déploiement, explorer, verify
|
||
|
||
| Ressource | URL | Contenu |
|
||
|-----------|-----|---------|
|
||
| **BscScan — verify** | https://testnet.bscscan.com/verifyContract | Publier le **code source** après deploy |
|
||
| **Hardhat — verify plugin** | https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify | `npx hardhat verify --network bscTestnet <adresse>` |
|
||
| **BNB — faucet** | https://docs.bnbchain.org/bnb-smart-chain/developers/faucet/ | tBNB (tu as déjà utilisé Telegram) |
|
||
| **Guide réalisation** | [guide-realisation.md](guide-realisation.md) | Étapes deploy du dépôt perso |
|
||
|
||
---
|
||
|
||
## 5. ethers.js (utilisé par Hardhat)
|
||
|
||
| Ressource | URL | Contenu |
|
||
|-----------|-----|---------|
|
||
| **ethers v6 docs** | https://docs.ethers.org/v6/ | `Wallet`, `Contract`, `parseEther` |
|
||
| **Hardhat + ethers** | https://hardhat.org/hardhat-runner/docs/advanced/using-ethers | Dans tests et scripts deploy |
|
||
|
||
Tu n’as pas besoin de tout maîtriser : savoir lire un script `deploy.js` qui fait `const Token = await ethers.getContractFactory("FGC42Forge")` suffit au début.
|
||
|
||
---
|
||
|
||
## 6. Outils complémentaires (sujet les cite)
|
||
|
||
| Outil | URL | Usage |
|
||
|-------|-----|--------|
|
||
| **Remix IDE** | https://remix.ethereum.org/ | Test rapide d’un `.sol` sans Hardhat |
|
||
| **Truffle docs** | https://archive.truffleframework.com/docs | Comparaison — [03-hardhat](03-hardhat-et-alternatives.md) |
|
||
| **Solidity VS Code** | Extension « Solidity » (Nomic Foundation) | Coloration, compilation locale |
|
||
|
||
---
|
||
|
||
## 7. Fiches projet Tokenizer (doc interne)
|
||
|
||
| Document | Lien |
|
||
|----------|------|
|
||
| Sujet traduit | [../sujets/tokenizer.md](../sujets/tokenizer.md) |
|
||
| Web3, RPC, mint, multisig | [02-web3-comprendre.md](02-web3-comprendre.md) |
|
||
| Hardhat vs alternatives | [03-hardhat-et-alternatives.md](03-hardhat-et-alternatives.md) |
|
||
| Étapes pas à pas | [parcours-etape-par-etape.md](parcours-etape-par-etape.md) |
|
||
| Étape 2 Hardhat | [etapes/etape-02-init-hardhat.md](etapes/etape-02-init-hardhat.md) |
|
||
|
||
---
|
||
|
||
## 8. Plan de lecture « minimum » avant l’étape 3
|
||
|
||
Si tu manques de temps, lire au moins :
|
||
|
||
1. [Solidity — Simple Storage](https://docs.soliditylang.org/en/latest/introduction-to-smart-contracts.html) (intro officielle)
|
||
2. [OpenZeppelin ERC20 — Usage](https://docs.openzeppelin.com/contracts/5.x/erc20#usage)
|
||
3. [Hardhat — Getting started](https://hardhat.org/hardhat-runner/docs/getting-started) jusqu’au premier `compile`
|
||
4. [02-web3 § 7.2](02-web3-comprendre.md#72-glossaire-anglais--supply-owner-ownable-onlyowner) (supply, owner, onlyOwner)
|
||
|
||
Ensuite : coder `FGC42Forge.sol` avec le guide étape 3 (à venir après validation étape 2).
|
||
|
||
---
|
||
|
||
*Dernière mise à jour : liens vérifiés oct. 2026 — signaler dans le chat si un lien est mort pour mise à jour.*
|