localhost 파일 import 할 수 있다.
contracts: solidity 파일 저장하는 폴더
scripts: solidity 파일을 배포하는 폴더
tests: 테스트 코드 저장하는 폴더
artifacts: metadata를 저장하는 경로
compiler, language, abi 등 저장
Owner: test 환경
bytecode: byte 데이터 + opcodes(byte code가 실제로 의미하는 것)
Solidity Compiler: Web 상에서의 Solidity Compiler 파일을 설치하고 쓸 수 있다.
YUL: Assembly언어에 가까운 언어
Solidity 언어 안에 YUL을 함께 써서 contract를 작성할 수 있다.
Virtual Machine: Dynamic Gas비 같은 경우 EVM 버전을 바꿔서 Soft Fork해서 활용한다.
Compiler Configuration
contract 내부, 외부 모두에 define될 수 있다.
Function Modifier
modifier 객체 내에 "_" 위치에 modifier 객체를 call한 함수의 logic이 수행된다.
예시
modifier onlySeller() {
require(msg.sender == seller, "Only seller can call this.");
_;
}
function abort() public view onlySeller{ //Modifier usage
// ...}
Events: type에 대한 정의와 output에 대한 정의로 선언할 수 있다.
Error: Error 객체
Error를 호출할 때는 revert를 사용한다.
revert를 사용하면 transaction이 즉시 종료된다.
error NotEnoughFunds(uint requested, uint available);
revert NotEnoughFunds(amount, balance);
StructTypes: 여러 개의 predefined 된 data type의 집합
Enum Types: 배열의 각 원소에 값이 자동 부여된다.