반업주부의 일상 배움사

블록체인 하나씩 알아보기 :: ERC20 본문

IT 인터넷/Blockchain

블록체인 하나씩 알아보기 :: ERC20

Banjubu 2022. 7. 19. 16:51
반응형

 

mint와 burn을 제공하는 간단한 것부터 해볼게요.

 

BanjubuCoin.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract BanjubuCoin is ERC20, ERC20Burnable, Ownable {
    constructor() ERC20("BanjubuCoin", "BJB") {}

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
}

 

Rinkeby에 올렸어요.

https://rinkeby.etherscan.io/address/0x9Baa04dA62Da27712388988c7bc7596FAd5dE1A4

 

BanjubuCoin | Address 0x9Baa04dA62Da27712388988c7bc7596FAd5dE1A4 | Etherscan

The Contract Address 0x9Baa04dA62Da27712388988c7bc7596FAd5dE1A4 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on Etherscan.

rinkeby.etherscan.io

 

0x302...에게 토큰(코인)을 53개 지급할게요.

 

0x302...의 갯수를 확인했더니 53개가 있네요.

 

0x302...로 계정을 연결하면 자신의 토큰을 없앨 수 있어요. (burn)

 

다시 확인하니 줄어있네요.

 

이제 NFT를 생성할게요.

 

2022.07.19 - [IT 인터넷/Blockchain] - 블록체인 하나씩 알아보기 :: ERC721

 

블록체인 하나씩 알아보기 :: ERC721

코인은 만들었고요. 2022.07.19 - [IT 인터넷/Blockchain] - 블록체인 하나씩 알아보기 :: ERC20 블록체인 하나씩 알아보기 :: ERC20 mint와 burn을 제공하는 간단한 것부터 해볼게요. BanjubuCoin.sol // SPDX-Li..

banjubu.tistory.com

 

 

 

영어, 중국어 공부중이신가요?

홈스쿨 교재. 한 권으로 가족 모두 할 수 있어요!

 

한GLO 미네르바에듀 : 네이버쇼핑 스마트스토어

한글로 영어가 된다?! 한글로[한GLO]는 영어 중국어 일어 러시아어 스페인어가 됩니다!!

smartstore.naver.com

 

반응형
LIST
Comments