<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Metadude</title>
        <link>https://paragraph.com/@henrygong</link>
        <description>undefined</description>
        <lastBuildDate>Fri, 17 Apr 2026 12:30:25 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[How to launch your first ERC20 Token on EVM compatible blockchains?]]></title>
            <link>https://paragraph.com/@henrygong/how-to-launch-your-first-erc20-token-on-evm-compatible-blockchains</link>
            <guid>kbC360MgFd0VVGQ0Nq9R</guid>
            <pubDate>Mon, 02 Jan 2023 09:16:15 GMT</pubDate>
            <description><![CDATA[Cryptocurrencies have recently become popular, opening endless possibilities to companies, individuals, and DAOs. If you want to learn how to create and deploy an ERC20 Token In 20 minutes, that’s the right place to be. In this tutorial, you’re going to understand how to create a cryptocurrency using Solidity and the ERC20 Token standard (Ethereum request of comment) maintained by OpenZeppelin. We will first write the Smart Contract using REMIX IDE, an online IDE specifically made for Ethereu...]]></description>
            <content:encoded><![CDATA[<p>Cryptocurrencies have recently become popular, opening endless possibilities to companies, individuals, and DAOs. If you want to learn how to create and deploy an ERC20 Token In 20 minutes, that’s the right place to be. In this tutorial, you’re going to understand how to create a cryptocurrency using Solidity and the ERC20 Token standard (Ethereum request of comment) maintained by OpenZeppelin. We will first write the Smart Contract using REMIX IDE, an online IDE specifically made for Ethereum development with Solidity. We’ll then set up a local environment using Hardhat to deploy your own cryptocurrency on the Mumbai Polygon Testnet. By the end of this tutorial you’ll learn:</p><ul><li><p>Develop and deploy an Ethereum Smart Contracts using the IX IDE.</p></li><li><p>How to create and deploy an ERC20 Token with Solidity.</p></li><li><p>Setup a local Ethereum development environment using Hardhat.</p></li><li><p>Deploy a cryptocurrency on Polygon Mumbai.</p></li><li><p>Visualize your own cryptocurrency on MetaMask.</p></li><li><p>How to start your own cryptocurrency.</p></li></ul><p>It is not assumed any previous Solidity knowledge, although is suggested to have some previous programming knowledge before starting this tutorial. If you don’t know where to start, I highly suggest you go and check the complete web3 roadmap (Updated this year). That said, let’s dig straight into how to develop and deploy an ERC20 token.</p><p><strong>How To Create an ERC20 Token: Set up The Environment With REMIX</strong> We’ll learn how to create and deploy an ERC20 Token Smart Contract using REMIX, an easy-to-use, free, with a great Solidity compatible IntelliJ feature, and decent compile-time errors, IDE. Navigate to <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://remix.ethereum.org">remix.ethereum.org</a>, open the contacts folder, and create a new file called “Token.sol”:</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/30233a783a6ee4af04ca93ea3bfff5257c0b10370f475e1444b44c884bb2f506.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><strong>How to Create and Deploy an ERC20 Token</strong></p><p>Whenever a new Solidity file is created, it’s mandatory to add the License-identifier and the pragma to specify the Solidity version the compiler should use to build our code. In the Token.sol file, write the following code:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>
</code></pre><p>The “^” means the code is compatible with any version of the compiler from Solidity 0.8.0 to 0.8.9. Now we need to import the ERC20 token contract from OpenZeppelin, but first, let me briefly go through what is an ERC20 Token, important to understand if you want to create your own cryptocurrency. If you’re already familiar with this concept, feel free to skip to the next paragraph.</p><p><strong>How to Create and Deploy an ERC20 Token: What is an ERC20?</strong> According to the official OpenZeppelin documentation: “An ERC20 token contract keeps track of fungible tokens: any token is exactly equal to any other token; no tokens have special rights or behavior associated with them. This makes ERC20 tokens useful for things like a medium of exchange currency, voting rights, staking, and more.” Simply put ERC20 is nothing more than a class, with its methods and members, that runs the logic of what we commonly call cryptocurrencies, with a broader meaning though, as it also finds applications in other use cases. OpenZeppelin on the other hand is considered the standard library maintaining ERC contracts classes.</p><p><strong>How to Create and Deploy an ERC20 Token</strong></p><p>Import the OpenZeppelin ERC20 contract in the Token.sol file:</p><p><strong>Token.sol</strong></p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/ERC20.sol"</span>;
</code></pre><p>And initialize the Token, <strong>inheriting from the ERC20.sol</strong> contract:</p><p><strong>Token.sol</strong></p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;

contract DevToken is ERC20{
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/ERC20.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span></span>{
}
</code></pre><p>Here we’re declaring a new contract called “DevToken”, using the Solidity keyword <strong>contract</strong>, while inheriting from the ERC20 OpenZeppelin’s contract using the <strong>“is”</strong> keyword.</p><p>Inheriting from the ERC20 contract will give us access to methods like <strong>_mint() and balanceOf()</strong>. If you want to take a look through all the available methods, <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.openzeppelin.com/contracts/4.x/api/token/erc20">you can check the official ERC20 documentation.</a></p><p>The next step is to create a cryptocurrency is to call the contract’s constructor and provide the <strong>name and symbol</strong> of the Token. To do so, inside the contract, write the following code:</p><p><strong>Token.sol</strong></p><pre data-type="codeBlock" text="contract DevToken is ERC20{
    constructor() ERC20(&quot;DevToken&quot;, &quot;DVT&quot;){}
}
"><code><span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>)</span>{}
}
</code></pre><p>At this point your code should look like this:</p><p><strong>Token.sol</strong></p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;

contract DevToken is ERC20{
    constructor() ERC20(&quot;DevToken&quot;, &quot;DVT&quot;){
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>
<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/ERC20.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>)</span>{
    }
}
</code></pre><p>**Great!**🎉 One last step before testing our own Cryptocurrency and moving to more complex topics, we now need to effectively deploy our ERC20 Token.</p><p><strong>How To Create an ERC20 Token: Mint The Cryptocurrency</strong></p><p>As said before, inheriting from the ERC20 contract, gives us access to the _mint() method used to create new tokens, and send them to a given address, exactly what we need now. Minting is defined as the process of validating information, creating a new block, and recording that information into the blockchain. Simply put, “mint” means: creating something, like a number of Tokens, or an NFT, and saving it on the blockchain. Let’s say we want to create 1000 tokens and send them to our wallet, to achieve this, we can add the following code in the constructor: <strong>Token.sol</strong></p><pre data-type="codeBlock" text="
contract DevToken is ERC20{
  constructor() ERC20(&quot;DevToken&quot;, &quot;DVT&quot;){
    _mint(msg.sender,1000*10**18);
  }
}
"><code>
<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span></span>{
  <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>)</span>{
    _mint(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>,<span class="hljs-number">1000</span><span class="hljs-operator">*</span><span class="hljs-number">10</span><span class="hljs-operator">*</span><span class="hljs-operator">*</span><span class="hljs-number">18</span>);
  }
}
</code></pre><p>There’s a lot going on here, let’s take a second to understand it: First of all, we’re calling the _mint() function, which is responsible to issue the tokens, and wants two parameters:</p><ul><li><p>to: address of the wallet/contract that will receive the tokens,</p></li><li><p>amount: amount of tokens to send. The “to” argument, is taken from msg.sender, a special variable which value is the address of the wallet/contract calling the contract.</p></li></ul><br><p>The amount, on the other hand, needs to take care of the decimals, and that’s why we’re passing such a big number, let me go through it for a second.</p><p><strong>A Note On Decimals</strong></p><p>When dealing with cryptocurrencies you may want to be able to send arbitrary amounts, like 0.004ETH. Unfortunately, Solidity and the Ethereum Virtual Machine do not support decimals: only integer numbers can be used. This means that only whole numbers can be sent (1, 4, 5), and this, of course, poses an issue. So what’s the workaround? It’s very simple, a token contract can use larger integer values (the EVM supports 256-bit integers) so that a balance of 1000000000000000000 represents 1 ETH with 18 decimal places, hence a transfer of 4000000000000000 will correspond to 0.004ETH being sent. We that in mind, when calculating our total supply, we have to take account of the total amount of tokens, including the decimal places we want to have. If you want a total max supply of 1.000.000.000 tokens, with 18 decimal places, like Ethereum and many other cryptocurrencies have, you want to pass 1000000000<em>10</em>*18 that is (1000000000000000000000000000). On the other hand, when sending 2 tokens the method to call will actually be: transfer(recipient, 2 * 101**8);</p><p>Ok now that we understand what’s going on in the mint function, let’s test our ERC20 Token contract.</p><p><strong>Deploy Your ERC20 Token Cryptocurrency</strong></p><p>On REMIX, click on the Solidity icon on the left side of the screen, and click on compile. You might also want to activate auto compile, to allow REMIX to listen for code changes, and compile your code.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b8abcfc78c7c626c8db4c09f34be958f64dda80a359f27b9f2a7c28acfc5fb79.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>This will compile the Token.sol code, populating the artifacts folder with our Token’s Contract abi (application binary interface) and their binary version, used to deploy it on the blockchain. Now that we have our artifacts, click on the Ethereum logo under the Solidity icon, select your contract in the dropdown menu, and click on deploy:</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/fe8c7532a97cec176f0327bdb7c77d75910c841c5829f22d4d883071f34071ab.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Congratulations! 🎉 If everything worked as expected, you’ve just created and deployed an ERC20 token!</p><p><strong>Interact With Your First Cryptocurrency</strong> Remember? When deployed, our smart contract should have issued 1000 tokens to our wallet! If you watch, right above the Deploy button, there’s the “account” field:</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/ddbdf15ee813ce6bf67c54872ebe23c26bdc897e0ba5b11c8ca6b2ddae201e9b.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>That’s the address of the wallet we used to deploy our ERC20 Token contract, we can say that because there’s some Ethereum missing, the Gas fees we paid to deploy the contract on the Ethereum Virtual Machine. If everything worked as expected, we should now see the issued amount of tokens in the balance of our wallet’s address. To test this out, as you can notice, right under the deploy button, and “Deployed Contracts”, there’s your deployed ERC20 token. Clicking on the dropdown menu will give you access to all of the ERC20 methods, that your contract has inherited or implemented:</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/944038e5a67a9f757ddb2afce700c3341bc9aa03c8bbeb0329095a3b86bff559.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>The color of the buttons represents whether the representing function modifies any value on the blockchain, costing Gas (Orange), or it’s a simple view function just reading and returning a value (Blue). Between those buttons, there’s one saying “balanceOf“, it requires an address as an input and will retrieve the associated amount of ERC20 Tokens. Let’s use it:</p><ol><li><p>Copy the wallet address clicking on the “copy” icon near the wallet address.</p></li><li><p>Scroll down in the token methods and search for “balanceOf”.</p></li><li><p>Paste the wallet address in the field.</p></li><li><p>Click the blue balanceOf button.</p></li><li><p>Check the amount.</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/08d2834d7a573d11e6c6fd11e1f2e68792914d74475bcb77a2acac51a870f01c.png" alt="This should give us back a total amount of 1000000000000000000000 tokens, that’s because we chose to give the Token 18 decimals. To convert the amount we can simply divide the number by 10^18 and get back 1000, or go to eth-converter.com to convert on the fly (as we’re using the same amount of decimals as Ethereum)." blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">This should give us back a total amount of 1000000000000000000000 tokens, that’s because we chose to give the Token 18 decimals. To convert the amount we can simply divide the number by 10^18 and get back 1000, or go to eth-converter.com to convert on the fly (as we’re using the same amount of decimals as Ethereum).</figcaption></figure><p>Well done, you’ve just created your own cryptocurrency! 🎉 Unfortunately, though, there are two issues at the moment:</p><ol><li><p>Our Token is not yet accessible from outside REMIX because currently deployed on the Remix EVM, a virtual machine that acts as a blockchain, not accessible by anything except your REMIX instance.</p></li><li><p>Instead of issuing all the tokens on deployment, as we’re doing now, we might want to issue the tokens as a reward, as a consequence of an action, or simply in small batches.</p></li></ol><p>Let’s first address the first issue, how to handle token supply. Note: REMIX uses a hosted virtual ethereum environment, that can be compared to a testnet but it’s not publicly accessible outside the environment itself. Your contract won’t be deployed on the actual Ethereum mainnet, nor in a publicly accessible testnet.</p><p><strong>How to Develop an ERC20: Create A Token Supply That Works</strong> When you need to create your own cryptocurrency supply, we have 3 main choices:</p><ul><li><p>Fixed Supply</p></li><li><p>Uncapped Lazy Supply</p></li><li><p>Capped Lazy Supply</p></li></ul><p>At this point, our token has a Fixed supply issued on deployment, let’s explore what it means, and the alternatives we have when developing our cryptocurrencies.</p><p><em>Fixed Supply</em> The total supply of the token is issued on deployment and sent to the deploying wallet address. In this case, we choose a total supply beforehand and issue the whole amount to our wallet when the contract’s constructor gets called, leaving us the effort of distributing the tokens among different holders. If we don’t want to issue all the tokens at once, though, we should opt for a lazy minting approach.</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;

contract DevToken is ERC20{
    constructor() ERC20(&quot;DevToken&quot;, &quot;DVT&quot;){
        _mint(msg.sender,1000*10**18);
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/ERC20.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>)</span>{
        _mint(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>,<span class="hljs-number">1000</span><span class="hljs-operator">*</span><span class="hljs-number">10</span><span class="hljs-operator">*</span><span class="hljs-operator">*</span><span class="hljs-number">18</span>);
    }
}
</code></pre><p><em>Uncapped Lazy Supply</em> Tokens aren’t minted and issued in a unique batch on deployment, but in small quantities and sent to the specified wallet(s), consequently to one or more actions. In this case, the total max supply is regulated through economic-driven principles and not on a hard-coded value. Think of a Miner validating a transaction and getting tokens back as a reward, or a user stacking their tokens to receive periodic rewards. The absence of a hardcoded Max supply, though, could make your token inflationary, incurring a loss of value over time, or worst putting its security at risk. Even if this goes outside the focus of this tutorial, is good to understand that we can, and should, cap our supply.</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;

contract DevToken is ERC20{
    constructor() ERC20(&quot;DevToken&quot;, &quot;DVT&quot;){}

    function issueToken(address receiver, uint256 amount) public{
        _mint(receiver, amount);
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/ERC20.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>)</span>{}

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">issueToken</span>(<span class="hljs-params"><span class="hljs-keyword">address</span> receiver, <span class="hljs-keyword">uint256</span> amount</span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span></span>{
        _mint(receiver, amount);
    }
}
</code></pre><p><em>Capped Lazy Supply</em> Like in the Uncapped Lazy Supply mechanism, the tokens are issued in small quantities, with the only difference that here the max-supply is decided beforehand and hardcoded in the smart contract, or passed on deployment. In this tutorial, we’re going to broadly explore all the methods to create the supply of our Tokens.</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol&quot;;

