일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
- 기준
- blockchain
- built in object
- node.js
- JavaScript
- typeScript
- tailwindcss
- CLASS
- HTML
- evm
- SSR
- graphQL
- API
- REACT
- error
- Props
- hardhat
- concept
- middleware
- solidity
- 삶
- Redux
- bitcoin
- Ethereum
- express.js
- nextJS
- CSS
- Interface
- web
- useState
- Today
- Total
목록전체 글 (369)
ReasonJun
The revert() function in Solidity is used to revert a transaction and undo all state changes that have been made so far. It can be used to handle errors or to prevent invalid state changes from happening. The revert() function can be used in a number of ways. For example, it can be used to: Check for invalid input data and revert the transaction if the input data is invalid. Check for state inva..
The assert() function in Solidity is used to check for internal errors. If the condition passed to the assert() function evaluates to false, the function will throw an exception and the transaction will be reverted. The assert() function is typically used to check for invalid input data or to verify that a certain state invariant is true. For example, the following code uses the assert() functio..
Encapsulation Encapsulation is one of the four main principles of OOP, often referred to as the four pillars of OOP, which also include inheritance, polymorphism, and abstraction. Encapsulation involves bundling data (attributes or properties) and methods (functions or procedures) that operate on that data into a single unit, known as a class. This class acts as a blueprint for creating objects,..
Solidity is an object-oriented programming language, which means that it supports the concepts of classes, objects, and methods. Class A class is a blueprint for creating objects. It defines the structure and behavior of objects. A class can contain state variables, functions, and other classes. Object An object is an instance of a class. It has the state variables and functions defined in the c..
Abstract contracts and interfaces are both powerful features of Solidity that can be used to improve the quality, flexibility, and readability of your code. However, there are some key differences between the two. Abstract contracts Abstract contracts are contracts that cannot be deployed by themselves. They must be inherited by other contracts. Abstract contracts are used to define the common f..
A Solidity interface is a contract that can only contain function declarations. Interfaces are used to define the common functionality of a group of related contracts. Interfaces cannot be inherited, they must be inherited with a contract. You cannot define a fully implemented function. Functions that are not implemented must be specified. The visibility specifier of the function must be externa..
An abstract contract in Solidity is a contract that cannot be deployed by itself. It must be inherited by other contracts. Abstract contracts are used to define the common functionality of a group of related contracts. To create an abstract contract, you use the abstract keyword. For example, the following contract is abstract: abstract contract Student { function major() public pure virtual ret..
The virtual and override keywords in Solidity are used to support function overriding. Function overriding allows you to redefine a function that is inherited from a base contract. This can be useful for customizing the behavior of the function for your specific needs. Virtual functions A function is marked as virtual if it can be overridden by derived contracts. When a function is marked as vir..
Function overloading in Solidity allows you to define multiple functions with the same name but different argument types and/or numbers. This can be useful for creating more flexible and reusable code. For example, the following contract defines an overloaded add() function: contract Math { function add(uint256 a, uint256 b) public pure returns (uint256) { return a + b; } function add(uint256 a,..
// SPDX-License-Identifier: MIT pragma solidity >= 0.7.0 < 0.9.0; contract Number { uint private num = 4; function changeNum() public { num = 5; } function getNum() public view returns (uint) { return num; } } contract Caller { Number internal instance = new Number(); function changeNumber() public { instance.changeNum(); } function getNumber() public view returns(uint) { return instance.getNum(..