Gusto mo bang gumawa ng token para sa iyong proyekto, gagawa ng komunidad sa mga tagasuporta sa pamamagitan ng pagbahagi ng tokens sa pamamagitan airdrop at marahil maglunsad ng ICO at sa ilang punto? Pagkatapos itong gabay ay para sayo!
Sa sunod-sunod na gabay na ito ipapakita ko sa inyo kung paano gagawa ng sariling ERC20 token at magsimulang ipamahagi ito sa pamamagitan ng einax.com token trading platform.
0. Kailangan may ETH kaUpang makumpleto ang gabay na ito kailangan mo magkaroon ng halagang kahit $2 worth of Ethereum [ETH]. Sa gabay na ito gumamit ako ng Metamask Chrome Extenstion na kung saan pwede mo makuha dito:
https://metamask.io/1. Paggawa ng ERC20 Ethereum based tokenUna, gusto naming mag-deploy ng smart contract na ERC20 ayon sa pamantayan.
Buksan mo ang
Remix (kung saan may isang kahanga-hangang browser-based IDE para sa pag-unlad ng smart contract) sa pamamagitan ng pagsunod sa link na ito :
https://remix.ethereum.org/. Sa pamamagitan ng default makikita mo ang ballot.sol smart contract. Maari mo nang e-close ang ballot.sol tab gumawa ng bago sa pagpindot ng binilugan na "+" sign
Ngayon sa sandaling mayroon ka ng isang bagong walang laman na tab kopyahin ang code sa ibaba at i-paste mo ito sa Remix:
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ----------------------------------------------------------------------------
contract FixedSupplyToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "FIXED";
name = "Example Fixed Supply Token";
decimals = 18;
_totalSupply = 1000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
Dito ako kumopya ng Code
this wiki pageNgayon Pindutin ang "Simula magtipon o Start to compile" at siguraduhin mong na walang compilation errors (Pulang mga mensahe)
Ngayon mag-log in sa iyong MetaMask browser extension at siguraduhin Remix ay konektado nito. Dapat ito ang lumabas katulad nito:
Baguhin ang token name na iyong gusto, simbolo at kabuuang supply:
Ngayon ay simple lang gawin ilipat ang contract sa FixedSupplyToken at pindutin ang Deploy button. Ayan!
Pagkatapos mong napindot yung Deploy button ang Remix ay magtatanong sayo ng kumpirmasyon
Kung ok lang sayo ang gas price na nagpapahiwatig sa iyo na magbayad at maari mo nang e-click "Confirm" baba ng sumolpot na window or Tab.
Dadalhin nito ang window ng Metamask na mukhang ganito:
Kung saan maaari nating makita ang ating pag-deploy ng kontrata ay nagkakahalaga sa ito ng $ 1.12
Ngayon pindutin ang "Confirm" button at ang iyong kontrata ay dapat na deployed na ito sa Ethereum mainnet
0x0e0a6c613Ea16aE347CB98732e152530Ae9Bc7F2 gagamitin ko ito bilang isang example
Pagkatapos ng ilang minuto dapat itong makumpirma at makikita mo ang link sa iyong sariwang deploy na smart na kontrata sa listahan ng mga transaksyong Metamask. Narito ang transaksyon sa pag-deploy ng aking token:
https://etherscan.io/tx/0x6a39c40cc35eb03874808358eb0ab2ea9967c0c27f40fe3bf65c345fa2080da2Token's smart contract address is:
0x0e0a6c613ea16ae347cb98732e152530ae9bc7f2Ayos! Sa puntong ito ang aming token ay ganap na umaandar.
2. Kumpirmahin ang kontrata sa etherscan.ioIto ay isang magandang ideya upang kumpirmahin ang iyong smart code ng kontrata sa etherscan.io kaya lahat ng tao ay magagawang tingnan ito nang madali. Dahil ang address ng kontrata ng aking token ay 0x0e0a6c613Ea16aE347CB98732e152530Ae9Bc7F2 Gagamitin ko ito bilang isang halimbawa
Pumunta sa pahina ng kontrata ng token sa etherscan.io:
https://etherscan.io/address/0x0e0a6c613ea16ae347cb98732e152530ae9bc7f2Pindutin ang
Code tab at pindutin ang
Verify And PublishSa "I-verify ang Kontrata ng Code" dapat mong punan ang lahat ng kinakailangang mga patlang nang tama upang ma-verify ng etherscan ang code ng smart code ng iyong token:
I-click ang pindutan ng Verify at I-publish at kung ang lahat ng bagay ay mabuti dapat mong makita ang mga sumusunod:
Ngayon na ang code ng token ay na-verify kahit sino ay maaaring madaling suriin ito at siguraduhin na ito ay eksakto kung ano ang iyong inaangkin na ginagawa nito. Bukod dito ang token na ito ay karapat-dapat na nakalista sa
https://einax.com3. Paglista ng token on einax.comAng bahaging ito ay madali lamang i-drop sa amin ng isang mensahe sa pamamagitan ng Telegram na may isang link sa iyong na-verify na smart kontrata ng token.
Our telegram group ay:
https://t.me/einax_exchangeKapag ang iyong token ay nakalista sa einax.com maaari mong simulan ang pamamahagi nito sa pamamagitan ng airdrops sa isang malawak na madla o lumikha ng mga redeemable voucher kung kailangan mo ng mas personalized na diskarte. Ang lahat ng mga serbisyo ay libre. Plano rin naming ilunsad ang TOKEN / ETH trading pairs sa ika-1 ng Nobyembre, 2018. Ang iyong token ay awtomatikong ililista sa isang palitan.
PS:
We've published a guide on how to launch your own AirDrops on einax platform. The good part is that you don't even have to deposit anything to test airdrops - every new account registered at einax.com receives 100 Welcome Tokens for free.
Original Post by Einax=
https://bitcointalk.org/index.php?topic=5006219.0