contract DevToken is ERC20Capped{
    constructor(uint256 cap) ERC20(&quot;DevToken&quot;, &quot;DVT&quot;) ERC20Capped(cap){
}

    function issueToken() public{
        _mint(msg.sender, 1000*10**18);
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20Capped</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> cap</span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>) <span class="hljs-title">ERC20Capped</span>(<span class="hljs-params">cap</span>)</span>{
}

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">issueToken</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span></span>{
        _mint(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">1000</span><span class="hljs-operator">*</span><span class="hljs-number">10</span><span class="hljs-operator">*</span><span class="hljs-operator">*</span><span class="hljs-number">18</span>);
    }
}
</code></pre><p><strong>How to Create a ERC20 Token – Security and Access Control</strong></p><p>Copying what the <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.openzeppelin.com/contracts/4.x/">OpenZeppelin documentation on access-control </a>tells us:</p><p>Access control, or “who is allowed to do this thing”, is incredibly important when dealing with smart contracts. The access control of your contract may govern who can mint tokens, vote on proposals, freeze transfers, and many other things**.**</p><p>It is therefore <strong>critical</strong> to understand how you implement it, lest someone else <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://blog.openzeppelin.com/on-the-parity-wallet-multisig-hack-405a8c12e8f7">steals your whole system</a>.</p><p>The most common and basic form of access control is the concept of <em>ownership</em> where there’s only an account allowed to perform sensitive tasks on a contract (the owner). This approach is perfectly reasonable for contracts that have a single administrative user.</p><p>OpenZeppelin provides Ownable for implementing ownership in contracts.</p><p>To use it, we’ll need to import the contract in our code, add it as a super-class of our Token contract, just like we did before, and add a function modifier to the issueToken() function ADD LINK:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;
import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;

