Last active
October 3, 2023 18:58
-
-
Save Violet-Bora-Lee/865243efc292a7f9751e76c3cd528d3d to your computer and use it in GitHub Desktop.
솔리디티 event 기본 문법
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.10; | |
// 이벤트 | |
// 블록체인에 로그를 남길 때 사용하는 문법(객체)이다. | |
// 프론트엔드 등에서 특정 컨트랙트에 대한 로그를 파싱하여 응용하려 할 때 유용하다. | |
// 블록체인 상태변수보다 낮은 비용으로 정보를 저장할 수 있다. | |
contract Events { | |
// sender 주소와 메시지에 해당하는 문자열을 기록할 용도의 이벤트 선언 | |
event TestCalled(address sender, string message); | |
function test() public { | |
// 이벤트 로깅 | |
emit TestCalled(msg.sender, "Someone called test()!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment