Are you a Web3 developer? Help us improve the Chiliz Chain docs! Share your opinion
in less than 2 minutes
Chiliz Chain Developer Docs
Chiliz ChainBlock ExplorerCommunitySocios.com
Français / French
Français / French
  • Documentation pour les développeurs Chiliz Chain
  • Démarrage rapide
    • Chiliz Chain en résumé
    • Connection au Mainnet & Testnet
    • Obtenir des tokens Testnet
    • Déployer & vérifier un contrat
      • Déployer avec Remix IDE
        • ERC-20 smart contract
      • Déployer avec Thirdweb
      • Vérifier avec Chiliscan
      • Vérifier avec Chiliz Block Explorer
    • Exécuter un nœud Chiliz Chain
    • Cours en ligne gratuit
    • Adresses d'allocation de l'offre d'inflation
  • Apprendre
    • À propos de Chiliz Chain
      • 2024 Dragon8 hard fork
      • Tokenomics
      • Chiliz Labs
    • Chiliz Bridge
      • Comment bridge ses CHZ
    • Staking sur Chiliz Chain
      • Staker ses CHZ
      • Déstaker ses CHZ
      • Récompenses de Staking
      • Staker CHZ depuis sa Ledger
    • Devenir un Validateur
      • Exécuter un noeud validateur
      • Validateur Slashing
    • À propos des Fan Tokens
      • Migration des Fan Tokens vers Chiliz Chain
    • Glossaire
      • Blockchain
      • Mécanisme de Consensus
      • Gouvernance
      • Validateur
      • Staking
      • Portefeuille
      • CAP-20
      • Wrapped CHZ (wCHZ)
    • FAQs
  • Développer
    • Les principes de bases
      • Utiliser Metamask
        • Installer Metamask
        • Lier Chiliz Chain à Metamask
      • Se connecter à Chiliz Chain
        • Se connecter en utilisant un RPC
        • Exécuter un nœud sur Chiliz Chain
        • Utiliser un portefeuille matériel
      • Explorateurs de blocs
      • Spicy Faucets
        • Obtenir des testsCHZs avec le Faucet Tatum
        • Obtenir des testCHZs avec Spicy Faucet
        • Obtenir des Fan Tokens test avec Spicy Faucet
      • Obtenir Wrapped CHZ
      • Comment faire ?
        • Comment obtenir le solde d'un portefeuille ?
        • Comment obtenir l'historique d'un portefeuille ?
        • Comment obtenir les métadonnées d'un NFT spécifique ?
      • Conseils et astuces
    • Avancé
      • Comment utiliser l'abstraction de compte
      • Comment utiliser une Oracle
      • Comment utiliser un RNG
Powered by GitBook
On this page
  • Créez votre propre token
  • Contrat intelligent ERC-20

Was this helpful?

  1. Démarrage rapide
  2. Déployer & vérifier un contrat
  3. Déployer avec Remix IDE

ERC-20 smart contract

Personnalisez et utilisez le contrat intelligent ERC-20 pour créer un token.

Last updated 11 months ago

Was this helpful?

Créez votre propre token

Comme bonne pratique, vous pouvez choisir de créer votre propre token en utilisant .

Utilisez le contrat intelligent suivant dans l'éditeur de code de votre choix, personnalisez votre cryptomonnaie, et compilez votre code après avoir approuvé la connexion en utilisant votre portefeuille numérique préféré (ici, le portefeuille MetaMask est utilisé).

Contrat intelligent ERC-20

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.16;

interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

contract SampleERC20Token is IERC20 {
    string public symbol;
    string public  name;
    uint8 public decimals;
    uint public _totalSupply;
    mapping(address => uint) balances;
    mapping(address => mapping(address => uint)) allowed;

    constructor() {
        symbol = "SYM";
        name = "Sample ERC20 Token";
        decimals = 2;
        _totalSupply = 100000;
        balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
 Personnalisez et utilisez le contrat intelligent ERC-20 pour créer un jeton.   }
    function totalSupply() external view returns (uint) {
        return _totalSupply  - balances[address(0)];
    }
    function balanceOf(address tokenOwner) external view returns (uint balance) {
        return balances[tokenOwner];
    }
    function transfer(address to, uint tokens) public returns (bool success) {
        balances[msg.sender] = balances[msg.sender] - tokens;
        balances[to] = balances[to] + tokens;
        emit Transfer(msg.sender, to, tokens);
        return true;
    }
    function approve(address spender, uint tokens) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }
    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = balances[from] - tokens;
        allowed[from][msg.sender] = allowed[from][msg.sender] - tokens;
        balances[to] = balances[to] + tokens;
        emit Transfer(from, to, tokens);
        return true;
    }
    function allowance(address tokenOwner, address spender) external view returns (uint remaining) {
        return allowed[tokenOwner][spender];
    }
}
le modèle standard ERC-20