Skip to content

DevJihwan/SmartContractSample_ERC20token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SmartContractSample_ERC20Token

ERC20Toekn ๋ฐœํ–‰ ๋ฐ ํ…Œ์ŠคํŠธ๋„ท ๋ฐฐํฌ
ERC20์ด๋ž€ ์Šน์ธ๋ฐ›์€ ๊ฐœ์„  ์ œ์•ˆ์„œ : EIP(Ethereum Imporvement Proposal) -> ERC(Ethereum Request for Comments)
๋Œ€๋ถ€๋ถ„์˜ ํ† ํฐ๋“ค์€ ERC20์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“ค์–ด์ง. 

Kind of ERC

*   ERC20 : ์›์กฐ ์ด๋”๋ฆฌ์›€์„ ๋ฐœํ–‰ํ•˜๋Š” ํ‘œ์ค€, ์ฝ”์ธ ๊ฐ„ ๋“ฑ๊ฐ€ ๊ตํ™˜ ๊ฐ€๋Šฅ
*   ERC721 : NFT ์ฝ”์ธ ๋ฐœํ–‰ ํ‘œ์ค€, ์ฝ”์ธ๊ฐ„ ๋“ฑ๊ฐ€๊ตํ™˜ ๋ถˆ๊ฐ€ 
*   ERC1155 : ํ•œ์ •๋œ ์ˆ˜๋Ÿ‰์œผ๋กœ ๋™์ผ ๊ฐ€์น˜ NFT

Ropsten TestNet

* ์ด๋”๋ฆฌ์›€ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ๋„คํŠธ์›Œํฌ, ๋ฉ”์ธ๋„ท์— ์ „ํ˜€ ์˜ํ–ฅ์„ ์ฃผ์ง€ ์•Š์Œ. 
* Ropsten ์™ธ Rinkeby, Kovan ๋“ฑ์˜ ํ…Œ์ŠคํŠธ๋„ท์ด ์žˆ์Œ. ํŽธ์˜์ƒ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” Ropsten์—์„œ ํ…Œ์ŠคํŠธ ๋ฐฐํฌ
* ์„ค์ •๋ฐฉ๋ฒ•
    01. ๋ฉ”ํƒ€๋งˆ์Šคํฌ ํ…Œ์ŠคํŠธ๋„ท ๊ณ„์ • ํ™œ์„ฑํ™” : ์„ค์ • - ๊ณ ๊ธ‰ - ํ…Œ์ŠคํŠธ ๋„คํŠธ์›Œํฌ ๋ณด๊ธฐ ํ™œ์„ฑํ™”
    02. Ropsten ํ…Œ์ŠคํŠธ ๋„คํŠธ์›Œํฌ ์ง€๊ฐ‘ ํ™•์ธ 
    03. https://faucet.egorfine.com/ ์ ‘์†ํ•˜์—ฌ Rosten Eth ๋ฐ›์•„์˜ค๊ธฐ 
    04. 5๋ถ„ ์ด๋‚ด 10ETH ์ˆ˜์‹  ํ™•์ธ 

ํ…Œ์ŠคํŠธ๋„ท์—์„œ ERC20 ํ† ํฐ์„ ๋ฐฐํฌํ•˜๋Š” ๋ฐฉ๋ฒ•

* ๋ฆฌ๋ฏน์Šค
* vscode 
    01. infura.io/ ํšŒ์›๊ฐ€์ž… 
    02. API Key ํ™•์ธ 
    03. truffle-config.js ์ˆ˜์ • line21 - 25, 63-70 ์ฃผ์„ ํ•ด์ œ 
    04. const infurakey = <API key ์ž…๋ ฅ>;
    05. <์„ค์น˜> npm install @truffle/hdwallet-provider
    06. rootํด๋” ๋ฐ‘์—์„œ .secret ํŒŒ์ผ์ƒ์„ฑ ๋ฐ hdwallet ๋‚ด์šฉ ์ž…๋ ฅ 
    07. truffle migrate --network ropsten
[์ฐธ๊ณ ] : https://kimsfamily.kr/331

Ether Scan

* https://ropsten.etherscan.io/address/0xb05ecc7a07215f39e41c78112530f6fc70c6adbc (๋ฆฌ๋ฏน์Šค์—์„œ ๋ฐœํ–‰๋œ DWT ์ถ”์ )

Manual for programming

00. truffle init (ํŠธ๋Ÿฌํ”Œ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ)
    * contacts : ์Šค๋งˆํŠธ์ปจํŠธ๋ž™ํŠธ ์ž‘์„ฑ ํด๋”
    * migrations : ๋ฐฐํฌ 
01. npm install openzeppelin-solidity --save (openzeppelin์€ ERC20 ํ† ํฐ ๋ฐœํ–‰ ๊ด€๋ จ ์˜คํ”ˆ์†Œ์Šค์ž„)
02. <ํด๋”>   /contracts ์—์„œ SampleToken.sol ์ž‘์„ฑ 
03. <๋ช…๋ น์–ด> truffle compile
04. <ํด๋”>   /build/contracts ํด๋„์— json ํ˜•ํƒœ์˜ ๋ฌธ์„œ ์ƒ์„ฑ ํ™•์ธ 
05. truffle-config.js ์—์„œ ใ…ฃocalhost (host: "127.0.0.1") ๋ฐ port (7545) ํ™•์ธ (ganache์™€ ์—ฐ๊ฒฐ๋จ)
06. <๋ช…๋ น์–ด> truffle migrate --reset
    * Deploying "SampleToke"์—์„œ contract address ํ™•์ธ (์ด๊ฒŒ Token ์ฃผ์†Œ)
    * ์œ„ ํ† ํฐ ์ฃผ์†Œ๋ฅผ metamask์— ๋“ฑ๋ก 

Tips

* ๊ตฌ๊ธ€๋ง์— ๋– ๋‹ค๋‹ˆ๋Š” ๋Œ€๋ถ€๋ถ„์˜ ์˜ˆ์ œ๋Š” solidity 0.5 version ์ˆ˜์ค€. ํ˜„์žฌ solidity 0.8 version
* ERC20Detailed.sol์€ ์ด์ œ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ. 

Reference

About

๐Ÿต๐ŸŒ•๐ŸŒ‘ERC20 Token publishing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published