Шпаргалка (Cheatsheet) Solidity [Переведено на русский]
Global Variables
block.coinbase (address): (текущий адрес майнера блока)current block miner's address
block.difficulty (uint):(текущая сложность блока) current block difficulty
block.gaslimit (uint):(текущий блок gaslimit) current block gaslimit
block.number (uint): (текущий номер блока) current block number
block.blockhash (function(uint) returns (bytes32)): (хеш данного блока)hash of the given block
block.timestamp (uint): (отметка времени текущего блока) current block timestamp
msg.data (bytes): (полная Calldata) complete calldata
msg.gas (uint): (оставшийся газ) remaining gas
msg.sender (address): (отправитель сообщения (текущий звонок)) sender of the message (current call)
msg.value (uint): (количество вэй, отправленных с сообщением) number of wei sent with the message
now (uint): (отметка времени текущего блока (псевдоним для block.timestamp)) current block timestamp (alias for block.timestamp)
tx.gasprice (uint): (цена на газ по сделке) gas price of the transaction
tx.origin (address): (отправитель транзакции (полная цепочка вызовов)) sender of the transaction (full call chain)
sha3(...) returns (bytes32): (вычислить хэш Ethereum-SHA3 (плотно упакованных) аргументов) compute the Ethereum-SHA3 hash of the (tightly packed) arguments
sha256(...) returns (bytes32): (вычислить хэш SHA256 (плотно упакованных) аргументов) compute the SHA256 hash of the (tightly packed) arguments
ripemd160(...) returns (bytes20): (вычислить RIPEMD из 256 (плотно упакованных) аргументов
ecrecover (bytes32, byte, bytes32, bytes32) возвращает (адрес): восстановить открытый ключ из подписи эллиптической кривой) compute RIPEMD of 256 the (tightly packed) arguments
ecrecover(bytes32, byte, bytes32, bytes32) returns (address): (восстановить открытый ключ из подписи эллиптической кривой) recover public key from elliptic curve signature
this (current contract's type): (текущий контракт, явно конвертируемый в адрес
super: контракт на один уровень выше в иерархии наследования) the current contract, explicitly convertible to address
super: (контракт на один уровень выше в иерархии наследования) the contract one level higher in the inheritance hierarchy
suicide(address): (самоубийство по текущему контракту, отправив свои средства по указанному адресу
<адрес> .balance: баланс адреса в Вэй) suicide the current contract, sending its funds to the given address
<address>.balance: (баланс адреса в Вэй) balance of the address in Wei
<address>.send(uint256) returns (bool): (отправить заданное количество Wei на адрес, в случае неудачи возвращает false.) send given amount of Wei to address, returns false on failure.
Спецификаторы видимости функций (Function Visibility Specifiers)
function myFunction() <visibility specifier> returns (bool) {
return true;
}
public: (видимый снаружи и внутри (создает функцию доступа для переменных хранилища / состояния)) visible externally and internally (creates accessor function for storage/state variables)
private: (виден только в текущем контракте) only visible in the current contract
external: (виден только извне (только для функций) - т.е. может быть вызван только через сообщение (via this.fun)) only visible externally (only for functions) - i.e. can only be message-called (via this.fun)
internal: (виден только внутри) only visible internally
Модификаторы (Modifiers)
constant for state variables: (Запрещает назначение (кроме инициализации), не занимает слот памяти.) Disallows assignment (except initialisation), does not occupy storage slot.
constant for functions: (Запрещает изменение состояния - это еще не принудительно.) Disallows modification of state - this is not enforced yet.
anonymous for events: (Не сохраняет подпись события как тему.) Does not store event signature as topic.
indexed for event parameters: (Сохраняет параметр как тему.) Stores the parameter as topic.
Types
TODO
Оригинал GitHub: https://github.com/ethereum/wiki/wiki/%5BRussian%5D-%D0%A0%D1%83%D0%BA%D0%BE%D0%B2%D0%BE%D0%B4%D1%81%D1%82%D0%B2%D0%BE-%D0%BF%D0%BE-Solidity#cheatsheet
Post #6
352