암호화폐 (비트코인, cryptocurrency, bitcoin)  Solidity 이더리움 Cheatsheet 

 

 Solidity 이더리움 Cheatsheet

Order of Precedence of Operators

The following is the order of precedence for operators, listed in order of evaluation.

Precedence

Description

Operator

1

Postfix increment and decrement

++--

New expression

new <typename>

Array subscripting

<array>[<index>]

Member access

<object>.<member>

Function-like call

<func>(<args...>)

Parentheses

(<statement>)

2

Prefix increment and decrement

++--

Unary minus

-

Unary operations

delete

Logical NOT

!

Bitwise NOT

~

3

Exponentiation

**

4

Multiplication, division and modulo

*/%

5

Addition and subtraction

+-

6

Bitwise shift operators

<<>>

7

Bitwise AND

&

8

Bitwise XOR

^

9

Bitwise OR

|

10

Inequality operators

<><=>=

11

Equality operators

==!=

12

Logical AND

&&

13

Logical OR

||

14

Ternary operator

<conditional> ? <if-true> : <if-false>

Assignment operators

=|=^=&=<<=>>=+=-=*=/=%=

15

Comma operator

,

ABI Encoding and Decoding Functions

  • abi.decode(bytes memory encodedData, (...)) returns (...)ABI-decodes the provided data. The types are given in parentheses as second argument. Example: (uint a, uint[2] memory b, bytes memory c) = abi.decode(data, (uint, uint[2], bytes))

    경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
    어린이용이며, 설치가 필요없는 브라우저 게임입니다.
    https://s1004games.com

  • abi.encode(...) returns (bytes memory)ABI-encodes the given arguments

  • abi.encodePacked(...) returns (bytes memory): Performs packed encoding of the given arguments. Note that this encoding can be ambiguous!

  • abi.encodeWithSelector(bytes4 selector, ...) returns (bytes memory)ABI-encodes the given arguments starting from the second and prepends the given four-byte selector

  • abi.encodeCall(function functionPointer, (...)) returns (bytes memory): ABI-encodes a call to functionPointer with the arguments found in the tuple. Performs a full type-check, ensuring the types match the function signature. Result equals abi.encodeWithSelector(functionPointer.selector, (...))

  • abi.encodeWithSignature(string memory signature, ...) returns (bytes memory): Equivalent to abi.encodeWithSelector(bytes4(keccak256(bytes(signature))), ...)

Members of bytes and string

Members of address

  • <address>.balance (uint256): balance of the Address in Wei

  • <address>.code (bytes memory): code at the Address (can be empty)

  • <address>.codehash (bytes32): the codehash of the Address

  • <address>.call(bytes memory) returns (bool, bytes memory): issue low-level CALL with the given payload, returns success condition and return data

  • <address>.delegatecall(bytes memory) returns (bool, bytes memory): issue low-level DELEGATECALL with the given payload, returns success condition and return data

  • <address>.staticcall(bytes memory) returns (bool, bytes memory): issue low-level STATICCALL with the given payload, returns success condition and return data

  • <address payable>.send(uint256 amount) returns (bool): send given amount of Wei to Address, returns false on failure

  • <address payable>.transfer(uint256 amount): send given amount of Wei to Address, throws on failure

Block and Transaction Properties

  • blockhash(uint blockNumber) returns (bytes32): hash of the given block - only works for 256 most recent blocks

  • block.basefee (uint): current block’s base fee (EIP-3198 and EIP-1559)

  • block.blobbasefee (uint): current block’s blob base fee (EIP-7516 and EIP-4844)

  • block.chainid (uint): current chain id

  • block.coinbase (address payable): current block miner’s address

  • block.difficulty (uint): current block difficulty (EVM < Paris). For other EVM versions it behaves as a deprecated alias for block.prevrandao that will be removed in the next breaking release

  • block.gaslimit (uint): current block gaslimit

  • block.number (uint): current block number

  • block.prevrandao (uint): random number provided by the beacon chain (EVM >= Paris) (see EIP-4399 )

  • block.timestamp (uint): current block timestamp in seconds since Unix epoch

  • gasleft() returns (uint256): remaining gas

  • msg.data (bytes): complete calldata

  • msg.sender (address): sender of the message (current call)

  • msg.sig (bytes4): first four bytes of the calldata (i.e. function identifier)

  • msg.value (uint): number of wei sent with the message

  • tx.gasprice (uint): gas price of the transaction

  • tx.origin (address): sender of the transaction (full call chain)

Validations and Assertions

  • assert(bool condition): abort execution and revert state changes if condition is false (use for internal error)

  • require(bool condition): abort execution and revert state changes if condition is false (use for malformed input or error in external component)

  • require(bool condition, string memory message): abort execution and revert state changes if condition is false (use for malformed input or error in external component). Also provide error message.

  • revert(): abort execution and revert state changes

  • revert(string memory message): abort execution and revert state changes providing an explanatory string

