흔자
반응형
[Solidity] OpenZeppelin ERC20.sol의 mint 함수 이해하기
Develop/Solidity 2023. 5. 8. 11:38

mint() 예시 /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address..

[Solidity] OpenZeppelin Ownable.sol로 스마트 컨트랙트의 소유권 관리하기
Develop/Solidity 2023. 5. 4. 15:41

스마트 컨트랙트에서 소유권을 관리하고 변경하는 방법에 대해 살펴보겠다. 이를 위해 OpenZeppelin의 Ownable.sol 컨트랙트에서 제공하는 세 가지 함수 renounceOwnership, transferOwnership을 사용한다. Ownable.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "./Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an accou..

[Solidity] OpenZeppelin ERC20.sol의 approve와 allowance 함수 이해하기
Develop/Solidity 2023. 5. 3. 13:11

ERC20 토큰 컨트랙트의 핵심 기능 중 하나는 토큰 소유자가 다른 사용자에게 자신의 토큰을 사용할 수 있는 권한을 부여하는 것이다. 이를 위해 ERC20 표준에는 approve와 allowance라는 두 가지 중요한 함수가 포함되어 있다. ERC20.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./IERC20Metadata.sol"; import "./Context.sol"; /** * @dev Implementation of the {IERC20} inter..

[Solidity] OpenZeppelin의 Context.sol 이해하기
Develop/Solidity 2023. 4. 10. 17:29

OpenZeppelin이란? OpenZeppelin은 이더리움 스마트 컨트랙트 개발에 사용되는 오픈 소스 라이브러리이다. 보안이 검증된 컨트랙트 및 구성 요소를 제공하여 개발자들이 안전하고 효율적인 스마트 컨트랙트를 구축할 수 있도록 돕는다. OpenZeppelin의 Context 컨트랙트는 이 라이브러리의 일부로 제공된다. Context 컨트랙트란? Context 컨트랙트는 현재 실행 컨텍스트에 대한 정보를 제공하는 추상 컨트랙트입니다. 트랜잭션의 발신자와 데이터를 다루는 데 사용되며 메타 트랜잭션과 같은 경우에도 올바른 정보를 처리할 수 있도록 돕는다. GitHub - OpenZeppelin/openzeppelin-contracts: OpenZeppelin Contracts is a library f..

[Solidity] ERC20 토큰 소각 기능 구현하기: 오픈제플린의 ERC20Burnable 컨트랙트 사용법
Develop/Solidity 2023. 4. 4. 11:03

소각? 소각 기능은 토큰의 totalSupply를 줄여 가치를 유지하거나 높이는 데 도움이 되는 방법 중 하나이다. OpenZeppelin의 ERC20Burnable 컨트랙트 소개 ERC20Burnable 컨트랙트는 OpenZeppelin Contracts 라이브러리의 일부로 ERC20 토큰에 대한 burn 기능을 구현한다. 이 컨트랙트는 Context와 ERC20 컨트랙트를 상속하여 기본적인 ERC20 토큰 기능을 확장한다. 주요 함수 burn(uint256 amount) 함수는 호출자가 소유한 토큰을 소각할 수 있게 한다. 이 함수는 내부적으로 _burn 함수를 호출하여 토큰을 소각하며 호출자의 잔고에서 amount 만큼의 토큰이 차감된다. burnFrom(address account, uint256..

article thumbnail
[이더리움] 오픈제플린 라이브러리 ERC20 토큰 기능 정리
Blockchain/Ethereum 2023. 2. 20. 17:20

Reference OpenZeppelin | Contracts OpenZeppelin Contracts helps you minimize risk by using battle-tested libraries of smart contracts for Ethereum and other blockchains. It includes the most used implementations of ERC standards. www.openzeppelin.com GitHub - OpenZeppelin/openzeppelin-contracts: OpenZeppelin Contracts is a library for secure smart contract development. OpenZeppelin Contracts is ..

반응형