contract DevToken is ERC20, Ownable{
    constructor() ERC20(&quot;DevToken&quot;, &quot;DVT&quot;){}

    function issueToken() public onlyOwner{
        _mint(msg.sender, 1000*10**18);
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/token/ERC20/ERC20.sol"</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">"@openzeppelin/contracts/access/Ownable.sol"</span>;

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DevToken</span> <span class="hljs-keyword">is</span> <span class="hljs-title">ERC20</span>, <span class="hljs-title">Ownable</span></span>{
    <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) <span class="hljs-title">ERC20</span>(<span class="hljs-params"><span class="hljs-string">"DevToken"</span>, <span class="hljs-string">"DVT"</span></span>)</span>{}

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">issueToken</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span> <span class="hljs-title">onlyOwner</span></span>{
        _mint(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">1000</span><span class="hljs-operator">*</span><span class="hljs-number">10</span><span class="hljs-operator">*</span><span class="hljs-operator">*</span><span class="hljs-number">18</span>);
    }
}
</code></pre><p>As we can notice, the Token contract is now inheriting both from the ERC20, and Ownable contract, this gives us access to the <strong>onlyOwner</strong> <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.tutorialspoint.com/solidity/solidity_function_modifiers.htm">function modifier</a> applied to the <strong>issueToken()</strong> function.</p><p>onlyOwner will run every time issueToken() gets called, verifying if the caller is the owner of the contract.</p><p>By default, the owner of an Ownable contract is the account that deployed it, which is usually exactly what you want.</p><p>Now that we have a reasonable understanding of how to design our token supply and how to secure its minting process, let’s learn how to deploy our token to a real and accessible blockchain, <strong>setting up a local development environment using Hardhat</strong>.</p><p>Here is the reference for local env set up:</p><p>[<strong>ref1</strong>]:</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://vitto.cc/how-to-create-and-deploy-an-erc20-token-in-20-minutes/">https://vitto.cc/how-to-create-and-deploy-an-erc20-token-in-20-minutes/</a></p><p>[<strong>ref2</strong>]:</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.alchemy.com/docs/how-to-make-nfts-with-on-chain-metadata-hardhat-and-javascript">https://docs.alchemy.com/docs/how-to-make-nfts-with-on-chain-metadata-hardhat-and-javascript</a></p>]]></content:encoded>
            <author>henrygong@newsletter.paragraph.com (Metadude)</author>
        </item>
        <item>
            <title><![CDATA[DeFi Projects Catalog]]></title>
            <link>https://paragraph.com/@henrygong/defi-projects-catalog</link>
            <guid>OgOy7FS7uAgddxxZhSKq</guid>
            <pubDate>Sun, 27 Mar 2022 03:28:05 GMT</pubDate>
            <description><![CDATA[DEX Uniswap, SushiSwap, Balancer, Curve, Bancor, PancakeSwap(BSC), TerraSwap(Terra Chain), 0x DEX Aggregator 1inch Network, Matcha(0x), Paraswap, DEX.AG, Totle Lending Protocol Compound, Maker, AAVE, Cream Finance, Venus(BSC), Anchor(Terra Chain). Alchemix, Liquity Stable Coin USDT(tether), DAI, Empty Set Dollar / ESD, Basic Cash / BAC, Frax Finance / FRAX, Fei Protocol / FEI, Reflexer / RAI, Float Protocol / FLOAT, Dynamic Set Dollar V2 / DSD, Gyroscope / GYR, TerraUSD / UST Derivative Perpe...]]></description>
            <content:encoded><![CDATA[<p><strong>DEX</strong></p><p>Uniswap, SushiSwap, Balancer, Curve, Bancor, PancakeSwap(BSC), TerraSwap(Terra Chain), 0x</p><p><strong>DEX Aggregator</strong></p><p>1inch Network, Matcha(0x), Paraswap, DEX.AG, Totle</p><p><strong>Lending Protocol</strong></p><p>Compound, Maker, AAVE, Cream Finance, Venus(BSC), Anchor(Terra Chain). Alchemix, Liquity</p><p><strong>Stable Coin</strong></p><p>USDT(tether), DAI, Empty Set Dollar / ESD, Basic Cash / BAC, Frax Finance / FRAX, Fei Protocol / FEI, Reflexer / RAI, Float Protocol / FLOAT, Dynamic Set Dollar V2 / DSD, Gyroscope / GYR, TerraUSD / UST</p><p><strong>Derivative</strong></p><p>Perpetuals: Perpetual Protocol, dYdX, Futureswap, MCDEX, Injective Protocol</p><p>Options: Hegic, Opyn, FinNexus, Auctus, Premia, Antimatter, Siren Protocol</p><p>Synthetics: Synthetix, UMA, Mirror Protocol, DEUS Finance</p><p><strong>Insurance</strong></p><p>Nexus Mutual, Armor Protocol, Cover Protocol, Unslashed Finance, Nsure Network, InsurAce</p><p><strong>Index / Defi ETF</strong></p><p>Index Cooperative, Indexed Finance, Powerpool, BasketDAO(BDPI), Cryptex Finance</p><p><strong>Prediction Market</strong></p><p>Augur, Omen, Polymarket</p><p><strong>Fixed Interest</strong></p><p>Yield, Saffron.Finance, Horizon Finance, Notional, BarnBridge, 88mph, Pendle</p><p><strong>Yield Farming Aggregator</strong></p><p>Yearn Finance, Alpha Finance, Badger Finance, Harvest Finance, Pancake Bunny(BSC), AutoFarm (BSC , HECO)</p><p><strong>Oracle</strong></p><p>Chainlink, Band Protocol, DIA</p><p><strong>Data Aggregator</strong></p><p>The Graph Protocol, Covalent, API3</p><p><strong>Multi / Cross Chain</strong></p><p>Ren Project, ThorChain, Binance Bridge, Anyswap, Terra Bridge, Multichain.xyz, Matic Bridge, APYSwap</p><p>source:</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://nigdaemon.gitbook.io/how-to-defi-advanced-zhogn-wen-b/master">https://nigdaemon.gitbook.io/how-to-defi-advanced-zhogn-wen-b/master</a></p>]]></content:encoded>
            <author>henrygong@newsletter.paragraph.com (Metadude)</author>
        </item>
        <item>
            <title><![CDATA[How to Defi]]></title>
            <link>https://paragraph.com/@henrygong/how-to-defi</link>
            <guid>3UQBNu9gsXX9Jf2goosb</guid>
            <pubDate>Sat, 22 Jan 2022 03:10:44 GMT</pubDate>
            <description><![CDATA[A great introduction book for anyone who’s interested in knowing more about Defi: https://assets.coingecko.com/books/how-to-defi/How_to_DeFi_Chinese.pdf]]></description>
            <content:encoded><![CDATA[<p>A great introduction book for anyone who’s interested in knowing more about Defi:</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://assets.coingecko.com/books/how-to-defi/How_to_DeFi_Chinese.pdf">https://assets.coingecko.com/books/how-to-defi/How_to_DeFi_Chinese.pdf</a></p>]]></content:encoded>
            <author>henrygong@newsletter.paragraph.com (Metadude)</author>
        </item>
    </channel>
</rss>