Mathematical and Cryptographic Functions

  • keccak256(bytes memory) returns (bytes32): compute the Keccak-256 hash of the input

  • sha256(bytes memory) returns (bytes32): compute the SHA-256 hash of the input

  • ripemd160(bytes memory) returns (bytes20): compute the RIPEMD-160 hash of the input

  • ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address): recover address associated with the public key from elliptic curve signature, return zero on error

  • addmod(uint x, uint y, uint k) returns (uint): compute (x + y) % k where the addition is performed with arbitrary precision and does not wrap around at 2**256. Assert that k != 0 starting from version 0.5.0.

  • mulmod(uint x, uint y, uint k) returns (uint): compute (x * y) % k where the multiplication is performed with arbitrary precision and does not wrap around at 2**256. Assert that k != 0 starting from version 0.5.0.

Type Information

  • type(C).name (string): the name of the contract

  • type(C).creationCode (bytes memory): creation bytecode of the given contract, see Type Information.

  • type(C).runtimeCode (bytes memory): runtime bytecode of the given contract, see Type Information.

  • type(I).interfaceId (bytes4): value containing the EIP-165 interface identifier of the given interface, see Type Information.

  • type(T).min (T): the minimum value representable by the integer type T, see Type Information.

  • type(T).max (T): the maximum value representable by the integer type T, see Type Information.

Function Visibility Specifiers

function myFunction() <visibility specifier> returns (bool) {
    return true;
}
  • public: visible externally and internally (creates a getter function for storage/state variables)

  • private: only visible in the current contract

  • external: only visible externally (only for functions) - i.e. can only be message-called (via this.func)

  • internal: only visible internally

Modifiers

  • pure for functions: Disallows modification or access of state.

  • view for functions: Disallows modification of state.

  • payable for functions: Allows them to receive Ether together with a call.

  • constant for state variables: Disallows assignment (except initialisation), does not occupy storage slot.

  • immutable for state variables: Allows assignment at construction time and is constant when deployed. Is stored in code.

  • anonymous for events: Does not store event signature as topic.

  • indexed for event parameters: Stores the parameter as topic.

  • virtual for functions and modifiers: Allows the function’s or modifier’s behavior to be changed in derived contracts.

  • override: States that this function, modifier or public state variable changes the behavior of a function or modifier in a base contract.

[출처] https://docs.soliditylang.org/en/latest/cheatsheet.html

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
공지 오라클 기본 샘플 데이터베이스 졸리운_곰 2014.01.02 86115
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 78625
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 95339
158 [기계학습][머신러닝] [인공지능] 지도학습, 비지도학습, 강화학습 file 졸리운_곰 2025.03.14 1336
157 [기계학습][머신러닝][딥러닝] 머신러닝 하루 만에 배우려고 하지 마라 file 졸리운_곰 2025.03.09 1203
156 [DeepLearning] Learning to generate lyrics and music with Recurrent Neural Networks : 순환 신경망을 사용하여 가사와 음악을 생성하는 방법 배우기 file 졸리운_곰 2024.11.29 1002
155 [tensorflow 1.13 1.x 버전 설치법] [TensorFlow] Anaconda 가상환경 이용하여 TensorFlow GPU 설치 졸리운_곰 2024.01.08 1565
154 [AutoML][AutoKeras] [OSS] AutoKeras로 자동학습(AutoML) 하기 file 졸리운_곰 2023.07.02 1557
153 [Tensorflow 2.0] 모델 저장하고 불러오기 졸리운_곰 2023.05.21 1008
152 [pytorch] Pytorch에서 학습한 모델 저장 및 불러오기 졸리운_곰 2023.05.21 1824
151 [pytorch] Using BERT with Pytorch file 졸리운_곰 2023.03.06 1089
150 [pytorch] Full NMT model from pretrained BERT file 졸리운_곰 2023.03.06 937
149 [기계학습][딥러닝] PyTorch Hello World 졸리운_곰 2023.02.12 1226
148 [기계학습] [번역] TensorFlow Lite 튜토리얼 3 부 : Raspberry Pi의 음성 인식 졸리운_곰 2022.11.18 1102
147 [기계학습] [번역] TensorFlow Lite 튜토리얼 2 부 : 음성 인식 모델 교육 졸리운_곰 2022.11.18 1194
146 [기계학습] [번역] TensorFlow Lite 튜토리얼 1 부 : Wake Word 기능 추출 졸리운_곰 2022.11.18 1057
145 [기계학습][딥러닝] Generative Adversarial Net (GAN) PyTorch 구현: 손글씨 생성 file 졸리운_곰 2022.11.18 1001
144 [기계학습][딥러닝] Flask를 이용하여 파이토치를 REST API로 베포하기 file 졸리운_곰 2022.11.12 1008
143 [기계학습][머신러닝][딥러닝] Vanilla GAN file 졸리운_곰 2022.11.08 810
142 [기계학습][머신러닝][딥러닝] Generative Adversarial Net (GAN) PyTorch 구현: 손글씨 생성 file 졸리운_곰 2022.11.08 1425
141 [기계학습][머신러닝][딥러닝] DCGAN 튜토리얼 file 졸리운_곰 2022.11.08 1019
140 [PyTorch] pytorch 기본 문법 및 코드, 팁 snippets file 졸리운_곰 2022.10.20 1065
139 [tensorflow] [인공지능] TensorFlow GPU 동작 확인 방법 file 졸리운_곰 2022.09.04 1003
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED