흔자
반응형
[Solidity] unchecked 문법 이해하기
Develop/Solidity 2023. 5. 8. 13:54

unchecked? Solidity에서 unchecked 문법은 스마트 컨트랙트에서 오버플로우(overflow)와 언더플로우(underflow) 검사를 명시적으로 생략하도록 지시하는 기능이다. unchecked 블록 내부의 코드는 컴파일러에 의해 오버플로와 언더플로 검사가 수행되지 않는다. 오버플로우? 언더플로우? 오버플로우(overflow)는 컴퓨터 프로그래밍에서 정수형 변수가 표현할 수 있는 값의 범위를 초과하여 발생하는 현상이다. 오버플로우가 발생하면 변수는 예상치 못한 값으로 변경되며 프로그램의 잘못된 동작이나 오류를 일으킬 수 있다. 또한 스마트 컨트랙트 보안의 취약점이 발생할 수 있다. 오버플로우는 주로 두 가지 상황에서 발생한다. 1. 두 정수의 덧셈 연산에서 합이 최대 표현 가능한 값보다 ..

[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..

article thumbnail
[이더리움] TypeScript와 OpenZeppelin을 활용하여 나만의 ERC20 이더리움 토큰을 배포해보기
Blockchain/Ethereum 2023. 2. 21. 16:37

프로젝트 구성에 대해서는 아래 글을 참고. [이더리움] Hardhat 설치 후 typescript 프로젝트 생성하기 Hardhat 기존 프로젝트에 Hardhat 설치 npm install --save-dev hardhat # npm install --save-dev hardhat npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package heun.tistory.com 오픈제플린(OpenZeppelin) 사용하여 솔리디티 작성 오픈제플린 라이브러리를 이용하여 솔리디티를 작성할 수 있는데 기능도 추가할 수 ..

[Hardhat] Solidity 스마트 컨트랙트 배포를 위한 Hardhat + TypeScript 프로젝트 파일트리
Develop/Solidity 2023. 2. 21. 10:42

[이더리움] Hardhat 설치 후 typescript 프로젝트 생성하기Hardhat 기존 프로젝트에 Hardhat 설치 npm install --save-dev hardhat # npm install --save-dev hardhat npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request packageheun.tistory.comHardhat설치와 프로젝트 구성하는 방법에 대해서 궁금하다면 위에 글을 참고파일 트리project├── .hardhat│ ├── cache│ ├── config.ts│ ├─..

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 ..

반응형