diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000000..18af34d26b
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,152 @@
+cmake_minimum_required(VERSION 3.13.0)
+
+set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The path to the cmake directory")
+list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR})
+
+# Set the build type, if none was specified.
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
+ set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
+ else()
+ set(DEFAULT_BUILD_TYPE "Release")
+ endif()
+ set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
+endif()
+
+include(EthToolchains)
+
+# Set cmake_policies
+include(EthPolicy)
+eth_policy()
+
+# project name and version should be set after cmake_policy CMP0048
+set(PROJECT_VERSION "0.8.25")
+# OSX target needed in order to support std::visit
+set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
+project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
+
+include(TestBigEndian)
+TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
+if (IS_BIG_ENDIAN)
+ message(FATAL_ERROR "${PROJECT_NAME} currently does not support big endian systems.")
+endif()
+
+option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
+option(SOLC_STATIC_STDLIBS "Link solc against static versions of libgcc and libstdc++ on supported platforms" OFF)
+option(STRICT_Z3_VERSION "Use the latest version of Z3" ON)
+option(PEDANTIC "Enable extra warnings and pedantic build flags. Treat all warnings as errors." ON)
+option(PROFILE_OPTIMIZER_STEPS "Output performance metrics for the optimiser steps." OFF)
+
+# Setup cccache.
+include(EthCcache)
+
+# Let's find our dependencies
+include(EthDependencies)
+include(fmtlib)
+include(jsoncpp)
+include(range-v3)
+include_directories(SYSTEM ${JSONCPP_INCLUDE_DIR})
+
+find_package(Threads)
+
+if(NOT PEDANTIC)
+ message(WARNING "-- Pedantic build flags turned off. Warnings will not make compilation fail. This is NOT recommended in development builds.")
+endif()
+
+if (PROFILE_OPTIMIZER_STEPS)
+ add_definitions(-DPROFILE_OPTIMIZER_STEPS)
+endif()
+
+# Figure out what compiler and system are we using
+include(EthCompilerSettings)
+
+# Include utils
+include(EthUtils)
+
+# Create license.h from LICENSE.txt and template
+# Converting to char array is required due to MSVC's string size limit.
+file(READ ${PROJECT_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT HEX)
+string(REGEX MATCHALL ".." LICENSE_TEXT "${LICENSE_TEXT}")
+string(REGEX REPLACE ";" ",\n\t0x" LICENSE_TEXT "${LICENSE_TEXT}")
+set(LICENSE_TEXT "0x${LICENSE_TEXT}")
+
+configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/license.h.in" include/license.h)
+
+include(EthOptions)
+configure_project(TESTS)
+set(LATEST_Z3_VERSION "4.12.1")
+set(MINIMUM_Z3_VERSION "4.8.16")
+find_package(Z3)
+if (${Z3_FOUND})
+ if (${STRICT_Z3_VERSION})
+ if (NOT ("${Z3_VERSION_STRING}" VERSION_EQUAL ${LATEST_Z3_VERSION}))
+ message(
+ FATAL_ERROR
+ "SMTChecker tests require Z3 ${LATEST_Z3_VERSION} for all tests to pass.\n\
+Build with -DSTRICT_Z3_VERSION=OFF if you want to use a different version. \
+You can also use -DUSE_Z3=OFF to build without Z3. In both cases use --no-smt when running tests."
+ )
+ endif()
+ else()
+ if ("${Z3_VERSION_STRING}" VERSION_LESS ${MINIMUM_Z3_VERSION})
+ message(
+ FATAL_ERROR
+ "Solidity requires Z3 ${MINIMUM_Z3_VERSION} or newer. You can also use -DUSE_Z3=OFF to build without Z3."
+ )
+ endif()
+ endif()
+endif()
+
+if(${USE_Z3_DLOPEN})
+ add_definitions(-DHAVE_Z3)
+ add_definitions(-DHAVE_Z3_DLOPEN)
+ find_package(Python3 COMPONENTS Interpreter)
+ if(${Z3_FOUND})
+ get_target_property(Z3_HEADER_HINTS z3::libz3 INTERFACE_INCLUDE_DIRECTORIES)
+ endif()
+ find_path(Z3_HEADER_PATH z3.h HINTS ${Z3_HEADER_HINTS})
+ if(Z3_HEADER_PATH)
+ set(Z3_FOUND TRUE)
+ else()
+ message(SEND_ERROR "Dynamic loading of Z3 requires Z3 headers to be present at build time.")
+ endif()
+ if(NOT ${Python3_FOUND})
+ message(SEND_ERROR "Dynamic loading of Z3 requires Python 3 to be present at build time.")
+ endif()
+ if(${SOLC_LINK_STATIC})
+ message(SEND_ERROR "solc cannot be linked statically when dynamically loading Z3.")
+ endif()
+elseif (${Z3_FOUND})
+ add_definitions(-DHAVE_Z3)
+ message("Z3 SMT solver found. This enables optional SMT checking with Z3.")
+endif()
+
+find_package(CVC4 QUIET)
+if (${CVC4_FOUND})
+ add_definitions(-DHAVE_CVC4)
+ message("CVC4 SMT solver found. This enables optional SMT checking with CVC4.")
+endif()
+
+if (NOT (${Z3_FOUND} OR ${CVC4_FOUND}))
+ message("No SMT solver found (or it has been forcefully disabled). Optional SMT checking will not be available.\
+ \nPlease install Z3 or CVC4 or remove the option disabling them (USE_Z3, USE_CVC4).")
+endif()
+
+add_subdirectory(libsolutil)
+add_subdirectory(liblangutil)
+add_subdirectory(libsmtutil)
+add_subdirectory(libevmasm)
+add_subdirectory(libyul)
+add_subdirectory(libsolidity)
+add_subdirectory(libsolc)
+add_subdirectory(libstdlib)
+add_subdirectory(tools)
+
+if (NOT EMSCRIPTEN)
+ add_subdirectory(solc)
+endif()
+
+if (TESTS AND NOT EMSCRIPTEN)
+ add_subdirectory(test)
+endif()
diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst
index 06b8f86af5..12555e3c14 100644
--- a/docs/050-breaking-changes.rst
+++ b/docs/050-breaking-changes.rst
@@ -87,6 +87,7 @@ Untuk sebagian besar topik, kompiler akan memberikan saran.
fungsi dan konstruktor, dan ``external`` ke setiap fungsi fallback atau interface
yang belum menentukan visibilitasnya.
+<<<<<<< HEAD
* Lokasi data eksplisit untuk semua variabel tipe struct, array, atau mapping
sekarang wajib. Ini juga diterapkan pada parameter fungsi dan variabel
return. Misalnya, ubah ``uint[] x = m_x`` menjadi ``uint[] storage x =
@@ -94,6 +95,15 @@ Untuk sebagian besar topik, kompiler akan memberikan saran.
di mana ``memory`` adalah lokasi data dan dapat diganti dengan ``storage`` atau
``calldata`` yang sesuai. Perhatikan bahwa fungsi ``external`` memerlukan parameter
dengan lokasi data ``calldata``.
+=======
+* Explicit data location for all variables of struct, array or mapping types is
+ now mandatory. This is also applied to function parameters and return
+ variables. For example, change ``uint[] x = z`` to ``uint[] storage x =
+ z``, and ``function f(uint[][] x)`` to ``function f(uint[][] memory x)``
+ where ``memory`` is the data location and might be replaced by ``storage`` or
+ ``calldata`` accordingly. Note that ``external`` functions require
+ parameters with a data location of ``calldata``.
+>>>>>>> english/develop
* Jenis kontrak tidak lagi menyertakan anggota ``address``
untuk memisahkan namespace. Oleh karena itu, sekarang perlu
@@ -136,8 +146,13 @@ Untuk sebagian besar topik, kompiler akan memberikan saran.
atau buat fungsi internal baru untuk logika program yang menggunakan
``msg.value``.
+<<<<<<< HEAD
* Untuk alasan kejelasan, command line interface sekarang memerlukan ``-`` jika input
standar digunakan sebagai sumber.
+=======
+* For clarity reasons, the command-line interface now requires ``-`` if the
+ standard input is used as source.
+>>>>>>> english/develop
Elemen Usang
============
@@ -146,6 +161,7 @@ Bagian ini mencantumkan perubahan yang menghentikan fitur atau sintaks sebelumny
banyak dari perubahan ini sudah diaktifkan dalam mode eksperimental
``v0.5.0``.
+<<<<<<< HEAD
Command Line dan JSON Interfaces
--------------------------------
@@ -157,6 +173,21 @@ Command Line dan JSON Interfaces
penggantian nama bahasa perantara ``Julia`` menjadi ``Yul``.
* Opsi baris perintah ``--clone-bin`` dan ``--combined-json clone-bin`` telah dihapus.
+=======
+Command-line and JSON Interfaces
+--------------------------------
+
+* The command-line option ``--formal`` (used to generate Why3 output for
+ further formal verification) was deprecated and is now removed. A new
+ formal verification module, the SMTChecker, is enabled via ``pragma
+ experimental SMTChecker;``.
+
+* The command-line option ``--julia`` was renamed to ``--yul`` due to the
+ renaming of the intermediate language ``Julia`` to ``Yul``.
+
+* The ``--clone-bin`` and ``--combined-json clone-bin`` command-line options
+ were removed.
+>>>>>>> english/develop
* Remapping dengan awalan kosong tidak diizinkan.
@@ -475,7 +506,7 @@ Versi baru:
return data;
}
- using address_make_payable for address;
+ using AddressMakePayable for address;
// Data location for 'arr' must be specified
function g(uint[] memory /* arr */, bytes8 x, OtherContract otherContract, address unknownContract) public payable {
// 'otherContract.transfer' is not provided.
@@ -492,7 +523,7 @@ Versi baru:
// 'address payable' should be used whenever possible.
// To increase clarity, we suggest the use of a library for
// the conversion (provided after the contract in this example).
- address payable addr = unknownContract.make_payable();
+ address payable addr = unknownContract.makePayable();
require(addr.send(1 ether));
// Since uint32 (4 bytes) is smaller than bytes8 (8 bytes),
@@ -508,8 +539,8 @@ Versi baru:
// We can define a library for explicitly converting ``address``
// to ``address payable`` as a workaround.
- library address_make_payable {
- function make_payable(address x) internal pure returns (address payable) {
+ library AddressMakePayable {
+ function makePayable(address x) internal pure returns (address payable) {
return address(uint160(x));
}
}
diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst
index 19d58088dd..7cf4e8dd78 100644
--- a/docs/060-breaking-changes.rst
+++ b/docs/060-breaking-changes.rst
@@ -12,8 +12,13 @@ Untuk daftar lengkap cek
Perubahan yang Mungkin Tidak Diperingatkan oleh Kompiler
========================================================
+<<<<<<< HEAD
Bagian ini mencantumkan perubahan di mana perilaku kode Anda mungkin
berubah tanpa kompiler memberi tahu Anda tentang hal itu.
+=======
+This section lists changes where the behavior of your code might
+change without the compiler telling you about it.
+>>>>>>> english/develop
* Jenis eksponensial yang dihasilkan adalah jenis basis. Dulunya adalah tipe terkecil
yang dapat menampung tipe basis dan tipe eksponen, seperti halnya operasi simetris.
@@ -51,9 +56,17 @@ Untuk sebagian besar topik, kompiler akan memberikan saran.
Jika nama mengandung titik, awalan hingga titik tidak boleh bertentangan dengan deklarasi apa pun di luar inline
assembly blok.
+<<<<<<< HEAD
* Pembayangan variabel state sekarang tidak diizinkan. Kontrak turunan hanya bisa
mendeklarasikan variabel state ``x``, jika tidak ada variabel state yang terlihat dengan
nama yang sama di salah satu basisnya.
+=======
+* In inline assembly, opcodes that do not take arguments are now represented as "built-in functions" instead of standalone identifiers. So ``gas`` is now ``gas()``.
+
+* State variable shadowing is now disallowed. A derived contract can only
+ declare a state variable ``x``, if there is no visible state variable with
+ the same name in any of its bases.
+>>>>>>> english/develop
Perubahan Semantic dan Syntactic
@@ -100,25 +113,45 @@ atau lebih sulit untuk dicapai.
Perubahan Interface
===================
+<<<<<<< HEAD
Bagian ini mencantumkan perubahan yang tidak terkait dengan bahasa itu sendiri, tetapi memiliki efek pada antarmuka
kompiler. Ini dapat mengubah cara Anda menggunakan kompiler pada baris perintah, cara Anda menggunakan antarmuka
yang dapat diprogram, atau cara Anda menganalisis output yang dihasilkan olehnya.
+=======
+This section lists changes that are unrelated to the language itself, but that have an effect on the interfaces of
+the compiler. These may change the way how you use the compiler on the command-line, how you use its programmable
+interface, or how you analyze the output produced by it.
+>>>>>>> english/develop
Reporter Error Baru
~~~~~~~~~~~~~~~~~~~
+<<<<<<< HEAD
Reporter kesalahan baru diperkenalkan, yang bertujuan untuk menghasilkan pesan kesalahan yang lebih mudah diakses di baris perintah.
Ini diaktifkan secara default, tetapi meneruskan ``--old-reporter`` akan mengembalikan ke pelapor kesalahan lama yang tidak digunakan lagi.
+=======
+A new error reporter was introduced, which aims at producing more accessible error messages on the command-line.
+It is enabled by default, but passing ``--old-reporter`` falls back to the deprecated old error reporter.
+>>>>>>> english/develop
Metadata Hash Options
~~~~~~~~~~~~~~~~~~~~~
+<<<<<<< HEAD
Kompiler sekarang menambahkan hash `IPFS `_ dari file metadata ke akhir bytecode secara default
(untuk detailnya, lihat dokumentasi di :doc:`contract metadata `). Sebelum 0.6.0, kompiler menambahkan
`Swarm `_ hash secara default, dan untuk tetap mendukung perilaku ini,
opsi baris perintah baru ``--metadata-hash`` diperkenalkan. Ini memungkinkan Anda untuk memilih hash yang akan diproduksi dan
ditambahkan, dengan meneruskan ``ipfs`` atau ``swarm`` sebagai nilai ke opsi baris perintah ``--metadata-hash``.
Meneruskan nilai ``none`` akan menghapus hash sepenuhnya.
+=======
+The compiler now appends the `IPFS `_ hash of the metadata file to the end of the bytecode by default
+(for details, see documentation on :doc:`contract metadata `). Before 0.6.0, the compiler appended the
+`Swarm `_ hash by default, and in order to still support this behavior,
+the new command-line option ``--metadata-hash`` was introduced. It allows you to select the hash to be produced and
+appended, by passing either ``ipfs`` or ``swarm`` as value to the ``--metadata-hash`` command-line option.
+Passing the value ``none`` completely removes the hash.
+>>>>>>> english/develop
Perubahan ini juga dapat digunakan melalui :ref:`Standard JSON Interface` dan mempengaruhi metadata JSON yang dihasilkan oleh compiler.
@@ -168,8 +201,19 @@ Bagian ini memberikan petunjuk terperinci tentang cara memperbarui kode sebelumn
* Pilih pengidentifikasi unik untuk deklarasi variabel di inline assembly yang tidak bertentangan
dengan deklarasi di luar blok rakitan sebaris.
+<<<<<<< HEAD
* Tambahkan ``virtual`` ke setiap fungsi non-antarmuka yang ingin Anda timpa. Tambahkan ``virtual``
ke semua fungsi tanpa implementasi di luar antarmuka. Untuk pewarisan tunggal, tambahkan ``override``
ke setiap fungsi utama. Untuk pewarisan berganda, tambahkan ``override(A, B, ..)``, tempat Anda
mencantumkan semua kontrak yang mendefinisikan fungsi yang diganti dalam tanda kurung. Ketika beberap
basis mendefinisikan fungsi yang sama, kontrak pewarisan harus mengesampingkan semua fungsi yang bertentangan.
+=======
+* Add ``virtual`` to every non-interface function you intend to override. Add ``virtual``
+ to all functions without implementation outside interfaces. For single inheritance, add
+ ``override`` to every overriding function. For multiple inheritance, add ``override(A, B, ..)``,
+ where you list all contracts that define the overridden function in the parentheses. When
+ multiple bases define the same function, the inheriting contract must override all conflicting functions.
+
+* In inline assembly, add ``()`` to all opcodes that do not otherwise accept an argument.
+ For example, change ``pc`` to ``pc()``, and ``gas`` to ``gas()``.
+>>>>>>> english/develop
diff --git a/docs/080-breaking-changes.rst b/docs/080-breaking-changes.rst
index 546206b74c..a5e20a32a7 100644
--- a/docs/080-breaking-changes.rst
+++ b/docs/080-breaking-changes.rst
@@ -10,20 +10,34 @@ Untuk daftar lengkap cek
Perubahan Senyap dari Semantics
===============================
+<<<<<<< HEAD
Bagian ini mencantumkan perubahan di mana kode yang ada mengubah perilakunya tanpa
kompiler memberi tahu Anda tentang hal itu.
* Operasi aritmatika kembali pada underflow dan overflow. Anda dapat menggunakan ``unchecked { ... }`` untuk menggunakan
perilaku wrapping sebelumnya.
+=======
+This section lists changes where existing code changes its behavior without
+the compiler notifying you about it.
+
+* Arithmetic operations revert on underflow and overflow. You can use ``unchecked { ... }`` to use
+ the previous wrapping behavior.
+>>>>>>> english/develop
Pemeriksaan overflow sangat umum, jadi kami menjadikannya default untuk meningkatkan keterbacaan kode,
bahkan jika itu datang dengan sedikit peningkatan biaya gas.
* ABI coder v2 diaktifkan secara default.
+<<<<<<< HEAD
Anda dapat memilih untuk menggunakan perilaku lama menggunakan ``pragma abicoder v1;``.
Pragma ``pragma eksperimental ABIEncoderV2;`` masih valid, tetapi tidak digunakan lagi dan tidak berpengaruh.
Jika Anda ingin eksplisit, gunakan ``pragma abicoder v2;`` sebagai gantinya.
+=======
+ You can choose to use the old behavior using ``pragma abicoder v1;``.
+ The pragma ``pragma experimental ABIEncoderV2;`` is still valid, but it is deprecated and has no effect.
+ If you want to be explicit, please use ``pragma abicoder v2;`` instead.
+>>>>>>> english/develop
Perhatikan bahwa ABI coder v2 mendukung lebih banyak jenis daripada v1 dan melakukan lebih banyak pemeriksaan *sanity* pada input.
ABI coder v2 membuat beberapa panggilan fungsi lebih mahal dan juga dapat membuat panggilan kontrak
@@ -57,8 +71,13 @@ Pembatasan Baru
Bagian ini mencantumkan perubahan yang mungkin menyebabkan kontrak yang ada tidak dapat dikompilasi lagi.
+<<<<<<< HEAD
* Ada batasan baru terkait dengan konversi literal yang eksplisit. Perilaku sebelumnya dalam
kasus-kasus berikut mungkin ambigu:
+=======
+* There are new restrictions related to explicit conversions of literals. The previous behavior in
+ the following cases was likely ambiguous:
+>>>>>>> english/develop
1. Konversi eksplisit dari literal negatif dan literal yang lebih besar dari ``type(uint160).max`` ke
``address`` tidak diizinkan.
@@ -106,7 +125,11 @@ Bagian ini mencantumkan perubahan yang mungkin menyebabkan kontrak yang ada tida
* Fungsi global ``log0``, ``log1``, ``log2``, ``log3`` dan ``log4`` tealah dihapus.
+<<<<<<< HEAD
Ini adalah fungsi low-level yang sebagian besar tidak terpakai. Perilaku mereka dapat diakses dari inline assembly.
+=======
+ These are low-level functions that were largely unused. Their behavior can be accessed from inline assembly.
+>>>>>>> english/develop
* definisi ``enum`` tidak boleh berisi lebih dari 256 anggota.
@@ -163,6 +186,7 @@ PErubahan Interface
Bagaimana cara memperbarui kode Anda?
=====================================
+<<<<<<< HEAD
- Jika Anda mengandalkan wrapping arithmetic, kelilingi setiap operasi dengan ``unchecked { ... }``.
- Opsional: Jika Anda menggunakan SafeMath atau library serupa, ubah ``x.add(y)`` menjadi ``x + y``, ``x.mul(y)`` menjadi ``x * y`` dll.
- Tambahkan ``pragma abicoder v1;`` jika Anda ingin tetap menggunakan ABI coder lama.
@@ -174,3 +198,16 @@ Bagaimana cara memperbarui kode Anda?
- ubah ``x**y**z`` menjadi ``(x**y)**z``.
- gunakan inline assembly sebagai pengganti untuk ``log0``, ..., ``log4``.
- Negate unsigned integers dengan menguranginya dari nilai maksimum tipe dan menambahkan 1 (mis. ``type(uint256).max - x + 1``, sambil memastikan bahwa `x` bukan nol)
+=======
+- If you rely on wrapping arithmetic, surround each operation with ``unchecked { ... }``.
+- Optional: If you use SafeMath or a similar library, change ``x.add(y)`` to ``x + y``, ``x.mul(y)`` to ``x * y`` etc.
+- Add ``pragma abicoder v1;`` if you want to stay with the old ABI coder.
+- Optionally remove ``pragma experimental ABIEncoderV2`` or ``pragma abicoder v2`` since it is redundant.
+- Change ``byte`` to ``bytes1``.
+- Add intermediate explicit type conversions if required.
+- Combine ``c.f{gas: 10000}{value: 1}()`` to ``c.f{gas: 10000, value: 1}()``.
+- Change ``msg.sender.transfer(x)`` to ``payable(msg.sender).transfer(x)`` or use a stored variable of ``address payable`` type.
+- Change ``x**y**z`` to ``(x**y)**z``.
+- Use inline assembly as a replacement for ``log0``, ..., ``log4``.
+- Negate unsigned integers by subtracting them from the maximum value of the type and adding 1 (e.g. ``type(uint256).max - x + 1``, while ensuring that ``x`` is not zero)
+>>>>>>> english/develop
diff --git a/docs/Makefile b/docs/Makefile
index 3cc98f6990..01660bd388 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -34,7 +34,6 @@ help:
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@@ -116,12 +115,6 @@ latexpdf:
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-latexpdfja:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through platex and dvipdfmx..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000000..a3b5f25aed
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,23 @@
+# Solidity Language Docs
+
+## Local environment setup
+
+1. Install python https://www.python.org/downloads/
+1. Install sphinx (the tool used to generate the docs) https://www.sphinx-doc.org/en/master/usage/installation.html
+
+Go to `/docs` and run `./docs.sh` to install dependencies and build the project:
+
+```sh
+cd docs
+./docs.sh
+```
+
+That will output the generated htmls under _build/
+
+## Serve environment
+
+```py
+python3 -m http.server -d _build/html --cgi 8080
+```
+
+Visit dev server at http://localhost:8080
diff --git a/docs/_static/css/custom-dark.css b/docs/_static/css/custom-dark.css
new file mode 100644
index 0000000000..044a8f800d
--- /dev/null
+++ b/docs/_static/css/custom-dark.css
@@ -0,0 +1,595 @@
+
+
+/* DARK MODE STYLING */
+
+/* code directives */
+
+:root[style*=dark] .method dt,
+:root[style*=dark] .class dt,
+:root[style*=dark] .data dt,
+:root[style*=dark] .attribute dt,
+:root[style*=dark] .function dt,
+:root[style*=dark] .classmethod dt,
+:root[style*=dark] .exception dt,
+:root[style*=dark] .descclassname,
+:root[style*=dark] .descname {
+ background-color: #2d2d2d !important;
+}
+
+:root[style*=dark] .rst-content dl:not(.docutils) dt {
+ background-color: #0008;
+ border-top: solid 3px #fff2;
+ border-left: solid 3px #fff2;
+}
+
+:root[style*=dark] em.property {
+ color: #888888;
+}
+
+
+/* tables */
+
+:root[style*=dark] .rst-content table.docutils td {
+ border: 0px;
+}
+
+:root[style*=dark] .rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td {
+ background-color: #0002;
+}
+
+:root[style*=dark] .rst-content pre {
+ background: none;
+}
+
+/* inlined code highlights */
+
+:root[style*=dark] .xref,
+:root[style*=dark] .py-meth {
+ color: #aaddff !important;
+ font-weight: normal !important;
+}
+
+/* highlight color search text */
+
+:root[style*=dark] .rst-content .highlighted {
+ background: #ff5722;
+ box-shadow: 0 0 0 2px #f0978b;
+}
+
+/* notes, warnings, hints */
+
+:root[style*=dark] .hint .admonition-title {
+ background: #2aa87c !important;
+}
+
+:root[style*=dark] .warning .admonition-title {
+ background: #cc4444 !important;
+}
+
+:root[style*=dark] .admonition-title {
+ background: #3a7ca8 !important;
+}
+
+:root[style*=dark] .admonition,
+:root[style*=dark] .note {
+ background-color: #0008 !important;
+}
+
+
+/* table of contents */
+
+:root[style*=dark] .sidebar {
+ background-color: #191919 !important;
+}
+
+:root[style*=dark] .sidebar-title {
+ background-color: #2b2b2b !important;
+}
+
+:root[style*=dark] .wy-menu-vertical code.docutils.literal.notranslate {
+ background: none !important;
+ border: none !important;
+}
+
+
+:root[style*=dark] .toc-backref {
+ color: grey !important;
+}
+
+:root[style*=dark] .highlight {
+ background: #0008;
+ color: #f8f8f2
+}
+
+:root[style*=dark] .highlight .c {
+ color: #888
+}
+
+
+/* Comment */
+
+:root[style*=dark] .highlight .err {
+ color: #960050;
+ background-color: #1e0010
+}
+
+
+/* Error */
+
+:root[style*=dark] .highlight .k {
+ color: #66d9ef
+}
+
+
+/* Keyword */
+
+:root[style*=dark] .highlight .l {
+ color: #ae81ff
+}
+
+
+/* Literal */
+
+:root[style*=dark] .highlight .n {
+ color: #f8f8f2
+}
+
+
+/* Name */
+
+:root[style*=dark] .highlight .o {
+ color: #f92672
+}
+
+
+/* Operator */
+
+:root[style*=dark] .highlight .p {
+ color: #f8f8f2
+}
+
+
+/* Punctuation */
+
+:root[style*=dark] .highlight .ch {
+ color: #888
+}
+
+
+/* Comment.Hashbang */
+
+:root[style*=dark] .highlight .cm {
+ color: #888
+}
+
+
+/* Comment.Multiline */
+
+:root[style*=dark] .highlight .cp {
+ color: #888
+}
+
+
+/* Comment.Preproc */
+
+:root[style*=dark] .highlight .cpf {
+ color: #888
+}
+
+
+/* Comment.PreprocFile */
+
+:root[style*=dark] .highlight .c1 {
+ color: #888
+}
+
+
+/* Comment.Single */
+
+:root[style*=dark] .highlight .cs {
+ color: #888
+}
+
+
+/* Comment.Special */
+
+:root[style*=dark] .highlight .gd {
+ color: #f92672
+}
+
+
+/* Generic.Deleted */
+
+:root[style*=dark] .highlight .ge {
+ font-style: italic
+}
+
+
+/* Generic.Emph */
+
+:root[style*=dark] .highlight .gi {
+ color: #a6e22e
+}
+
+
+/* Generic.Inserted */
+
+:root[style*=dark] .highlight .gs {
+ font-weight: bold
+}
+
+
+/* Generic.Strong */
+
+:root[style*=dark] .highlight .gu {
+ color: #888
+}
+
+
+/* Generic.Subheading */
+
+:root[style*=dark] .highlight .kc {
+ color: #66d9ef
+}
+
+
+/* Keyword.Constant */
+
+:root[style*=dark] .highlight .kd {
+ color: #66d9ef
+}
+
+
+/* Keyword.Declaration */
+
+:root[style*=dark] .highlight .kn {
+ color: #f92672
+}
+
+
+/* Keyword.Namespace */
+
+:root[style*=dark] .highlight .kp {
+ color: #66d9ef
+}
+
+
+/* Keyword.Pseudo */
+
+:root[style*=dark] .highlight .kr {
+ color: #66d9ef
+}
+
+
+/* Keyword.Reserved */
+
+:root[style*=dark] .highlight .kt {
+ color: #66d9ef
+}
+
+
+/* Keyword.Type */
+
+:root[style*=dark] .highlight .ld {
+ color: #e6db74
+}
+
+
+/* Literal.Date */
+
+:root[style*=dark] .highlight .m {
+ color: #ae81ff
+}
+
+
+/* Literal.Number */
+
+:root[style*=dark] .highlight .s {
+ color: #e6db74
+}
+
+
+/* Literal.String */
+
+:root[style*=dark] .highlight .na {
+ color: #a6e22e
+}
+
+
+/* Name.Attribute */
+
+:root[style*=dark] .highlight .nb {
+ color: #f8f8f2
+}
+
+
+/* Name.Builtin */
+
+:root[style*=dark] .highlight .nc {
+ color: #a6e22e
+}
+
+
+/* Name.Class */
+
+:root[style*=dark] .highlight .no {
+ color: #66d9ef
+}
+
+
+/* Name.Constant */
+
+:root[style*=dark] .highlight .nd {
+ color: #a6e22e
+}
+
+
+/* Name.Decorator */
+
+:root[style*=dark] .highlight .ni {
+ color: #f8f8f2
+}
+
+
+/* Name.Entity */
+
+:root[style*=dark] .highlight .ne {
+ color: #a6e22e
+}
+
+
+/* Name.Exception */
+
+:root[style*=dark] .highlight .nf {
+ color: #a6e22e
+}
+
+
+/* Name.Function */
+
+:root[style*=dark] .highlight .nl {
+ color: #f8f8f2
+}
+
+
+/* Name.Label */
+
+:root[style*=dark] .highlight .nn {
+ color: #f8f8f2
+}
+
+
+/* Name.Namespace */
+
+:root[style*=dark] .highlight .nx {
+ color: #a6e22e
+}
+
+
+/* Name.Other */
+
+:root[style*=dark] .highlight .py {
+ color: #f8f8f2
+}
+
+
+/* Name.Property */
+
+:root[style*=dark] .highlight .nt {
+ color: #f92672
+}
+
+
+/* Name.Tag */
+
+:root[style*=dark] .highlight .nv {
+ color: #f8f8f2
+}
+
+
+/* Name.Variable */
+
+:root[style*=dark] .highlight .ow {
+ color: #f92672
+}
+
+
+/* Operator.Word */
+
+:root[style*=dark] .highlight .w {
+ color: #f8f8f2
+}
+
+
+/* Text.Whitespace */
+
+:root[style*=dark] .highlight .mb {
+ color: #ae81ff
+}
+
+
+/* Literal.Number.Bin */
+
+:root[style*=dark] .highlight .mf {
+ color: #ae81ff
+}
+
+
+/* Literal.Number.Float */
+
+:root[style*=dark] .highlight .mh {
+ color: #ae81ff
+}
+
+
+/* Literal.Number.Hex */
+
+:root[style*=dark] .highlight .mi {
+ color: #ae81ff
+}
+
+
+/* Literal.Number.Integer */
+
+:root[style*=dark] .highlight .mo {
+ color: #ae81ff
+}
+
+
+/* Literal.Number.Oct */
+
+:root[style*=dark] .highlight .sa {
+ color: #e6db74
+}
+
+
+/* Literal.String.Affix */
+
+:root[style*=dark] .highlight .sb {
+ color: #e6db74
+}
+
+
+/* Literal.String.Backtick */
+
+:root[style*=dark] .highlight .sc {
+ color: #e6db74
+}
+
+
+/* Literal.String.Char */
+
+:root[style*=dark] .highlight .dl {
+ color: #e6db74
+}
+
+
+/* Literal.String.Delimiter */
+
+:root[style*=dark] .highlight .sd {
+ color: #e6db74
+}
+
+
+/* Literal.String.Doc */
+
+:root[style*=dark] .highlight .s2 {
+ color: #e6db74
+}
+
+
+/* Literal.String.Double */
+
+:root[style*=dark] .highlight .se {
+ color: #ae81ff
+}
+
+
+/* Literal.String.Escape */
+
+:root[style*=dark] .highlight .sh {
+ color: #e6db74
+}
+
+
+/* Literal.String.Heredoc */
+
+:root[style*=dark] .highlight .si {
+ color: #e6db74
+}
+
+
+/* Literal.String.Interpol */
+
+:root[style*=dark] .highlight .sx {
+ color: #e6db74
+}
+
+
+/* Literal.String.Other */
+
+:root[style*=dark] .highlight .sr {
+ color: #e6db74
+}
+
+
+/* Literal.String.Regex */
+
+:root[style*=dark] .highlight .s1 {
+ color: #e6db74
+}
+
+
+/* Literal.String.Single */
+
+:root[style*=dark] .highlight .ss {
+ color: #e6db74
+}
+
+
+/* Literal.String.Symbol */
+
+:root[style*=dark] .highlight .bp {
+ color: #f8f8f2
+}
+
+
+/* Name.Builtin.Pseudo */
+
+:root[style*=dark] .highlight .fm {
+ color: #a6e22e
+}
+
+
+/* Name.Function.Magic */
+
+:root[style*=dark] .highlight .vc {
+ color: #f8f8f2
+}
+
+
+/* Name.Variable.Class */
+
+:root[style*=dark] .highlight .vg {
+ color: #f8f8f2
+}
+
+
+/* Name.Variable.Global */
+
+:root[style*=dark] .highlight .vi {
+ color: #f8f8f2
+}
+
+
+/* Name.Variable.Instance */
+
+:root[style*=dark] .highlight .vm {
+ color: #f8f8f2
+}
+
+
+/* Name.Variable.Magic */
+
+:root[style*=dark] .highlight .il {
+ color: #ae81ff
+}
+
+
+/* Grammar */
+
+:root[style*=dark] .railroad-diagram {
+ fill: white;
+}
+
+:root[style*=dark] .railroad-diagram path {
+ stroke: white;
+}
+
+:root[style*=dark] .railroad-diagram rect {
+ stroke: white;
+}
+
+:root[style*=dark] .a4 .sig-name {
+ background-color: transparent !important;
+}
diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css
index 4ff53f3a7b..25ab265443 100644
--- a/docs/_static/css/custom.css
+++ b/docs/_static/css/custom.css
@@ -1,23 +1,185 @@
+/* ROOT DECLARATIONS */
+:root {
+ /* Text */
+ --color-a: #2B247C;
+ --color-b: #672AC8;
+ --color-c: #5554D9;
+ --color-d: #9F94E8;
+ --color-e: #AEC0F1;
+ --color-f: #E6E3EC;
+ /* Background */
+
+ --white: #FAF8FF;
+ --black: #110C4E;
+ --menu-bg: #2B247C06;
+ --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
+
+ --navHeight: 4.5rem;
+ --sideWidth: 300px;
+ --maxWidth: 80rem;
+ --desktopInlinePadding: 2rem;
+ --mobileInlinePadding: 1rem;
+ --currentVersionHeight: 45px;
+
+ text-rendering: geometricPrecision;
+ -webkit-font-smoothing: antialiased;
+}
+
+a,
+button {
+ border-radius: 0;
+}
+
+:root[style*=dark] {
+ --color-a: #E6E3EC !important;
+ --color-b: #AEC0F1 !important;
+ --color-c: #9F94E8 !important;
+ --color-d: #5554D9 !important;
+ --color-e: #672AC8 !important;
+ --color-f: #2B247C !important;
+
+ --white: #110C4E !important;
+ --black: #FAF8FF !important;
+ --menu-bg: #E6E3EC06 !important;
+}
+
+html,
+body,
+.unified-header::before,
+.wy-nav-side,
+.rst-versions,
+code,
+div,
+input[type=text],
+a,
+.wy-grid-for-nav {
+ transition: background 150ms ease-in-out;
+}
+
+html,
+body,
+.wy-grid-for-nav {
+ background-color: var(--color-f) !important;
+}
+
+body {
+ font-family: "Overpass", sans-serif;
+}
+
+a {
+ color: var(--color-c);
+}
+
+a, section {
+ scroll-margin-top: calc(var(--navHeight) + 2rem);
+}
+
+hr {
+ margin-block: 2rem;
+ border-color: var(--color-d) !important;
+}
+
+
+/* HEADER STYLES */
+h1 {
+ font-family: 'Overpass', sans-serif;
+ font-weight: 700;
+ font-size: 44px;
+ color: var(--color-a) !important;
+ line-height: 1.1;
+ text-wrap: balance;
+ margin-top: 4rem;
+ margin-bottom: 1.5rem;
+}
+
+section:first-of-type h1:first-of-type {
+ font-family: 'Overpass mono', monospace;
+ font-size: 48px;
+ margin-top: 3rem;
+ margin-bottom: 5rem;
+}
+
+h2 {
+ font-family: 'Overpass', sans-serif;
+ font-weight: 700;
+ font-size: 38px;
+ color: var(--color-a) !important;
+ line-height: 46px;
+ text-wrap: balance;
+ margin-top: 4rem;
+ margin-bottom: 1.5rem;
+}
+
+*:not([role=navigation])>p[role=heading]>span,
+h3 {
+ font-family: 'Overpass', sans-serif;
+ font-weight: 700;
+ font-size: 32px;
+ color: var(--color-a) !important;
+ line-height: 46px;
+ text-wrap: balance;
+ margin-top: 4rem;
+ margin-bottom: 1.5rem;
+}
+
+h4 {
+ font-family: 'Overpass', sans-serif;
+ font-weight: 700;
+ font-size: 32px;
+ color: var(--color-a) !important;
+ line-height: 46px;
+ text-wrap: balance;
+ margin-top: 3rem;
+ margin-bottom: 1.5rem;
+}
+
+h5 {
+ font-family: 'Overpass', sans-serif;
+ font-weight: 700;
+ font-size: 18px;
+ color: var(--color-a) !important;
+ line-height: 1.4;
+ text-wrap: balance;
+}
+
+h6 {
+ font-family: 'Overpass', sans-serif;
+ font-weight: 700;
+ font-size: 16px;
+ color: var(--color-a) !important;
+ line-height: 1.4;
+ text-wrap: balance;
+}
+
+span.pre,
pre {
- white-space: pre-wrap; /* css-3 */
- white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
- white-space: -pre-wrap; /* Opera 4-6 */
- white-space: -o-pre-wrap; /* Opera 7 */
+ /* css-3 */
+ white-space: pre-wrap;
+ /* Mozilla, since 1999 */
+ white-space: -moz-pre-wrap;
+ /* Opera 4-6 */
+ white-space: -pre-wrap;
+ /* Opera 7 */
+ white-space: -o-pre-wrap;
word-wrap: break-word;
+ font-family: 'Overpass Mono', monospace;
}
-.wy-table-responsive table td, .wy-table-responsive table th {
+small,
+small * {
+ font-size: 12px;
+}
+
+.wy-table-responsive table td,
+.wy-table-responsive table th {
white-space: normal;
}
+
.rst-content table.docutils td {
vertical-align: top;
}
/* links */
-.rst-content a:not(:visited) {
- color: #002fa7;
-}
-
.rst-content .highlighted {
background: #eac545;
}
@@ -27,60 +189,638 @@ pre {
background: #fafafa;
}
-.wy-side-nav-search img.logo {
- width: 100px !important;
- padding: 0;
+/* project version (displayed under project logo) */
+.wy-side-nav-search>div.version {
+ color: var(--color-b);
+ margin-top: 0;
+ margin-bottom: 0.5rem;
+ text-align: start;
}
-.wy-side-nav-search > a {
- padding: 0;
+/* Link to Remix IDE shown next to code snippets */
+.rst-content p.remix-link-container {
+ display: block;
+ text-align: right;
margin: 0;
+ line-height: 1em;
}
-/* project version (displayed under project logo) */
-.wy-side-nav-search .version {
- color: #272525 !important;
+.rst-content .remix-link-container a.remix-link {
+ font-size: 0.7em;
+ padding: 0.1em 0.5em;
+ background: transparent;
+ color: var(--color-a) !important;
+ border: 1px solid var(--color-a);
+ text-decoration: none;
}
-/* menu section headers */
-.wy-menu .caption {
- color: #65afff !important;
+.rst-content div.highlight-solidity,
+.rst-content div.highlight-yul {
+ margin-top: 0;
}
-/* Link to Remix IDE shown next to code snippets */
-p.remix-link-container {
+/* CUSTOMIZATION UPDATES */
+
+.wy-nav-content-wrap,
+.wy-nav-content {
+ background: transparent !important;
+}
+
+.wy-side-nav-search {
+ background-color: transparent !important;
+ color: var(--color-a) !important;
+ box-shadow: 0 4 4 0 var(--color-a);
+ border-bottom: 1px solid var(--color-d) !important;
+}
+
+.wy-side-nav-search svg {
+ color: var(--color-a) !important;
+}
+
+.wy-nav-top {
+ background-color: transparent !important;
+ color: var(--color-a) !important;
+}
+
+.wy-nav-top a {
+ color: var(--color-a) !important;
+}
+
+.wy-breadcrumbs a.icon-home:before {
+ content: "Documentation";
+ font-family: "Overpass", sans-serif;
+}
+
+.rst-content table.docutils thead {
+ color: var(--color-a);
+}
+
+code.docutils.literal.notranslate {
+ padding: 2px 4px;
+ font-size: 0.875em;
+ font-family: "Overpass Mono", monospace;
+ background: var(--white);
+ color: var(--color-c);
+ border: 0px;
+}
+
+dt code.docutils.literal.notranslate {
+ background: none;
+}
+
+.wy-nav-content {
+ color: var(--color-a);
+}
+
+/* .rst-content a:not(:visited) { */
+/* color: var(--color-b) !important; */
+/* } */
+
+.rst-content a:visited {
+ color: var(--color-c) !important;
+}
+
+.rst-content a {
+ text-decoration: underline;
+}
+
+.rst-content a:where(:focus, :focus-visible, :hover) {
+ color: var(--color-d) !important;
+}
+
+.wy-side-scroll a {
+ color: var(--color-a);
+ background: transparent;
+ font-size: 1rem;
+ line-height: 125%;
+}
+
+.wy-menu-vertical li.current a,
+.wy-menu-vertical li.current li a,
+.wy-menu-vertical li.current li a code {
+ border: none;
+ color: var(--color-a);
+}
+
+ul.current ul,
+.wy-menu-vertical li.current a:hover,
+.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a,
+.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a,
+.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a,
+.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a,
+.wy-menu-vertical li.current {
+ background: var(--menu-bg) !important;
+}
+
+.wy-menu.wy-menu-vertical>ul {
+ margin-bottom: 3rem;
+}
+
+.wy-menu.wy-menu-vertical>p {
+ color: var(--color-c);
+}
+
+.wy-menu-vertical li.on a,
+.wy-menu-vertical li.current>a {
+ background: var(--menu-bg) !important;
+ border-bottom: 0px !important;
+ border-top: 0px !important;
+}
+
+.btn {
+ border-radius: 0;
+ text-decoration: none !important;
+}
+
+.wy-breadcrumbs-aside a,
+.wy-breadcrumbs-aside a:visited,
+a.fa.fa-github,
+a.fa.fa-github:visited,
+a.fa.fa-github:not(:visited),
+a.btn.btn-neutral:visited,
+a.btn.btn-neutral:not(:visited),
+a.btn.btn-neutral {
+ background: transparent !important;
+ color: var(--color-a) !important;
+ border: 2px solid var(--color-a) !important;
+ text-decoration: none;
+}
+
+.rst-content .remix-link-container a.remix-link:hover,
+.wy-breadcrumbs-aside a:hover,
+a.fa.fa-github:hover,
+a.btn.btn-neutral:hover {
+ background: var(--white) !important;
+ color: var(--color-b) !important;
+ border-color: var(--color-b) !important;
+}
+
+footer .rst-footer-buttons {
+ display: flex;
+ justify-content: center;
+ gap: 2rem;
+}
+
+/**
+ * Customization for the unified layout
+ */
+
+/* Site wrapper, and two children: header and rest */
+.unified-wrapper {
position: relative;
- right: -100%; /* Positioned next to the the top-right corner of the code block following it. */
+ display: flex;
+ flex-direction: column;
+ inset: 0;
+ max-width: var(--maxWidth);
+ margin-inline: auto;
+}
+
+/* Site header */
+.unified-header {
+ position: fixed;
+ top: 0;
+ inset-inline: 0;
+ z-index: 99999;
+ display: flex;
+ align-items: center;
+ box-shadow: var(--shadow);
}
-a.remix-link {
- position: absolute; /* Remove it from normal flow not to affect the original position of the snippet. */
- top: 0.5em;
- width: 3.236em; /* Size of the margin (= right-side padding in .wy-nav-content in the current theme). */
+.unified-header .inner-header {
+ display: flex;
+ margin-inline: auto;
+ width: 100%;
+ max-width: var(--maxWidth);
+ align-items: center;
+ justify-content: space-between;
+ padding-inline: var(--desktopInlinePadding);
+ padding-block: 1rem;
}
-a.remix-link .link-icon {
- background: url("../img/solid-share-arrow.svg") no-repeat;
+.unified-header::before {
+ content: "";
+ position: absolute;
+ inset: 0;
+ opacity: 95%;
+ background: var(--color-f);
+ z-index: -1;
+ backdrop-filter: blur(3px);
+}
+
+.unified-header .home-link {
display: block;
- width: 1.5em;
- height: 1.5em;
- margin: auto;
+ text-decoration: none;
+ width: 25px;
+ height: 40px;
}
-a.remix-link .link-text {
- display: none; /* Visible only on hover. */
- width: 3.3em; /* Narrow enough to get two lines of text. */
- margin: auto;
- text-align: center;
- font-size: 0.8em;
- line-height: normal;
- color: black;
+.unified-header .home-link:hover .solidity-logo {
+ transform: scale(1.1);
+ transition: transform 100ms ease-in-out;
}
-a.remix-link:hover {
+.unified-header img.solidity-logo {
+ transform: scale(1);
+ transition: transform 100ms ease-in-out;
+ width: 100%;
+ height: 100%;
+}
+
+.unified-header .nav-bar {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+}
+
+.unified-header .nav-bar .nav-button-container {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.5rem;
+}
+
+.unified-header .nav-link {
+ display: inline-block;
+ padding-inline: 8px;
+ padding-block: 4px;
+ font-size: 14px;
+ font-family: 'Overpass Mono', monospace;
+ text-decoration: none;
+ color: var(--color-a);
+ letter-spacing: -0.02em;
+ font-weight: 400;
+ box-sizing: content-box;
+ border-bottom: 1px solid transparent;
+ white-space: nowrap;
+}
+
+.unified-header .nav-link.active {
+ background: var(--white);
+}
+
+.unified-header .nav-link:hover {
+ color: var(--color-c);
+ border-bottom: 1px solid var(--color-c);
+}
+
+/* Rest: Flex-row, with two children: side bar, and content */
+.unified-wrapper .wy-grid-for-nav {
+ position: relative !important;
+ display: flex;
+ margin-inline: auto;
+}
+
+/* First child: Side bar */
+.unified-wrapper .wy-grid-for-nav nav.wy-nav-side {
+ position: fixed;
+ display: flex;
+ flex-direction: column;
+ background: var(--color-f);
+ color: var(--color-a);
+ padding-bottom: unset !important;
+ z-index: 10 !important;
+ min-height: unset !important;
+ width: var(--sideWidth) !important;
+ top: var(--navHeight);
+ bottom: 0;
+ left: auto;
+ overflow: auto;
+}
+
+.unified-wrapper .wy-grid-for-nav nav.wy-nav-side .wy-side-scroll {
+ position: static !important;
+ width: unset !important;
+ overflow: unset !important;
+ height: unset !important;
+ padding-bottom: 2rem;
+}
+
+.unified-wrapper .wy-grid-for-nav nav.wy-nav-side .wy-side-scroll .wy-side-nav-search {
+ margin: 0 !important;
+ width: var(--sideWidth) !important;
+}
+
+.wy-nav-side,
+.wy-side-scroll,
+.wy-side-nav-search,
+.my-menu {
+ width: 100% !important;
+}
+
+.wy-nav-side input[type=text] {
+ font-family: "Overpass", sans-serif;
+ border-radius: 0;
+ border-color: var(--color-d);
+ background: var(--white);
+ box-shadow: none;
+ color: var(--color-a);
+}
+
+.wy-nav-side input[type=text]::placeholder {
+ font-family: "Overpass", sans-serif;
+ color: var(--color-e);
+ font-size: 16px;
+ position: relative;
+ top: 4px;
+}
+
+/* Second child: Content */
+.unified-wrapper .wy-grid-for-nav .wy-nav-content {
+ width: 100%;
+ max-width: unset !important; /* override */
+ padding-inline: var(--desktopInlinePadding);
+ margin-inline-start: var(--sideWidth);
+ margin-top: var(--navHeight);
+}
+
+.unified-wrapper .wy-grid-for-nav .wy-nav-content .rst-content {
+ max-width: min(70ch, calc(100vw - 2 * var(--desktopInlinePadding) - var(--sideWidth)));
+ margin-inline: auto;
+}
+
+.unified-wrapper.menu-open .backdrop {
opacity: 0.5;
}
-a.remix-link:hover .link-text {
+.unified-wrapper .wy-nav-side,
+.unified-wrapper .rst-versions {
+ left: auto;
+
+}
+
+.unified-wrapper .backdrop {
+ opacity: 0;
+ transition: opacity 200ms ease-in-out;
+}
+
+@media (max-width: 768px) {
+ h2 {
+ margin-top: 3rem;
+ margin-bottom: 1rem;
+ }
+
+ h3 {
+ margin-top: 3rem;
+ margin-bottom: 1rem;
+ }
+
+ h4 {
+ margin-top: 2rem;
+ margin-bottom: 1rem;
+ }
+
+ /* Menu closed styles */
+ .unified-header .nav-link {
+ display: none;
+ }
+
+ .unified-header .inner-header {
+ padding-inline: var(--mobileInlinePadding);
+ }
+
+ .unified-wrapper .wy-grid-for-nav nav.wy-nav-side {
+ transform: translateX(-100%);
+ transition: transform 200ms ease-in-out;
+ }
+
+ /* Menu open styles */
+ .unified-wrapper.menu-open nav.wy-nav-side {
+ transform: translateX(0);
+ transition: transform 200ms ease-in-out;
+ }
+
+ .unified-wrapper.menu-open .rst-versions {
+ position: sticky;
+ bottom: 0;
+ width: 100%;
+ }
+
+ .unified-wrapper.menu-open .backdrop {
+ display: block;
+ position: fixed;
+ inset: 0;
+ opacity: 1;
+ transition: opacity 200ms ease-in-out;
+ z-index: 5;
+ background: #0006;
+ }
+
+ a.skip-to-content {
+ display: none;
+ }
+
+ .wy-nav-content {
+ margin-inline-start: 0 !important;
+ }
+
+ .rst-content {
+ max-width: 100% !important;
+ }
+
+ .wy-side-scroll {
+ padding-bottom: 0 !important;
+ }
+}
+
+ul.search .context {
+ color: var(--color-a) !important;
+}
+
+.rst-versions {
+ background: var(--color-f);
+}
+
+.rst-versions.shift-up {
+ height: unset !important;
+ max-height: unset !important;
+ overflow-y: unset !important;
+}
+
+.rst-content dl:not(.docutils) dt {
+ color: var(--color-a);
+ background-color: #fff8;
+ border-top: solid 3px #0002;
+ border-inline-start: solid 3px #0002;
+ padding: 2px 6px;
+}
+
+.rst-versions .rst-current-version {
+ border-color: var(--color-d) !important;
+}
+
+.rst-current-version *,
+.rst-current-version .fa:before,
+.rst-current-version .fa-element {
+ color: var(--color-b) !important;
+}
+
+.rst-current-version dt,
+.rst-current-version dd,
+.rst-current-version dd a,
+.rst-other-versions dl:last-of-type dt,
+.rst-other-versions dl:last-of-type dd,
+.rst-other-versions dl:last-of-type dd a {
+ font-size: 14px !important;
+}
+
+.rst-other-versions {
+ background: var(--white) !important;
+ color: var(--color-a) !important;
+ max-height: calc(100vh - var(--navHeight) - var(--currentVersionHeight));
+ overflow-y: scroll;
+}
+
+.rst-other-versions a {
+ text-decoration: underline;
+ color: var(--color-c) !important;
+}
+
+.rst-other-versions dt {
+ color: var(--color-a) !important;
+}
+
+.rst-other-versions dl {
+ margin-bottom: 1.5rem !important;
+}
+
+.rst-other-versions dl:last-of-type {
+ margin-top: 2rem !important;
+}
+
+/* Bottom Search */
+.wy-nav-side input[type=text],
+.rst-other-versions dl:last-of-type dd {
+ width: 100%;
+}
+
+.rst-other-versions dl:last-of-type dt {
+ color: var(--color-b) !important;
+}
+
+.rst-other-versions dl:last-of-type div[style*=padding],
+.rst-other-versions dl dd:first-of-type a {
+ padding-inline-start: 0 !important;
+}
+
+button.toctree-expand {
+ color: var(--black) !important;
+}
+
+/* Light/dark color mode toggle 🌓 */
+button.color-toggle {
+ display: inline-flex;
+ appearance: none;
+ -webkit-box-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ justify-content: center;
+ user-select: none;
+ outline: none;
+ height: 28px;
+ width: 28px;
+ background: none;
+ border: none;
+ padding: 6px;
+ margin: 6px;
+ transition-duration: 200ms;
+ transition-property: background-color,
+ color,
+ fill,
+ stroke,
+ opacity;
+}
+
+button.color-toggle:focus-visible {
+ outline: 2px solid var(--color-c);
+ color: var(--color-c);
+}
+
+button.color-toggle:hover {
+ color: var(--color-c);
+ background: #0002;
+}
+
+button.color-toggle .color-toggle-icon {
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ display: inline-block;
+ line-height: 1em;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ vertical-align: middle;
+ /* color: var(--color-a); */
+}
+
+
+button.mobile-menu-button {
+ display: none;
+}
+
+@media (max-width: 768px) {
+ nav.wy-nav-top {
+ display: none;
+ }
+
+ button.mobile-menu-button {
+ display: flex;
+ }
+}
+
+
+.hidden {
+ display: none;
+}
+
+#search-results .search li:first-child,
+#search-results .search li {
+ border-color: var(--color-d);
+}
+
+#search-results .search li:last-child {
+ border: 0px;
+}
+
+.forum-link::after {
+ content: ' ↗';
+ font-size: 14px;
+ font-family: 'Overpass Mono', monospace;
+}
+
+.wy-breadcrumbs>li {
+ padding-top: 8px;
+}
+
+.wy-breadcrumbs-aside a {
+ padding: 0.5rem 0.75rem;
+ font-size: 12px;
+ font-family: "'Overpass'", sans-serif;
+ font-weight: 700;
+}
+
+a.skip-to-content:visited,
+a.skip-to-content:not(:visited),
+a.skip-to-content {
display: block;
+ pointer-events: none;
+ width: fit-content;
+ opacity: 0;
+ transition: opacity 200ms ease-in-out;
+ padding: 2px 4px;
+ font-size: 14px;
+ margin-inline-end: auto;
+ margin-inline-start: 1.5rem;
+ color: var(--color-a);
+ white-space: nowrap;
}
+
+a.skip-to-content:focus {
+ opacity: 1;
+ transition: opacity 200ms ease-in-out;
+}
+
+#content {
+ scroll-margin-top: 6rem;
+ scroll-behavior: smooth;
+}
\ No newline at end of file
diff --git a/docs/_static/css/dark.css b/docs/_static/css/dark.css
deleted file mode 100644
index a87ff09ebe..0000000000
--- a/docs/_static/css/dark.css
+++ /dev/null
@@ -1,635 +0,0 @@
-/* links */
-
-.rst-content a:not(:visited) {
- color: #aaddff !important;
-}
-
-/* code directives */
-
-.method dt,
-.class dt,
-.data dt,
-.attribute dt,
-.function dt,
-.classmethod dt,
-.exception dt,
-.descclassname,
-.descname {
- background-color: #2d2d2d !important;
-}
-
-.rst-content dl:not(.docutils) dt {
- color: #aaddff;
- background-color: #2d2d2d;
- border-top: solid 3px #525252;
- border-left: solid 3px #525252;
-}
-
-em.property {
- color: #888888;
-}
-
-
-/* tables */
-
-.rst-content table.docutils thead {
- color: #ddd;
-}
-
-.rst-content table.docutils td {
- border: 0px;
-}
-
-.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td {
- background-color: #5a5a5a;
-}
-
-.rst-content pre {
- background: none;
-}
-
-/* inlined code highlights */
-
-.xref,
-.py-meth,
-.rst-content a code {
- color: #aaddff !important;
- font-weight: normal !important;
-}
-
-.rst-content code {
- color: #eee !important;
- font-weight: normal !important;
-}
-
-code.literal {
- background-color: #2d2d2d !important;
- border: 1px solid #6d6d6d !important;
-}
-
-code.docutils.literal.notranslate {
- color: #ddd;
-}
-
-/* highlight color search text */
-
-.rst-content .highlighted {
- background: #ff5722;
- box-shadow: 0 0 0 2px #f0978b;
-}
-
-/* notes, warnings, hints */
-
-.hint .admonition-title {
- background: #2aa87c !important;
-}
-
-.warning .admonition-title {
- background: #cc4444 !important;
-}
-
-.admonition-title {
- background: #3a7ca8 !important;
-}
-
-.admonition,
-.note {
- background-color: #2d2d2d !important;
-}
-
-
-/* table of contents */
-
-.wy-nav-content-wrap {
- background-color: rgba(0, 0, 0, 0.6) !important;
-}
-
-.sidebar {
- background-color: #191919 !important;
-}
-
-.sidebar-title {
- background-color: #2b2b2b !important;
-}
-
-.wy-menu-vertical a {
- color: #ddd;
-}
-
-.wy-menu-vertical code.docutils.literal.notranslate {
- color: #404040;
- background: none !important;
- border: none !important;
-}
-
-.wy-nav-content {
- background: #3c3c3c;
- color: #dddddd;
-}
-
-.wy-menu-vertical li.on a,
-.wy-menu-vertical li.current>a {
- background: #a3a3a3;
- border-bottom: 0px !important;
- border-top: 0px !important;
-}
-
-.wy-menu-vertical li.current {
- background: #b3b3b3;
-}
-
-.toc-backref {
- color: grey !important;
-}
-
-.highlight .hll {
- background-color: #49483e
-}
-
-.highlight {
- background: #222;
- color: #f8f8f2
-}
-
-.highlight .c {
- color: #888
-}
-
-
-/* Comment */
-
-.highlight .err {
- color: #960050;
- background-color: #1e0010
-}
-
-
-/* Error */
-
-.highlight .k {
- color: #66d9ef
-}
-
-
-/* Keyword */
-
-.highlight .l {
- color: #ae81ff
-}
-
-
-/* Literal */
-
-.highlight .n {
- color: #f8f8f2
-}
-
-
-/* Name */
-
-.highlight .o {
- color: #f92672
-}
-
-
-/* Operator */
-
-.highlight .p {
- color: #f8f8f2
-}
-
-
-/* Punctuation */
-
-.highlight .ch {
- color: #888
-}
-
-
-/* Comment.Hashbang */
-
-.highlight .cm {
- color: #888
-}
-
-
-/* Comment.Multiline */
-
-.highlight .cp {
- color: #888
-}
-
-
-/* Comment.Preproc */
-
-.highlight .cpf {
- color: #888
-}
-
-
-/* Comment.PreprocFile */
-
-.highlight .c1 {
- color: #888
-}
-
-
-/* Comment.Single */
-
-.highlight .cs {
- color: #888
-}
-
-
-/* Comment.Special */
-
-.highlight .gd {
- color: #f92672
-}
-
-
-/* Generic.Deleted */
-
-.highlight .ge {
- font-style: italic
-}
-
-
-/* Generic.Emph */
-
-.highlight .gi {
- color: #a6e22e
-}
-
-
-/* Generic.Inserted */
-
-.highlight .gs {
- font-weight: bold
-}
-
-
-/* Generic.Strong */
-
-.highlight .gu {
- color: #888
-}
-
-
-/* Generic.Subheading */
-
-.highlight .kc {
- color: #66d9ef
-}
-
-
-/* Keyword.Constant */
-
-.highlight .kd {
- color: #66d9ef
-}
-
-
-/* Keyword.Declaration */
-
-.highlight .kn {
- color: #f92672
-}
-
-
-/* Keyword.Namespace */
-
-.highlight .kp {
- color: #66d9ef
-}
-
-
-/* Keyword.Pseudo */
-
-.highlight .kr {
- color: #66d9ef
-}
-
-
-/* Keyword.Reserved */
-
-.highlight .kt {
- color: #66d9ef
-}
-
-
-/* Keyword.Type */
-
-.highlight .ld {
- color: #e6db74
-}
-
-
-/* Literal.Date */
-
-.highlight .m {
- color: #ae81ff
-}
-
-
-/* Literal.Number */
-
-.highlight .s {
- color: #e6db74
-}
-
-
-/* Literal.String */
-
-.highlight .na {
- color: #a6e22e
-}
-
-
-/* Name.Attribute */
-
-.highlight .nb {
- color: #f8f8f2
-}
-
-
-/* Name.Builtin */
-
-.highlight .nc {
- color: #a6e22e
-}
-
-
-/* Name.Class */
-
-.highlight .no {
- color: #66d9ef
-}
-
-
-/* Name.Constant */
-
-.highlight .nd {
- color: #a6e22e
-}
-
-
-/* Name.Decorator */
-
-.highlight .ni {
- color: #f8f8f2
-}
-
-
-/* Name.Entity */
-
-.highlight .ne {
- color: #a6e22e
-}
-
-
-/* Name.Exception */
-
-.highlight .nf {
- color: #a6e22e
-}
-
-
-/* Name.Function */
-
-.highlight .nl {
- color: #f8f8f2
-}
-
-
-/* Name.Label */
-
-.highlight .nn {
- color: #f8f8f2
-}
-
-
-/* Name.Namespace */
-
-.highlight .nx {
- color: #a6e22e
-}
-
-
-/* Name.Other */
-
-.highlight .py {
- color: #f8f8f2
-}
-
-
-/* Name.Property */
-
-.highlight .nt {
- color: #f92672
-}
-
-
-/* Name.Tag */
-
-.highlight .nv {
- color: #f8f8f2
-}
-
-
-/* Name.Variable */
-
-.highlight .ow {
- color: #f92672
-}
-
-
-/* Operator.Word */
-
-.highlight .w {
- color: #f8f8f2
-}
-
-
-/* Text.Whitespace */
-
-.highlight .mb {
- color: #ae81ff
-}
-
-
-/* Literal.Number.Bin */
-
-.highlight .mf {
- color: #ae81ff
-}
-
-
-/* Literal.Number.Float */
-
-.highlight .mh {
- color: #ae81ff
-}
-
-
-/* Literal.Number.Hex */
-
-.highlight .mi {
- color: #ae81ff
-}
-
-
-/* Literal.Number.Integer */
-
-.highlight .mo {
- color: #ae81ff
-}
-
-
-/* Literal.Number.Oct */
-
-.highlight .sa {
- color: #e6db74
-}
-
-
-/* Literal.String.Affix */
-
-.highlight .sb {
- color: #e6db74
-}
-
-
-/* Literal.String.Backtick */
-
-.highlight .sc {
- color: #e6db74
-}
-
-
-/* Literal.String.Char */
-
-.highlight .dl {
- color: #e6db74
-}
-
-
-/* Literal.String.Delimiter */
-
-.highlight .sd {
- color: #e6db74
-}
-
-
-/* Literal.String.Doc */
-
-.highlight .s2 {
- color: #e6db74
-}
-
-
-/* Literal.String.Double */
-
-.highlight .se {
- color: #ae81ff
-}
-
-
-/* Literal.String.Escape */
-
-.highlight .sh {
- color: #e6db74
-}
-
-
-/* Literal.String.Heredoc */
-
-.highlight .si {
- color: #e6db74
-}
-
-
-/* Literal.String.Interpol */
-
-.highlight .sx {
- color: #e6db74
-}
-
-
-/* Literal.String.Other */
-
-.highlight .sr {
- color: #e6db74
-}
-
-
-/* Literal.String.Regex */
-
-.highlight .s1 {
- color: #e6db74
-}
-
-
-/* Literal.String.Single */
-
-.highlight .ss {
- color: #e6db74
-}
-
-
-/* Literal.String.Symbol */
-
-.highlight .bp {
- color: #f8f8f2
-}
-
-
-/* Name.Builtin.Pseudo */
-
-.highlight .fm {
- color: #a6e22e
-}
-
-
-/* Name.Function.Magic */
-
-.highlight .vc {
- color: #f8f8f2
-}
-
-
-/* Name.Variable.Class */
-
-.highlight .vg {
- color: #f8f8f2
-}
-
-
-/* Name.Variable.Global */
-
-.highlight .vi {
- color: #f8f8f2
-}
-
-
-/* Name.Variable.Instance */
-
-.highlight .vm {
- color: #f8f8f2
-}
-
-
-/* Name.Variable.Magic */
-
-.highlight .il {
- color: #ae81ff
-}
-
-
-/* Literal.Number.Integer.Long */
-
-
-/* Link to Remix IDE shown over code snippets */
-a.remix-link {
- filter: invert(1); /* The icon is black. In dark mode we want it white. */
-}
diff --git a/docs/_static/css/fonts.css b/docs/_static/css/fonts.css
new file mode 100644
index 0000000000..1a987a6da1
--- /dev/null
+++ b/docs/_static/css/fonts.css
@@ -0,0 +1,2 @@
+@import url("https://fonts.cdnfonts.com/css/overpass");
+@import url("https://fonts.cdnfonts.com/css/overpass-mono");
\ No newline at end of file
diff --git a/docs/_static/css/pygments.css b/docs/_static/css/pygments.css
new file mode 100644
index 0000000000..0e640681de
--- /dev/null
+++ b/docs/_static/css/pygments.css
@@ -0,0 +1,399 @@
+pre {
+ line-height: 125%;
+}
+
+td.linenos .normal {
+ color: inherit;
+ background-color: transparent;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+span.linenos {
+ color: inherit;
+ background-color: transparent;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+td.linenos .special {
+ color: #000000;
+ background-color: #ffffc0;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+span.linenos.special {
+ color: #000000;
+ background-color: #ffffc0;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+.highlight .hll {
+ background-color: #ffffcc
+}
+
+.highlight {
+ background: #eeffcc;
+}
+
+.highlight .c {
+ color: #408090;
+ font-style: italic
+}
+
+/* Comment */
+.highlight .err {
+ border: 1px solid #FF0000
+}
+
+/* Error */
+.highlight .k {
+ color: #007020;
+ font-weight: bold
+}
+
+/* Keyword */
+.highlight .o {
+ color: #666666
+}
+
+/* Operator */
+.highlight .ch {
+ color: #408090;
+ font-style: italic
+}
+
+/* Comment.Hashbang */
+.highlight .cm {
+ color: #408090;
+ font-style: italic
+}
+
+/* Comment.Multiline */
+.highlight .cp {
+ color: #007020
+}
+
+/* Comment.Preproc */
+.highlight .cpf {
+ color: #408090;
+ font-style: italic
+}
+
+/* Comment.PreprocFile */
+.highlight .c1 {
+ color: #408090;
+ font-style: italic
+}
+
+/* Comment.Single */
+.highlight .cs {
+ color: #408090;
+ background-color: #fff0f0
+}
+
+/* Comment.Special */
+.highlight .gd {
+ color: #A00000
+}
+
+/* Generic.Deleted */
+.highlight .ge {
+ font-style: italic
+}
+
+/* Generic.Emph */
+.highlight .gr {
+ color: #FF0000
+}
+
+/* Generic.Error */
+.highlight .gh {
+ color: #000080;
+ font-weight: bold
+}
+
+/* Generic.Heading */
+.highlight .gi {
+ color: #00A000
+}
+
+/* Generic.Inserted */
+.highlight .go {
+ color: #333333
+}
+
+/* Generic.Output */
+.highlight .gp {
+ color: #c65d09;
+ font-weight: bold
+}
+
+/* Generic.Prompt */
+.highlight .gs {
+ font-weight: bold
+}
+
+/* Generic.Strong */
+.highlight .gu {
+ color: #800080;
+ font-weight: bold
+}
+
+/* Generic.Subheading */
+.highlight .gt {
+ color: #0044DD
+}
+
+/* Generic.Traceback */
+.highlight .kc {
+ color: #007020;
+ font-weight: bold
+}
+
+/* Keyword.Constant */
+.highlight .kd {
+ color: #007020;
+ font-weight: bold
+}
+
+/* Keyword.Declaration */
+.highlight .kn {
+ color: #007020;
+ font-weight: bold
+}
+
+/* Keyword.Namespace */
+.highlight .kp {
+ color: #007020
+}
+
+/* Keyword.Pseudo */
+.highlight .kr {
+ color: #007020;
+ font-weight: bold
+}
+
+/* Keyword.Reserved */
+.highlight .kt {
+ color: #902000
+}
+
+/* Keyword.Type */
+.highlight .m {
+ color: #208050
+}
+
+/* Literal.Number */
+.highlight .s {
+ color: #4070a0
+}
+
+/* Literal.String */
+.highlight .na {
+ color: #4070a0
+}
+
+/* Name.Attribute */
+.highlight .nb {
+ color: #007020
+}
+
+/* Name.Builtin */
+.highlight .nc {
+ color: #0e84b5;
+ font-weight: bold
+}
+
+/* Name.Class */
+.highlight .no {
+ color: #60add5
+}
+
+/* Name.Constant */
+.highlight .nd {
+ color: #555555;
+ font-weight: bold
+}
+
+/* Name.Decorator */
+.highlight .ni {
+ color: #d55537;
+ font-weight: bold
+}
+
+/* Name.Entity */
+.highlight .ne {
+ color: #007020
+}
+
+/* Name.Exception */
+.highlight .nf {
+ color: #06287e
+}
+
+/* Name.Function */
+.highlight .nl {
+ color: #002070;
+ font-weight: bold
+}
+
+/* Name.Label */
+.highlight .nn {
+ color: #0e84b5;
+ font-weight: bold
+}
+
+/* Name.Namespace */
+.highlight .nt {
+ color: #062873;
+ font-weight: bold
+}
+
+/* Name.Tag */
+.highlight .nv {
+ color: #bb60d5
+}
+
+/* Name.Variable */
+.highlight .ow {
+ color: #007020;
+ font-weight: bold
+}
+
+/* Operator.Word */
+.highlight .w {
+ color: #bbbbbb
+}
+
+/* Text.Whitespace */
+.highlight .mb {
+ color: #208050
+}
+
+/* Literal.Number.Bin */
+.highlight .mf {
+ color: #208050
+}
+
+/* Literal.Number.Float */
+.highlight .mh {
+ color: #208050
+}
+
+/* Literal.Number.Hex */
+.highlight .mi {
+ color: #208050
+}
+
+/* Literal.Number.Integer */
+.highlight .mo {
+ color: #208050
+}
+
+/* Literal.Number.Oct */
+.highlight .sa {
+ color: #4070a0
+}
+
+/* Literal.String.Affix */
+.highlight .sb {
+ color: #4070a0
+}
+
+/* Literal.String.Backtick */
+.highlight .sc {
+ color: #4070a0
+}
+
+/* Literal.String.Char */
+.highlight .dl {
+ color: #4070a0
+}
+
+/* Literal.String.Delimiter */
+.highlight .sd {
+ color: #4070a0;
+ font-style: italic
+}
+
+/* Literal.String.Doc */
+.highlight .s2 {
+ color: #4070a0
+}
+
+/* Literal.String.Double */
+.highlight .se {
+ color: #4070a0;
+ font-weight: bold
+}
+
+/* Literal.String.Escape */
+.highlight .sh {
+ color: #4070a0
+}
+
+/* Literal.String.Heredoc */
+.highlight .si {
+ color: #70a0d0;
+ font-style: italic
+}
+
+/* Literal.String.Interpol */
+.highlight .sx {
+ color: #c65d09
+}
+
+/* Literal.String.Other */
+.highlight .sr {
+ color: #235388
+}
+
+/* Literal.String.Regex */
+.highlight .s1 {
+ color: #4070a0
+}
+
+/* Literal.String.Single */
+.highlight .ss {
+ color: #517918
+}
+
+/* Literal.String.Symbol */
+.highlight .bp {
+ color: #007020
+}
+
+/* Name.Builtin.Pseudo */
+.highlight .fm {
+ color: #06287e
+}
+
+/* Name.Function.Magic */
+.highlight .vc {
+ color: #bb60d5
+}
+
+/* Name.Variable.Class */
+.highlight .vg {
+ color: #bb60d5
+}
+
+/* Name.Variable.Global */
+.highlight .vi {
+ color: #bb60d5
+}
+
+/* Name.Variable.Instance */
+.highlight .vm {
+ color: #bb60d5
+}
+
+/* Name.Variable.Magic */
+.highlight .il {
+ color: #208050
+}
+
+/* Literal.Number.Integer.Long */
\ No newline at end of file
diff --git a/docs/_static/css/toggle.css b/docs/_static/css/toggle.css
index add134f6c2..6f03e6fb6a 100644
--- a/docs/_static/css/toggle.css
+++ b/docs/_static/css/toggle.css
@@ -9,6 +9,13 @@ input[type=checkbox] {
padding: 10px;
display: flex;
justify-content: space-between;
+ background-color: var(--color-f);
+ border-top: 1px solid var(--color-c);
+}
+
+.fa-caret-down,
+.fa-book {
+ color: var(--color-a) !important;
}
.rst-versions .rst-current-version .fa-book,
@@ -76,8 +83,6 @@ html.transition *:after {
transition-delay: 0 !important;
}
-nav.wy-nav-side {
- /* The default padding of 2em is too small and the "Keyword Index" link gets obscured
- * by the version toggle. */
- padding-bottom: 3em;
-}
+.wy-menu-vertical a:hover {
+ background-color: #0002;
+}
\ No newline at end of file
diff --git a/docs/_static/img/favicon.ico b/docs/_static/img/favicon.ico
new file mode 100644
index 0000000000..a2b8f877a3
Binary files /dev/null and b/docs/_static/img/favicon.ico differ
diff --git a/docs/_static/img/favicon.png b/docs/_static/img/favicon.png
new file mode 100644
index 0000000000..3991d87e98
Binary files /dev/null and b/docs/_static/img/favicon.png differ
diff --git a/docs/_static/img/hamburger-dark.svg b/docs/_static/img/hamburger-dark.svg
new file mode 100644
index 0000000000..26d9fed9df
--- /dev/null
+++ b/docs/_static/img/hamburger-dark.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/docs/_static/img/hamburger-light.svg b/docs/_static/img/hamburger-light.svg
new file mode 100644
index 0000000000..d5d0d0aed2
--- /dev/null
+++ b/docs/_static/img/hamburger-light.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/docs/_static/img/logo-dark.svg b/docs/_static/img/logo-dark.svg
new file mode 100644
index 0000000000..92a12a9fed
--- /dev/null
+++ b/docs/_static/img/logo-dark.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/docs/_static/img/logo.svg b/docs/_static/img/logo.svg
new file mode 100644
index 0000000000..19391843b4
--- /dev/null
+++ b/docs/_static/img/logo.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/docs/_static/img/moon.svg b/docs/_static/img/moon.svg
new file mode 100644
index 0000000000..607dc1b47f
--- /dev/null
+++ b/docs/_static/img/moon.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/docs/_static/img/sun.svg b/docs/_static/img/sun.svg
new file mode 100644
index 0000000000..f86fd22b2d
--- /dev/null
+++ b/docs/_static/img/sun.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/_static/js/constants.js b/docs/_static/js/constants.js
new file mode 100644
index 0000000000..67fa16cdb0
--- /dev/null
+++ b/docs/_static/js/constants.js
@@ -0,0 +1,38 @@
+// Site URL
+const SITE_URL = "https://docs.soliditylang.org"
+const { origin, pathname } = location;
+const pathSplit = pathname.split("/");
+const rootPath = origin.includes(SITE_URL) && pathSplit.length > 3 ? pathSplit.splice(1, 2).join("/") : ''
+const ROOT_URL = `${origin}/${rootPath}`;
+
+// Color mode constants
+const [DARK, LIGHT] = ["dark", "light"];
+const LIGHT_LOGO_PATH = `${ROOT_URL}/_static/img/logo.svg`;
+const DARK_LOGO_PATH = `${ROOT_URL}/_static/img/logo-dark.svg`;
+const SUN_ICON_PATH = `${ROOT_URL}/_static/img/sun.svg`;
+const MOON_ICON_PATH = `${ROOT_URL}/_static/img/moon.svg`;
+const LIGHT_HAMBURGER_PATH = `${ROOT_URL}/_static/img/hamburger-light.svg`;
+const DARK_HAMBURGER_PATH = `${ROOT_URL}/_static/img/hamburger-dark.svg`;
+const COLOR_TOGGLE_ICON_CLASS = "color-toggle-icon";
+const SOLIDITY_LOGO_CLASS = "solidity-logo";
+const LS_COLOR_SCHEME = "color-scheme";
+
+// Solidity navigation constants
+const SOLIDITY_HOME_URL = "https://soliditylang.org";
+const BLOG_URL = `${SOLIDITY_HOME_URL}/blog`;
+const DOCS_URL = "/";
+const USE_CASES_PATH = `${SOLIDITY_HOME_URL}/use-cases`;
+const CONTRIBUTE_PATH = `/en/latest/contributing.html`;
+const ABOUT_PATH = `${SOLIDITY_HOME_URL}/about`;
+const FORUM_URL = "https://forum.soliditylang.org/";
+const NAV_LINKS = [
+ { name: "Blog", href: BLOG_URL },
+ { name: "Documentation", href: DOCS_URL },
+ { name: "Use cases", href: USE_CASES_PATH },
+ { name: "Contribute", href: CONTRIBUTE_PATH },
+ { name: "About", href: ABOUT_PATH },
+ { name: "Forum", href: FORUM_URL },
+];
+
+const MOBILE_MENU_TOGGLE_CLASS = "shift";
+const WRAPPER_CLASS = "unified-wrapper";
diff --git a/docs/_static/js/initialize.js b/docs/_static/js/initialize.js
new file mode 100644
index 0000000000..a20d4fce71
--- /dev/null
+++ b/docs/_static/js/initialize.js
@@ -0,0 +1,250 @@
+const getLogoSrc = (isDark) => (isDark ? DARK_LOGO_PATH : LIGHT_LOGO_PATH);
+
+const getModeIconSrc = (isDark) => (isDark ? SUN_ICON_PATH : MOON_ICON_PATH);
+
+const getMenuIconSrc = (isDark) =>
+ isDark ? DARK_HAMBURGER_PATH : LIGHT_HAMBURGER_PATH;
+
+function addFooterNote() {
+ const contentInfo = document.querySelector("div[role=contentinfo]");
+ const footerNote = document.createElement("p");
+ footerNote.classList.add("footer-note");
+ footerNote.innerHTML =
+ 'Customized with ❤️ by the ethereum.org team.';
+ contentInfo.parentNode.insertBefore(footerNote, contentInfo.nextSibling);
+}
+
+function rearrangeDom() {
+ const bodyDivs = document.querySelectorAll("body>div");
+ bodyDivs.forEach((div) => div.remove());
+ const wrapperDiv = document.createElement("div");
+ wrapperDiv.classList.add(WRAPPER_CLASS);
+ bodyDivs.forEach((div) => wrapperDiv.appendChild(div));
+ document.body.prepend(wrapperDiv);
+
+ const rstVersions = document.querySelector(".rst-versions");
+ rstVersions.remove();
+ const wyNavSide = document.querySelector("nav.wy-nav-side");
+ wyNavSide.appendChild(rstVersions);
+ const backdrop = document.createElement("div");
+ backdrop.classList.add("backdrop");
+ wrapperDiv.appendChild(backdrop);
+
+ const content = document.querySelector(".wy-nav-content");
+ content.id = "content";
+ const oldWrap = document.querySelector("section.wy-nav-content-wrap");
+ oldWrap.remove();
+ document.querySelector(".wy-grid-for-nav").appendChild(content);
+}
+
+function buildHeader() {
+ const isDarkMode = localStorage.getItem(LS_COLOR_SCHEME) == DARK;
+
+ const header = document.createElement("div");
+ header.classList.add("unified-header");
+ document.querySelector(`.${WRAPPER_CLASS}`).prepend(header);
+
+ const innerHeader = document.createElement("div");
+ innerHeader.classList.add("inner-header");
+ header.appendChild(innerHeader);
+
+ const homeLink = document.createElement("a");
+ homeLink.classList.add("home-link");
+ homeLink.href = SOLIDITY_HOME_URL;
+ homeLink.ariaLabel = "Solidity home";
+ innerHeader.appendChild(homeLink);
+
+ const logo = document.createElement("img");
+ logo.classList.add(SOLIDITY_LOGO_CLASS);
+ logo.src = getLogoSrc(isDarkMode);
+ logo.alt = "Solidity logo";
+ homeLink.appendChild(logo);
+
+ const skipToContent = document.createElement("a");
+ skipToContent.classList.add("skip-to-content");
+ skipToContent.href = "#content";
+ skipToContent.innerText = "{skip to content}";
+ innerHeader.appendChild(skipToContent);
+
+ const navBar = document.createElement("nav");
+ navBar.classList.add("nav-bar");
+ innerHeader.appendChild(navBar);
+
+ const linkElements = NAV_LINKS.map(({ name, href }) => {
+ const link = document.createElement("a");
+ link.classList.add("nav-link");
+ link.setAttribute("key", name);
+ link.setAttribute("href", href);
+ link.setAttribute("aria-label", name);
+ if (href === FORUM_URL) {
+ link.classList.add("forum-link");
+ link.setAttribute("target", "_blank");
+ link.setAttribute("rel", "noopener noreferrer");
+ }
+ link.innerText = name;
+ return link;
+ });
+ linkElements.forEach((link) => navBar.appendChild(link));
+
+ // Flex wrapper for color mode and mobile menu buttons
+ const navButtonContainer = document.createElement("div");
+ navButtonContainer.classList.add("nav-button-container");
+ navBar.appendChild(navButtonContainer);
+
+ // Build color toggle
+ const toggleIcon = document.createElement("img");
+ toggleIcon.classList.add(COLOR_TOGGLE_ICON_CLASS);
+ toggleIcon.src = getModeIconSrc(isDarkMode);
+ toggleIcon.alt = "Color mode toggle icon";
+ toggleIcon.setAttribute("aria-hidden", "true");
+ toggleIcon.setAttribute("key", "toggle icon");
+ const colorModeButton = document.createElement("button");
+ colorModeButton.classList.add("color-toggle");
+ colorModeButton.setAttribute("type", "button");
+ colorModeButton.setAttribute("aria-label", "Toggle light dark mode");
+ colorModeButton.setAttribute("key", "color mode button");
+ colorModeButton.addEventListener("click", toggleColorMode);
+ colorModeButton.appendChild(toggleIcon);
+ navButtonContainer.appendChild(colorModeButton);
+
+ // Build mobile hamburger menu
+ const menuIcon = document.createElement("img");
+ menuIcon.classList.add(COLOR_TOGGLE_ICON_CLASS);
+ menuIcon.src = getMenuIconSrc(isDarkMode);
+ menuIcon.alt = "Toggle menu";
+ menuIcon.setAttribute("aria-hidden", "true");
+ menuIcon.setAttribute("key", "menu icon");
+ const menuButton = document.createElement("button");
+ menuButton.classList.add("color-toggle");
+ menuButton.classList.add("mobile-menu-button");
+ menuButton.setAttribute("type", "button");
+ menuButton.setAttribute("aria-label", "Toggle menu");
+ menuButton.setAttribute("key", "menu button");
+ menuButton.addEventListener("click", toggleMenu);
+ menuButton.appendChild(menuIcon);
+ navButtonContainer.appendChild(menuButton);
+}
+
+const updateActiveNavLink = () => {
+ const navLinks = document.querySelectorAll(".unified-header .nav-link");
+ navLinks.forEach((link) => {
+ const href = link.getAttribute("href");
+ if (document.documentURI.includes("contributing.html")) {
+ link.classList[href.includes("contributing.html") ? "add" : "remove"](
+ "active"
+ );
+ } else {
+ link.classList[document.documentURI.includes(href) ? "add" : "remove"](
+ "active"
+ );
+ }
+ });
+};
+
+document.addEventListener("locationchange", updateActiveNavLink);
+
+function updateGitHubEditPath() {
+ // Replaces the version number in the GitHub edit path with "develop"
+ const gitHubEditAnchor = document.querySelector(".wy-breadcrumbs-aside > a");
+ const url = new URL(gitHubEditAnchor.href);
+ const split = url.pathname.split("/");
+ const versionIndex = split.indexOf("blob") + 1;
+ split[versionIndex] = "develop";
+ url.pathname = split.join("/");
+ gitHubEditAnchor.setAttribute("href", url.toString());
+ gitHubEditAnchor.setAttribute("target", "_blank");
+ gitHubEditAnchor.setAttribute("rel", "noopener noreferrer");
+}
+
+function initialize() {
+ // Rearrange DOM elements for styling
+ rearrangeDom();
+
+ // Check localStorage for existing color scheme preference
+ var prefersDark = localStorage.getItem(LS_COLOR_SCHEME) == DARK;
+ // Check link for search param "color"... it may be "light" or "dark"
+ var urlParams = new URLSearchParams(window.location.search);
+ if (urlParams.size > 0) {
+ // This is used for color mode continuity between the main Solidity Lang site and the docs
+ var colorSchemeParam = urlParams.get("color");
+ // If present, overwrite prefersDark accordingly
+ if (colorSchemeParam) {
+ prefersDark = colorSchemeParam == DARK;
+ }
+
+ // Remove "color" search param from URL
+ const { location, title } = document;
+ const { pathname, origin, search, hash } = location;
+ const newSearchParams = new URLSearchParams(search);
+ newSearchParams.delete("color");
+ const sanitizedSearch =
+ newSearchParams.size < 1 ? "" : "?" + newSearchParams.toString();
+ window.history.replaceState(
+ origin,
+ title,
+ pathname + sanitizedSearch + hash
+ );
+ }
+
+ // In case none existed, establish localStorage color scheme preference
+ var mode = prefersDark ? DARK : LIGHT;
+ localStorage.setItem(LS_COLOR_SCHEME, mode);
+
+ // Select the root element and set the style attribute to denote color-scheme attribute
+ document
+ .querySelector(":root")
+ .setAttribute("style", `--color-scheme: ${mode}`);
+
+ // Remove old input and RTD logo anchor element
+ document.querySelector("input[name=mode]").remove();
+ document.querySelector("label[for=switch]").remove();
+ document.querySelector(".wy-side-nav-search > a").remove();
+
+ // Add footer note
+ addFooterNote();
+
+ // Build header
+ buildHeader();
+
+ // Close menu
+ toggleMenu({ force: false });
+
+ // Update active nav link
+ updateActiveNavLink();
+
+ // Update GitHub edit path to direct to `develop` branch
+ updateGitHubEditPath();
+}
+
+document.addEventListener("DOMContentLoaded", initialize);
+
+const handleClick = (e) => {
+ if (e.target.closest(".backdrop")) {
+ toggleMenu({ force: false });
+ }
+
+ if (e.target.closest("a")) {
+ const target = e.target.closest("a");
+ const href = target.getAttribute("href");
+ if (href.includes(SOLIDITY_HOME_URL)) {
+ const url = new URL(href);
+ const params = new URLSearchParams(url.search);
+ params.set("color", localStorage.getItem(LS_COLOR_SCHEME));
+ url.search = params.toString();
+ target.setAttribute("href", url.toString());
+ }
+ }
+};
+document.addEventListener("click", handleClick);
+
+const handleKeyDown = (e) => {
+ if (e.metaKey && e.key === "k") {
+ document.querySelector("#rtd-search-form input").focus();
+ } else if (e.key === "Escape") {
+ toggleMenu({ force: false });
+ }
+ if (e.metaKey && e.code === "Backslash") {
+ toggleColorMode();
+ }
+};
+document.addEventListener("keydown", handleKeyDown);
diff --git a/docs/_static/js/toggle.js b/docs/_static/js/toggle.js
index f46a3a6662..6ea2dd1f80 100644
--- a/docs/_static/js/toggle.js
+++ b/docs/_static/js/toggle.js
@@ -1,38 +1,47 @@
-document.addEventListener('DOMContentLoaded', function() {
+function toggleColorMode() {
+ // Check localStorage for previous color scheme preference, assign the opposite
+ var newMode = localStorage.getItem(LS_COLOR_SCHEME) == DARK ? LIGHT : DARK;
- function toggleCssMode(isDay) {
- var mode = (isDay ? "Day" : "Night");
- localStorage.setItem("css-mode", mode);
+ // Update localStorage with new color scheme preference
+ localStorage.setItem(LS_COLOR_SCHEME, newMode);
- var daysheet = $('link[href="_static/pygments.css"]')[0].sheet;
- daysheet.disabled = !isDay;
+ // Update the root element with the new color scheme preference
+ document
+ .querySelector(":root")
+ .setAttribute("style", `--color-scheme: ${newMode}`);
- var nightsheet = $('link[href="_static/css/dark.css"]')[0];
- if (!isDay && nightsheet === undefined) {
- var element = document.createElement("link");
- element.setAttribute("rel", "stylesheet");
- element.setAttribute("type", "text/css");
- element.setAttribute("href", "_static/css/dark.css");
- document.getElementsByTagName("head")[0].appendChild(element);
- return;
- }
- if (nightsheet !== undefined) {
- nightsheet.sheet.disabled = isDay;
- }
- }
-
- var initial = localStorage.getItem("css-mode") != "Night";
- var checkbox = document.querySelector('input[name=mode]');
+ // Update logo
+ document
+ .querySelector(`img.${SOLIDITY_LOGO_CLASS}`)
+ .setAttribute("src", newMode === LIGHT ? LIGHT_LOGO_PATH : DARK_LOGO_PATH);
- toggleCssMode(initial);
- checkbox.checked = initial;
+ // Update color mode toggle icon
+ document
+ .querySelector(`img.${COLOR_TOGGLE_ICON_CLASS}`)
+ .setAttribute("src", newMode === LIGHT ? MOON_ICON_PATH : SUN_ICON_PATH);
- checkbox.addEventListener('change', function() {
- document.documentElement.classList.add('transition');
- window.setTimeout(() => {
- document.documentElement.classList.remove('transition');
- }, 1000)
- toggleCssMode(this.checked);
- })
+ // Update hamburger menu icon color
+ document
+ .querySelector("button.mobile-menu-button img")
+ .setAttribute(
+ "src",
+ newMode === LIGHT ? LIGHT_HAMBURGER_PATH : DARK_HAMBURGER_PATH
+ );
+}
-});
\ No newline at end of file
+function toggleMenu(options = {}) {
+ const handleClassToggle = ({ classList }, className) => {
+ if (typeof options.force !== "undefined") {
+ classList.toggle(className, options.force);
+ } else {
+ classList.toggle(className);
+ }
+ };
+ document
+ .querySelectorAll('[data-toggle="rst-versions"]')
+ .forEach((e) => handleClassToggle(e, MOBILE_MENU_TOGGLE_CLASS));
+ document
+ .querySelectorAll('[data-toggle="wy-nav-shift"]')
+ .forEach((e) => handleClassToggle(e, MOBILE_MENU_TOGGLE_CLASS));
+ handleClassToggle(document.querySelector(`.${WRAPPER_CLASS}`), "menu-open");
+}
diff --git a/docs/_templates/versions.html b/docs/_templates/versions.html
index f680b6506d..a2432e3703 100644
--- a/docs/_templates/versions.html
+++ b/docs/_templates/versions.html
@@ -13,13 +13,13 @@
- {{ _('Versions') }} {% for slug, url in versions %}
- {{ slug }}
+ {{ _('Downloads') }} {% for type, url in downloads %}
+ {{ type }}
{% endfor %}
- {{ _('Downloads') }} {% for type, url in downloads %}
- {{ type }}
+ {{ _('Versions') }} {% for slug, url in versions %}
+ {{ slug }}
{% endfor %}
@@ -33,4 +33,4 @@
-
\ No newline at end of file
+
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index 4029bbcf82..c9dad922ef 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -13,21 +13,35 @@ Contract Application Binary Interface (ABI) adalah cara standar untuk berinterak
dari luar blockchain maupun untuk interaksi kontrak-ke-kontrak. Data dikodekan menurut jenisnya,
seperti yang dijelaskan dalam spesifikasi ini. Pengkodean tidak menggambarkan diri sendiri dan dengan demikian memerlukan skema untuk memecahkan kode.
+<<<<<<< HEAD
Kami menganggap fungsi antarmuka kontrak diketik dengan kuat, dikenal pada waktu kompilasi dan statis.
Kami berasumsi bahwa semua kontrak akan memiliki definisi antarmuka dari setiap kontrak yang mereka sebut tersedia pada waktu kompilasi.
+=======
+We assume that the interface functions of a contract are strongly typed, known at compilation time and static.
+We assume that all contracts will have the interface definitions of any contracts they call available at compile-time.
+>>>>>>> english/develop
Spesifikasi ini tidak membahas kontrak yang antarmukanya dinamis atau hanya diketahui saat run-time.
.. _abi_function_selector:
-.. index:: selector
+.. index:: ! selector; of a function
Fungsi Selector
===============
+<<<<<<< HEAD
Empat byte pertama dari data panggilan untuk panggilan fungsi menentukan fungsi yang akan dipanggil. Ini adalah
yang pertama (kiri, orde tinggi dalam big-endian) empat byte hash Keccak-256 dari tanda tangan fungsi. Tanda tangan
didefinisikan sebagai ekspresi kanonik dari prototipe dasar tanpa penentu lokasi data, yaitu nama fungsi dengan daftar
tipe parameter yang dikurung. Jenis parameter dipisahkan dengan koma tunggal - tidak ada spasi yang digunakan.
+=======
+The first four bytes of the call data for a function call specifies the function to be called. It is the
+first (left, high-order in big-endian) four bytes of the Keccak-256 hash of the signature of
+the function. The signature is defined as the canonical expression of the basic prototype without data
+location specifier, i.e.
+the function name with the parenthesised list of parameter types. Parameter types are split by a single
+comma — no spaces are used.
+>>>>>>> english/develop
.. note::
Jenis kembalinya suatu fungsi bukan bagian dari tanda tangan ini. Di dalam
@@ -130,8 +144,13 @@ Encoding dirancang untuk memiliki properti berikut, yang sangat berguna jika beb
versi ABI sebelumnya, jumlah pembacaan diskalakan secara linier dengan jumlah total parameter dinamis dalam
kasus terburuk.
+<<<<<<< HEAD
2. Data dari variabel atau elemen array tidak disisipkan dengan data lain dan itu adalah
relocatable, yaitu hanya menggunakan "addresses" relatif.
+=======
+2. The data of a variable or an array element is not interleaved with other data and it is
+ relocatable, i.e. it only uses relative "addresses".
+>>>>>>> english/develop
Spesifikasi Formal Encoding
@@ -188,10 +207,15 @@ pada jenis ``X``
- ``T[]`` dimana ``X`` mempunyai elemen ``k`` (``k`` diasumsikan bertipe ``uint256``):
- ``enc(X) = enc(k) enc([X[0], ..., X[k-1]])``
+ ``enc(X) = enc(k) enc((X[0], ..., X[k-1]))``
+<<<<<<< HEAD
yaitu dikodekan seolah-olah itu adalah array ukuran statis ``k``, diawali dengan
jumlah elemen.
+=======
+ i.e. it is encoded as if it were a tuple with ``k`` elements of the same type (resp. an array of static size ``k``), prefixed with
+ the number of elements.
+>>>>>>> english/develop
- ``bytes``, panjang dari ``k`` (yang diasumsikan bertipe ``uint256``):
@@ -249,8 +273,27 @@ Diberikan kontrak:
}
+<<<<<<< HEAD
Jadi untuk contoh ``Foo`` kita jika kita ingin memanggil ``baz`` dengan parameter ``69`` dan
``true``, kita akan melewati total 68 byte, yang dapat dipecah menjadi:
+=======
+Thus, for our ``Foo`` example, if we wanted to call ``bar`` with the argument ``["abc", "def"]``, we would pass 68 bytes total, broken down into:
+
+- ``0xfce353f6``: the Method ID. This is derived from the signature ``bar(bytes3[2])``.
+- ``0x6162630000000000000000000000000000000000000000000000000000000000``: the first part of the first
+ parameter, a ``bytes3`` value ``"abc"`` (left-aligned).
+- ``0x6465660000000000000000000000000000000000000000000000000000000000``: the second part of the first
+ parameter, a ``bytes3`` value ``"def"`` (left-aligned).
+
+In total:
+
+.. code-block:: none
+
+ 0xfce353f661626300000000000000000000000000000000000000000000000000000000006465660000000000000000000000000000000000000000000000000000000000
+
+If we wanted to call ``baz`` with the parameters ``69`` and
+``true``, we would pass 68 bytes total, which can be broken down into:
+>>>>>>> english/develop
- ``0xcdcd77c0``: ID Metode. Ini diturunkan sebagai 4 byte pertama hash Keccak dari
bentuk ASCII dari tanda tangan ``baz(uint32,bool)``.
@@ -268,6 +311,7 @@ Secara keseluruhan:
Ini mengembalikan satu ``bool``. Jika, misalnya, mengembalikan ``false``, outputnya adalah
array byte tunggal ``0x0000000000000000000000000000000000000000000000000000000000000000``, satu bool.
+<<<<<<< HEAD
Jika kita ingin memanggil ``bar`` dengan argumen ``["abc", "def"]``, kita akan melewati total 68 byte, dipecah menjadi:
- ``0xfce353f6``: ID Metode. Ini diturunkan dari tanda tangan ``bar(bytes3[2])``.
@@ -284,6 +328,10 @@ Secara keseluruhan:
Jika kita ingin memanggil ``sam`` dengan argumen ``"dave"``, ``true`` dan ``[1,2,3]``, kita akan
melewati total 292 byte, dipecah menjadi:
+=======
+If we wanted to call ``sam`` with the arguments ``"dave"``, ``true`` and ``[1,2,3]``, we would
+pass 292 bytes total, broken down into:
+>>>>>>> english/develop
- ``0xa5643bf2``: ID Metode. Ini diturunkan dari tanda tangan ``sam(bytes,bool,uint256[])``. Perhatikan bahwa ``uint`` diganti dengan representasi kanoniknya ``uint256``.
- ``0x00000000000000000000000000000000000000000000000000000000000060``: lokasi bagian data dari parameter pertama (tipe dinamis), diukur dalam byte dari awal blok argumen. Dalam hal ini, ``0x60``.
@@ -305,6 +353,7 @@ Secara keseluruhan:
penggunaan Dynamic Types
========================
+<<<<<<< HEAD
Panggilan ke fungsi dengan tanda tangan ``f(uint,uint32[],byte10,bytes)`` dengan nilai
``(0x123, [0x456, 0x789], "1234567890", "Hello, world!")`` dikodekan dengan cara berikut:
@@ -313,6 +362,16 @@ Kemudian kami mengkodekan bagian kepala dari keempat argumen. Untuk tipe statis
ini adalah nilai yang ingin kita sampaikan secara langsung, sedangkan untuk tipe dinamis ``uint32[]`` dan ``byte``,
kami menggunakan offset dalam byte ke awal area datanya, diukur dari awal nilainya
encoding (yaitu tidak menghitung empat byte pertama yang berisi hash dari tanda tangan fungsi). Ini adalah:
+=======
+A call to a function with the signature ``f(uint256,uint32[],bytes10,bytes)`` with values
+``(0x123, [0x456, 0x789], "1234567890", "Hello, world!")`` is encoded in the following way:
+
+We take the first four bytes of ``keccak("f(uint256,uint32[],bytes10,bytes)")``, i.e. ``0x8be65246``.
+Then we encode the head parts of all four arguments. For the static types ``uint256`` and ``bytes10``,
+these are directly the values we want to pass, whereas for the dynamic types ``uint32[]`` and ``bytes``,
+we use the offset in bytes to the start of their data area, measured from the start of the value
+encoding (i.e. not counting the first four bytes containing the hash of the function signature). These are:
+>>>>>>> english/develop
- ``0x0000000000000000000000000000000000000000000000000000000000000000123`` (``0x123`` diisi hingga 32 byte)
- ``0x00000000000000000000000000000000000000000000000000000000000000080`` (offset untuk memulai bagian data dari parameter kedua, 4*32 byte, persis ukuran bagian kepala)
@@ -345,8 +404,13 @@ Secara keseluruhan, encoding adalah (baris baru setelah pemilih fungsi dan masin
000000000000000000000000000000000000000000000000000000000000000d
48656c6c6f2c20776f726c642100000000000000000000000000000000000000
+<<<<<<< HEAD
Mari kita terapkan prinsip yang sama untuk mengkodekan data untuk suatu fungsi dengan tanda tangan ``g(uint[][],string[])``
dengan nilai ``([[1, 2], [3]], ["satu", "dua", "tiga"])`` tetapi mulai dari bagian pengkodean yang paling atomik:
+=======
+Let us apply the same principle to encode the data for a function with a signature ``g(uint256[][],string[])``
+with values ``([[1, 2], [3]], ["one", "two", "three"])`` but start from the most atomic parts of the encoding:
+>>>>>>> english/develop
Pertama kita mengkodekan panjang dan data dari larik dinamis tertanam pertama ``[1, 2]`` dari larik akar pertama ``[[1, 2], [3]]``:
@@ -413,8 +477,13 @@ Offset ``e`` menunjuk ke awal konten string ``"three"`` yaitu baris 7 (224 byte)
jadi ``e = 0x000000000000000000000000000000000000000000000000000000000000000e0``.
+<<<<<<< HEAD
Perhatikan bahwa pengkodean elemen tertanam dari array root tidak bergantung satu sama lain
dan memiliki penyandian yang sama untuk fungsi dengan tanda tangan ``g(string[],uint[][])``.
+=======
+Note that the encodings of the embedded elements of the root arrays are not dependent on each other
+and have the same encodings for a function with a signature ``g(string[],uint256[][])``.
+>>>>>>> english/develop
Kemudian kami menyandikan panjang array root pertama:
@@ -499,6 +568,7 @@ yang efisien dan keterbacaan arbitrer dengan mendefinisikan peristiwa dengan dua
diindeks, satu tidak — dimaksudkan untuk memiliki nilai yang sama.
.. _abi_errors:
+.. index:: error, selector; of an error
Errors
======
@@ -558,7 +628,11 @@ Deskripsi fungsi adalah sebuah objek JSON dengan:
blockchain state `), ``view`` (:ref:`specified to not modify the blockchain
state `), ``nonpayable`` (fungsi yang tidak menerima Ether - default) dan ``payable`` (fungsi yang menerima Ether).
+<<<<<<< HEAD
Konstruktor dan fungi fallback tidak pernah memiliki ``name`` atau ``output``. Fungsi fallback juga tidak memiliki ``input``.
+=======
+Constructor, receive, and fallback never have ``name`` or ``outputs``. Receive and fallback do not have ``inputs`` either.
+>>>>>>> english/develop
.. note::
Mengirim non-zero Ether ke fungsi non-payable akan menggagalkan transaksi.
@@ -586,6 +660,7 @@ Errors terlihat sebagai berikut:
- ``name``: nama dari error.
- ``inputs``: an array of objects, each of which contains:
+<<<<<<< HEAD
* ``name``: nama dari parameter.
* ``type``: tipe canonical dari parameter (lebih lanjut dibawah).
* ``components``: digunakan untuk tuple types (lebih lanjut dibawah).
@@ -596,6 +671,31 @@ Errors terlihat sebagai berikut:
tanda tangan yang identik dalam array JSON, misalnya jika kesalahan berasal
dari file yang berbeda dalam kontrak pintar atau direferensikan dari smart kontrak lain.
Untuk ABI, hanya nama kesalahan itu sendiri yang relevan dan bukan di mana itu didefinisikan.
+=======
+ * ``name``: the name of the parameter.
+ * ``type``: the canonical type of the parameter (more below).
+ * ``components``: used for tuple types (more below).
+ * ``indexed``: ``true`` if the field is part of the log's topics, ``false`` if it is one of the log's data segments.
+
+- ``anonymous``: ``true`` if the event was declared as ``anonymous``.
+
+Errors look as follows:
+
+- ``type``: always ``"error"``
+- ``name``: the name of the error.
+- ``inputs``: an array of objects, each of which contains:
+
+ * ``name``: the name of the parameter.
+ * ``type``: the canonical type of the parameter (more below).
+ * ``components``: used for tuple types (more below).
+
+.. note::
+ There can be multiple errors with the same name and even with identical signature
+ in the JSON array; for example, if the errors originate from different
+ files in the smart contract or are referenced from another smart contract.
+ For the ABI, only the name of the error itself is relevant and not where it is
+ defined.
+>>>>>>> english/develop
Sebagai contoh,
@@ -641,6 +741,7 @@ akan menghasilkan JSON:
Menangani jenis tupel
---------------------
+<<<<<<< HEAD
Meskipun nama-nama itu sengaja bukan bagian dari pengkodean ABI, mereka sangat masuk akal untuk dimasukkan
dalam JSON untuk memungkinkan menampilkannya kepada pengguna akhir. Struktur *nested *dengan cara berikut:
@@ -651,6 +752,18 @@ urutan ``[]`` dan ``[k]`` dengan
integer ``k``. Komponen dari tupel kemudian disimpan dalam anggota ``components``,
yang merupakan tipe array dan memiliki struktur yang sama dengan objek tingkat atas kecuali itu
``indexed`` tidak diperbolehkan di sana.
+=======
+Despite the fact that names are intentionally not part of the ABI encoding, they do make a lot of sense to be included
+in the JSON to enable displaying it to the end user. The structure is nested in the following way:
+
+An object with members ``name``, ``type`` and potentially ``components`` describes a typed variable.
+The canonical type is determined until a tuple type is reached and the string description up
+to that point is stored in ``type`` prefix with the word ``tuple``, i.e. it will be ``tuple`` followed by
+a sequence of ``[]`` and ``[k]`` with
+integers ``k``. The components of the tuple are then stored in the member ``components``,
+which is of an array type and has the same structure as the top-level object except that
+``indexed`` is not allowed there.
+>>>>>>> english/develop
Sebagai contoh, kode
@@ -732,6 +845,7 @@ akan menghasilkan JSON:
Mode Strict Encoding
====================
+<<<<<<< HEAD
Strict encoding mode adalah mode yang mengarah ke pengkodean yang sama persis seperti yang didefinisikan dalam spesifikasi formal di atas.
Ini berarti offset harus sekecil mungkin sambil tetap tidak membuat tumpang tindih di area data dan dengan demikian tidak ada celah yang
diizinkan.
@@ -739,15 +853,30 @@ diizinkan.
Biasanya, decoder ABI ditulis secara langsung hanya dengan mengikuti pointer offset, tetapi beberapa decoder
mungkin menerapkan strict mode. Decoder Solidity ABI saat ini tidak menerapkan strict mode, tetapi encoder
selalu membuat data dalam strict mode.
+=======
+Strict encoding mode is the mode that leads to exactly the same encoding as defined in the formal specification above.
+This means that offsets have to be as small as possible while still not creating overlaps in the data areas, and thus no gaps are
+allowed.
+
+Usually, ABI decoders are written in a straightforward way by just following offset pointers, but some decoders
+might enforce strict mode. The Solidity ABI decoder currently does not enforce strict mode, but the encoder
+always creates data in strict mode.
+>>>>>>> english/develop
Mode Non-standard Packed
========================
Melalui ``abi.encodePacked()``, Solidity mendukung mode non-standard packed di mana:
+<<<<<<< HEAD
- tipe yang lebih pendek dari 32 byte tidak diisi nol atau tanda diperpanjang dan
- tipe dinamis dikodekan di tempat dan tanpa panjang.
- elemen array diisi, tetapi masih dikodekan di tempat
+=======
+- types shorter than 32 bytes are concatenated directly, without padding or sign extension
+- dynamic types are encoded in-place and without the length.
+- array elements are padded, but still encoded in-place
+>>>>>>> english/develop
Selain itu, struct serta nested array tidak didukung.
@@ -763,6 +892,7 @@ Sebagai contoh, pengkodean ``int16(-1), bytes1(0x42), uint16(0x03), string("Hell
Lebih spesifik:
+<<<<<<< HEAD
- Selama pengkodean, semuanya dikodekan di tempat. Artinya
tidak ada perbedaan antara kepala dan ekor, seperti dalam penyandian ABI,
dan panjang larik tidak disandikan.
@@ -774,6 +904,20 @@ Lebih spesifik:
tanpa bidang panjangnya.
- Encoding ``string`` atau ``bytes`` tidak menerapkan padding di akhir
kecuali jika itu adalah bagian dari array atau struct (kemudian diisi ke kelipatan 32 byte).
+=======
+- During the encoding, everything is encoded in-place. This means that there is
+ no distinction between head and tail, as in the ABI encoding, and the length
+ of an array is not encoded.
+- The direct arguments of ``abi.encodePacked`` are encoded without padding,
+ as long as they are not arrays (or ``string`` or ``bytes``).
+- The encoding of an array is the concatenation of the
+ encoding of its elements **with** padding.
+- Dynamically-sized types like ``string``, ``bytes`` or ``uint[]`` are encoded
+ without their length field.
+- The encoding of ``string`` or ``bytes`` does not apply padding at the end,
+ unless it is part of an array or struct (then it is padded to a multiple of
+ 32 bytes).
+>>>>>>> english/develop
Secara umum, pengkodean menjadi ambigu segera setelah ada dua elemen berukuran dinamis,
karena bidang panjang yang hilang.
@@ -798,9 +942,15 @@ untuk menambahkan pemilih fungsi. Karena penyandiannya ambigu, tidak ada fungsi
Encoding Parameter Event Terindeks
==================================
+<<<<<<< HEAD
Parameter Event Terindeks yang bukan tipe nilai, yaitu array dan struct tidak disimpan
secara langsung melainkan keccak256-hash dari pengkodean disimpan. Pengkodean ini
didefinisikan sebagai berikut:
+=======
+Indexed event parameters that are not value types, i.e. arrays and structs are not
+stored directly but instead a Keccak-256 hash of an encoding is stored. This encoding
+is defined as follows:
+>>>>>>> english/develop
- pengkodean nilai ``byte`` dan ``string`` hanyalah konten string
tanpa awalan padding atau panjang.
diff --git a/docs/analysing-compilation-output.rst b/docs/analysing-compilation-output.rst
index 130991fdb1..6d0236d265 100644
--- a/docs/analysing-compilation-output.rst
+++ b/docs/analysing-compilation-output.rst
@@ -11,7 +11,7 @@ dari perakitan sebelum dan sesudah perubahan seringkali sangat mencerahkan.
Pertimbangkan kontrak berikut (bernama, katakan ``contract.sol``):
-.. code-block:: Solidity
+.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.9.0;
diff --git a/docs/assembly.rst b/docs/assembly.rst
index a6c2dcf18b..aada72bf5e 100644
--- a/docs/assembly.rst
+++ b/docs/assembly.rst
@@ -7,9 +7,15 @@ Inline Assembly
.. index:: ! assembly, ! asm, ! evmasm
+<<<<<<< HEAD
Anda dapat menyisipkan pernyataan Solidity dengan inline assembly dalam bahasa
yang mirip dengan salah satu mesin virtual Ethereum. Ini memberi Anda kontrol
yang lebih halus, yang sangat berguna saat Anda menyempurnakan bahasa dengan menulis library.
+=======
+You can interleave Solidity statements with inline assembly in a language close
+to the one of the Ethereum Virtual Machine. This gives you more fine-grained control,
+which is especially useful when you are enhancing the language by writing libraries.
+>>>>>>> english/develop
Bahasa yang digunakan untuk inline assembly di Solidity disebut :ref:`Yul `
dan didokumentasikan dalam bagiannya sendiri. Bagian ini hanya akan membahas bagaimana
@@ -45,19 +51,19 @@ yang dapat digunakan kembali dapat meningkatkan bahasa Solidity tanpa perubahan
pragma solidity >=0.4.16 <0.9.0;
library GetCode {
- function at(address _addr) public view returns (bytes memory o_code) {
+ function at(address addr) public view returns (bytes memory code) {
assembly {
// retrieve the size of the code, this needs assembly
- let size := extcodesize(_addr)
+ let size := extcodesize(addr)
// allocate output byte array - this could also be done without assembly
- // by using o_code = new bytes(size)
- o_code := mload(0x40)
+ // by using code = new bytes(size)
+ code := mload(0x40)
// new "memory end" including padding
- mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
+ mstore(0x40, add(code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
// store length in memory
- mstore(o_code, size)
+ mstore(code, size)
// actually retrieve the code, this needs assembly
- extcodecopy(_addr, add(o_code, 0x20), 0, size)
+ extcodecopy(addr, add(code, 0x20), 0, size)
}
}
}
@@ -74,49 +80,49 @@ kode yang efisien, misalnya:
library VectorSum {
// This function is less efficient because the optimizer currently fails to
// remove the bounds checks in array access.
- function sumSolidity(uint[] memory _data) public pure returns (uint sum) {
- for (uint i = 0; i < _data.length; ++i)
- sum += _data[i];
+ function sumSolidity(uint[] memory data) public pure returns (uint sum) {
+ for (uint i = 0; i < data.length; ++i)
+ sum += data[i];
}
// We know that we only access the array in bounds, so we can avoid the check.
// 0x20 needs to be added to an array because the first slot contains the
// array length.
- function sumAsm(uint[] memory _data) public pure returns (uint sum) {
- for (uint i = 0; i < _data.length; ++i) {
+ function sumAsm(uint[] memory data) public pure returns (uint sum) {
+ for (uint i = 0; i < data.length; ++i) {
assembly {
- sum := add(sum, mload(add(add(_data, 0x20), mul(i, 0x20))))
+ sum := add(sum, mload(add(add(data, 0x20), mul(i, 0x20))))
}
}
}
// Same as above, but accomplish the entire code within inline assembly.
- function sumPureAsm(uint[] memory _data) public pure returns (uint sum) {
+ function sumPureAsm(uint[] memory data) public pure returns (uint sum) {
assembly {
// Load the length (first 32 bytes)
- let len := mload(_data)
+ let len := mload(data)
// Skip over the length field.
//
// Keep temporary variable so it can be incremented in place.
//
- // NOTE: incrementing _data would result in an unusable
- // _data variable after this assembly block
- let data := add(_data, 0x20)
+ // NOTE: incrementing data would result in an unusable
+ // data variable after this assembly block
+ let dataElementLocation := add(data, 0x20)
// Iterate until the bound is not met.
for
- { let end := add(data, mul(len, 0x20)) }
- lt(data, end)
- { data := add(data, 0x20) }
+ { let end := add(dataElementLocation, mul(len, 0x20)) }
+ lt(dataElementLocation, end)
+ { dataElementLocation := add(dataElementLocation, 0x20) }
{
- sum := add(sum, mload(data))
+ sum := add(sum, mload(dataElementLocation))
}
}
}
}
-
+.. index:: selector; of a function
Akses ke Variabel Eksternal, Fungsi dan library
-----------------------------------------------
@@ -126,6 +132,7 @@ Anda dapat mengakses variabel Solidity dan pengenal lainnya dengan menggunakan n
Variabel lokal dari tipe nilai dapat langsung digunakan dalam inline assembly.
Keduanya dapat dibaca dan ditugaskan.
+<<<<<<< HEAD
Variabel lokal yang merujuk ke memori mengevaluasi ke alamat variabel dalam memori bukan nilai itu sendiri.
Variabel tersebut juga dapat ditetapkan, tetapi perhatikan bahwa tugas hanya akan mengubah penunjuk dan bukan
data dan Anda bertanggung jawab untuk menghormati manajemen memori Solidity.
@@ -140,6 +147,22 @@ Untuk pointer fungsi eksternal, alamat dan pemilih fungsi dapat diakses mengguna
``x.address`` dan ``x.selector``.
Pemilih terdiri dari empat byte rata kanan.
Kedua nilai tersebut dapat ditetapkan. Sebagai contoh:
+=======
+Local variables that refer to memory evaluate to the address of the variable in memory, not the value itself.
+Such variables can also be assigned to, but note that an assignment will only change the pointer and not the data
+and that it is your responsibility to respect Solidity's memory management.
+See :ref:`Conventions in Solidity `.
+
+Similarly, local variables that refer to statically-sized calldata arrays or calldata structs
+evaluate to the address of the variable in calldata, not the value itself.
+The variable can also be assigned a new offset, but note that no validation is performed to ensure that
+the variable will not point beyond ``calldatasize()``.
+
+For external function pointers the address and the function selector can be
+accessed using ``x.address`` and ``x.selector``.
+The selector consists of four right-aligned bytes.
+Both values can be assigned to. For example:
+>>>>>>> english/develop
.. code-block:: solidity
:force:
@@ -203,8 +226,14 @@ Variabel Solidity Lokal tersedia untuk assignment, misalnya:
``assembly { signextend(, x) }``
+<<<<<<< HEAD
Sejak Solidity 0.6.0 nama variabel inline assembly tidak boleh membayangi deklarasi apa pun
yang terlihat dalam lingkup blok inline assembly (termasuk deklarasi variabel, kontrak, dan fungsi).
+=======
+Since Solidity 0.6.0, the name of a inline assembly variable may not
+shadow any declaration visible in the scope of the inline assembly block
+(including variable, contract and function declarations).
+>>>>>>> english/develop
Sejak Solidity 0.7.0, variabel dan fungsi yang dideklarasikan di dalam blok inline assembly mungkin
tidak berisi ``.``, tetapi menggunakan ``.`` valid untuk mengakses variabel Solidity dari luar blok
@@ -225,6 +254,7 @@ akhir blok telah tercapai.
Konvensi dalam Solidiy
-----------------------
+<<<<<<< HEAD
Berbeda dengan EVM assembly, Solidity memiliki tipe yang lebih sempit dari 256 bit,
mis. ``uint24``. Untuk efisiensi, sebagian besar operasi aritmatika mengabaikan fakta bahwa
tipe dapat lebih pendek dari 256
@@ -241,6 +271,34 @@ Tidak ada jaminan bahwa memori tersebut belum pernah digunakan sebelumnya dan de
demikian Anda tidak dapat berasumsi bahwa isinya adalah nol byte.
Tidak ada mekanisme bawaan untuk melepaskan atau membebaskan memori yang dialokasikan.
Berikut adalah assembly snippet yang dapat Anda gunakan untuk mengalokasikan memori yang mengikuti proses yang diuraikan di atas
+=======
+.. _assembly-typed-variables:
+
+Values of Typed Variables
+=========================
+
+In contrast to EVM assembly, Solidity has types which are narrower than 256 bits,
+e.g. ``uint24``. For efficiency, most arithmetic operations ignore the fact that
+types can be shorter than 256
+bits, and the higher-order bits are cleaned when necessary,
+i.e., shortly before they are written to memory or before comparisons are performed.
+This means that if you access such a variable
+from within inline assembly, you might have to manually clean the higher-order bits
+first.
+
+.. _assembly-memory-management:
+
+Memory Management
+=================
+
+Solidity manages memory in the following way. There is a "free memory pointer"
+at position ``0x40`` in memory. If you want to allocate memory, use the memory
+starting from where this pointer points at and update it.
+There is no guarantee that the memory has not been used before and thus
+you cannot assume that its contents are zero bytes.
+There is no built-in mechanism to release or free allocated memory.
+Here is an assembly snippet you can use for allocating memory that follows the process outlined above:
+>>>>>>> english/develop
.. code-block:: yul
@@ -262,6 +320,110 @@ adalah pointer ke array memori. Panjang array dinamis disimpan pada
slot array pertama dan diikuti oleh elemen array.
.. warning::
+<<<<<<< HEAD
Statically-sized memory arrays tidak memiliki bidang panjang, tetapi mungkin akan
ditambahkan nanti untuk memungkinkan konvertibilitas yang lebih baik antara array
berukuran statis dan dinamis, jadi jangan mengandalkan ini.
+=======
+ Statically-sized memory arrays do not have a length field, but it might be added later
+ to allow better convertibility between statically and dynamically-sized arrays; so,
+ do not rely on this.
+
+Memory Safety
+=============
+
+Without the use of inline assembly, the compiler can rely on memory to remain in a well-defined
+state at all times. This is especially relevant for :ref:`the new code generation pipeline via Yul IR `:
+this code generation path can move local variables from stack to memory to avoid stack-too-deep errors and
+perform additional memory optimizations, if it can rely on certain assumptions about memory use.
+
+While we recommend to always respect Solidity's memory model, inline assembly allows you to use memory
+in an incompatible way. Therefore, moving stack variables to memory and additional memory optimizations are,
+by default, globally disabled in the presence of any inline assembly block that contains a memory operation
+or assigns to Solidity variables in memory.
+
+However, you can specifically annotate an assembly block to indicate that it in fact respects Solidity's memory
+model as follows:
+
+.. code-block:: solidity
+
+ assembly ("memory-safe") {
+ ...
+ }
+
+In particular, a memory-safe assembly block may only access the following memory ranges:
+
+- Memory allocated by yourself using a mechanism like the ``allocate`` function described above.
+- Memory allocated by Solidity, e.g. memory within the bounds of a memory array you reference.
+- The scratch space between memory offset 0 and 64 mentioned above.
+- Temporary memory that is located *after* the value of the free memory pointer at the beginning of the assembly block,
+ i.e. memory that is "allocated" at the free memory pointer without updating the free memory pointer.
+
+Furthermore, if the assembly block assigns to Solidity variables in memory, you need to assure that accesses to
+the Solidity variables only access these memory ranges.
+
+Since this is mainly about the optimizer, these restrictions still need to be followed, even if the assembly block
+reverts or terminates. As an example, the following assembly snippet is not memory safe, because the value of
+``returndatasize()`` may exceed the 64 byte scratch space:
+
+.. code-block:: solidity
+
+ assembly {
+ returndatacopy(0, 0, returndatasize())
+ revert(0, returndatasize())
+ }
+
+On the other hand, the following code *is* memory safe, because memory beyond the location pointed to by the
+free memory pointer can safely be used as temporary scratch space:
+
+.. code-block:: solidity
+
+ assembly ("memory-safe") {
+ let p := mload(0x40)
+ returndatacopy(p, 0, returndatasize())
+ revert(p, returndatasize())
+ }
+
+Note that you do not need to update the free memory pointer if there is no following allocation,
+but you can only use memory starting from the current offset given by the free memory pointer.
+
+If the memory operations use a length of zero, it is also fine to just use any offset (not only if it falls into the scratch space):
+
+.. code-block:: solidity
+
+ assembly ("memory-safe") {
+ revert(0, 0)
+ }
+
+Note that not only memory operations in inline assembly itself can be memory-unsafe, but also assignments to
+Solidity variables of reference type in memory. For example the following is not memory-safe:
+
+.. code-block:: solidity
+
+ bytes memory x;
+ assembly {
+ x := 0x40
+ }
+ x[0x20] = 0x42;
+
+Inline assembly that neither involves any operations that access memory nor assigns to any Solidity variables
+in memory is automatically considered memory-safe and does not need to be annotated.
+
+.. warning::
+ It is your responsibility to make sure that the assembly actually satisfies the memory model. If you annotate
+ an assembly block as memory-safe, but violate one of the memory assumptions, this **will** lead to incorrect and
+ undefined behavior that cannot easily be discovered by testing.
+
+In case you are developing a library that is meant to be compatible across multiple versions
+of Solidity, you can use a special comment to annotate an assembly block as memory-safe:
+
+.. code-block:: solidity
+
+ /// @solidity memory-safe-assembly
+ assembly {
+ ...
+ }
+
+Note that we will disallow the annotation via comment in a future breaking release; so, if you are not concerned with
+backward-compatibility with older compiler versions, prefer using the dialect string.
+>>>>>>> english/develop
diff --git a/docs/brand-guide.rst b/docs/brand-guide.rst
index a23c98b2bc..d08a309fff 100644
--- a/docs/brand-guide.rst
+++ b/docs/brand-guide.rst
@@ -55,16 +55,23 @@ Anda bebas untuk:
Di bawah ketentuan berikut:
+<<<<<<< HEAD
- **Atribusi** — Anda harus memberikan kredit yang sesuai, memberikan tautan ke lisensi, dan menunjukkan
jika ada perubahan. Anda dapat melakukannya dengan cara yang wajar, tetapi tidak dengan cara apa pun yang
menunjukkan bahwa tim inti Solidity mendukung Anda atau penggunaan Anda.
+=======
+- **Attribution** — You must give appropriate credit, provide a link to
+ the license, and indicate if changes were made. You may do so in any
+ reasonable manner, but not in any way that suggests that the Solidity
+ core team endorses you or your use.
+>>>>>>> english/develop
Saat menggunakan logo Solidity, harap hormati pedoman logo Solidity.
Pedoman Logo Solidity
=====================
-.. image:: logo.svg
+.. image:: solidity_logo.svg
:width: 256
*(Klik kanan pada logo untuk mengunduhnya.)*
diff --git a/docs/bugs.json b/docs/bugs.json
index 0b72c05c7d..c853f95edd 100644
--- a/docs/bugs.json
+++ b/docs/bugs.json
@@ -1,4 +1,120 @@
[
+ {
+ "uid": "SOL-2023-3",
+ "name": "VerbatimInvalidDeduplication",
+ "summary": "All ``verbatim`` blocks are considered identical by deduplicator and can incorrectly be unified when surrounded by identical opcodes.",
+ "description": "The block deduplicator is a step of the opcode-based optimizer which identifies equivalent assembly blocks and merges them into a single one. However, when blocks contained ``verbatim``, their comparison was performed incorrectly, leading to the collapse of assembly blocks which are identical except for the contents of the ``verbatim`` items. Since ``verbatim`` is only available in Yul, compilation of Solidity sources is not affected.",
+ "link": "https://blog.soliditylang.org/2023/11/08/verbatim-invalid-deduplication-bug/",
+ "introduced": "0.8.5",
+ "fixed": "0.8.23",
+ "severity": "low"
+ },
+ {
+ "uid": "SOL-2023-2",
+ "name": "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "summary": "Optimizer sequences containing FullInliner do not preserve the evaluation order of arguments of inlined function calls in code that is not in expression-split form.",
+ "description": "Function call arguments in Yul are evaluated right to left. This order matters when the argument expressions have side-effects, and changing it may change contract behavior. FullInliner is an optimizer step that can replace a function call with the body of that function. The transformation involves assigning argument expressions to temporary variables, which imposes an explicit evaluation order. FullInliner was written with the assumption that this order does not necessarily have to match usual argument evaluation order because the argument expressions have no side-effects. In most circumstances this assumption is true because the default optimization step sequence contains the ExpressionSplitter step. ExpressionSplitter ensures that the code is in *expression-split form*, which means that function calls cannot appear nested inside expressions, and all function call arguments have to be variables. The assumption is, however, not guaranteed to be true in general. Version 0.6.7 introduced a setting allowing users to specify an arbitrary optimization step sequence, making it possible for the FullInliner to actually encounter argument expressions with side-effects, which can result in behavior differences between optimized and unoptimized bytecode. Contracts compiled without optimization or with the default optimization sequence are not affected. To trigger the bug the user has to explicitly choose compiler settings that contain a sequence with FullInliner step not preceded by ExpressionSplitter.",
+ "link": "https://blog.soliditylang.org/2023/07/19/full-inliner-non-expression-split-argument-evaluation-order-bug/",
+ "introduced": "0.6.7",
+ "fixed": "0.8.21",
+ "severity": "low",
+ "conditions": {
+ "yulOptimizer": true
+ }
+ },
+ {
+ "uid": "SOL-2023-1",
+ "name": "MissingSideEffectsOnSelectorAccess",
+ "summary": "Accessing the ``.selector`` member on complex expressions leaves the expression unevaluated in the legacy code generation.",
+ "description": "When accessing the ``.selector`` member on an expression with side-effects, like an assignment, a function call or a conditional, the expression would not be evaluated in the legacy code generation. This would happen in expressions where the functions used in the expression were all known at compilation time, regardless of whether the whole expression could be evaluated at compilation time or not. Note that the code generated by the IR pipeline was unaffected and would behave as expected.",
+ "link": "https://blog.soliditylang.org/2023/07/19/missing-side-effects-on-selector-access-bug/",
+ "introduced": "0.6.2",
+ "fixed": "0.8.21",
+ "severity": "low",
+ "conditions": {
+ "viaIR": false
+ }
+ },
+ {
+ "uid": "SOL-2022-7",
+ "name": "StorageWriteRemovalBeforeConditionalTermination",
+ "summary": "Calling functions that conditionally terminate the external EVM call using the assembly statements ``return(...)`` or ``stop()`` may result in incorrect removals of prior storage writes.",
+ "description": "A call to a Yul function that conditionally terminates the external EVM call could result in prior storage writes being incorrectly removed by the Yul optimizer. This used to happen in cases in which it would have been valid to remove the store, if the Yul function in question never actually terminated the external call, and the control flow always returned back to the caller instead. Conditional termination within the same Yul block instead of within a called function was not affected. In Solidity with optimized via-IR code generation, any storage write before a function conditionally calling ``return(...)`` or ``stop()`` in inline assembly, may have been incorrectly removed, whenever it would have been valid to remove the write without the ``return(...)`` or ``stop()``. In optimized legacy code generation, only inline assembly that did not refer to any Solidity variables and that involved conditionally-terminating user-defined assembly functions could be affected.",
+ "link": "https://blog.soliditylang.org/2022/09/08/storage-write-removal-before-conditional-termination/",
+ "introduced": "0.8.13",
+ "fixed": "0.8.17",
+ "severity": "medium/high",
+ "conditions": {
+ "yulOptimizer": true
+ }
+ },
+ {
+ "uid": "SOL-2022-6",
+ "name": "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "summary": "ABI-encoding a tuple with a statically-sized calldata array in the last component would corrupt 32 leading bytes of its first dynamically encoded component.",
+ "description": "When ABI-encoding a statically-sized calldata array, the compiler always pads the data area to a multiple of 32-bytes and ensures that the padding bytes are zeroed. In some cases, this cleanup used to be performed by always writing exactly 32 bytes, regardless of how many needed to be zeroed. This was done with the assumption that the data that would eventually occupy the area past the end of the array had not yet been written, because the encoder processes tuple components in the order they were given. While this assumption is mostly true, there is an important corner case: dynamically encoded tuple components are stored separately from the statically-sized ones in an area called the *tail* of the encoding and the tail immediately follows the *head*, which is where the statically-sized components are placed. The aforementioned cleanup, if performed for the last component of the head would cross into the tail and overwrite up to 32 bytes of the first component stored there with zeros. The only array type for which the cleanup could actually result in an overwrite were arrays with ``uint256`` or ``bytes32`` as the base element type and in this case the size of the corrupted area was always exactly 32 bytes. The problem affected tuples at any nesting level. This included also structs, which are encoded as tuples in the ABI. Note also that lists of parameters and return values of functions, events and errors are encoded as tuples.",
+ "link": "https://blog.soliditylang.org/2022/08/08/calldata-tuple-reencoding-head-overflow-bug/",
+ "introduced": "0.5.8",
+ "fixed": "0.8.16",
+ "severity": "medium",
+ "conditions": {
+ "ABIEncoderV2": true
+ }
+ },
+ {
+ "uid": "SOL-2022-5",
+ "name": "DirtyBytesArrayToStorage",
+ "summary": "Copying ``bytes`` arrays from memory or calldata to storage may result in dirty storage values.",
+ "description": "Copying ``bytes`` arrays from memory or calldata to storage is done in chunks of 32 bytes even if the length is not a multiple of 32. Thereby, extra bytes past the end of the array may be copied from calldata or memory to storage. These dirty bytes may then become observable after a ``.push()`` without arguments to the bytes array in storage, i.e. such a push will not result in a zero value at the end of the array as expected. This bug only affects the legacy code generation pipeline, the new code generation pipeline via IR is not affected.",
+ "link": "https://blog.soliditylang.org/2022/06/15/dirty-bytes-array-to-storage-bug/",
+ "introduced": "0.0.1",
+ "fixed": "0.8.15",
+ "severity": "low"
+ },
+ {
+ "uid": "SOL-2022-4",
+ "name": "InlineAssemblyMemorySideEffects",
+ "summary": "The Yul optimizer may incorrectly remove memory writes from inline assembly blocks, that do not access solidity variables.",
+ "description": "The Yul optimizer considers all memory writes in the outermost Yul block that are never read from as unused and removes them. This is valid when that Yul block is the entire Yul program, which is always the case for the Yul code generated by the new via-IR pipeline. Inline assembly blocks are never optimized in isolation when using that pipeline. Instead they are optimized as a part of the whole Yul input. However, the legacy code generation pipeline (which is still the default) runs the Yul optimizer individually on an inline assembly block if the block does not refer to any local variables defined in the surrounding Solidity code. Consequently, memory writes in such inline assembly blocks are removed as well, if the written memory is never read from in the same assembly block, even if the written memory is accessed later, for example by a subsequent inline assembly block.",
+ "link": "https://blog.soliditylang.org/2022/06/15/inline-assembly-memory-side-effects-bug/",
+ "introduced": "0.8.13",
+ "fixed": "0.8.15",
+ "severity": "medium",
+ "conditions": {
+ "yulOptimizer": true
+ }
+ },
+ {
+ "uid": "SOL-2022-3",
+ "name": "DataLocationChangeInInternalOverride",
+ "summary": "It was possible to change the data location of the parameters or return variables from ``calldata`` to ``memory`` and vice-versa while overriding internal and public functions. This caused invalid code to be generated when calling such a function internally through virtual function calls.",
+ "description": "When calling external functions, it is irrelevant if the data location of the parameters is ``calldata`` or ``memory``, the encoding of the data does not change. Because of that, changing the data location when overriding external functions is allowed. The compiler incorrectly also allowed a change in the data location for overriding public and internal functions. Since public functions can be called internally as well as externally, this causes invalid code to be generated when such an incorrectly overridden function is called internally through the base contract. The caller provides a memory pointer, but the called function interprets it as a calldata pointer or vice-versa.",
+ "link": "https://blog.soliditylang.org/2022/05/17/data-location-inheritance-bug/",
+ "introduced": "0.6.9",
+ "fixed": "0.8.14",
+ "severity": "very low"
+ },
+ {
+ "uid": "SOL-2022-2",
+ "name": "NestedCalldataArrayAbiReencodingSizeValidation",
+ "summary": "ABI-reencoding of nested dynamic calldata arrays did not always perform proper size checks against the size of calldata and could read beyond ``calldatasize()``.",
+ "description": "Calldata validation for nested dynamic types is deferred until the first access to the nested values. Such an access may for example be a copy to memory or an index or member access to the outer type. While in most such accesses calldata validation correctly checks that the data area of the nested array is completely contained in the passed calldata (i.e. in the range [0, calldatasize()]), this check may not be performed, when ABI encoding such nested types again directly from calldata. For instance, this can happen, if a value in calldata with a nested dynamic array is passed to an external call, used in ``abi.encode`` or emitted as event. In such cases, if the data area of the nested array extends beyond ``calldatasize()``, ABI encoding it did not revert, but continued reading values from beyond ``calldatasize()`` (i.e. zero values).",
+ "link": "https://blog.soliditylang.org/2022/05/17/calldata-reencode-size-check-bug/",
+ "introduced": "0.5.8",
+ "fixed": "0.8.14",
+ "severity": "very low"
+ },
+ {
+ "uid": "SOL-2022-1",
+ "name": "AbiEncodeCallLiteralAsFixedBytesBug",
+ "summary": "Literals used for a fixed length bytes parameter in ``abi.encodeCall`` were encoded incorrectly.",
+ "description": "For the encoding, the compiler only considered the types of the expressions in the second argument of ``abi.encodeCall`` itself, but not the parameter types of the function given as first argument. In almost all cases the abi encoding of the type of the expression matches the abi encoding of the parameter type of the given function. This is because the type checker ensures the expression is implicitly convertible to the respective parameter type. However this is not true for number literals used for fixed bytes types shorter than 32 bytes, nor for string literals used for any fixed bytes type. Number literals were encoded as numbers instead of being shifted to become left-aligned. String literals were encoded as dynamically sized memory strings instead of being converted to a left-aligned bytes value.",
+ "link": "https://blog.soliditylang.org/2022/03/16/encodecall-bug/",
+ "introduced": "0.8.11",
+ "fixed": "0.8.13",
+ "severity": "very low"
+
+ },
{
"uid": "SOL-2021-4",
"name": "UserDefinedValueTypesBug",
@@ -8,7 +124,6 @@
"introduced": "0.8.8",
"fixed": "0.8.9",
"severity": "very low"
-
},
{
"uid": "SOL-2021-3",
diff --git a/docs/bugs.rst b/docs/bugs.rst
index 3c8469c35a..3963520791 100644
--- a/docs/bugs.rst
+++ b/docs/bugs.rst
@@ -6,8 +6,13 @@
Daftar Bug yang Diketahui
#########################
+<<<<<<< HEAD
Di bawah, Anda dapat menemukan daftar berformat JSON dari beberapa bug terkait keamanan yang diketahui di
Kompiler solidity. File itu sendiri di-host di `repositori Github
+=======
+Below, you can find a JSON-formatted list of some of the known security-relevant bugs in the
+Solidity compiler. The file itself is hosted in the `GitHub repository
+>>>>>>> english/develop
`_.
Daftar ini terbentang hingga versi 0.3.0, bug yang diketahui hanya ada
dalam versi sebelumnya yang tidak terdaftar.
@@ -67,6 +72,7 @@ conditions
nanti.
Jika tidak ada kondisi yang diberikan, asumsikan bahwa bug tetap ada.
check
+<<<<<<< HEAD
Bidang ini berisi pemeriksaan berbeda yang melaporkan apakah kontrak pintar
mengandung bug atau tidak. Jenis pemeriksaan pertama adalah ekspresi Javascript
reguler yang akan dicocokkan dengan kode sumber ("source-regex")
@@ -77,6 +83,20 @@ check
program Solidity ("ast-compact-json-path"). Kueri penelusuran yang ditentukan
adalah ekspresi `JsonPath `_.
Jika setidaknya satu jalur AST Soliditas cocok dengan kueri, kemungkinan besar bug ada.
+=======
+ This field contains different checks that report whether the smart contract
+ contains the bug or not. The first type of check are JavaScript regular
+ expressions that are to be matched against the source code ("source-regex")
+ if the bug is present. If there is no match, then the bug is very likely
+ not present. If there is a match, the bug might be present. For improved
+ accuracy, the checks should be applied to the source code after stripping
+ comments.
+ The second type of check are patterns to be checked on the compact AST of
+ the Solidity program ("ast-compact-json-path"). The specified search query
+ is a `JsonPath `_ expression.
+ If at least one path of the Solidity AST matches the query, the bug is
+ likely present.
+>>>>>>> english/develop
.. literalinclude:: bugs.json
:language: js
diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json
index 6385af1707..156b846d01 100644
--- a/docs/bugs_by_version.json
+++ b/docs/bugs_by_version.json
@@ -1,6 +1,7 @@
{
"0.1.0": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -22,6 +23,7 @@
},
"0.1.1": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -43,6 +45,7 @@
},
"0.1.2": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -64,6 +67,7 @@
},
"0.1.3": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -85,6 +89,7 @@
},
"0.1.4": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -107,6 +112,7 @@
},
"0.1.5": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -129,6 +135,7 @@
},
"0.1.6": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -153,6 +160,7 @@
},
"0.1.7": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -177,6 +185,7 @@
},
"0.2.0": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -202,6 +211,7 @@
},
"0.2.1": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -227,6 +237,7 @@
},
"0.2.2": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -252,6 +263,7 @@
},
"0.3.0": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -279,6 +291,7 @@
},
"0.3.1": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -305,6 +318,7 @@
},
"0.3.2": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -331,6 +345,7 @@
},
"0.3.3": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -356,6 +371,7 @@
},
"0.3.4": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -381,6 +397,7 @@
},
"0.3.5": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -406,6 +423,7 @@
},
"0.3.6": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -429,6 +447,7 @@
},
"0.4.0": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -452,6 +471,7 @@
},
"0.4.1": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -475,6 +495,7 @@
},
"0.4.10": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -497,6 +518,7 @@
},
"0.4.11": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -518,6 +540,7 @@
},
"0.4.12": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -538,6 +561,7 @@
},
"0.4.13": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -558,6 +582,7 @@
},
"0.4.14": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -577,6 +602,7 @@
},
"0.4.15": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -595,6 +621,7 @@
},
"0.4.16": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -616,6 +643,7 @@
},
"0.4.17": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -638,6 +666,7 @@
},
"0.4.18": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -659,6 +688,7 @@
},
"0.4.19": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -681,6 +711,7 @@
},
"0.4.2": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -703,6 +734,7 @@
},
"0.4.20": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -725,6 +757,7 @@
},
"0.4.21": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -747,6 +780,7 @@
},
"0.4.22": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -769,6 +803,7 @@
},
"0.4.23": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -790,6 +825,7 @@
},
"0.4.24": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -811,6 +847,7 @@
},
"0.4.25": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -830,6 +867,7 @@
},
"0.4.26": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -846,6 +884,7 @@
},
"0.4.3": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -867,6 +906,7 @@
},
"0.4.4": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -887,6 +927,7 @@
},
"0.4.5": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -910,6 +951,7 @@
},
"0.4.6": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -932,6 +974,7 @@
},
"0.4.7": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -954,6 +997,7 @@
},
"0.4.8": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -976,6 +1020,7 @@
},
"0.4.9": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"KeccakCaching",
"EmptyByteArrayCopy",
"DynamicArrayCleanup",
@@ -998,6 +1043,7 @@
},
"0.5.0": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1017,6 +1063,7 @@
},
"0.5.1": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1036,6 +1083,9 @@
},
"0.5.10": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1051,6 +1101,9 @@
},
"0.5.11": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1065,6 +1118,9 @@
},
"0.5.12": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1079,6 +1135,9 @@
},
"0.5.13": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1093,6 +1152,9 @@
},
"0.5.14": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1109,6 +1171,9 @@
},
"0.5.15": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1124,6 +1189,9 @@
},
"0.5.16": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1138,6 +1206,9 @@
},
"0.5.17": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1151,6 +1222,7 @@
},
"0.5.2": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1170,6 +1242,7 @@
},
"0.5.3": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1189,6 +1262,7 @@
},
"0.5.4": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1208,6 +1282,7 @@
},
"0.5.5": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1229,6 +1304,7 @@
},
"0.5.6": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1250,6 +1326,7 @@
},
"0.5.7": {
"bugs": [
+ "DirtyBytesArrayToStorage",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1269,6 +1346,9 @@
},
"0.5.8": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1287,6 +1367,9 @@
},
"0.5.9": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1304,6 +1387,9 @@
},
"0.6.0": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1319,6 +1405,9 @@
},
"0.6.1": {
"bugs": [
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1333,6 +1422,12 @@
},
"0.6.10": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1343,6 +1438,12 @@
},
"0.6.11": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1353,6 +1454,12 @@
},
"0.6.12": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1363,6 +1470,10 @@
},
"0.6.2": {
"bugs": [
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1377,6 +1488,10 @@
},
"0.6.3": {
"bugs": [
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1391,6 +1506,10 @@
},
"0.6.4": {
"bugs": [
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
"EmptyByteArrayCopy",
@@ -1405,6 +1524,10 @@
},
"0.6.5": {
"bugs": [
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1419,6 +1542,10 @@
},
"0.6.6": {
"bugs": [
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1432,6 +1559,11 @@
},
"0.6.7": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1445,6 +1577,11 @@
},
"0.6.8": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1455,6 +1592,12 @@
},
"0.6.9": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1466,6 +1609,12 @@
},
"0.7.0": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1476,6 +1625,12 @@
},
"0.7.1": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1487,6 +1642,12 @@
},
"0.7.2": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1497,6 +1658,12 @@
},
"0.7.3": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching",
@@ -1506,6 +1673,12 @@
},
"0.7.4": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching"
@@ -1514,6 +1687,12 @@
},
"0.7.5": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching"
@@ -1522,6 +1701,12 @@
},
"0.7.6": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching"
@@ -1530,6 +1715,12 @@
},
"0.8.0": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching"
@@ -1538,6 +1729,12 @@
},
"0.8.1": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching"
@@ -1545,19 +1742,162 @@
"released": "2021-01-27"
},
"0.8.10": {
- "bugs": [],
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation"
+ ],
"released": "2021-11-09"
},
+ "0.8.11": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
+ "AbiEncodeCallLiteralAsFixedBytesBug"
+ ],
+ "released": "2021-12-20"
+ },
+ "0.8.12": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
+ "AbiEncodeCallLiteralAsFixedBytesBug"
+ ],
+ "released": "2022-02-16"
+ },
+ "0.8.13": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "StorageWriteRemovalBeforeConditionalTermination",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "InlineAssemblyMemorySideEffects",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation"
+ ],
+ "released": "2022-03-16"
+ },
+ "0.8.14": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "StorageWriteRemovalBeforeConditionalTermination",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "InlineAssemblyMemorySideEffects"
+ ],
+ "released": "2022-05-17"
+ },
+ "0.8.15": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "StorageWriteRemovalBeforeConditionalTermination",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup"
+ ],
+ "released": "2022-06-15"
+ },
+ "0.8.16": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "StorageWriteRemovalBeforeConditionalTermination"
+ ],
+ "released": "2022-08-08"
+ },
+ "0.8.17": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess"
+ ],
+ "released": "2022-09-08"
+ },
+ "0.8.18": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess"
+ ],
+ "released": "2023-02-01"
+ },
+ "0.8.19": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess"
+ ],
+ "released": "2023-02-22"
+ },
"0.8.2": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory",
"KeccakCaching"
],
"released": "2021-03-02"
},
+ "0.8.20": {
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess"
+ ],
+ "released": "2023-05-10"
+ },
+ "0.8.21": {
+ "bugs": [
+ "VerbatimInvalidDeduplication"
+ ],
+ "released": "2023-07-19"
+ },
+ "0.8.22": {
+ "bugs": [
+ "VerbatimInvalidDeduplication"
+ ],
+ "released": "2023-10-25"
+ },
+ "0.8.23": {
+ "bugs": [],
+ "released": "2023-11-08"
+ },
+ "0.8.24": {
+ "bugs": [],
+ "released": "2024-01-25"
+ },
"0.8.3": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables",
"ABIDecodeTwoDimensionalArrayMemory"
],
@@ -1565,37 +1905,79 @@
},
"0.8.4": {
"bugs": [
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables"
],
"released": "2021-04-21"
},
"0.8.5": {
"bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables"
],
"released": "2021-06-10"
},
"0.8.6": {
"bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables"
],
"released": "2021-06-22"
},
"0.8.7": {
"bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"SignedImmutables"
],
"released": "2021-08-11"
},
"0.8.8": {
"bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation",
"UserDefinedValueTypesBug",
"SignedImmutables"
],
"released": "2021-09-27"
},
"0.8.9": {
- "bugs": [],
+ "bugs": [
+ "VerbatimInvalidDeduplication",
+ "FullInlinerNonExpressionSplitArgumentEvaluationOrder",
+ "MissingSideEffectsOnSelectorAccess",
+ "AbiReencodingHeadOverflowWithStaticArrayCleanup",
+ "DirtyBytesArrayToStorage",
+ "DataLocationChangeInInternalOverride",
+ "NestedCalldataArrayAbiReencodingSizeValidation"
+ ],
"released": "2021-09-29"
}
}
\ No newline at end of file
diff --git a/docs/cheatsheet.rst b/docs/cheatsheet.rst
index 59abcdaef5..0683ff1e30 100644
--- a/docs/cheatsheet.rst
+++ b/docs/cheatsheet.rst
@@ -2,71 +2,20 @@
Cheatsheet
**********
-.. index:: precedence
-
-.. _order:
+.. index:: operator;precedence
Urutan Prioritas Operator
=========================
+<<<<<<< HEAD
Berikut ini adalah urutan prioritas untuk operator, tercantum dalam urutan evaluasi.
+=======
+.. include:: types/operator-precedence-table.rst
+>>>>>>> english/develop
-+------------+-------------------------------------+--------------------------------------------+
-| Precedence | Description | Operator |
-+============+=====================================+============================================+
-| *1* | Postfix increment and decrement | ``++``, ``--`` |
-+ +-------------------------------------+--------------------------------------------+
-| | New expression | ``new `` |
-+ +-------------------------------------+--------------------------------------------+
-| | Array subscripting | ``[]`` |
-+ +-------------------------------------+--------------------------------------------+
-| | Member access | ``.`` |
-+ +-------------------------------------+--------------------------------------------+
-| | Function-like call | ``()`` |
-+ +-------------------------------------+--------------------------------------------+
-| | Parentheses | ``()`` |
-+------------+-------------------------------------+--------------------------------------------+
-| *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 | `` ? : `` |
-+ +-------------------------------------+--------------------------------------------+
-| | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, |
-| | | ``>>=``, ``+=``, ``-=``, ``*=``, ``/=``, |
-| | | ``%=`` |
-+------------+-------------------------------------+--------------------------------------------+
-| *15* | Comma operator | ``,`` |
-+------------+-------------------------------------+--------------------------------------------+
+.. index:: abi;decode, abi;encode, abi;encodePacked, abi;encodeWithSelector, abi;encodeCall, abi;encodeWithSignature
+<<<<<<< HEAD
.. index:: assert, block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, gas price, origin, revert, require, keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, codehash, send
Variabel Global
@@ -158,6 +107,129 @@ Variabel Global
``sha3`` sebagai alias untuk ``keccak256``.
.. note::
Di versi 0.7.0, alias ``now`` (untuk ``block.timestamp``) telah dihilangkan.
+=======
+ABI Encoding and Decoding Functions
+===================================
+
+- ``abi.decode(bytes memory encodedData, (...)) returns (...)``: :ref:`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))``
+- ``abi.encode(...) returns (bytes memory)``: :ref:`ABI `-encodes the given arguments
+- ``abi.encodePacked(...) returns (bytes memory)``: Performs :ref:`packed encoding ` of
+ the given arguments. Note that this encoding can be ambiguous!
+- ``abi.encodeWithSelector(bytes4 selector, ...) returns (bytes memory)``: :ref:`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))), ...)``
+
+.. index:: bytes;concat, string;concat
+
+Members of ``bytes`` and ``string``
+====================================
+
+- ``bytes.concat(...) returns (bytes memory)``: :ref:`Concatenates variable number of
+ arguments to one byte array`
+
+- ``string.concat(...) returns (string memory)``: :ref:`Concatenates variable number of
+ arguments to one string array`
+
+.. index:: address;balance, address;codehash, address;send, address;code, address;transfer
+
+Members of ``address``
+======================
+
+- ``.balance`` (``uint256``): balance of the :ref:`address` in Wei
+- ``.code`` (``bytes memory``): code at the :ref:`address` (can be empty)
+- ``.codehash`` (``bytes32``): the codehash of the :ref:`address`
+- ``.call(bytes memory) returns (bool, bytes memory)``: issue low-level ``CALL`` with the given payload,
+ returns success condition and return data
+- ``.delegatecall(bytes memory) returns (bool, bytes memory)``: issue low-level ``DELEGATECALL`` with the given payload,
+ returns success condition and return data
+- ``.staticcall(bytes memory) returns (bool, bytes memory)``: issue low-level ``STATICCALL`` with the given payload,
+ returns success condition and return data
+- ``.send(uint256 amount) returns (bool)``: send given amount of Wei to :ref:`address`,
+ returns ``false`` on failure
+- ``.transfer(uint256 amount)``: send given amount of Wei to :ref:`address`, throws on failure
+
+.. index:: blockhash, blobhash, block, block;basefee, block;blobbasefee, block;chainid, block;coinbase, block;difficulty, block;gaslimit, block;number, block;prevrandao, block;timestamp
+.. index:: gasleft, msg;data, msg;sender, msg;sig, msg;value, tx;gasprice, tx;origin
+
+Block and Transaction Properties
+================================
+
+- ``blockhash(uint blockNumber) returns (bytes32)``: hash of the given block - only works for 256 most recent blocks
+- ``blobhash(uint index) returns (bytes32)``: versioned hash of the ``index``-th blob associated with the current transaction.
+ A versioned hash consists of a single byte representing the version (currently ``0x01``), followed by the last 31 bytes
+ of the SHA256 hash of the KZG commitment (`EIP-4844 `_).
+- ``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)
+
+.. index:: assert, require, revert
+
+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
+
+.. index:: cryptography, keccak256, sha256, ripemd160, ecrecover, addmod, mulmod
+
+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.
+
+.. index:: this, super, selfdestruct
+
+Contract-related
+================
+
+- ``this`` (current contract's type): the current contract, explicitly convertible to ``address`` or ``address payable``
+- ``super``: a contract one level higher in the inheritance hierarchy
+- ``selfdestruct(address payable recipient)``: destroy the current contract, sending its funds to the given address
+
+.. index:: type;name, type;creationCode, type;runtimeCode, type;interfaceId, type;min, type;max
+
+Type Information
+================
+
+- ``type(C).name`` (``string``): the name of the contract
+- ``type(C).creationCode`` (``bytes memory``): creation bytecode of the given contract, see :ref:`Type Information`.
+- ``type(C).runtimeCode`` (``bytes memory``): runtime bytecode of the given contract, see :ref:`Type Information`.
+- ``type(I).interfaceId`` (``bytes4``): value containing the EIP-165 interface identifier of the given interface, see :ref:`Type Information`.
+- ``type(T).min`` (``T``): the minimum value representable by the integer type ``T``, see :ref:`Type Information`.
+- ``type(T).max`` (``T``): the maximum value representable by the integer type ``T``, see :ref:`Type Information`.
+
+>>>>>>> english/develop
.. index:: visibility, public, private, external, internal
@@ -182,6 +254,7 @@ Function Visibility Specifiers
Modifiers
=========
+<<<<<<< HEAD
- ``pure`` untuk fungsi: Tidak mengizinkan modifikasi atau akses state.
- ``view`` untuk fungsi: Melarang modifikasi state.
- ``payable`` untuk fungsi: Memungkinkan mereka menerima Ether bersama dengan panggilan.
@@ -204,3 +277,17 @@ Kata kunci ini dicadangkan di Solidity. Mereka mungkin menjadi bagian dari sinta
``mutable``, ``null``, ``of``, ``partial``, ``promise``, ``reference``, ``relocatable``,
``sealed``, ``sizeof``, ``static``, ``supports``, ``switch``, ``typedef``, ``typeof``,
``var``.
+=======
+- ``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 initialization), 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.
+
+>>>>>>> english/develop
diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst
index 3c82bb11de..d042f8fd80 100644
--- a/docs/common-patterns.rst
+++ b/docs/common-patterns.rst
@@ -17,10 +17,17 @@ panggilan ``transfer`` langsung, ini tidak disarankan karena
memperkenalkan potensi risiko keamanan. Anda dapat membaca lebih
lanjut tentang ini di halaman :ref:`security_considerations`.
+<<<<<<< HEAD
Berikut ini adalah contoh pola penarikan dalam praktik dalam sebuah
kontrak dimana tujuannya adalah untuk mengirimkan uang sebanyak-banyaknya
ke dalam kontrak agar menjadi “yang terkaya”, terinspirasi dari
`Raja Ether `_.
+=======
+The following is an example of the withdrawal pattern in practice in
+a contract where the goal is to send the most of some compensation, e.g. Ether, to the
+contract in order to become the "richest", inspired by
+`King of the Ether `_.
+>>>>>>> english/develop
Dalam kontrak berikut, jika Anda bukan lagi yang terkaya,
Anda menerima dana dari orang yang sekarang paling kaya.
@@ -34,7 +41,7 @@ Anda menerima dana dari orang yang sekarang paling kaya.
address public richest;
uint public mostSent;
- mapping (address => uint) pendingWithdrawals;
+ mapping(address => uint) pendingWithdrawals;
/// The amount of Ether sent was not higher than
/// the currently highest amount.
@@ -55,7 +62,7 @@ Anda menerima dana dari orang yang sekarang paling kaya.
function withdraw() public {
uint amount = pendingWithdrawals[msg.sender];
// Remember to zero the pending refund before
- // sending to prevent re-entrancy attacks
+ // sending to prevent reentrancy attacks
pendingWithdrawals[msg.sender] = 0;
payable(msg.sender).transfer(amount);
}
@@ -163,9 +170,9 @@ batasan ini sangat mudah dibaca.
// prepend a check that only passes
// if the function is called from
// a certain address.
- modifier onlyBy(address _account)
+ modifier onlyBy(address account)
{
- if (msg.sender != _account)
+ if (msg.sender != account)
revert Unauthorized();
// Do not forget the "_;"! It will
// be replaced by the actual function
@@ -173,17 +180,17 @@ batasan ini sangat mudah dibaca.
_;
}
- /// Make `_newOwner` the new owner of this
+ /// Make `newOwner` the new owner of this
/// contract.
- function changeOwner(address _newOwner)
+ function changeOwner(address newOwner)
public
onlyBy(owner)
{
- owner = _newOwner;
+ owner = newOwner;
}
- modifier onlyAfter(uint _time) {
- if (block.timestamp < _time)
+ modifier onlyAfter(uint time) {
+ if (block.timestamp < time)
revert TooEarly();
_;
}
@@ -205,21 +212,21 @@ batasan ini sangat mudah dibaca.
// refunded, but only after the function body.
// This was dangerous before Solidity version 0.4.0,
// where it was possible to skip the part after `_;`.
- modifier costs(uint _amount) {
- if (msg.value < _amount)
+ modifier costs(uint amount) {
+ if (msg.value < amount)
revert NotEnoughEther();
_;
- if (msg.value > _amount)
- payable(msg.sender).transfer(msg.value - _amount);
+ if (msg.value > amount)
+ payable(msg.sender).transfer(msg.value - amount);
}
- function forceOwnerChange(address _newOwner)
+ function forceOwnerChange(address newOwner)
public
payable
costs(200 ether)
{
- owner = _newOwner;
+ owner = newOwner;
// just some example condition
if (uint160(owner) & 0 == 1)
// This did not refund for Solidity
@@ -314,8 +321,8 @@ fungsi selesai.
uint public creationTime = block.timestamp;
- modifier atStage(Stages _stage) {
- if (stage != _stage)
+ modifier atStage(Stages stage_) {
+ if (stage != stage_)
revert FunctionInvalidAtThisStage();
_;
}
diff --git a/docs/conf.py b/docs/conf.py
index 5fa2e6ab5d..ddc3ee81bb 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -31,7 +31,10 @@ def setup(sphinx):
sphinx.add_lexer('Solidity', SolidityLexer)
sphinx.add_lexer('Yul', YulLexer)
+ sphinx.add_css_file('css/fonts.css')
sphinx.add_css_file('css/custom.css')
+ sphinx.add_css_file('css/custom-dark.css')
+ sphinx.add_css_file('css/pygments.css')
# -- General configuration ------------------------------------------------
@@ -45,6 +48,7 @@ def setup(sphinx):
'sphinx_a4doc',
'html_extra_template_renderer',
'remix_code_links',
+ 'sphinx.ext.imgconverter',
]
a4_base_path = os.path.dirname(__file__) + '/grammar'
@@ -63,7 +67,7 @@ def setup(sphinx):
# General information about the project.
project = 'Solidity'
-copyright = '2016-2021, Ethereum'
+project_copyright = '2016-2023, The Solidity Authors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -73,7 +77,7 @@ def setup(sphinx):
with open('../CMakeLists.txt', 'r', encoding='utf8') as f:
version = re.search('PROJECT_VERSION "([^"]+)"', f.read()).group(1)
# The full version, including alpha/beta/rc tags.
-if os.path.isfile('../prerelease.txt') != True or os.path.getsize('../prerelease.txt') == 0:
+if not os.path.isfile('../prerelease.txt') or os.path.getsize('../prerelease.txt') == 0:
release = version
else:
# This is a prerelease version
@@ -131,7 +135,6 @@ def setup(sphinx):
# documentation.
html_theme_options = {
'logo_only': True,
- 'style_nav_header_background': '#65afff',
'display_version': True,
}
@@ -147,12 +150,12 @@ def setup(sphinx):
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-html_logo = "logo.svg"
+# html_logo = "logo.svg"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
-#html_favicon = None
+html_favicon = "_static/img/favicon.ico"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -161,7 +164,7 @@ def setup(sphinx):
html_css_files = ["css/toggle.css"]
-html_js_files = ["js/toggle.js"]
+html_js_files = ["js/constants.js", "js/initialize.js", "js/toggle.js"]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
@@ -209,7 +212,7 @@ def setup(sphinx):
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
diff --git a/docs/contracts/abstract-contracts.rst b/docs/contracts/abstract-contracts.rst
index cef5a56cbd..ee0a23cc25 100644
--- a/docs/contracts/abstract-contracts.rst
+++ b/docs/contracts/abstract-contracts.rst
@@ -6,12 +6,24 @@
Kontrak Abstrak
******************
+<<<<<<< HEAD
Kontrak perlu ditandai sebagai abstrak ketika setidaknya salah satu fungsinya tidak diimplementasikan.
Kontrak dapat ditandai sebagai abstrak meskipun semua fungsi diimplementasikan.
Ini dapat dilakukan dengan menggunakan kata kunci ``abstract`` seperti yang ditunjukkan pada contoh berikut. Perhatikan bahwa kontrak
ini perlu didefinisikan sebagai abstrak, karena fungsi ``utterance()`` telah didefinisikan, tetapi tidak ada implementasi yang diberikan
(tidak ada badan implementasi ``{ }`` yang diberikan).
+=======
+Contracts must be marked as abstract when at least one of their functions is not implemented or when
+they do not provide arguments for all of their base contract constructors.
+Even if this is not the case, a contract may still be marked abstract, such as when you do not intend
+for the contract to be created directly. Abstract contracts are similar to :ref:`interfaces` but an
+interface is more limited in what it can declare.
+
+An abstract contract is declared using the ``abstract`` keyword as shown in the following example.
+Note that this contract needs to be defined as abstract, because the function ``utterance()`` is declared,
+but no implementation was provided (no implementation body ``{ }`` was given).
+>>>>>>> english/develop
.. code-block:: solidity
diff --git a/docs/contracts/constant-state-variables.rst b/docs/contracts/constant-state-variables.rst
index 47136b57b3..6eb2309c1d 100644
--- a/docs/contracts/constant-state-variables.rst
+++ b/docs/contracts/constant-state-variables.rst
@@ -30,25 +30,29 @@ adalah :ref:`strings ` (hanya untuk constants) dan :ref:`tipe nilai =0.7.4;
+ pragma solidity ^0.8.21;
uint constant X = 32**22 + 8;
contract C {
string constant TEXT = "abc";
bytes32 constant MY_HASH = keccak256("abc");
- uint immutable decimals;
+ uint immutable decimals = 18;
uint immutable maxBalance;
address immutable owner = msg.sender;
- constructor(uint _decimals, address _reference) {
- decimals = _decimals;
+ constructor(uint decimals_, address ref) {
+ if (decimals_ != 0)
+ // Immutables are only immutable when deployed.
+ // At construction time they can be assigned to any number of times.
+ decimals = decimals_;
+
// Assignments to immutables can even access the environment.
- maxBalance = _reference.balance;
+ maxBalance = ref.balance;
}
- function isBalanceTooHigh(address _other) public view returns (bool) {
- return _other.balance > maxBalance;
+ function isBalanceTooHigh(address other) public view returns (bool) {
+ return other.balance > maxBalance;
}
}
@@ -71,6 +75,7 @@ Fitur ini belum sepenuhnya dapat digunakan.
Immutable
=========
+<<<<<<< HEAD
Variabel yang dideklarasikan sebagai ``immutable`` sedikit kurang dibatasi daripada
yang dideklarasikan sebagai ``constant``: Variabel Immutable dapat diberi nilai arbitrer
dalam konstruktor kontrak atau pada titik deklarasinya. Mereka dapat ditugaskan hanya
@@ -88,4 +93,38 @@ yang sebenarnya disimpan di blockchain.
Ini adalah perlindungan terhadap interpretasi yang berbeda tentang
urutan inisialisasi variabel state dan eksekusi konstruktor, terutama
- yang berkaitan dengan pewarisan(inheritance).
\ No newline at end of file
+ yang berkaitan dengan pewarisan(inheritance).
+=======
+Variables declared as ``immutable`` are a bit less restricted than those
+declared as ``constant``: Immutable variables can be assigned a
+value at construction time.
+The value can be changed at any time before deployment and then it becomes permanent.
+
+One additional restriction is that immutables can only be assigned to inside expressions for which
+there is no possibility of being executed after creation.
+This excludes all modifier definitions and functions other than constructors.
+
+There are no restrictions on reading immutable variables.
+The read is even allowed to happen before the variable is written to for the first time because variables in
+Solidity always have a well-defined initial value.
+For this reason it is also allowed to never explicitly assign a value to an immutable.
+
+.. warning::
+ When accessing immutables at construction time, please keep the :ref:`initialization order
+ ` in mind.
+ Even if you provide an explicit initializer, some expressions may end up being evaluated before
+ that initializer, especially when they are at a different level in inheritance hierarchy.
+
+.. note::
+ Before Solidity 0.8.21 initialization of immutable variables was more restrictive.
+ Such variables had to be initialized exactly once at construction time and could not be read
+ before then.
+
+The contract creation code generated by the compiler will modify the
+contract's runtime code before it is returned by replacing all references
+to immutables with the values assigned to them. This is important if
+you are comparing the
+runtime code generated by the compiler with the one actually stored in the
+blockchain. The compiler outputs where these immutables are located in the deployed bytecode
+in the ``immutableReferences`` field of the :ref:`compiler JSON standard output `.
+>>>>>>> english/develop
diff --git a/docs/contracts/creating-contracts.rst b/docs/contracts/creating-contracts.rst
index 5e55c327e2..586d8c8dcf 100644
--- a/docs/contracts/creating-contracts.rst
+++ b/docs/contracts/creating-contracts.rst
@@ -8,9 +8,15 @@ Kontrak dapat dibuat "dari luar" melalui transaksi Ethereum atau dari dalam kont
IDEs, seperti `Remix `_, membuat proses pembuatan lebih mulus dengan menggunakan elemen UI.
+<<<<<<< HEAD
Salah satu cara untuk membuat kontrak secara terprogram di Ethereum adalah melalui JavaScript API `web3.js `_.
Ini memiliki fungsi yang disebut `web3.eth.Contract `_
untuk memfasilitasi pembuatan kontrak.
+=======
+One way to create contracts programmatically on Ethereum is via the JavaScript API `web3.js `_.
+It has a function called `web3.eth.Contract `_
+to facilitate contract creation.
+>>>>>>> english/develop
Saat kontrak dibuat, :ref:`constructor ` (fungsi yang dideklarasikan dengan
kata kunci ``constructor``) dijalankan satu kali.
@@ -47,7 +53,7 @@ Ini berarti bahwa *cyclic creation dependencies* tidak mungkin.
// This is the constructor which registers the
// creator and the assigned name.
- constructor(bytes32 _name) {
+ constructor(bytes32 name_) {
// State variables are accessed via their name
// and not via e.g. `this.owner`. Functions can
// be accessed directly or through `this.f`,
@@ -64,7 +70,7 @@ Ini berarti bahwa *cyclic creation dependencies* tidak mungkin.
// no real way to verify that.
// This does not create a new contract.
creator = TokenCreator(msg.sender);
- name = _name;
+ name = name_;
}
function changeName(bytes32 newName) public {
diff --git a/docs/contracts/errors.rst b/docs/contracts/errors.rst
index d65995f8b4..107d0a3f69 100644
--- a/docs/contracts/errors.rst
+++ b/docs/contracts/errors.rst
@@ -1,5 +1,4 @@
-.. index:: ! error, revert
-
+.. index:: ! error, revert, ! selector; of an error
.. _errors:
***************************
@@ -74,7 +73,21 @@ Demikian pula, ``assert`` yang gagal atau kondisi serupa akan dikembalikan denga
tipe bawaan ``Panic(uint256)``.
.. note::
+<<<<<<< HEAD
Data kesalahan seharusnya hanya digunakan untuk memberikan indikasi kegagalan, tetapi bukan
sebagai sarana untuk control-flow. Alasannya adalah bahwa data pengembalian panggilan inner
disebarkan kembali melalui rantai panggilan eksternal secara default. Ini berarti bahwa panggilan
inner dapat "menempa" mengembalikan data yang sepertinya berasal dari kontrak yang memanggilnya.
+=======
+ Error data should only be used to give an indication of failure, but
+ not as a means for control-flow. The reason is that the revert data
+ of inner calls is propagated back through the chain of external calls
+ by default. This means that an inner call
+ can "forge" revert data that looks like it could have come from the
+ contract that called it.
+
+Members of Errors
+=================
+
+- ``error.selector``: A ``bytes4`` value containing the error selector.
+>>>>>>> english/develop
diff --git a/docs/contracts/events.rst b/docs/contracts/events.rst
index 72d39377c4..56bb06727a 100644
--- a/docs/contracts/events.rst
+++ b/docs/contracts/events.rst
@@ -1,4 +1,4 @@
-.. index:: ! event
+.. index:: ! event, ! event; anonymous, ! event; indexed, ! event; topic
.. _events:
@@ -9,12 +9,23 @@ Events
Solidity events memberikan abstraksi di atas fungsi logging EVM.
Aplikasi dapat berlangganan dan mendengarkan event ini melalui antarmuka RPC dari klien Ethereum.
+<<<<<<< HEAD
Event adalah anggota kontrak yang dapat diwariskan. Saat Anda memanggil mereka, mereka menyebabkan
argumen disimpan di log transaksi - sebuah struktur data khusus di blockchain.
Log ini dikaitkan dengan alamat kontrak, dimasukkan ke dalam blockchain, dan tetap
di sana selama blok dapat diakses (selamanya sampai sekarang, tetapi ini mungkin
berubah dengan Serenity). Log dan data peristiwanya tidak dapat diakses dari dalam
kontrak (bahkan dari kontrak yang membuatnya).
+=======
+Events can be defined at file level or as inheritable members of contracts (including interfaces and libraries).
+When you call them, they cause the
+arguments to be stored in the transaction's log - a special data structure
+in the blockchain. These logs are associated with the address of the contract that emitted them,
+are incorporated into the blockchain, and stay there as long as a block is
+accessible (forever as of now, but this might
+change in the future). The Log and its event data is not accessible from within
+contracts (not even from the contract that created them).
+>>>>>>> english/develop
Dimungkinkan untuk meminta bukti Merkle untuk log, jadi jika entitas eksternal
memberikan kontrak dengan bukti seperti itu, ia dapat memeriksa apakah log tersebut
@@ -68,6 +79,18 @@ Ini juga memungkinkan Anda untuk mendeklarasikan empat argumen yang diindeks dar
data dengan benar.
Secara khusus, dimungkinkan untuk "memalsukan" tanda tangan event lain menggunakan event anonim.
+.. index:: ! selector; of an event
+
+Members of Events
+=================
+
+- ``event.selector``: For non-anonymous events, this is a ``bytes32`` value
+ containing the ``keccak256`` hash of the event signature, as used in the default topic.
+
+
+Example
+=======
+
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
@@ -75,18 +98,18 @@ Ini juga memungkinkan Anda untuk mendeklarasikan empat argumen yang diindeks dar
contract ClientReceipt {
event Deposit(
- address indexed _from,
- bytes32 indexed _id,
- uint _value
+ address indexed from,
+ bytes32 indexed id,
+ uint value
);
- function deposit(bytes32 _id) public payable {
+ function deposit(bytes32 id) public payable {
// Events are emitted using `emit`, followed by
// the name of the event and the arguments
// (if any) in parentheses. Any such invocation
// (even deeply nested) can be detected from
// the JavaScript API by filtering for `Deposit`.
- emit Deposit(msg.sender, _id, msg.value);
+ emit Deposit(msg.sender, id, msg.value);
}
}
@@ -121,9 +144,9 @@ Output di atas terlihat seperti berikut (trimmed):
{
"returnValues": {
- "_from": "0x1111…FFFFCCCC",
- "_id": "0x50…sd5adb20",
- "_value": "0x420042"
+ "from": "0x1111…FFFFCCCC",
+ "id": "0x50…sd5adb20",
+ "value": "0x420042"
},
"raw": {
"data": "0x7f…91385",
@@ -131,9 +154,18 @@ Output di atas terlihat seperti berikut (trimmed):
}
}
+<<<<<<< HEAD
Sumber Daya Tambahan untuk Memahami Event
=========================================
- `Dokumentasi Javascript `_
- `Contoh penggunaan events `_
- `Cara mengaksesnya di js `_
+=======
+Additional Resources for Understanding Events
+=============================================
+
+- `JavaScript documentation `_
+- `Example usage of events `_
+- `How to access them in js `_
+>>>>>>> english/develop
diff --git a/docs/contracts/function-modifiers.rst b/docs/contracts/function-modifiers.rst
index 69990cb2f9..a0e36feee4 100644
--- a/docs/contracts/function-modifiers.rst
+++ b/docs/contracts/function-modifiers.rst
@@ -6,9 +6,15 @@
Fungsi Modifier
****************
+<<<<<<< HEAD
Modifier dapat digunakan untuk mengubah perilaku fungsi dengan cara deklaratif.
Misalnya,
Anda dapat menggunakan Modifier untuk memeriksa kondisi secara otomatis sebelum menjalankan fungsi.
+=======
+Modifiers can be used to change the behavior of functions in a declarative way.
+For example,
+you can use a modifier to automatically check a condition prior to executing the function.
+>>>>>>> english/develop
Modifier adalah
properti kontrak *inheritable* dan dapat ditimpa oleh kontrak turunan,
@@ -19,6 +25,7 @@ Untuk detailnya, silakan lihat :ref:`Modifier Overriding `.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.1 <0.9.0;
+ // This will report a warning due to deprecated selfdestruct
contract owned {
constructor() { owner = payable(msg.sender); }
@@ -60,7 +67,7 @@ Untuk detailnya, silakan lihat :ref:`Modifier Overriding `.
}
contract Register is priced, destructible {
- mapping (address => bool) registeredAddresses;
+ mapping(address => bool) registeredAddresses;
uint price;
constructor(uint initialPrice) { price = initialPrice; }
@@ -72,8 +79,8 @@ Untuk detailnya, silakan lihat :ref:`Modifier Overriding `.
registeredAddresses[msg.sender] = true;
}
- function changePrice(uint _price) public onlyOwner {
- price = _price;
+ function changePrice(uint price_) public onlyOwner {
+ price = price_;
}
}
@@ -112,9 +119,21 @@ dipisahkan spasi dan dievaluasi dalam urutan yang disajikan
Modifier tidak dapat secara implisit mengakses atau mengubah argumen dan mengembalikan nilai fungsi yang mereka modifikasi.
Nilai-nilai mereka hanya dapat diberikan kepada mereka secara eksplisit pada saat permintaan.
+<<<<<<< HEAD
Pengembalian eksplisit dari modifier atau badan fungsi hanya meninggalkan modifier
atau badan fungsi saat ini. Variabel return ditetapkan dan aliran kontrol berlanjut
setelah ``_`` di modifier sebelumnya.
+=======
+In function modifiers, it is necessary to specify when you want the function to which the modifier is
+applied to be run. The placeholder statement (denoted by a single underscore character ``_``) is used to
+denote where the body of the function being modified should be inserted. Note that the
+placeholder operator is different from using underscores as leading or trailing characters in variable
+names, which is a stylistic choice.
+
+Explicit returns from a modifier or function body only leave the current
+modifier or function body. Return variables are assigned and
+control flow continues after the ``_`` in the preceding modifier.
+>>>>>>> english/develop
.. warning::
Dalam versi Solidity sebelumnya, pernyataan ``return`` dalam fungsi yang
@@ -124,8 +143,13 @@ Pengembalian eksplisit dari modifier dengan ``return;`` tidak memengaruhi nilai
Akan tetapi, modifier dapat memilih untuk tidak menjalankan isi fungsi sama sekali dan dalam hal ini variabel
yang dikembalikan disetel ke :ref:`default values` sama seperti jika fungsi memiliki isi kosong.
+<<<<<<< HEAD
Simbol ``_`` dapat muncul di modifier beberapa kali. Setiap kemunculan diganti
dengan fungsi body.
+=======
+The ``_`` symbol can appear in the modifier multiple times. Each occurrence is replaced with
+the function body, and the function returns the return value of the final occurrence.
+>>>>>>> english/develop
Ekspresi Arbitrary diperbolehkan untuk argumen modifier dan dalam konteks ini,
semua simbol yang terlihat dari fungsi terlihat di modifier.
diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst
index e39072505e..e8183bf0b6 100644
--- a/docs/contracts/functions.rst
+++ b/docs/contracts/functions.rst
@@ -1,4 +1,4 @@
-.. index:: ! functions
+.. index:: ! functions, ! function;free
.. _functions:
@@ -17,28 +17,37 @@ memanggil mereka, mirip dengan fungsi library internal.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.1 <0.9.0;
- function sum(uint[] memory _arr) pure returns (uint s) {
- for (uint i = 0; i < _arr.length; i++)
- s += _arr[i];
+ function sum(uint[] memory arr) pure returns (uint s) {
+ for (uint i = 0; i < arr.length; i++)
+ s += arr[i];
}
contract ArrayExample {
bool found;
- function f(uint[] memory _arr) public {
+ function f(uint[] memory arr) public {
// This calls the free function internally.
// The compiler will add its code to the contract.
- uint s = sum(_arr);
+ uint s = sum(arr);
require(s >= 10);
found = true;
}
}
.. note::
+<<<<<<< HEAD
Fungsi yang didefinisikan di luar kontrak masih selalu dijalankan dalam konteks kontrak. Mereka masih
memiliki akses ke variabel ``this``, dapat memanggil kontrak lain, mengirim mereka Ether dan menghancurkan
kontrak yang memanggil mereka, antara lain. Perbedaan utama pada fungsi yang didefinisikan di dalam kontrak
adalah bahwa fungsi bebas tidak memiliki akses langsung ke variabel storage dan fungsi tidak berada dalam
cakupannya.
+=======
+ Functions defined outside a contract are still always executed
+ in the context of a contract.
+ They still can call other contracts, send them Ether and destroy the contract that called them,
+ among other things. The main difference to functions defined inside a contract
+ is that free functions do not have direct access to the variable ``this``, storage variables and functions
+ not in their scope.
+>>>>>>> english/develop
.. _function-parameters-return-variables:
@@ -64,13 +73,14 @@ dengan dua integer, Anda akan menggunakan sesuatu seperti berikut:
contract Simple {
uint sum;
- function taker(uint _a, uint _b) public {
- sum = _a + _b;
+ function taker(uint a, uint b) public {
+ sum = a + b;
}
}
Parameter fungsi dapat digunakan sebagai variabel lokal lainnya dan mereka juga dapat ditugaskan.
+<<<<<<< HEAD
.. note::
Sebuah :ref:`external function` tidak dapat menerima
@@ -81,6 +91,8 @@ Parameter fungsi dapat digunakan sebagai variabel lokal lainnya dan mereka juga
Sebuah :ref:`internal function` dapat menerima
array multi-dimensi tanpa mengaktifkan fitur.
+=======
+>>>>>>> english/develop
.. index:: return array, return string, array, string, array of strings, dynamic array, variably sized array, return struct, struct
Variabel Return
@@ -98,13 +110,13 @@ yang diteruskan sebagai parameter fungsi, maka Anda menggunakan sesuatu seperti:
pragma solidity >=0.4.16 <0.9.0;
contract Simple {
- function arithmetic(uint _a, uint _b)
+ function arithmetic(uint a, uint b)
public
pure
- returns (uint o_sum, uint o_product)
+ returns (uint sum, uint product)
{
- o_sum = _a + _b;
- o_product = _a * _b;
+ sum = a + b;
+ product = a * b;
}
}
@@ -124,12 +136,12 @@ langsung dengan pernyataan ``return``:
pragma solidity >=0.4.16 <0.9.0;
contract Simple {
- function arithmetic(uint _a, uint _b)
+ function arithmetic(uint a, uint b)
public
pure
- returns (uint o_sum, uint o_product)
+ returns (uint sum, uint product)
{
- return (_a + _b, _a * _b);
+ return (a + b, a * b);
}
}
@@ -137,6 +149,7 @@ Jika Anda menggunakan ``return`` lebih awal untuk meninggalkan fungsi yang memil
Anda harus memberikan nilai return bersamaan dengan pernyataan return.
.. note::
+<<<<<<< HEAD
Anda tidak dapat mengembalikan beberapa tipe dari fungsi non-internal, terutama
array dan struct dinamis multi-dimensi. Jika Anda mengaktifkan
You cannot return some types from non-internal functions, notably
@@ -144,6 +157,18 @@ Anda harus memberikan nilai return bersamaan dengan pernyataan return.
ABI coder v2 dengan menambahkan ``pragma abicoder v2;`` ke file sumber Anda,
maka lebih banyak jenis yang tersedia, tetapi jenis ``mapping`` masih terbatas
di dalam satu kontrak dan Anda tidak dapat mentransfernya.
+=======
+ You cannot return some types from non-internal functions.
+ This includes the types listed below and any composite types that recursively contain them:
+
+ - mappings,
+ - internal function types,
+ - reference types with location set to ``storage``,
+ - multi-dimensional arrays (applies only to :ref:`ABI coder v1 `),
+ - structs (applies only to :ref:`ABI coder v1 `).
+
+ This restriction does not apply to library functions because of their different :ref:`internal ABI `.
+>>>>>>> english/develop
.. _multi-return:
@@ -255,7 +280,11 @@ Mengembalikan perubahan state tidak dianggap sebagai "modifikasi state", karena
state yang dibuat sebelumnya dalam kode yang tidak memiliki batasan ``view`` atau ``pure`` yang dikembalikan
dan kode tersebut memiliki opsi untuk menangkap ``revert`` dan tidak menyebarkannya.
+<<<<<<< HEAD
Perilaku ini juga sejalan dengan opcode ``STATICCALL``.
+=======
+This behavior is also in line with the ``STATICCALL`` opcode.
+>>>>>>> english/develop
.. warning::
Tidak mungkin untuk mencegah fungsi membaca state di level EVM,
@@ -279,7 +308,7 @@ Perilaku ini juga sejalan dengan opcode ``STATICCALL``.
Fungsi Spesial
==============
-.. index:: ! receive ether function, function;receive ! receive
+.. index:: ! receive ether function, function;receive, ! receive
.. _receive-ether-function:
@@ -293,6 +322,7 @@ Fungsi ini tidak dapat memiliki argumen, tidak dapat mengembalikan apa pun dan h
visibilitas ``eksternal`` dan mutabilitas state ``payable``.
Itu bisa virtual, dapat menimpa dan dapat memiliki modifiers.
+<<<<<<< HEAD
Fungsi terima dieksekusi pada panggilan
ke kontrak dengan calldata kosong. Ini adalah fungsi yang dijalankan
pada transfer Ether biasa (misalnya melalui ``.send()`` atau ``.transfer()``). Jika tidak ada
@@ -300,6 +330,16 @@ fungsi seperti itu, tetapi ada :ref:`fallback function `
yang harus dibayar, fungsi fallback akan dipanggil pada transfer Ether biasa. Jika
tidak ada Fungsi Terima Ehter maupun fungsi fallback yang dapat dibayarkan, kontrak
tidak dapat menerima Ether melalui transaksi reguler dan mengeluarkan eksepsi.
+=======
+The receive function is executed on a
+call to the contract with empty calldata. This is the function that is executed
+on plain Ether transfers (e.g. via ``.send()`` or ``.transfer()``). If no such
+function exists, but a payable :ref:`fallback function `
+exists, the fallback function will be called on a plain Ether transfer. If
+neither a receive Ether nor a payable fallback function is present, the
+contract cannot receive Ether through a transaction that does not represent a payable function call and throws an
+exception.
+>>>>>>> english/develop
Dalam kasus terburuk, fungsi ``receive`` hanya dapat mengandalkan 2300 gas yang
tersedia (misalnya ketika ``send`` atau ``transfer`` digunakan), menyisakan sedikit
@@ -312,6 +352,7 @@ Operasi berikut akan mengkonsumsi lebih banyak gas daripada 2300 tunjangan gas:
- Mengirim Ether
.. warning::
+<<<<<<< HEAD
Kontrak yang menerima Ether secara langsung (tanpa pemanggilan fungsi,
yaitu menggunakan ``send`` atau ``transfer``) tetapi tidak mendefinisikan
fungsi terima Ether atau fungsi payable fallback, melempar pengecualian,
@@ -319,6 +360,15 @@ Operasi berikut akan mengkonsumsi lebih banyak gas daripada 2300 tunjangan gas:
Jadi jika Anda ingin kontrak Anda menerima Ether, Anda harus mengimplementasikan
fungsi terima Ether (menggunakan fungsi payable fallback untuk menerima Ether
tidak disarankan, karena tidak akan gagal pada *interface confusions*).
+=======
+ When Ether is sent directly to a contract (without a function call, i.e. sender uses ``send`` or ``transfer``)
+ but the receiving contract does not define a receive Ether function or a payable fallback function,
+ an exception will be thrown, sending back the Ether (this was different
+ before Solidity v0.4.0). If you want your contract to receive Ether,
+ you have to implement a receive Ether function (using payable fallback functions for receiving Ether is
+ not recommended, since the fallback is invoked and would not fail for interface confusions
+ on the part of the sender).
+>>>>>>> english/develop
.. warning::
@@ -357,11 +407,19 @@ Di bawah ini Anda dapat melihat contoh kontrak Sink yang menggunakan fungsi ``re
Fungsi Fallback
---------------
+<<<<<<< HEAD
Kontrak dapat memiliki paling banyak satu fungsi ``fallback``, yang dideklarasikan
menggunakan ``fallback () external [payable]`` atau ``fallback (byte calldata _input)
external [payable] return (bytes memory _output)`` ( keduanya tanpa kata kunci ``fungsi``).
Fungsi ini harus memiliki visibilitas ``eksternal``. Fungsi fallback dapat berupa virtual,
dapat ditimpa, dan dapat memiliki modifier.
+=======
+A contract can have at most one ``fallback`` function, declared using either ``fallback () external [payable]``
+or ``fallback (bytes calldata input) external [payable] returns (bytes memory output)``
+(both without the ``function`` keyword).
+This function must have ``external`` visibility. A fallback function can be virtual, can override
+and can have modifiers.
+>>>>>>> english/develop
Fungsi fallback dijalankan pada panggilan ke kontrak jika tidak ada fungsi lain yang cocok
dengan tanda tangan fungsi yang diberikan, atau jika tidak ada data yang diberikan sama sekali
@@ -369,10 +427,16 @@ dan tidak ada :ref:`Fungsi terima Ether ` .
Fungsi fallback selalu menerima data, tetapi untuk juga menerima Eter, fungsi tersebut harus
ditandai ``dapat dibayar``.
+<<<<<<< HEAD
Jika versi dengan parameter digunakan, ``_input`` akan berisi data lengkap yang dikirim ke
kontrak (sama dengan ``msg.data``) dan dapat mengembalikan data dalam ``_output``. Data yang
dikembalikan tidak akan dikodekan ABI. Sebaliknya itu akan dikembalikan tanpa modifikasi
(bahkan padding sekalipun).
+=======
+If the version with parameters is used, ``input`` will contain the full data sent to the contract
+(equal to ``msg.data``) and can return data in ``output``. The returned data will not be
+ABI-encoded. Instead it will be returned without modifications (not even padding).
+>>>>>>> english/develop
Dalam kasus terburuk, jika fungsi payable fallback juga digunakan sebagai pengganti fungsi
penerimaan, itu hanya dapat mengandalkan 2300 gas yang tersedia (lihat :ref:`receive Ether
@@ -388,12 +452,22 @@ kompleks selama ada cukup gas yang diteruskan ke sana.
fungsi payablefallback untuk membedakan transfer Ether dari kebingungan antarmuka.
.. note::
+<<<<<<< HEAD
Jika Anda ingin mendekode data input, Anda dapat memeriksa empat byte pertama untuk
pemilih fungsi dan kemudian Anda dapat menggunakan ``abi.decode`` bersama dengan
sintaks slice array untuk mendekode data yang dikodekan ABI:
``(c, d) = abi.decode(_input[4:], (uint256, uint256));`` Perhatikan bahwa ini hanya
boleh digunakan sebagai pilihan terakhir dan fungsi yang tepat harus digunakan
sebagai gantinya.
+=======
+ If you want to decode the input data, you can check the first four bytes
+ for the function selector and then
+ you can use ``abi.decode`` together with the array slice syntax to
+ decode ABI-encoded data:
+ ``(c, d) = abi.decode(input[4:], (uint256, uint256));``
+ Note that this should only be used as a last resort and
+ proper functions should be used instead.
+>>>>>>> english/develop
.. code-block:: solidity
@@ -479,13 +553,13 @@ Contoh berikut menunjukkan overloading fungsi:
pragma solidity >=0.4.16 <0.9.0;
contract A {
- function f(uint _in) public pure returns (uint out) {
- out = _in;
+ function f(uint value) public pure returns (uint out) {
+ out = value;
}
- function f(uint _in, bool _really) public pure returns (uint out) {
- if (_really)
- out = _in;
+ function f(uint value, bool really) public pure returns (uint out) {
+ if (really)
+ out = value;
}
}
@@ -499,12 +573,12 @@ fungsi yang terlihat secara eksternal berbedaberdasarkan tipe Solidity-nya tetap
// This will not compile
contract A {
- function f(B _in) public pure returns (B out) {
- out = _in;
+ function f(B value) public pure returns (B out) {
+ out = value;
}
- function f(address _in) public pure returns (address out) {
- out = _in;
+ function f(address value) public pure returns (address out) {
+ out = value;
}
}
@@ -532,12 +606,12 @@ tepat satu kandidat, resolusi gagal.
pragma solidity >=0.4.16 <0.9.0;
contract A {
- function f(uint8 _in) public pure returns (uint8 out) {
- out = _in;
+ function f(uint8 val) public pure returns (uint8 out) {
+ out = val;
}
- function f(uint256 _in) public pure returns (uint256 out) {
- out = _in;
+ function f(uint256 val) public pure returns (uint256 out) {
+ out = val;
}
}
diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst
index 9e92c00c58..b235403b5a 100644
--- a/docs/contracts/inheritance.rst
+++ b/docs/contracts/inheritance.rst
@@ -38,7 +38,7 @@ Details are given in the following example.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
-
+ // This will report a warning due to deprecated selfdestruct
contract Owned {
constructor() { owner = payable(msg.sender); }
@@ -52,7 +52,7 @@ Details are given in the following example.
// accessed externally via `this`, though.
contract Destructible is Owned {
// The keyword `virtual` means that the function can change
- // its behaviour in derived classes ("overriding").
+ // its behavior in derived classes ("overriding").
function destroy() virtual public {
if (msg.sender == owner) selfdestruct(owner);
}
@@ -74,9 +74,9 @@ Details are given in the following example.
}
- // Multiple inheritance is possible. Note that `owned` is
+ // Multiple inheritance is possible. Note that `Owned` is
// also a base class of `Destructible`, yet there is only a single
- // instance of `owned` (as for virtual inheritance in C++).
+ // instance of `Owned` (as for virtual inheritance in C++).
contract Named is Owned, Destructible {
constructor(bytes32 name) {
Config config = Config(0xD5f9D8D94886E70b06E474c3fB14Fd43E2f23970);
@@ -113,7 +113,7 @@ Details are given in the following example.
// Here, we only specify `override` and not `virtual`.
// This means that contracts deriving from `PriceFeed`
- // cannot change the behaviour of `destroy` anymore.
+ // cannot change the behavior of `destroy` anymore.
function destroy() public override(Destructible, Named) { Named.destroy(); }
function get() public view returns(uint r) { return info; }
@@ -127,6 +127,7 @@ penghancuran. Cara ini bermasalah, seperti yang terlihat pada contoh berikut:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
+ // This will report a warning due to deprecated selfdestruct
contract owned {
constructor() { owner = payable(msg.sender); }
@@ -159,6 +160,7 @@ eksplisit dalam penggantian akhir, tetapi fungsi ini akan melewati
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
+ // This will report a warning due to deprecated selfdestruct
contract owned {
constructor() { owner = payable(msg.sender); }
@@ -276,8 +278,13 @@ Dalam pengertian ini, jalur override untuk tanda tangan adalah jalur melalui gra
pada kontrak yang sedang dipertimbangkan dan berakhir pada kontrak yang menyebutkan fungsi dengan tanda tangan
tersebut yang tidak menimpa.
+<<<<<<< HEAD
Jika Anda tidak menandai fungsi yang diganti sebagai ``virtual``, kontrak turunan tidak dapat lagi
mengubah perilaku fungsi tersebut.
+=======
+If you do not mark a function that overrides as ``virtual``, derived
+contracts can no longer change the behavior of that function.
+>>>>>>> english/develop
.. note::
@@ -377,8 +384,14 @@ secara eksplisit:
Konstruktor
============
+<<<<<<< HEAD
Konstruktor adalah fungsi opsional yang dideklarasikan dengan kata kunci ``constructor`` yang
dijalankan saat pembuatan kontrak, dan tempat Anda dapat menjalankan kode inisialisasi kontrak.
+=======
+A constructor is an optional function declared with the ``constructor`` keyword
+which is executed upon contract creation, and where you can run contract
+initialization code.
+>>>>>>> english/develop
Sebelum kode konstruktor dieksekusi, variabel state diinisialisasi ke nilai yang ditentukan jika
Anda menginisialisasinya secara inline, atau :ref:`nilai default` jika tidak.
@@ -399,8 +412,8 @@ dengan ``constructor() {}``. Sebagai contoh:
abstract contract A {
uint public a;
- constructor(uint _a) {
- a = _a;
+ constructor(uint a_) {
+ a = a_;
}
}
@@ -412,6 +425,7 @@ Anda dapat menggunakan parameter internal dalam konstruktor (misalnya pointer st
Dalam hal ini, kontrak harus ditandai sebagai :ref:`abstract `, karena
parameter ini tidak dapat diberi nilai valid dari luar tetapi hanya melalui konstruktor kontrak turunan.
+<<<<<<< HEAD
.. warning ::
Sebelum versi 0.4.22, konstruktor didefinisikan sebagai fungsi dengan nama yang sama dengan kontrak.
Sintaks ini tidak digunakan lagi dan tidak diizinkan lagi di versi 0.5.0.
@@ -419,9 +433,18 @@ parameter ini tidak dapat diberi nilai valid dari luar tetapi hanya melalui kons
.. warning ::
Sebelum versi 0.7.0, Anda harus menentukan visibilitas konstruktor sebagai
``internal`` atau ``publik``.
+=======
+.. warning::
+ Prior to version 0.4.22, constructors were defined as functions with the same name as the contract.
+ This syntax was deprecated and is not allowed anymore in version 0.5.0.
+
+.. warning::
+ Prior to version 0.7.0, you had to specify the visibility of constructors as either
+ ``internal`` or ``public``.
+>>>>>>> english/develop
-.. index:: ! base;constructor
+.. index:: ! base;constructor, inheritance list, contract;abstract, abstract contract
Argumen untuk Basis Konstruktor
================================
@@ -437,7 +460,7 @@ kontrak turunan perlu menentukan semuanya. Ini dapat dilakukan dengan dua cara:
contract Base {
uint x;
- constructor(uint _x) { x = _x; }
+ constructor(uint x_) { x = x_; }
}
// Either directly specify in the inheritance list...
@@ -445,11 +468,21 @@ kontrak turunan perlu menentukan semuanya. Ini dapat dilakukan dengan dua cara:
constructor() {}
}
- // or through a "modifier" of the derived constructor.
+ // or through a "modifier" of the derived constructor...
contract Derived2 is Base {
- constructor(uint _y) Base(_y * _y) {}
+ constructor(uint y) Base(y * y) {}
+ }
+
+ // or declare abstract...
+ abstract contract Derived3 is Base {
+ }
+
+ // and have the next concrete derived contract initialize it.
+ contract DerivedFromDerived is Derived3 {
+ constructor() Base(10 + 10) {}
}
+<<<<<<< HEAD
Salah satu caranya adalah langsung di daftar inheritance (``is Base(7)``). Cara yang lainnya
adalah modifier dipanggil sebagai bagian dari
konstruktor turunan (``Base(_y * _y)``). Cara pertama untuk
@@ -461,6 +494,26 @@ Menentukan argumen di kedua tempat adalah kesalahan.
Jika kontrak turunan tidak menentukan argumen untuk semua basis konstruktor
kontraknya, itu akan menjadi abstrak.
+=======
+One way is directly in the inheritance list (``is Base(7)``). The other is in
+the way a modifier is invoked as part of
+the derived constructor (``Base(y * y)``). The first way to
+do it is more convenient if the constructor argument is a
+constant and defines the behavior of the contract or
+describes it. The second way has to be used if the
+constructor arguments of the base depend on those of the
+derived contract. Arguments have to be given either in the
+inheritance list or in modifier-style in the derived constructor.
+Specifying arguments in both places is an error.
+
+If a derived contract does not specify the arguments to all of its base
+contracts' constructors, it must be declared abstract. In that case, when
+another contract derives from it, that other contract's inheritance list
+or constructor must provide the necessary parameters
+for all base classes that haven't had their parameters specified (otherwise,
+that other contract must be declared abstract as well). For example, in the above
+code snippet, see ``Derived3`` and ``DerivedFromDerived``.
+>>>>>>> english/develop
.. index:: ! inheritance;multiple, ! linearization, ! C3 linearization
@@ -548,9 +601,20 @@ Satu area di mana linearisasi pewarisan sangat penting dan mungkin tidak begitu
Mewarisi Berbagai Jenis Anggota dengan Nama Yang Sama
======================================================
+<<<<<<< HEAD
Ini adalah kesalahan ketika salah satu dari pasangan berikut dalam kontrak memiliki nama yang sama karena warisan:
- sebuah fungsi dan modifier
- sebuah fungsi dan event
- senuah event dan modifier
Sebagai pengecualian, state variabel getter dapat menimpa fungsi eksternal.
+=======
+The only situations where, due to inheritance, a contract may contain multiple definitions sharing
+the same name are:
+
+- Overloading of functions.
+- Overriding of virtual functions.
+- Overriding of external virtual functions by state variable getters.
+- Overriding of virtual modifiers.
+- Overloading of events.
+>>>>>>> english/develop
diff --git a/docs/contracts/interfaces.rst b/docs/contracts/interfaces.rst
index be930a3b07..8b7c8c355c 100644
--- a/docs/contracts/interfaces.rst
+++ b/docs/contracts/interfaces.rst
@@ -9,11 +9,19 @@ Interfaces
Interfaces mirip dengan kontrak abstrak, tetapi tidak dapat menerapkan fungsi apa pun.
Ada batasan lebih lanjut:
+<<<<<<< HEAD
- Mereka tidak bisa mewarisi dari kontrak lain, tetapi mereka bisa mewarisi dari interfaces lain.
- Semua fungsi yang dideklarasikan harus bersifat eksternal.
- Mereka tidak dapat mendeklarasikan konstruktor.
- Mereka tidak dapat mendeklarasikan variabel state.
- Mereka tidak dapat mendeklarasikan modifier.
+=======
+- They cannot inherit from other contracts, but they can inherit from other interfaces.
+- All declared functions must be external in the interface, even if they are public in the contract.
+- They cannot declare a constructor.
+- They cannot declare state variables.
+- They cannot declare modifiers.
+>>>>>>> english/develop
Beberapa pembatasan ini mungkin akan dicabut di masa mendatang.
@@ -64,7 +72,7 @@ pewarisan normal.
Tipe yang didefinisikan di dalam interface dan struktur seperti kontrak
lainnya dapat diakses dari kontrak lain: ``Token.TokenType`` atau ``Token.Coin``.
-.. warning:
+.. warning::
Interfaces telah mendukung jenis ``enum`` sejak :doc:`Solidity versi 0.5.0 <050-breaking-changes>`, pastikan
menetapkan versi pragma ini sebagai minimum.
diff --git a/docs/contracts/libraries.rst b/docs/contracts/libraries.rst
index d8ead79b74..2c46a45da9 100644
--- a/docs/contracts/libraries.rst
+++ b/docs/contracts/libraries.rst
@@ -22,6 +22,7 @@ khusus, tidak mungkin untuk menghancurkan library.
versi tersebut, library berisi :ref:`mekanisme` yang melarang fungsi state-modifying
dipanggil secara langsung (yaitu tanpa ``DELEGATECALL``).
+<<<<<<< HEAD
Perpustakaan dapat dilihat sebagai basis kontrak implisit dari kontrak yang menggunakannya.
Mereka tidak akan terlihat secara eksplisit dalam hierarki pewarisan, tetapi panggilan ke
fungsi library terlihat seperti panggilan ke fungsi eksplisit basis kontrak (menggunakan akses
@@ -32,6 +33,19 @@ memori ` akan diteruskan dengan referensi dan tidak disalin.
Untuk merealisasikan hal ini dalam EVM, kode fungsi library internal dan semua fungsi yang dipanggil
dari dalamnya pada waktu kompilasi akan dimasukkan dalam kontrak panggilan, dan panggilan ``JUMP`` biasa
akan digunakan sebagai pengganti ``DELEGATECALL``.
+=======
+Libraries can be seen as implicit base contracts of the contracts that use them.
+They will not be explicitly visible in the inheritance hierarchy, but calls
+to library functions look just like calls to functions of explicit base
+contracts (using qualified access like ``L.f()``).
+Of course, calls to internal functions
+use the internal calling convention, which means that all internal types
+can be passed and types :ref:`stored in memory ` will be passed by reference and not copied.
+To realize this in the EVM, the code of internal library functions
+that are called from a contract
+and all functions called from therein will at compile time be included in the calling
+contract, and a regular ``JUMP`` call will be used instead of a ``DELEGATECALL``.
+>>>>>>> english/develop
.. note::
Analogi inheritance rusak ketika datang ke fungsi publik.
@@ -136,16 +150,16 @@ fungsi eksternal:
r.limbs[0] = x;
}
- function add(bigint memory _a, bigint memory _b) internal pure returns (bigint memory r) {
- r.limbs = new uint[](max(_a.limbs.length, _b.limbs.length));
+ function add(bigint memory a, bigint memory b) internal pure returns (bigint memory r) {
+ r.limbs = new uint[](max(a.limbs.length, b.limbs.length));
uint carry = 0;
for (uint i = 0; i < r.limbs.length; ++i) {
- uint a = limb(_a, i);
- uint b = limb(_b, i);
+ uint limbA = limb(a, i);
+ uint limbB = limb(b, i);
unchecked {
- r.limbs[i] = a + b + carry;
+ r.limbs[i] = limbA + limbB + carry;
- if (a + b < a || (a + b == type(uint).max && carry > 0))
+ if (limbA + limbB < limbA || (limbA + limbB == type(uint).max && carry > 0))
carry = 1;
else
carry = 0;
@@ -162,8 +176,8 @@ fungsi eksternal:
}
}
- function limb(bigint memory _a, uint _limb) internal pure returns (uint) {
- return _limb < _a.limbs.length ? _a.limbs[_limb] : 0;
+ function limb(bigint memory a, uint index) internal pure returns (uint) {
+ return index < a.limbs.length ? a.limbs[index] : 0;
}
function max(uint a, uint b) private pure returns (uint) {
@@ -205,7 +219,7 @@ Dibandingkan dengan kontrak, library dibatasi dengan cara berikut:
(hal Ini mungkin akan diangkat di lain waktu.)
.. _library-selectors:
-.. index:: selector
+.. index:: ! selector; of a library function
Fungsi Tanda Tangan dan Selektor di library
===========================================
diff --git a/docs/contracts/using-for.rst b/docs/contracts/using-for.rst
index 15b666249c..1446e5a430 100644
--- a/docs/contracts/using-for.rst
+++ b/docs/contracts/using-for.rst
@@ -1,4 +1,4 @@
-.. index:: ! using for, library
+.. index:: ! using for, library, ! operator;user-defined, function;free
.. _using-for:
@@ -6,6 +6,7 @@
Using For
*********
+<<<<<<< HEAD
Direktif ``using A for B;`` dapat digunakan untuk melampirkan fungsi library
(dari library ``A``) ke tipe apa pun (``B``) dalam konteks sebuah kontrak.
Fungsi-fungsi ini akan menerima objek yang mereka panggil sebagai parameter
@@ -25,49 +26,148 @@ dalam kontrak, bukan di dalam fungsinya.
Mari kita tulis ulang set contoh dari
:ref:`libraries` dengan cara ini:
+=======
+The directive ``using A for B`` can be used to attach
+functions (``A``) as operators to user-defined value types
+or as member functions to any type (``B``).
+The member functions receive the object they are called on
+as their first parameter (like the ``self`` variable in Python).
+The operator functions receive operands as parameters.
+
+It is valid either at file level or inside a contract,
+at contract level.
+
+The first part, ``A``, can be one of:
+
+- A list of functions, optionally with an operator name assigned (e.g.
+ ``using {f, g as +, h, L.t} for uint``).
+ If no operator is specified, the function can be either a library function or a free function and
+ is attached to the type as a member function.
+ Otherwise it must be a free function and it becomes the definition of that operator on the type.
+- The name of a library (e.g. ``using L for uint``) -
+ all non-private functions of the library are attached to the type
+ as member functions
+
+At file level, the second part, ``B``, has to be an explicit type (without data location specifier).
+Inside contracts, you can also use ``*`` in place of the type (e.g. ``using L for *;``),
+which has the effect that all functions of the library ``L``
+are attached to *all* types.
+
+If you specify a library, *all* non-private functions in the library get attached,
+even those where the type of the first parameter does not
+match the type of the object. The type is checked at the
+point the function is called and function overload
+resolution is performed.
+
+If you use a list of functions (e.g. ``using {f, g, h, L.t} for uint``),
+then the type (``uint``) has to be implicitly convertible to the
+first parameter of each of these functions. This check is
+performed even if none of these functions are called.
+Note that private library functions can only be specified when ``using for`` is inside a library.
+
+If you define an operator (e.g. ``using {f as +} for T``), then the type (``T``) must be a
+:ref:`user-defined value type ` and the definition must be a ``pure`` function.
+Operator definitions must be global.
+The following operators can be defined this way:
+
++------------+----------+---------------------------------------------+
+| Category | Operator | Possible signatures |
++============+==========+=============================================+
+| Bitwise | ``&`` | ``function (T, T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``|`` | ``function (T, T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``^`` | ``function (T, T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``~`` | ``function (T) pure returns (T)`` |
++------------+----------+---------------------------------------------+
+| Arithmetic | ``+`` | ``function (T, T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``-`` | ``function (T, T) pure returns (T)`` |
+| + +---------------------------------------------+
+| | | ``function (T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``*`` | ``function (T, T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``/`` | ``function (T, T) pure returns (T)`` |
+| +----------+---------------------------------------------+
+| | ``%`` | ``function (T, T) pure returns (T)`` |
++------------+----------+---------------------------------------------+
+| Comparison | ``==`` | ``function (T, T) pure returns (bool)`` |
+| +----------+---------------------------------------------+
+| | ``!=`` | ``function (T, T) pure returns (bool)`` |
+| +----------+---------------------------------------------+
+| | ``<`` | ``function (T, T) pure returns (bool)`` |
+| +----------+---------------------------------------------+
+| | ``<=`` | ``function (T, T) pure returns (bool)`` |
+| +----------+---------------------------------------------+
+| | ``>`` | ``function (T, T) pure returns (bool)`` |
+| +----------+---------------------------------------------+
+| | ``>=`` | ``function (T, T) pure returns (bool)`` |
++------------+----------+---------------------------------------------+
+
+Note that unary and binary ``-`` need separate definitions.
+The compiler will choose the right definition based on how the operator is invoked.
+
+The ``using A for B;`` directive is active only within the current
+scope (either the contract or the current module/source unit),
+including within all of its functions, and has no effect
+outside of the contract or module in which it is used.
+
+When the directive is used at file level and applied to a
+user-defined type which was defined at file level in the same file,
+the word ``global`` can be added at the end. This will have the
+effect that the functions and operators are attached to the type everywhere
+the type is available (including other files), not only in the
+scope of the using statement.
+
+Let us rewrite the set example from the
+:ref:`libraries` section in this way, using file-level functions
+instead of library functions.
+>>>>>>> english/develop
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
- pragma solidity >=0.6.0 <0.9.0;
-
+ pragma solidity ^0.8.13;
- // This is the same code as before, just without comments
struct Data { mapping(uint => bool) flags; }
+ // Now we attach functions to the type.
+ // The attached functions can be used throughout the rest of the module.
+ // If you import the module, you have to
+ // repeat the using directive there, for example as
+ // import "flags.sol" as Flags;
+ // using {Flags.insert, Flags.remove, Flags.contains}
+ // for Flags.Data;
+ using {insert, remove, contains} for Data;
- library Set {
- function insert(Data storage self, uint value)
- public
- returns (bool)
- {
- if (self.flags[value])
- return false; // already there
- self.flags[value] = true;
- return true;
- }
+ function insert(Data storage self, uint value)
+ returns (bool)
+ {
+ if (self.flags[value])
+ return false; // already there
+ self.flags[value] = true;
+ return true;
+ }
- function remove(Data storage self, uint value)
- public
- returns (bool)
- {
- if (!self.flags[value])
- return false; // not there
- self.flags[value] = false;
- return true;
- }
+ function remove(Data storage self, uint value)
+ returns (bool)
+ {
+ if (!self.flags[value])
+ return false; // not there
+ self.flags[value] = false;
+ return true;
+ }
- function contains(Data storage self, uint value)
- public
- view
- returns (bool)
- {
- return self.flags[value];
- }
+ function contains(Data storage self, uint value)
+ view
+ returns (bool)
+ {
+ return self.flags[value];
}
contract C {
- using Set for Data; // this is the crucial change
Data knownValues;
function register(uint value) public {
@@ -79,12 +179,17 @@ Mari kita tulis ulang set contoh dari
}
}
+<<<<<<< HEAD
Dimungkinkan juga untuk memperluas tipe dasar dengan cara itu:
+=======
+It is also possible to extend built-in types in that way.
+In this example, we will use a library.
+>>>>>>> english/develop
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
- pragma solidity >=0.6.8 <0.9.0;
+ pragma solidity ^0.8.13;
library Search {
function indexOf(uint[] storage self, uint value)
@@ -97,27 +202,69 @@ Dimungkinkan juga untuk memperluas tipe dasar dengan cara itu:
return type(uint).max;
}
}
+ using Search for uint[];
contract C {
- using Search for uint[];
uint[] data;
function append(uint value) public {
data.push(value);
}
- function replace(uint _old, uint _new) public {
+ function replace(uint from, uint to) public {
// This performs the library function call
- uint index = data.indexOf(_old);
+ uint index = data.indexOf(from);
if (index == type(uint).max)
- data.push(_new);
+ data.push(to);
else
- data[index] = _new;
+ data[index] = to;
}
}
+<<<<<<< HEAD
Perhatikan bahwa semua panggilan library eksternal adalah panggilan
fungsi EVM yang sebenarnya. Ini berarti bahwa jika Anda melewatkan memori
atau tipe nilai, salinan akan dilakukan, bahkan untuk variabel ``self``. Satu-satunya situasi
di mana tidak ada salinan yang akan dilakukan adalah ketika variabel referensi penyimpanan
digunakan atau ketika fungsi library internal dipanggil.
+=======
+Note that all external library calls are actual EVM function calls. This means that
+if you pass memory or value types, a copy will be performed, even in case of the
+``self`` variable. The only situation where no copy will be performed
+is when storage reference variables are used or when internal library
+functions are called.
+
+Another example shows how to define a custom operator for a user-defined type:
+
+.. code-block:: solidity
+
+ // SPDX-License-Identifier: GPL-3.0
+ pragma solidity ^0.8.19;
+
+ type UFixed16x2 is uint16;
+
+ using {
+ add as +,
+ div as /
+ } for UFixed16x2 global;
+
+ uint32 constant SCALE = 100;
+
+ function add(UFixed16x2 a, UFixed16x2 b) pure returns (UFixed16x2) {
+ return UFixed16x2.wrap(UFixed16x2.unwrap(a) + UFixed16x2.unwrap(b));
+ }
+
+ function div(UFixed16x2 a, UFixed16x2 b) pure returns (UFixed16x2) {
+ uint32 a32 = UFixed16x2.unwrap(a);
+ uint32 b32 = UFixed16x2.unwrap(b);
+ uint32 result32 = a32 * SCALE / b32;
+ require(result32 <= type(uint16).max, "Divide overflow");
+ return UFixed16x2.wrap(uint16(a32 * SCALE / b32));
+ }
+
+ contract Math {
+ function avg(UFixed16x2 a, UFixed16x2 b) public pure returns (UFixed16x2) {
+ return (a + b) / UFixed16x2.wrap(200);
+ }
+ }
+>>>>>>> english/develop
diff --git a/docs/contracts/visibility-and-getters.rst b/docs/contracts/visibility-and-getters.rst
index 979dc49f61..4f50910d42 100644
--- a/docs/contracts/visibility-and-getters.rst
+++ b/docs/contracts/visibility-and-getters.rst
@@ -1,11 +1,14 @@
.. index:: ! visibility, external, public, private, internal
+.. |visibility-caveat| replace:: Making something ``private`` or ``internal`` only prevents other contracts from reading or modifying the information, but it will still be visible to the whole world outside of the blockchain.
+
.. _visibility-and-getters:
**********************
Visibility dan Getters
**********************
+<<<<<<< HEAD
Solidity mengetahui dua jenis panggilan fungsi: panggilan internal yang
tidak membuat panggilan EVM aktual (juga disebut "pesan panggilan") dan
panggilan eksternal yang dapat melakukannya. Karena itu, ada empat jenis
@@ -14,6 +17,36 @@ visibilitas untuk fungsi dan variabel state.
Fungsi harus ditentukan sebagai ``external``,
``public``, ``internal`` atau ``private``.
Untuk variabel state, ``external`` tidak dimungkinkan.
+=======
+State Variable Visibility
+=========================
+
+``public``
+ Public state variables differ from internal ones only in that the compiler automatically generates
+ :ref:`getter functions` for them, which allows other contracts to read their values.
+ When used within the same contract, the external access (e.g. ``this.x``) invokes the getter
+ while internal access (e.g. ``x``) gets the variable value directly from storage.
+ Setter functions are not generated so other contracts cannot directly modify their values.
+
+``internal``
+ Internal state variables can only be accessed from within the contract they are defined in
+ and in derived contracts.
+ They cannot be accessed externally.
+ This is the default visibility level for state variables.
+
+``private``
+ Private state variables are like internal ones but they are not visible in derived contracts.
+
+.. warning::
+ |visibility-caveat|
+
+Function Visibility
+===================
+
+Solidity knows two kinds of function calls: external ones that do create an actual EVM message call and internal ones that do not.
+Furthermore, internal functions can be made inaccessible to derived contracts.
+This gives rise to four types of visibility for functions.
+>>>>>>> english/develop
``external``
Fungsi eksternal adalah bagian dari antarmuka kontrak, yang berarti mereka
@@ -22,6 +55,7 @@ Untuk variabel state, ``external`` tidak dimungkinkan.
tetapi ``this.f()`` akan berfungsi).
``public``
+<<<<<<< HEAD
Fungsi publik adalah bagian dari antarmuka kontrak dan dapat dipanggil secara
internal atau melalui pesan. Untuk variabel state publik, fungsi getter otomatis
(lihat di bawah) dihasilkan.
@@ -43,6 +77,22 @@ Untuk variabel state, ``external`` tidak dimungkinkan.
hanya mencegah kontrak lain membaca atau mengubah informasi,
tetapi informasi itu masih akan terlihat oleh seluruh dunia
di luar blockchain.
+=======
+ Public functions are part of the contract interface
+ and can be either called internally or via message calls.
+
+``internal``
+ Internal functions can only be accessed from within the current contract
+ or contracts deriving from it.
+ They cannot be accessed externally.
+ Since they are not exposed to the outside through the contract's ABI, they can take parameters of internal types like mappings or storage references.
+
+``private``
+ Private functions are like internal ones but they are not visible in derived contracts.
+
+.. warning::
+ |visibility-caveat|
+>>>>>>> english/develop
Penentu visibilitas diberikan setelah jenis untuk
variabel state dan antara daftar parameter dan daftar
@@ -182,12 +232,12 @@ Contoh berikutnya lebih kompleks:
struct Data {
uint a;
bytes3 b;
- mapping (uint => uint) map;
+ mapping(uint => uint) map;
uint[3] c;
uint[] d;
bytes e;
}
- mapping (uint => mapping(bool => Data[])) public data;
+ mapping(uint => mapping(bool => Data[])) public data;
}
Ini menghasilkan fungsi dari bentuk berikut. Mapping dan array (dengan
diff --git a/docs/contributing.rst b/docs/contributing.rst
index d41407c398..c254f54087 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -2,10 +2,15 @@
Berkontribusi
#############
+<<<<<<< HEAD
Bantuan selalu diterima dan ada banyak pilihan bagaimana Anda dapat berkontribusi pada Solidity.
+=======
+Help is always welcome and there are plenty of options to contribute to Solidity.
+>>>>>>> english/develop
Secara khusus, kami menghargai dukungan di bidang-bidang berikut:
+<<<<<<< HEAD
* Melaporkan masalah.
* Memperbaiki dan menanggapi `Solidity's GitHub issues
`_, terutama yang ditandai sebagai
@@ -15,6 +20,17 @@ Secara khusus, kami menghargai dukungan di bidang-bidang berikut:
* Menerjemahkan dokumentasi ke lebih banyak bahasa.
* Menanggapi pertanyaan dari pengguna lain di `StackExchange
`_ dan `Solidity Gitter Chat
+=======
+* Reporting issues.
+* Fixing and responding to `Solidity's GitHub issues
+ `_, especially those tagged as
+ `"good first issue" `_ which are
+ meant as introductory issues for external contributors.
+* Improving the documentation.
+* `Translating `_ the documentation into more languages.
+* Responding to questions from other users on `StackExchange
+ `_ and the `Solidity Gitter Chat
+>>>>>>> english/develop
`_.
* Terlibat dalam proses desain bahasa dengan mengusulkan perubahan bahasa atau fitur baru di `Forum Solidity `_ dan memberikan masukan.
@@ -22,11 +38,16 @@ Untuk memulai, Anda dapat mencoba :ref:`building-from-source` untuk membiasakan
diri Anda dengan komponen Solidity dan proses build. Juga, mungkin
berguna untuk menjadi ahli dalam menulis kontrak pintar di Solidity.
+<<<<<<< HEAD
Harap diperhatikan bahwa proyek ini dirilis dengan `Kode Etik Kontributor `_. Dengan berpartisipasi dalam proyek ini - dalam masalah, permintaan tarik, atau saluran Gitter - Anda setuju untuk mematuhi persyaratannya.
+=======
+Please note that this project is released with a `Contributor Code of Conduct `_. By participating in this project — in the issues, pull requests, or Gitter channels — you agree to abide by its terms.
+>>>>>>> english/develop
Panggilan Tim
=============
+<<<<<<< HEAD
Jika Anda memiliki masalah atau menarik permintaan untuk didiskusikan, atau tertarik
untuk mendengar apa yang sedang dikerjakan oleh tim dan kontributor, Anda dapat bergabung
dengan panggilan tim publik kami:
@@ -35,6 +56,14 @@ dengan panggilan tim publik kami:
- Rabu pukul 14:00 CET/CEST.
Kedua panggilan berlangsung di `Jitsi `_.
+=======
+If you have issues or pull requests to discuss, or are interested in hearing what
+the team and contributors are working on, you can join our public team call:
+
+- Wednesdays at 3PM CET/CEST.
+
+The call takes place on `Jitsi `_.
+>>>>>>> english/develop
Cara Melaporkan Masalah
=======================
@@ -43,6 +72,7 @@ Untuk melaporkan masalah, silakan gunakan
`GitHub issue tracker `_. Saat
melaporkan masalah, harap sebutkan detail berikut:
+<<<<<<< HEAD
* Versi solidity.
* Kode sumber (jika ada).
* Sistem operasi.
@@ -51,6 +81,19 @@ melaporkan masalah, harap sebutkan detail berikut:
Mengurangi kode sumber yang menyebabkan masalah seminimal mungkin selalu
sangat membantu dan terkadang bahkan memperjelas kesalahpahaman.
+=======
+* Solidity version.
+* Source code (if applicable).
+* Operating system.
+* Steps to reproduce the issue.
+* Actual vs. expected behavior.
+
+Reducing the source code that caused the issue to a bare minimum is always
+very helpful, and sometimes even clarifies a misunderstanding.
+
+For technical discussions about language design, a post in the
+`Solidity forum `_ is the correct place (see :ref:`solidity_language_design`).
+>>>>>>> english/develop
Workflow untuk Pull Requests
============================
@@ -67,9 +110,15 @@ lebih mudah.
Selain itu, jika Anda menulis fitur baru, pastikan Anda menambahkan kasus uji yang sesuai
di bawah ``test/`` (lihat di bawah).
+<<<<<<< HEAD
Namun, jika Anda membuat perubahan yang lebih besar, silakan berkonsultasi dengan `Solidity Development Gitter channel
`_ (berbeda dari yang disebutkan di atas, yang ini adalah
berfokus pada kompiler dan pengembangan bahasa daripada penggunaan bahasa) terlebih dahulu.
+=======
+However, if you are making a larger change, please consult with the `Solidity Development Gitter channel
+`_ (different from the one mentioned above — this one is
+focused on compiler and language development instead of language usage) first.
+>>>>>>> english/develop
Fitur baru dan perbaikan bug harus ditambahkan ke file ``Changelog.md``: harap
ikuti gaya entri sebelumnya, jika berlaku.
@@ -79,7 +128,14 @@ Terakhir, pastikan Anda menghormati `gaya pengkodean
untuk proyek ini. Juga, meskipun kami melakukan pengujian CI, harap uji kode Anda dan
pastikan itu dibangun secara lokal sebelum mengirimkan permintaan pull.
+<<<<<<< HEAD
Terima kasih untuk bantuannya!
+=======
+We highly recommend going through our `review checklist `_ before submitting the pull request.
+We thoroughly review every PR and will help you get it right, but there are many common problems that can be easily avoided, making the review much smoother.
+
+Thank you for your help!
+>>>>>>> english/develop
Menjalankan Tes Compiler
==========================
@@ -87,6 +143,7 @@ Menjalankan Tes Compiler
Prasyarat
-------------
+<<<<<<< HEAD
Untuk menjalankan semua pengujian kompiler, Anda mungkin ingin menginstal beberapa dependensi secara
opsional (`evmone `_,
`libz3 `_, dan
@@ -96,28 +153,59 @@ Di macOS, beberapa skrip pengujian mengharapkan GNU coreutils diinstal.
Ini paling mudah dilakukan dengan menggunakan Homebrew: ``brew install coreutils``.
Menjalankan Tes
+=======
+For running all compiler tests you may want to optionally install a few
+dependencies (`evmone `_,
+`libz3 `_).
+
+On macOS systems, some of the testing scripts expect GNU coreutils to be installed.
+This can be easiest accomplished using Homebrew: ``brew install coreutils``.
+
+On Windows systems, make sure that you have a privilege to create symlinks,
+otherwise several tests may fail.
+Administrators should have that privilege, but you may also
+`grant it to other users `_
+or
+`enable Developer Mode `_.
+
+Running the Tests
+>>>>>>> english/develop
-----------------
Solidity mencakup berbagai jenis tes, kebanyakan dibundel ke dalam aplikasi ``soltest``
`Boost C++ Test Framework `_.
Jalankan ``build/test/soltest`` atau wrapper ``scripts/soltest.sh`` cukup untuk sebagian besar perubahan.
+<<<<<<< HEAD
Skrip ``./scripts/tests.sh`` menjalankan sebagian besar pengujian Solidity secara otomatis,
termasuk yang dibundel ke dalam `Boost C++ Test Framework `_
aplikasi ``soltest`` (atau pembungkusnya ``scripts/soltest.sh``), serta pengujian baris perintah dan
tes kompilasi.
+=======
+The ``./scripts/tests.sh`` script executes most Solidity tests automatically,
+including those bundled into the `Boost C++ Test Framework `_
+application ``soltest`` (or its wrapper ``scripts/soltest.sh``), as well as command-line tests and
+compilation tests.
+>>>>>>> english/develop
Sistem pengujian secara otomatis mencoba menemukan lokasi
`evmone `_ untuk menjalankan tes semantik.
+<<<<<<< HEAD
Library ``evmone`` harus ditempatkan di direktori ``deps`` atau ``deps/lib`` relatif terhadap
direktori kerja saat ini, ke induknya atau induknya. Atau lokasi eksplisit
untuk objek bersama ``evmone`` dapat ditentukan melalui environment variable ``ETH_EVMONE``.
+=======
+The ``evmone`` library must be located in the ``deps`` or ``deps/lib`` directory relative to the
+current working directory, to its parent or its parent's parent. Alternatively, an explicit location
+for the ``evmone`` shared object can be specified via the ``ETH_EVMONE`` environment variable.
+>>>>>>> english/develop
``evmone`` diperlukan terutama untuk menjalankan tes semantik dan gas.
Jika Anda belum menginstalnya, Anda dapat melewati pengujian ini dengan meneruskan flag ``--no-semantic-tests``
ke ``scripts/soltest.sh``.
+<<<<<<< HEAD
Menjalankan tes Ewasm dinonaktifkan secara default dan dapat diaktifkan secara eksplisit
melalui ``./scripts/soltest.sh --ewasm`` dan membutuhkan `hera `_
untuk dapat ditemukan oleh ``soltest``.
@@ -126,6 +214,10 @@ variabel untuk menentukan lokasi eksplisit disebut ``ETH_HERA``.
Library ``evmone`` dan ``hera`` harus diakhiri dengan nama file
ekstensi ``.so`` di Linux, ``.dll`` di sistem Windows dan ``.dylib`` di macOS.
+=======
+The ``evmone`` library should end with the file name
+extension ``.so`` on Linux, ``.dll`` on Windows systems and ``.dylib`` on macOS.
+>>>>>>> english/develop
Untuk menjalankan pengujian SMT, library ``libz3`` harus diinstal dan dapat ditemukan
oleh ``cmake`` selama tahap konfigurasi kompiler.
@@ -135,7 +227,7 @@ Tes SMT dengan mengekspor ``SMT_FLAGS=--no-smt`` sebelum menjalankan ``./scripts
menjalankan ``./scripts/soltest.sh --no-smt``.
Pengujian ini adalah ``libsolidity/smtCheckerTests`` dan ``libsolidity/smtCheckerTestsJSON``.
-.. note ::
+.. note::
Untuk mendapatkan daftar semua pengujian unit yang dijalankan oleh Soltest, jalankan ``./build/test/soltest --list_content=HRF``.
@@ -156,14 +248,20 @@ Lihat terutama:
- `run_test (-t) `_ to run specific tests cases, and
- `report-level (-r) `_ give a more detailed report.
-.. note ::
+.. note::
Mereka yang bekerja di lingkungan Windows yang ingin menjalankan set dasar di atas
tanpa libz3. Menggunakan Git Bash, Anda menggunakan: ``./build/test/Release/soltest.exe -- --no-smt``.
Jika Anda menjalankan ini di Command Prompt biasa, gunakan ``.\build\test\Release\soltest.exe -- --no-smt``.
+<<<<<<< HEAD
Jika Anda ingin men-debug menggunakan GDB, pastikan Anda membangun yang berbeda dari "biasa".
Misalnya, Anda dapat menjalankan perintah berikut di folder ``build`` Anda:
+=======
+If you want to debug using GDB, make sure you build differently than the "usual".
+For example, you could run the following command in your ``build`` folder:
+
+>>>>>>> english/develop
.. code-block:: bash
cmake -DCMAKE_BUILD_TYPE=Debug ..
@@ -234,12 +332,21 @@ menyediakan cara untuk mengedit, memperbarui atau melewati file kontrak saat ini
Ini menawarkan beberapa opsi untuk tes yang gagal:
+<<<<<<< HEAD
- ``edit``: ``isoltest`` mencoba membuka kontrak di editor sehingga Anda dapat menyesuaikannya. Itu bisa menggunakan editor yang diberikan pada baris perintah (sebagai ``isoltest --editor /path/to/editor``), dalam environment variable ``EDITOR`` atau hanya ``/usr/bin/editor`` ( dalam urutan itu).
- ``update``: Memperbarui ekspektasi untuk kontrak yang sedang diuji. Ini memperbarui anotasi dengan menghapus harapan yang tidak terpenuhi dan menambahkan harapan yang hilang. Tes kemudian dijalankan lagi.
- ``skip``: Melewati eksekusi tes khusus ini.
- ``quit``: Keluar ``isoltest``.
Semua opsi ini berlaku untuk kontrak saat ini, mengharapkan ``quit`` yang menghentikan seluruh proses pengujian.
+=======
+- ``edit``: ``isoltest`` tries to open the contract in an editor so you can adjust it. It either uses the editor given on the command-line (as ``isoltest --editor /path/to/editor``), in the environment variable ``EDITOR`` or just ``/usr/bin/editor`` (in that order).
+- ``update``: Updates the expectations for contract under test. This updates the annotations by removing unmet expectations and adding missing expectations. The test is then run again.
+- ``skip``: Skips the execution of this particular test.
+- ``quit``: Quits ``isoltest``.
+
+All of these options apply to the current contract, except ``quit`` which stops the entire testing process.
+>>>>>>> english/develop
Secara otomatis memperbarui tes di atas mengubahnya menjadi
@@ -264,6 +371,62 @@ dan menjalankan kembali tes. Sekarang lewat lagi:
Jangan memasukkan lebih dari satu kontrak ke dalam satu file, kecuali Anda sedang menguji inheritance atau cross-contract calls.
Setiap file harus menguji satu aspek dari fitur baru Anda.
+Command-line Tests
+------------------
+
+Our suite of end-to-end command-line tests checks the behaviour of the compiler binary as a whole
+in various scenarios.
+These tests are located in `test/cmdlineTests/ `_,
+one per subdirectory, and can be executed using the ``cmdlineTests.sh`` script.
+
+By default the script runs all available tests.
+You can also provide one or more `file name patterns `_,
+in which case only the tests matching at least one pattern will be executed.
+It is also possible to exclude files matching a specific pattern by prefixing it with ``--exclude``.
+
+By default the script assumes that a ``solc`` binary is available inside the ``build/`` subdirectory
+inside the working copy.
+If you build the compiler outside of the source tree, you can use the ``SOLIDITY_BUILD_DIR`` environment
+variable to specify a different location for the build directory.
+
+Example:
+
+.. code-block:: bash
+
+ export SOLIDITY_BUILD_DIR=~/solidity/build/
+ test/cmdlineTests.sh "standard_*" "*_yul_*" --exclude "standard_yul_*"
+
+The commands above will run tests from directories starting with ``test/cmdlineTests/standard_`` and
+subdirectories of ``test/cmdlineTests/`` that have ``_yul_`` somewhere in the name,
+but no test whose name starts with ``standard_yul_`` will be executed.
+It will also assume that the file ``solidity/build/solc/solc`` inside your home directory is the
+compiler binary (unless you are on Windows -- then ``solidity/build/solc/Release/solc.exe``).
+
+There are several kinds of command-line tests:
+
+- *Standard JSON test*: contains at least an ``input.json`` file.
+ In general may contain:
+
+ - ``input.json``: input file to be passed to the ``--standard-json`` option on the command line.
+ - ``output.json``: expected Standard JSON output.
+ - ``args``: extra command-line arguments passed to ``solc``.
+
+- *CLI test*: contains at least an ``input.*`` file (other than ``input.json``).
+ In general may contain:
+
+ - ``input.*``: a single input file, whose name will be supplied to ``solc`` on the command line.
+ Usually ``input.sol`` or ``input.yul``.
+ - ``args``: extra command-line arguments passed to ``solc``.
+ - ``stdin``: content to be passed to ``solc`` via standard input.
+ - ``output``: expected content of the standard output.
+ - ``err``: expected content of the standard error output.
+ - ``exit``: expected exit code. If not provided, zero is expected.
+
+- *Script test*: contains a ``test.*`` file.
+ In general may contain:
+
+ - ``test.*``: a single script to run, usually ``test.sh`` or ``test.py``.
+ The script must be executable.
Menjalankan Fuzzer melalui AFL
==============================
@@ -286,7 +449,11 @@ Selanjutnya, buat Solidity (atau hanya biner ``solfuzzer``) dengan AFL sebagai k
cmake .. -DCMAKE_C_COMPILER=path/to/afl-gcc -DCMAKE_CXX_COMPILER=path/to/afl-g++
make solfuzzer
+<<<<<<< HEAD
Pada tahap ini Anda seharusnya dapat melihat pesan yang mirip dengan berikut ini:
+=======
+At this stage, you should be able to see a message similar to the following:
+>>>>>>> english/develop
.. code-block:: text
@@ -341,11 +508,19 @@ dari dokumentasi atau tes lainnya:
# extract from documentation:
path/to/solidity/scripts/isolate_tests.py path/to/solidity/docs
+<<<<<<< HEAD
Dokumentasi AFL menyatakan bahwa corpus (file input awal) tidak boleh
terlalu besar. File itu sendiri tidak boleh lebih besar dari 1 kB dan harus ada
paling banyak satu file input per fungsionalitas, jadi lebih baik mulai dengan jumlah kecil.
Ada juga alat yang disebut ``afl-cmin`` yang dapat memangkas file input
yang menghasilkan perilaku biner yang serupa.
+=======
+The AFL documentation states that the corpus (the initial input files) should not be
+too large. The files themselves should not be larger than 1 kB and there should be
+at most one input file per functionality, so better start with a small number of.
+There is also a tool called ``afl-cmin`` that can trim input files
+that result in similar behavior of the binary.
+>>>>>>> english/develop
Sekarang jalankan fuzzer (``-m`` menambah ukuran memori hingga 60 MB):
@@ -392,6 +567,7 @@ dokumentasi untuk Solidity.
Bahasa Inggris
----------------
+<<<<<<< HEAD
Gunakan bahasa Inggris, dengan ejaan bahasa Inggris British lebih disukai, kecuali menggunakan nama proyek atau merek. Cobalah untuk mengurangi
penggunaan bahasa gaul dan referensi lokal, buat bahasa Anda sejelas mungkin untuk semua pembaca. Di bawah ini adalah beberapa referensi untuk membantu:
@@ -405,6 +581,20 @@ penggunaan bahasa gaul dan referensi lokal, buat bahasa Anda sejelas mungkin unt
Walaupun dokumentasi resmi Solidity ditulis dalam bahasa Inggris, ada kontribusi komunitas :ref:`translations`
dalam bahasa lain yang tersedia. Silakan merujuk ke `panduan terjemahan `_
untuk informasi tentang bagaimana berkontribusi pada terjemahan komunitas.
+=======
+Use International English, unless using project or brand names. Try to reduce the usage of
+local slang and references, making your language as clear to all readers as possible.
+Below are some references to help:
+
+* `Simplified technical English `_
+* `International English `_
+
+.. note::
+
+ While the official Solidity documentation is written in English, there are community contributed :ref:`translations`
+ in other languages available. Please refer to the `translation guide `_
+ for information on how to contribute to the community translations.
+>>>>>>> english/develop
Judul Kasus untuk Judul
-----------------------
@@ -469,6 +659,7 @@ Misalnya ``pragma solidity >=0.4.0 <0.9.0;``.
Menjalankan Tes Dokumentasi
---------------------------
+<<<<<<< HEAD
Pastikan kontribusi Anda lulus uji dokumentasi kami dengan menjalankan ``./scripts/docs.sh`` yang menginstal dependensi
yang diperlukan untuk dokumentasi dan memeriksa masalah apa pun seperti tautan rusak atau masalah sintaksis.
@@ -477,6 +668,18 @@ Desain Bahasa Solidity
Untuk secara aktif terlibat dalam proses desain bahasa dan berbagi ide Anda tentang masa depan Solidity,
silakan bergabung dengan `forum Solidity `_.
+=======
+Make sure your contributions pass our documentation tests by running ``./docs/docs.sh`` that installs dependencies
+needed for documentation and checks for any problems such as broken links or syntax issues.
+
+.. _solidity_language_design:
+
+Solidity Language Design
+========================
+
+To actively get involved in the language design process and to share your ideas concerning the future of Solidity,
+please join the `Solidity forum `_.
+>>>>>>> english/develop
Forum Solidity berfungsi sebagai tempat untuk mengusulkan dan mendiskusikan fitur bahasa baru dan implementasinya di
tahap awal ide atau modifikasi fitur yang ada.
@@ -490,11 +693,20 @@ fitur yang dipilih diperdebatkan secara rinci. Undangan untuk panggilan tersebut
Kami juga membagikan survei umpan balik dan konten lain yang relevan dengan desain bahasa di forum.
+<<<<<<< HEAD
Jika Anda ingin mengetahui posisi tim dalam hal atau menerapkan fitur baru, Anda dapat mengikuti status implementasi di `Solidity Github project `_.
Masalah dalam backlog desain memerlukan spesifikasi lebih lanjut dan akan dibahas dalam panggilan desain bahasa atau dalam panggilan tim reguler. Anda dapat
melihat perubahan yang akan datang untuk rilis terbaru berikutnya dengan mengubah dari default branch (`develop`) ke `breaking branch `_.
Untuk kasus dan pertanyaan ad-hoc, Anda dapat menghubungi kami melalui `Solidity-dev Gitter channel `_,
ruang obrolan khusus untuk percakapan seputar kompiler Solidity dan pengembangan bahasa.
+=======
+If you want to know where the team is standing in terms or implementing new features, you can follow the implementation status in the `Solidity GitHub project `_.
+Issues in the design backlog need further specification and will either be discussed in a language design call or in a regular team call. You can
+see the upcoming changes for the next breaking release by changing from the default branch (`develop`) to the `breaking branch `_.
+
+For ad-hoc cases and questions, you can reach out to us via the `Solidity-dev Gitter channel `_ — a
+dedicated chatroom for conversations around the Solidity compiler and language development.
+>>>>>>> english/develop
Kami senang mendengar pendapat Anda tentang bagaimana kami dapat meningkatkan proses desain bahasa menjadi lebih kolaboratif dan transparan.
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 7b79df59d7..e3f34948a2 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -144,8 +144,13 @@ sendiri mengeluarkan pengecualian atau kehabisan gas.
dengan menggunakan ``f.value(x).gas(g)()``. Ini tidak digunakan lagi di Solidity 0.6.2
dan tidak mungkin lagi sejak Solidity 0.7.0.
+<<<<<<< HEAD
Panggilan Bernama dan Parameter Fungsi Anonim
---------------------------------------------
+=======
+Function Calls with Named Parameters
+------------------------------------
+>>>>>>> english/develop
Argumen pemanggilan fungsi dapat diberikan berdasarkan nama, dalam urutan apa pun,
jika diapit dalam ``{ }`` seperti yang dapat dilihat pada contoh berikut.
@@ -167,14 +172,23 @@ tetapi bisa dalam urutan arbitrer.
function set(uint key, uint value) public {
data[key] = value;
}
-
}
+<<<<<<< HEAD
Nama Parameter Fungsi yang Dihilangkan
--------------------------------------
Nama parameter yang tidak digunakan (terutama parameter pengembalian) dapat dihilangkan.
Parameter tersebut akan tetap ada pada stack, tetapi tidak dapat diakses.
+=======
+Omitted Names in Function Definitions
+-------------------------------------
+
+The names of parameters and return values in the function declaration can be omitted.
+Those items with omitted names will still be present on the stack, but they are
+inaccessible by name. An omitted return value name
+can still return a value to the caller by use of the ``return`` statement.
+>>>>>>> english/develop
.. code-block:: solidity
@@ -276,7 +290,7 @@ yang hanya perlu dibuat jika terjadi perselisihan.
salt,
keccak256(abi.encodePacked(
type(D).creationCode,
- arg
+ abi.encode(arg)
))
)))));
@@ -356,15 +370,26 @@ misalnya yang berikut ini tidaklah valid: ``(x, uint y) = (1, 2);``
jadi kedua belah pihak harus memiliki jumlah komponen yang sama.
.. warning::
+<<<<<<< HEAD
Berhati-hatilah saat menetapkan ke beberapa variabel pada saat yang
sama ketika tipe referensi terlibat, karena dapat menyebabkan perilaku
penyalinan yang tidak terduga.
+=======
+ Be careful when assigning to multiple variables at the same time when
+ reference types are involved, because it could lead to unexpected
+ copying behavior.
+>>>>>>> english/develop
Komplikasi untuk Array dan Struct
---------------------------------
+<<<<<<< HEAD
Semantik assignments lebih rumit untuk tipe non-value seperti array dan struct,
termasuk ``byte`` dan ``string``, lihat :ref:`Lokasi data dan perilaku assignments ` untuk detailnya.
+=======
+The semantics of assignments are more complicated for non-value types like arrays and structs,
+including ``bytes`` and ``string``, see :ref:`Data location and assignment behavior ` for details.
+>>>>>>> english/develop
Pada contoh di bawah, panggilan ke ``g(x)`` tidak berpengaruh pada ``x`` karena
panggilan tersebut membuat salinan independen dari nilai penyimpanan di memori.
@@ -503,7 +528,11 @@ pemeriksaan tambahan.
Sejak Solidity 0.8.0, semua operasi aritmatika kembali ke over- dan underflow secara default,
sehingga membuat penggunaan libraries ini tidak perlu.
+<<<<<<< HEAD
Untuk mendapatkan perilaku sebelumnya, blok ``unchecked`` dapat digunakan:
+=======
+To obtain the previous behavior, an ``unchecked`` block can be used:
+>>>>>>> english/develop
.. code-block:: solidity
@@ -636,9 +665,15 @@ dalam situasi berikut:
Pengubah ``payable`` (termasuk konstruktor dan fungsi fallback).
#. Jika kontrak Anda menerima Ether melalui fungsi getter publik.
+<<<<<<< HEAD
Untuk kasus berikut, data kesalahan dari panggilan eksternal
(jika disediakan) diteruskan. Ini berarti bahwa hal itu dapat menyebabkan
sebuah `Error` atau `Panic` (atau apa pun yang diberikan):
+=======
+For the following cases, the error data from the external call
+(if provided) is forwarded. This means that it can either cause
+an ``Error`` or a ``Panic`` (or whatever else was given):
+>>>>>>> english/develop
#. Jika sebuah ``.transfer()`` gagal.
#. Jika Anda memanggil suatu fungsi melalui panggilan pesan tetapi tidak selesai
@@ -673,7 +708,7 @@ dan ``assert`` untuk pemeriksaan kesalahan internal.
addr.transfer(msg.value / 2);
// Since transfer throws an exception on failure and
// cannot call back here, there should be no way for us to
- // still have half of the money.
+ // still have half of the Ether.
assert(address(this).balance == balanceBeforeTransfer - msg.value / 2);
return address(this).balance;
}
@@ -687,8 +722,13 @@ karena efek yang diharapkan tidak terjadi. Karena kami ingin menjaga atomisitas
tindakan teraman adalah mengembalikan semua perubahan dan membuat seluruh transaksi (atau
setidaknya panggilan) tanpa efek.
+<<<<<<< HEAD
Dalam kedua kasus, pemanggil dapat bereaksi pada kegagalan tersebut menggunakan ``try``/``catch``, tetapi
perubahan pada pemanggil akan selalu dikembalikan.
+=======
+In both cases, the caller can react on such failures using ``try``/``catch``, but
+the changes in the callee will always be reverted.
+>>>>>>> english/develop
.. note::
@@ -707,8 +747,13 @@ Pernyataan ``revert`` mengambil kesalahan khusus sebagai argumen langsung tanpa
revert CustomError(arg1, arg2);
+<<<<<<< HEAD
Untuk alasan backwards-compatibility, ada juga fungsi ``revert()``, yang menggunakan tanda kurung
dan menerima string:
+=======
+For backward-compatibility reasons, there is also the ``revert()`` function, which uses parentheses
+and accepts a string:
+>>>>>>> english/develop
revert();
revert("description");
@@ -848,8 +893,13 @@ jenis kesalahan:
``catch { ... }`` (bahkan sebagai satu-satunya klausa catch) alih-alih klausa sebelumnya.
+<<<<<<< HEAD
Direncanakan untuk mendukung jenis data kesalahan lainnya di masa mendatang.
String ``Error`` dan ``Panic`` saat ini diuraikan apa adanya dan tidak diperlakukan sebagai identifiers.
+=======
+It is planned to support other types of error data in the future.
+The strings ``Error`` and ``Panic`` are currently parsed as is and are not treated as identifiers.
+>>>>>>> english/develop
Untuk menangkap semua kasus kesalahan, Anda harus memiliki setidaknya klausa
``catch { ...}`` atau klausa ``catch (byte memory lowLevelData) { ... }``.
@@ -872,8 +922,19 @@ dalam cakupan di blok berikut.
kegagalan decoding seperti disebutkan di atas atau karena tidak menyediakan klausa catch level rendah).
.. note::
+<<<<<<< HEAD
Alasan di balik panggilan yang gagal bisa bermacam-macam. Jangan berasumsi bahwa pesan kesalahan datang langsung dari
kontrak yang dipanggil: Kesalahan mungkin terjadi lebih dalam di rantai panggilan dan kontrak yang dipanggil baru saja
meneruskannya. Juga, bisa jadi karena situasi out-of-gas dan bukan kondisi kesalahan yang disengaja: Penelepon selalu
mempertahankan 63/64 gas dalam panggilan dan dengan demikian bahkan jika kontrak yang dipanggil kehabisan gas, pemanggil
masih memiliki sisa gas.
+=======
+ The reason behind a failed call can be manifold. Do not assume that
+ the error message is coming directly from the called contract:
+ The error might have happened deeper down in the call chain and the
+ called contract just forwarded it. Also, it could be due to an
+ out-of-gas situation and not a deliberate error condition:
+ The caller always retains at least 1/64th of the gas in a call and thus
+ even if the called contract goes out of gas, the caller still
+ has some gas left.
+>>>>>>> english/develop
diff --git a/docs/docs.sh b/docs/docs.sh
new file mode 100755
index 0000000000..f2c5667612
--- /dev/null
+++ b/docs/docs.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+#------------------------------------------------------------------------------
+# Bash script to build the Solidity Sphinx documentation locally.
+#
+# The documentation for solidity is hosted at:
+#
+# https://docs.soliditylang.org
+#
+# ------------------------------------------------------------------------------
+# This file is part of solidity.
+#
+# solidity is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# solidity is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with solidity. If not, see
+#
+# (c) 2016 solidity contributors.
+#------------------------------------------------------------------------------
+
+set -euo pipefail
+
+script_dir="$(dirname "$0")"
+
+cd "${script_dir}"
+pip3 install -r requirements.txt --upgrade --upgrade-strategy eager
+sphinx-build -nW -b html -d _build/doctrees . _build/html
diff --git a/docs/examples/blind-auction.rst b/docs/examples/blind-auction.rst
index 1668b1d8f7..bdaaf81af3 100644
--- a/docs/examples/blind-auction.rst
+++ b/docs/examples/blind-auction.rst
@@ -16,6 +16,7 @@ melihat tawaran yang sebenarnya sampai periode penawaran berakhir.
Lelang Terbuka Sederhana (Simple Open Auction)
==============================================
+<<<<<<< HEAD
Gagasan umum dari kontrak lelang sederhana berikut
adalah bahwa setiap orang dapat mengirimkan penawaran
mereka selama masa penawaran. Tawaran sudah termasuk
@@ -24,6 +25,14 @@ Jika tawaran tertinggi dinaikkan, penawar tertinggi sebelumnya
mendapatkan uang mereka kembali. Setelah akhir periode penawaran,
kontrak harus dipanggil secara manual agar penerima menerima
uang mereka - kontrak tidak dapat mengaktifkan dirinya sendiri.
+=======
+The general idea of the following simple auction contract is that everyone can
+send their bids during a bidding period. The bids already include sending some compensation,
+e.g. Ether, in order to bind the bidders to their bid. If the highest bid is
+raised, the previous highest bidder gets their Ether back. After the end of
+the bidding period, the contract has to be called manually for the beneficiary
+to receive their Ether - contracts cannot activate themselves.
+>>>>>>> english/develop
.. code-block:: solidity
@@ -95,19 +104,19 @@ uang mereka - kontrak tidak dapat mengaktifkan dirinya sendiri.
revert AuctionAlreadyEnded();
// If the bid is not higher, send the
- // money back (the revert statement
+ // Ether back (the revert statement
// will revert all changes in this
// function execution including
- // it having received the money).
+ // it having received the Ether).
if (msg.value <= highestBid)
revert BidNotHighEnough(highestBid);
if (highestBid != 0) {
- // Sending back the money by simply using
+ // Sending back the Ether by simply using
// highestBidder.send(highestBid) is a security risk
// because it could execute an untrusted contract.
// It is always safer to let the recipients
- // withdraw their money themselves.
+ // withdraw their Ether themselves.
pendingReturns[highestBidder] += highestBid;
}
highestBidder = msg.sender;
@@ -124,6 +133,9 @@ uang mereka - kontrak tidak dapat mengaktifkan dirinya sendiri.
// before `send` returns.
pendingReturns[msg.sender] = 0;
+ // msg.sender is not of type `address payable` and must be
+ // explicitly converted using `payable(msg.sender)` in order
+ // use the member function `send()`.
if (!payable(msg.sender).send(amount)) {
// No need to call throw here, just reset the amount owing
pendingReturns[msg.sender] = amount;
@@ -172,6 +184,7 @@ Keuntungan dari pelelangan buta adalah tidak ada tekanan waktu menjelang akhir p
Membuat pelelangan buta pada platform komputasi transparan mungkin terdengar seperti kontradiksi,
tetapi kriptografi datang untuk menyelamatkan.
+<<<<<<< HEAD
Selama **periode penawaran**, bidder tidak benar-benar mengirimkan penawaran mereka,
tetapi hanya versi hash dari penawaran tersebut. Karena saat ini secara praktis
dianggap tidak mungkin untuk menemukan dua nilai (cukup panjang)
@@ -191,6 +204,27 @@ selama fase pengungkapan, beberapa tawaran mungkin **tidak valid**, dan ini dise
tanda eksplisit untuk menempatkan tawaran yang tidak valid dengan transfer bernilai tinggi): Penawar
dapat mengacaukan persaingan dengan menempatkan beberapa tawaran yang tidak valid,
tinggi maupun rendah.
+=======
+During the **bidding period**, a bidder does not actually send their bid, but
+only a hashed version of it. Since it is currently considered practically
+impossible to find two (sufficiently long) values whose hash values are equal,
+the bidder commits to the bid by that. After the end of the bidding period,
+the bidders have to reveal their bids: They send their values unencrypted, and
+the contract checks that the hash value is the same as the one provided during
+the bidding period.
+
+Another challenge is how to make the auction **binding and blind** at the same
+time: The only way to prevent the bidder from just not sending the Ether after
+they won the auction is to make them send it together with the bid. Since value
+transfers cannot be blinded in Ethereum, anyone can see the value.
+
+The following contract solves this problem by accepting any value that is
+larger than the highest bid. Since this can of course only be checked during
+the reveal phase, some bids might be **invalid**, and this is on purpose (it
+even provides an explicit flag to place invalid bids with high-value
+transfers): Bidders can confuse competition by placing several high or low
+invalid bids.
+>>>>>>> english/develop
.. code-block:: solidity
diff --git a/docs/examples/micropayment.rst b/docs/examples/micropayment.rst
index 6de5eaae85..f19c94263b 100644
--- a/docs/examples/micropayment.rst
+++ b/docs/examples/micropayment.rst
@@ -2,11 +2,19 @@
Saluran Pembayaran Mikro (Micropayment Channel)
************************************************
+<<<<<<< HEAD
Di bagian ini kita akan mempelajari cara membuat contoh
implementasi saluran pembayaran. Dengan menggunakan tanda tangan
kriptografi untuk membuat transfer Ether secara berulang antara pihak yang sama,
aman, seketika, dan tanpa biaya transaksi. Misalnya, kita perlu memahami cara menyetujui
dan memverifikasi tanda tangan, dan mengatur saluran pembayaran.
+=======
+In this section, we will learn how to build an example implementation
+of a payment channel. It uses cryptographic signatures to make
+repeated transfers of Ether between the same parties secure, instantaneous, and
+without transaction fees. For the example, we need to understand how to
+sign and verify signatures, and setup the payment channel.
+>>>>>>> english/develop
Membuat dan memverifikasi tanda tangan
@@ -15,14 +23,29 @@ Membuat dan memverifikasi tanda tangan
Bayangkan, Alice ingin mengirim sejumlah Ether kepada Bob, misalnya
disini Alice sebagai pengirim dan Bob sebagai penerimanya.
+<<<<<<< HEAD
Alice hanya perlu mengirim pesan yang ditandatangani secara kriptografis off-chain
(misalnya melalui email) ke Bob dan ini mirip dengan menulis cek.
+=======
+Alice and Bob use signatures to authorize transactions, which is possible with smart contracts on Ethereum.
+Alice will build a simple smart contract that lets her transmit Ether, but instead of calling a function herself
+to initiate a payment, she will let Bob do that, and therefore pay the transaction fee.
+>>>>>>> english/develop
Alice dan Bob menggunakan tanda tangan untuk mengotorisasi transaksi, hal ini dimungkinkan dengan smart kontrak di Ethereum.
Alice akan membuat smart kontrak sederhana yang memumngkinkan dia mengirim Ether, tetapi alih-alih memanggil fungsi sendiri
untuk melakukan pembayaran, dia akan membiarkan Bob melakukan itu, dan sekaligus membayar biaya transaksi.
+<<<<<<< HEAD
Kontrak akan bekerja sebagai berikut:
+=======
+ 1. Alice deploys the ``ReceiverPays`` contract, attaching enough Ether to cover the payments that will be made.
+ 2. Alice authorizes a payment by signing a message with her private key.
+ 3. Alice sends the cryptographically signed message to Bob. The message does not need to be kept secret
+ (explained later), and the mechanism for sending it does not matter.
+ 4. Bob claims his payment by presenting the signed message to the smart contract, it verifies the
+ authenticity of the message and then releases the funds.
+>>>>>>> english/develop
1. Alice mendeploy kontrak ``ReceiverPays``, melampirkan cukup Ether untuk menutupi pembayaran yang akan dilakukan.
2. Alice mengotorisasi pembayaran dengan menandatangani pesan dengan kunci pribadinya.
@@ -34,6 +57,7 @@ Kontrak akan bekerja sebagai berikut:
Membuat tanda tangan
----------------------
+<<<<<<< HEAD
Alice tidak perlu berinteraksi dengan jaringan Ethereum
untuk menandatangani transaksi, prosesnya benar-benar offline.
@@ -41,6 +65,14 @@ Dalam tutorial ini, kita akan menandatangani pesan di browser
menggunakan `web3.js `_ dan
`MetaMask `_, menggunakan metode yang dijelaskan dalam `EIP-762 `_,
karena memberikan sejumlah manfaat keamanan lainnya.
+=======
+Alice does not need to interact with the Ethereum network
+to sign the transaction, the process is completely offline.
+In this tutorial, we will sign messages in the browser
+using `web3.js `_ and
+`MetaMask `_, using the method described in `EIP-712 `_,
+as it provides a number of other security benefits.
+>>>>>>> english/develop
.. code-block:: javascript
@@ -80,12 +112,21 @@ penuh di akhir bagian ini.
Packing arguments
-----------------
+<<<<<<< HEAD
Sekarang kita telah mengidentifikasi informasi apa yang akan disertakan dalam pesan yang ditandatangani,
kita siap untuk menyatukan pesan, hash, dan menandatanganinya. Untuk kesederhanaan,
kita gabungkan datanya. Library `Ethereumjs-abi `_
menyediakan fungsi yang disebut ``soliditySHA3`` yang meniru perilaku fungsi
Solidity ``keccak256`` yang diterapkan pada argumen yang dikodekan menggunakan ``abi.encodePacked``.
Berikut adalah fungsi JavaScript yang membuat tanda tangan yang tepat untuk contoh ``ReceiverPays``:
+=======
+Now that we have identified what information to include in the signed message,
+we are ready to put the message together, hash it, and sign it. For simplicity,
+we concatenate the data. The `ethereumjs-abi `_
+library provides a function called ``soliditySHA3`` that mimics the behavior of
+Solidity's ``keccak256`` function applied to arguments encoded using ``abi.encodePacked``.
+Here is a JavaScript function that creates the proper signature for the ``ReceiverPays`` example:
+>>>>>>> english/develop
.. code-block:: javascript
@@ -140,6 +181,7 @@ Kontrak penuh
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
+ // This will report a warning due to deprecated selfdestruct
contract ReceiverPays {
address owner = msg.sender;
@@ -236,8 +278,13 @@ menit akses jaringan, saluran pembayaran dapat tetap terbuka untuk jangka waktu
Di sisi lain, untuk pembayaran berulang, seperti membayar upah per jam kepada karyawan, saluran
pembayaran dapat tetap terbuka selama beberapa bulan atau tahun.
+<<<<<<< HEAD
Membuka Saluran Pembayaran
---------------------------
+=======
+ * The smart contract's address, used to prevent cross-contract replay attacks.
+ * The total amount of Ether that is owed to the recipient so far.
+>>>>>>> english/develop
Untuk membuka saluran pembayaran, Alice menyebarkan smart kontrak,
melampirkan Ether untuk di*escrow*kan dan menentukan penerima yang
@@ -337,6 +384,7 @@ Kontrak penuh
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
+ // This will report a warning due to deprecated selfdestruct
contract SimplePaymentChannel {
address payable public sender; // The account sending payments.
address payable public recipient; // The account receiving the payments.
diff --git a/docs/examples/modular.rst b/docs/examples/modular.rst
index 443acd2f97..09cf1c2c00 100644
--- a/docs/examples/modular.rst
+++ b/docs/examples/modular.rst
@@ -4,6 +4,7 @@
Kontrak Modular
*****************
+<<<<<<< HEAD
Pendekatan secara modular untuk membangun kontrak membantu Anda mengurangi kerumitan
dan meningkatkan keterbacaan yang akan membantu mengidentifikasi bug serta kerentanan
selama pengembangan dan peninjauan kode.
@@ -16,6 +17,20 @@ antar alamat sesuai dengan yang Anda harapkan. Dengan cara ini, Library ``Balanc
menyediakan komponen terisolasi yang melacak saldo akun dengan benar.
Sangat mudah untuk memverifikasi bahwa Library ``Balances`` tidak pernah menghasilkan
saldo negatif atau Overflow dan jumlah semua saldo adalah invarian sepanjang masa kontrak.
+=======
+A modular approach to building your contracts helps you reduce the complexity
+and improve the readability which will help to identify bugs and vulnerabilities
+during development and code review.
+If you specify and control the behavior of each module in isolation, the
+interactions you have to consider are only those between the module specifications
+and not every other moving part of the contract.
+In the example below, the contract uses the ``move`` method
+of the ``Balances`` :ref:`library ` to check that balances sent between
+addresses match what you expect. In this way, the ``Balances`` library
+provides an isolated component that properly tracks balances of accounts.
+It is easy to verify that the ``Balances`` library never produces negative balances or overflows
+and the sum of all balances is an invariant across the lifetime of the contract.
+>>>>>>> english/develop
.. code-block:: solidity
@@ -34,7 +49,7 @@ saldo negatif atau Overflow dan jumlah semua saldo adalah invarian sepanjang mas
contract Token {
mapping(address => uint256) balances;
using Balances for *;
- mapping(address => mapping (address => uint256)) allowed;
+ mapping(address => mapping(address => uint256)) allowed;
event Transfer(address from, address to, uint amount);
event Approval(address owner, address spender, uint amount);
diff --git a/docs/examples/safe-remote.rst b/docs/examples/safe-remote.rst
index 27550dccda..3577533e07 100644
--- a/docs/examples/safe-remote.rst
+++ b/docs/examples/safe-remote.rst
@@ -4,6 +4,7 @@
Pembelian Jarak Jauh yang Aman (Safe Remote Purchase)
*****************************************************
+<<<<<<< HEAD
Membeli barang dari jarak jauh saat ini membutuhkan banyak pihak yang perlu saling percaya.
Konfigurasi paling sederhana melibatkan penjual dan pembeli.
Pembeli ingin menerima barang dari penjual dan penjual ingin mendapatkan uang
@@ -17,6 +18,22 @@ kontrak sampai pembeli menegaskan bahwa mereka menerima item tersebut. Setelah i
nilainya dikembalikan ke pembeli (setengah dari deposit mereka) dan penjual mendapat tiga
kali nilai (deposit mereka ditambah nilai tersebut). Ide di balik ini adalah bahwa kedua belah pihak
memiliki insentif untuk menyelesaikan situasi atau sebaliknya uang mereka terkunci selamanya.
+=======
+Purchasing goods remotely currently requires multiple parties that need to trust each other.
+The simplest configuration involves a seller and a buyer. The buyer would like to receive
+an item from the seller and the seller would like to get some compensation, e.g. Ether,
+in return. The problematic part is the shipment here: There is no way to determine for
+sure that the item arrived at the buyer.
+
+There are multiple ways to solve this problem, but all fall short in one or the other way.
+In the following example, both parties have to put twice the value of the item into the
+contract as escrow. As soon as this happened, the Ether will stay locked inside
+the contract until the buyer confirms that they received the item. After that,
+the buyer is returned the value (half of their deposit) and the seller gets three
+times the value (their deposit plus the value). The idea behind
+this is that both parties have an incentive to resolve the situation or otherwise
+their Ether is locked forever.
+>>>>>>> english/develop
Kontrak ini tentu saja tidak menyelesaikan masalah, tetapi memberikan gambaran tentang bagaimana Anda
diff --git a/docs/examples/voting.rst b/docs/examples/voting.rst
index d16677a114..6afb6f8b03 100644
--- a/docs/examples/voting.rst
+++ b/docs/examples/voting.rst
@@ -107,6 +107,7 @@ akan mengembalikan proposal dengan jumlah suara terbanyak.
function delegate(address to) external {
// assigns reference
Voter storage sender = voters[msg.sender];
+ require(sender.weight != 0, "You have no right to vote");
require(!sender.voted, "You already voted.");
require(to != msg.sender, "Self-delegation is disallowed.");
@@ -126,11 +127,16 @@ akan mengembalikan proposal dengan jumlah suara terbanyak.
require(to != msg.sender, "Found loop in delegation.");
}
+ Voter storage delegate_ = voters[to];
+
+ // Voters cannot delegate to accounts that cannot vote.
+ require(delegate_.weight >= 1);
+
// Since `sender` is a reference, this
- // modifies `voters[msg.sender].voted`
+ // modifies `voters[msg.sender]`.
sender.voted = true;
sender.delegate = to;
- Voter storage delegate_ = voters[to];
+
if (delegate_.voted) {
// If the delegate already voted,
// directly add to the number of votes
@@ -185,5 +191,13 @@ akan mengembalikan proposal dengan jumlah suara terbanyak.
Kemungkinan Peningkatan
=======================
+<<<<<<< HEAD
Saat ini, banyak transaksi diperlukan untuk menetapkan hak
untuk memberikan suara kepada semua peserta. Bisakah Anda memikirkan cara yang lebih baik?
+=======
+Currently, many transactions are needed to
+assign the rights to vote to all participants.
+Moreover, if two or more proposals have the same
+number of votes, ``winningProposal()`` is not able
+to register a tie. Can you think of a way to fix these issues?
+>>>>>>> english/develop
diff --git a/docs/ext/remix_code_links.py b/docs/ext/remix_code_links.py
index 2fc15ddda0..55fc0ef5c2 100644
--- a/docs/ext/remix_code_links.py
+++ b/docs/ext/remix_code_links.py
@@ -22,23 +22,16 @@ def remix_code_url(source_code, language, solidity_version):
# NOTE: base64 encoded data may contain +, = and / characters. Remix seems to handle them just
# fine without any escaping.
base64_encoded_source = base64.b64encode(source_code.encode('utf-8')).decode('ascii')
- return f"https://remix.ethereum.org/?language={language}&version={solidity_version}&code={base64_encoded_source}"
+ return f"https://remix.ethereum.org/?#language={language}&version={solidity_version}&code={base64_encoded_source}"
def build_remix_link_node(url):
- link_icon_node = docutils.nodes.inline()
- link_icon_node.set_class('link-icon')
-
- link_text_node = docutils.nodes.inline(text="open in Remix")
- link_text_node.set_class('link-text')
-
- reference_node = docutils.nodes.reference('', '', internal=False, refuri=url)
- reference_node.set_class('remix-link')
- reference_node += [link_icon_node, link_text_node]
+ reference_node = docutils.nodes.reference('', 'open in Remix', internal=False, refuri=url, target='_blank')
+ reference_node['classes'].append('remix-link')
paragraph_node = docutils.nodes.paragraph()
- paragraph_node.set_class('remix-link-container')
- paragraph_node += reference_node
+ paragraph_node['classes'].append('remix-link-container')
+ paragraph_node.append(reference_node)
return paragraph_node
@@ -49,22 +42,24 @@ def insert_remix_link(app, doctree, solidity_version):
for literal_block_node in doctree.traverse(docutils.nodes.literal_block):
assert 'language' in literal_block_node.attributes
language = literal_block_node.attributes['language'].lower()
- if language in ['solidity', 'yul']:
- text_nodes = list(literal_block_node.traverse(docutils.nodes.Text))
- assert len(text_nodes) == 1
-
- remix_url = remix_code_url(text_nodes[0], language, solidity_version)
- url_length = len(remix_url.encode('utf-8'))
- if url_length > MAX_SAFE_URL_LENGTH:
- logger.warning(
- "Remix URL generated from the code snippet exceeds the maximum safe URL length "
- " (%d > %d bytes).",
- url_length,
- MAX_SAFE_URL_LENGTH,
- location=(literal_block_node.source, literal_block_node.line),
- )
-
- insert_node_before(literal_block_node, build_remix_link_node(remix_url))
+ if language not in ['solidity', 'yul']:
+ continue
+
+ text_nodes = list(literal_block_node.traverse(docutils.nodes.Text))
+ assert len(text_nodes) == 1
+
+ remix_url = remix_code_url(text_nodes[0], language, solidity_version)
+ url_length = len(remix_url.encode('utf-8'))
+ if url_length > MAX_SAFE_URL_LENGTH:
+ logger.warning(
+ "Remix URL generated from the code snippet exceeds the maximum safe URL length "
+ " (%d > %d bytes).",
+ url_length,
+ MAX_SAFE_URL_LENGTH,
+ location=(literal_block_node.source, literal_block_node.line),
+ )
+
+ insert_node_before(literal_block_node, build_remix_link_node(remix_url))
def setup(app):
diff --git a/docs/grammar/SolidityLexer.g4 b/docs/grammar/SolidityLexer.g4
index ddfbf5e66f..340ab25c9f 100644
--- a/docs/grammar/SolidityLexer.g4
+++ b/docs/grammar/SolidityLexer.g4
@@ -9,10 +9,9 @@ ReservedKeywords:
| 'partial' | 'promise' | 'reference' | 'relocatable' | 'sealed' | 'sizeof' | 'static'
| 'supports' | 'switch' | 'typedef' | 'typeof' | 'var';
-Pragma: 'pragma' -> pushMode(PragmaMode);
Abstract: 'abstract';
-Anonymous: 'anonymous';
Address: 'address';
+Anonymous: 'anonymous';
As: 'as';
Assembly: 'assembly' -> pushMode(AssemblyBlockMode);
Bool: 'bool';
@@ -30,13 +29,11 @@ Else: 'else';
Emit: 'emit';
Enum: 'enum';
Error: 'error'; // not a real keyword
-Revert: 'revert'; // not a real keyword
Event: 'event';
External: 'external';
Fallback: 'fallback';
False: 'false';
Fixed: 'fixed' | ('fixed' [1-9][0-9]* 'x' [1-9][0-9]*);
-From: 'from'; // not a real keyword
/**
* Jenis byte panjang tetap.
*/
@@ -46,7 +43,9 @@ FixedBytes:
'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' |
'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32';
For: 'for';
+From: 'from'; // not a real keyword
Function: 'function';
+Global: 'global'; // not a real keyword
Hex: 'hex';
If: 'if';
Immutable: 'immutable';
@@ -63,15 +62,17 @@ New: 'new';
/**
* Denominasi satuan untuk angka.
*/
-NumberUnit: 'wei' | 'gwei' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years';
+SubDenomination: 'wei' | 'gwei' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years';
Override: 'override';
Payable: 'payable';
+Pragma: 'pragma' -> pushMode(PragmaMode);
Private: 'private';
Public: 'public';
Pure: 'pure';
Receive: 'receive';
Return: 'return';
Returns: 'returns';
+Revert: 'revert'; // not a real keyword
/**
* Tipe integer yang Sized signed.
* int adalah alias dari int256.
@@ -89,6 +90,7 @@ Try: 'try';
Type: 'type';
Ufixed: 'ufixed' | ('ufixed' [1-9][0-9]+ 'x' [1-9][0-9]+);
Unchecked: 'unchecked';
+Unicode: 'unicode';
/**
* Sized unsigned integer types.
* uint adalah alias untuk uint256.
@@ -197,9 +199,7 @@ fragment EscapeSequence:
/**
* Sebuah literal string yang dikutip tunggal memungkinkan karakter unicode arbitrary.
*/
-UnicodeStringLiteral:
- 'unicode"' DoubleQuotedUnicodeStringCharacter* '"'
- | 'unicode\'' SingleQuotedUnicodeStringCharacter* '\'';
+UnicodeStringLiteral: 'unicode' (('"' DoubleQuotedUnicodeStringCharacter* '"') | ('\'' SingleQuotedUnicodeStringCharacter* '\''));
//@doc:inline
fragment DoubleQuotedUnicodeStringCharacter: ~["\r\n\\] | EscapeSequence;
//@doc:inline
@@ -222,9 +222,23 @@ fragment EvenHexDigits: HexCharacter HexCharacter ('_'? HexCharacter HexCharacte
fragment HexCharacter: [0-9A-Fa-f];
/**
+<<<<<<< HEAD
* Sebuah angka desimal literal terdiri dari angka desimal yang dapat dibatasi oleh garis bawah dan
* eksponen positif atau negatif opsional.
* Jika digit berisi titik desimal, literal memiliki tipe titik tetap.
+=======
+ * Scanned but not used by any rule, i.e, disallowed.
+ * solc parser considers number starting with '0', not immediately followed by '.' or 'x' as
+ * octal, even if non octal digits '8' and '9' are present.
+ */
+OctalNumber: '0' DecimalDigits ('.' DecimalDigits)?;
+
+
+/**
+ * A decimal number literal consists of decimal digits that may be delimited by underscores and
+ * an optional positive or negative exponent.
+ * If the digits contain a decimal point, the literal has fixed point type.
+>>>>>>> english/develop
*/
DecimalNumber: (DecimalDigits | (DecimalDigits? '.' DecimalDigits)) ([eE] '-'? DecimalDigits)?;
//@doc:inline
@@ -232,8 +246,19 @@ fragment DecimalDigits: [0-9] ('_'? [0-9])* ;
/**
+<<<<<<< HEAD
* Sebuah identifier dalam solidity harus dimulai dengan huruf, tanda dolar atau garis bawah dan
* mungkin untuk tambahan dapat berisi angka setelah simbol pertama.
+=======
+ * This is needed to avoid successfully parsing a number followed by a string with no whitespace between.
+ */
+DecimalNumberFollowedByIdentifier: DecimalNumber Identifier;
+
+
+/**
+ * An identifier in solidity has to start with a letter, a dollar-sign or an underscore and
+ * may additionally contain numbers after the first symbol.
+>>>>>>> english/develop
*/
Identifier: IdentifierStart IdentifierPart*;
//@doc:inline
@@ -251,6 +276,12 @@ mode AssemblyBlockMode;
AssemblyDialect: '"evmasm"';
AssemblyLBrace: '{' -> popMode, pushMode(YulMode);
+AssemblyFlagString: '"' DoubleQuotedStringCharacter+ '"';
+
+AssemblyBlockLParen: '(';
+AssemblyBlockRParen: ')';
+AssemblyBlockComma: ',';
+
AssemblyBlockWS: [ \t\r\n\u000C]+ -> skip ;
AssemblyBlockCOMMENT: '/*' .*? '*/' -> channel(HIDDEN) ;
AssemblyBlockLINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN) ;
@@ -278,14 +309,14 @@ YulEVMBuiltin:
'stop' | 'add' | 'sub' | 'mul' | 'div' | 'sdiv' | 'mod' | 'smod' | 'exp' | 'not'
| 'lt' | 'gt' | 'slt' | 'sgt' | 'eq' | 'iszero' | 'and' | 'or' | 'xor' | 'byte'
| 'shl' | 'shr' | 'sar' | 'addmod' | 'mulmod' | 'signextend' | 'keccak256'
- | 'pop' | 'mload' | 'mstore' | 'mstore8' | 'sload' | 'sstore' | 'msize' | 'gas'
+ | 'pop' | 'mload' | 'mstore' | 'mstore8' | 'sload' | 'sstore' | 'tload' | 'tstore'| 'msize' | 'gas'
| 'address' | 'balance' | 'selfbalance' | 'caller' | 'callvalue' | 'calldataload'
| 'calldatasize' | 'calldatacopy' | 'extcodesize' | 'extcodecopy' | 'returndatasize'
- | 'returndatacopy' | 'extcodehash' | 'create' | 'create2' | 'call' | 'callcode'
+ | 'returndatacopy' | 'mcopy' | 'extcodehash' | 'create' | 'create2' | 'call' | 'callcode'
| 'delegatecall' | 'staticcall' | 'return' | 'revert' | 'selfdestruct' | 'invalid'
| 'log0' | 'log1' | 'log2' | 'log3' | 'log4' | 'chainid' | 'origin' | 'gasprice'
- | 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'gaslimit'
- | 'basefee';
+ | 'blockhash' | 'blobhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty'
+ | 'prevrandao' | 'gaslimit' | 'basefee' | 'blobbasefee';
YulLBrace: '{' -> pushMode(YulMode);
YulRBrace: '}' -> popMode;
diff --git a/docs/grammar/SolidityParser.g4 b/docs/grammar/SolidityParser.g4
index d3eacdbc10..6fcc781ec0 100644
--- a/docs/grammar/SolidityParser.g4
+++ b/docs/grammar/SolidityParser.g4
@@ -12,6 +12,7 @@ options { tokenVocab=SolidityLexer; }
sourceUnit: (
pragmaDirective
| importDirective
+ | usingDirective
| contractDefinition
| interfaceDefinition
| libraryDefinition
@@ -21,6 +22,7 @@ sourceUnit: (
| enumDefinition
| userDefinedValueTypeDefinition
| errorDefinition
+ | eventDefinition
)* EOF;
//@doc: inline
@@ -151,16 +153,22 @@ stateMutability: Pure | View | Payable;
*/
overrideSpecifier: Override (LParen overrides+=identifierPath (Comma overrides+=identifierPath)* RParen)?;
/**
+<<<<<<< HEAD
* Definisi kontrak, library and fungsi interface.
* Tergantung pada konteks di mana fungsi didefinisikan, pembatasan lebih lanjut mungkin berlaku,
* misalnya fungsi dalam interface harus tidak diimplementasikan, yaitu tidak boleh berisi tubuh blok.
+=======
+ * The definition of contract, library, interface or free functions.
+ * Depending on the context in which the function is defined, further restrictions may apply,
+ * e.g. functions in interfaces have to be unimplemented, i.e. may not contain a body block.
+>>>>>>> english/develop
*/
functionDefinition
locals[
boolean visibilitySet = false,
boolean mutabilitySet = false,
boolean virtualSet = false,
- boolean overrideSpecifierSet = false
+ boolean overrideSpecifierSet = false,
]
:
Function (identifier | Fallback | Receive)
@@ -174,6 +182,7 @@ locals[
)*
(Returns LParen returnParameters=parameterList RParen)?
(Semicolon | body=block);
+
/**
* Definisi modifier.
* Perhatikan bahwa di dalam tubuh blok modifier, garis bawah tidak dapat digunakan sebagai pengenal,
@@ -311,10 +320,42 @@ errorDefinition:
Semicolon;
/**
+<<<<<<< HEAD
* Menggunakan direktif untuk mengikat fungsi library ke tipe.
* Dapat terjadi dalam kontrak dan library.
- */
-usingDirective: Using identifierPath For (Mul | typeName) Semicolon;
+=======
+ * Operators that users are allowed to implement for some types with `using for`.
+>>>>>>> english/develop
+ */
+userDefinableOperator:
+ BitAnd
+ | BitNot
+ | BitOr
+ | BitXor
+ | Add
+ | Div
+ | Mod
+ | Mul
+ | Sub
+ | Equal
+ | GreaterThan
+ | GreaterThanOrEqual
+ | LessThan
+ | LessThanOrEqual
+ | NotEqual;
+
+/**
+ * Using directive to attach library functions and free functions to types.
+ * Can occur within contracts and libraries and at the file level.
+ */
+usingDirective:
+ Using (
+ identifierPath
+ | (LBrace usingAliases (Comma usingAliases)* RBrace)
+ ) For (Mul | typeName) Global? Semicolon;
+
+usingAliases: identifierPath (As userDefinableOperator)?;
+
/**
* Nama tipe dapat berupa tipe dasar, tipe fungsi, tipe mapping, tipe user-defined
* (misalnya kontrak atau struct) atau tipe array.
@@ -346,7 +387,7 @@ dataLocation: Memory | Storage | Calldata;
*/
expression:
expression LBrack index=expression? RBrack # IndexAccess
- | expression LBrack start=expression? Colon end=expression? RBrack # IndexRangeAccess
+ | expression LBrack startIndex=expression? Colon endIndex=expression? RBrack # IndexRangeAccess
| expression Period (identifier | Address) # MemberAccess
| expression LBrace (namedArgument (Comma namedArgument)*)? RBrace # FunctionCallOptions
| expression callArgumentList # FunctionCall
@@ -367,12 +408,13 @@ expression:
| expression Or expression # OrOperation
| expression Conditional expression Colon expression # Conditional
| expression assignOp expression # Assignment
- | New typeName # NewExpression
+ | New typeName # NewExpr
| tupleExpression # Tuple
| inlineArrayExpression # InlineArray
| (
identifier
| literal
+ | literalWithSubDenomination
| elementaryTypeName[false]
) # PrimaryExpression
;
@@ -388,9 +430,12 @@ inlineArrayExpression: LBrack (expression ( Comma expression)* ) RBrack;
/**
* Selain identifier non-kata kunci biasa, beberapa kata kunci seperti 'from' dan 'error' juga dapat digunakan sebagai identifier.
*/
-identifier: Identifier | From | Error | Revert;
+identifier: Identifier | From | Error | Revert | Global;
literal: stringLiteral | numberLiteral | booleanLiteral | hexStringLiteral | unicodeStringLiteral;
+
+literalWithSubDenomination: numberLiteral SubDenomination;
+
booleanLiteral: True | False;
/**
* Literal string penuh terdiri dari satu atau beberapa string yang dikutip secara berurutan.
@@ -408,7 +453,8 @@ unicodeStringLiteral: UnicodeStringLiteral+;
/**
* Angka literal dapat berupa angka desimal atau heksadesimal dengan unit opsional.
*/
-numberLiteral: (DecimalNumber | HexNumber) NumberUnit?;
+numberLiteral: DecimalNumber | HexNumber;
+
/**
* Blok pernyataan dengan kurung kurawal. Membuka ruang lingkupnya sendiri.
*/
@@ -476,7 +522,13 @@ revertStatement: Revert expression callArgumentList Semicolon;
* Isi blok inline assembly menggunakan pemindai/lexer terpisah, yaitu kumpulan kata kunci dan
* identifier yang diizinkan berbeda di dalam blok inline assembly.
*/
-assemblyStatement: Assembly AssemblyDialect? AssemblyLBrace yulStatement* YulRBrace;
+assemblyStatement: Assembly AssemblyDialect? assemblyFlags? AssemblyLBrace yulStatement* YulRBrace;
+
+/**
+ * Assembly flags.
+ * Comma-separated list of double-quoted strings as flags.
+ */
+assemblyFlags: AssemblyBlockLParen AssemblyFlagString (AssemblyBlockComma AssemblyFlagString)* AssemblyBlockRParen;
//@doc:inline
variableDeclarationList: variableDeclarations+=variableDeclaration (Comma variableDeclarations+=variableDeclaration)*;
@@ -497,7 +549,7 @@ variableDeclarationTuple:
variableDeclarationStatement: ((variableDeclaration (Assign expression)?) | (variableDeclarationTuple Assign expression)) Semicolon;
expressionStatement: expression Semicolon;
-mappingType: Mapping LParen key=mappingKeyType DoubleArrow value=typeName RParen;
+mappingType: Mapping LParen key=mappingKeyType name=identifier? DoubleArrow value=typeName name=identifier? RParen;
/**
* Hanya tipe dasar atau tipe yang ditentukan pengguna yang layak sebagai kunci mapping.
*/
@@ -564,7 +616,7 @@ yulFunctionDefinition:
* Meskipun hanya pengidentifikasi tanpa titik yang dapat dideklarasikan dalam inline assembly,,
* jalur yang berisi titik dapat merujuk ke deklarasi di luar blok inline assembly,.
*/
-yulPath: YulIdentifier (YulPeriod YulIdentifier)*;
+yulPath: YulIdentifier (YulPeriod (YulIdentifier | YulEVMBuiltin))*;
/**
* Panggilan ke fungsi dengan nilai return hanya dapat terjadi sebagai sisi kanan tugas atau
* deklarasi variabel.
diff --git a/docs/index.rst b/docs/index.rst
index 2dce555b3b..5fa5e22bda 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,6 +1,7 @@
Solidity
========
+<<<<<<< HEAD
Solidity adalah bahasa tingkat tinggi berorientasi pada objek, untuk mengimplementasikan smart
kontrak. Smart kontrak adalah program yang mengatur perilaku akun
dalam lingkungan Ethereum.
@@ -22,22 +23,60 @@ terbaru yang dirilis. Selain dari kasus-kasus luar biasa, hanya versi terbaru ya
Selain itu, pembaharuan dan juga
fitur baru diperkenalkan secara teratur. Saat ini kami menggunakan
nomor versi 0.y.z `untuk menunjukkan laju perubahan yang cepat ini `_.
+=======
+Solidity is an object-oriented, high-level language for implementing smart contracts.
+Smart contracts are programs that govern the behavior of accounts within the Ethereum state.
+
+Solidity is a `curly-bracket language `_ designed to target the Ethereum Virtual Machine (EVM).
+It is influenced by C++, Python, and JavaScript.
+You can find more details about which languages Solidity has been inspired by in the :doc:`language influences ` section.
+
+Solidity is statically typed, supports inheritance, libraries, and complex user-defined types, among other features.
+
+With Solidity, you can create contracts for uses such as voting, crowdfunding, blind auctions, and multi-signature wallets.
+
+When deploying contracts, you should use the latest released version of Solidity.
+Apart from exceptional cases, only the latest version receives
+`security fixes `_.
+Furthermore, breaking changes, as well as new features, are introduced regularly.
+We currently use a 0.y.z version number `to indicate this fast pace of change `_.
+>>>>>>> english/develop
.. Warning::
+<<<<<<< HEAD
Solidity baru-baru ini merilis versi 0.8.x yang memperkenalkan banyak perubahan
besar. Pastikan Anda membaca :doc:`daftar lengkap <080-breaking-changes>`.
+=======
+ Solidity recently released the 0.8.x version that introduced a lot of breaking changes.
+ Make sure you read :doc:`the full list <080-breaking-changes>`.
+>>>>>>> english/develop
Ide untuk meningkatkan Solidity atau dokumentasi ini selalu diterima,
baca :doc:`panduan kontributor ` kami untuk detail selengkapnya.
+<<<<<<< HEAD
Mulai
-----
+=======
+.. Hint::
+
+ You can download this documentation as PDF, HTML or Epub
+ by clicking on the versions flyout menu in the bottom-left corner and selecting the preferred download format.
+
+
+Getting Started
+---------------
+>>>>>>> english/develop
**1. Memahami Dasar-dasar smart Kontrak**
+<<<<<<< HEAD
Jika Anda baru mengenal konsep smart kontrak, kami menyarankan Anda untuk memulai
dengan menggali bagian "Perkenalan smart Kontrak ", yang mencakup:
+=======
+If you are new to the concept of smart contracts, we recommend you to get started by digging into the "Introduction to Smart Contracts" section, which covers the following:
+>>>>>>> english/develop
* :ref:`Contoh sederhana smart kontrak ` ditulis dalam Solidity.
* :ref:`Dasar-dasar Blockchain `.
@@ -53,6 +92,7 @@ dan bagian “Deskripsi Bahasa” untuk memahami konsep inti bahasa solidity.
Ada berbagai cara untuk menginstal compiler Solidity,
cukup pilih opsi yang Anda inginkan dan ikuti langkah-langkah yang diuraikan di :ref:`halaman instalasi `.
+<<<<<<< HEAD
.. Hint::
Anda dapat mencoba contoh kode langsung di browser Anda dengan
`Remix IDE `_. Remix adalah IDE berbasis browser web
@@ -67,9 +107,25 @@ cukup pilih opsi yang Anda inginkan dan ikuti langkah-langkah yang diuraikan di
blockchains dan smart kontrak memiliki masalah uniknya sendiri yang
harus diwaspadai, jadi sebelum mengerjakan kode, pastikan Anda membaca
bagian :ref:`security_considerations`.
+=======
+.. hint::
+ You can try out code examples directly in your browser with the
+ `Remix IDE `_.
+ Remix is a web browser-based IDE that allows you to write, deploy and administer Solidity smart contracts,
+ without the need to install Solidity locally.
+
+.. warning::
+ As humans write software, it can have bugs.
+ Therefore, you should follow established software development best practices when writing your smart contracts.
+ This includes code review, testing, audits, and correctness proofs.
+ Smart contract users are sometimes more confident with code than their authors,
+ and blockchains and smart contracts have their own unique issues to watch out for,
+ so before working on production code, make sure you read the :ref:`security_considerations` section.
+>>>>>>> english/develop
**4. Pelajari lebih lanjut**
+<<<<<<< HEAD
Jika Anda ingin mempelajari lebih lanjut tentang membangun aplikasi terdesentralisasi di Ethereum,
`Sumber Daya Pengembang Ethereum `_
dapat membantu Anda dengan dokumentasi umum seputar Ethereum, dan berbagai pilihan tutorial,
@@ -78,12 +134,22 @@ alat dan kerangka pengembangan.
Jika Anda memiliki pertanyaan, Anda dapat mencari jawaban atau bertanya di
`Ethereum StackExchange `_, atau
`saluran Gitter kami `_.
+=======
+If you want to learn more about building decentralized applications on Ethereum,
+the `Ethereum Developer Resources `_ can help you with further general documentation around Ethereum,
+and a wide selection of tutorials, tools, and development frameworks.
+
+If you have any questions, you can try searching for answers or asking on the
+`Ethereum StackExchange `_,
+or our `Gitter channel `_.
+>>>>>>> english/develop
.. _translations:
Terjemahan
----------
+<<<<<<< HEAD
Relawan dari komunitas membantu menerjemahkan dokumentasi ini ke dalam beberapa bahasa.
Mereka memiliki berbagai tingkat kelengkapan dan ke up-to-date-an. Versi
inggris digunakan sebagai referensi.
@@ -103,6 +169,30 @@ inggris digunakan sebagai referensi.
* `Spanish `_
* `Turkish `_ (partial)
* `Indonesian `_ (partial)
+=======
+Community contributors help translate this documentation into several languages.
+Note that they have varying degrees of completeness and up-to-dateness.
+The English version stands as a reference.
+
+You can switch between languages by clicking on the flyout menu in the bottom-left corner
+and selecting the preferred language.
+
+* `Chinese `_
+* `French `_
+* `Indonesian `_
+* `Japanese `_
+* `Korean `_
+* `Persian `_
+* `Russian `_
+* `Spanish `_
+* `Turkish `_
+
+.. note::
+
+ We set up a GitHub organization and translation workflow to help streamline the community efforts.
+ Please refer to the translation guide in the `solidity-docs org `_
+ for information on how to start a new language or contribute to the community translations.
+>>>>>>> english/develop
Daftar isi
==========
@@ -114,8 +204,8 @@ Daftar isi
:caption: Basics
introduction-to-smart-contracts.rst
- installing-solidity.rst
solidity-by-example.rst
+ installing-solidity.rst
.. toctree::
:maxdepth: 2
@@ -154,21 +244,31 @@ Daftar isi
.. toctree::
:maxdepth: 2
- :caption: Additional Material
+ :caption: Advisory content
+ security-considerations.rst
+ bugs.rst
050-breaking-changes.rst
060-breaking-changes.rst
070-breaking-changes.rst
080-breaking-changes.rst
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Additional Material
+
natspec-format.rst
- security-considerations.rst
smtchecker.rst
- resources.rst
- path-resolution.rst
yul.rst
+ path-resolution.rst
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Resources
+
style-guide.rst
common-patterns.rst
- bugs.rst
+ resources.rst
contributing.rst
- brand-guide.rst
language-influences.rst
+ brand-guide.rst
diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst
index 5c84966f3d..714d45aa5c 100644
--- a/docs/installing-solidity.rst
+++ b/docs/installing-solidity.rst
@@ -9,17 +9,37 @@ Menginstal Kompiler Solidity
Versioning
==========
+<<<<<<< HEAD
Versi Solidity mengikuti `semantic versioning `_ dan sebagai tambahan
untuk rilis, versi **nightly development builds** juga tersedia. Nightly builds tidak
dijamin akan berfungsi dan meskipun telah dilakukan upaya terbaik build tersebut mungkin berisi perubahan
yang tidak terdokumentasi dan/atau rusak. Kami merekomendasikan menggunakan rilis terbaru. Penginstal paket di bawah ini
akan menggunakan rilis terbaru.
+=======
+Solidity versions follow `Semantic Versioning `_. In
+addition, patch-level releases with major release 0 (i.e. 0.x.y) will not
+contain breaking changes. That means code that compiles with version 0.x.y
+can be expected to compile with 0.x.z where z > y.
+
+In addition to releases, we provide **nightly development builds** to make
+it easy for developers to try out upcoming features and
+provide early feedback. Note, however, that while the nightly builds are usually
+very stable, they contain bleeding-edge code from the development branch and are
+not guaranteed to be always working. Despite our best efforts, they might
+contain undocumented and/or broken changes that will not become a part of an
+actual release. They are not meant for production use.
+
+When deploying contracts, you should use the latest released version of Solidity. This
+is because breaking changes, as well as new features and bug fixes are introduced regularly.
+We currently use a 0.x version number `to indicate this fast pace of change `_.
+>>>>>>> english/develop
Remix
=====
*Kami merekomendasikan Remix untuk kontrak kecil dan untuk mempelajari Solidity dengan cepat.*
+<<<<<<< HEAD
`Akses Remix online `_, anda tidak perlu menginstal apapun.
Jika ingin menggunakannya tanpa koneksi internet, silahkan kunjungi
https://github.com/ethereum/remix-live/tree/gh-pages dan download file ``.zip`` seperti
@@ -29,6 +49,17 @@ tanpa menginstal beberapa versi Solidity.
Opsi lebih lanjut di halaman ini merinci penginstalan sofware commandline Solidity compiler
di komputer anda. Pilih commandline compiler jika anda mengerjakan kontrak yang lebih besar
atau jika anda membutuhkan lebih banyak opsi compilation.
+=======
+`Access Remix online `_, you do not need to install anything.
+If you want to use it without connection to the Internet, go to
+https://github.com/ethereum/remix-live/tree/gh-pages#readme and follow the instructions on that page.
+Remix is also a convenient option for testing nightly builds
+without installing multiple Solidity versions.
+
+Further options on this page detail installing command-line Solidity compiler software
+on your computer. Choose a command-line compiler if you are working on a larger contract
+or if you require more compilation options.
+>>>>>>> english/develop
.. _solcjs:
@@ -42,10 +73,17 @@ lebih lanjut di halaman ini. dokumentasi
kompiler berfitur lengkap, ``solc``. Penggunaan ``solcjs`` didokumentasikan di dalam
`repository `_ nya sendiri.
+<<<<<<< HEAD
Note: Proyek solc-js diturunkan dari C++
`solc` dengan menggunakan Emscripten yang artinya keduanya menggunakan source code compiler yang sama.
`solc-js` dapat digunakan dalam proyek JavaScript secara langsung (seperti Remix).
Silakan merujuk ke repositori solc-js untuk instruksi.
+=======
+Note: The solc-js project is derived from the C++
+`solc` by using Emscripten, which means that both use the same compiler source code.
+`solc-js` can be used in JavaScript projects directly (such as Remix).
+Please refer to the solc-js repository for instructions.
+>>>>>>> english/develop
.. code-block:: bash
@@ -53,42 +91,80 @@ Silakan merujuk ke repositori solc-js untuk instruksi.
.. note::
+<<<<<<< HEAD
Commandline yang dapat dieksekusi bernama ``solcjs``.
Opsi baris perintah ``solcjs`` tidak kompatibel dengan ``solc`` dan alat (seperti ``geth``)
mengharapkan perilaku ``solc`` tidak akan bekerja dengan ``solcjs``.
+=======
+ The command-line executable is named ``solcjs``.
+
+ The command-line options of ``solcjs`` are not compatible with ``solc`` and tools (such as ``geth``)
+ expecting the behavior of ``solc`` will not work with ``solcjs``.
+>>>>>>> english/develop
Docker
======
+<<<<<<< HEAD
Image Docker dari build Solidity tersedia menggunakan image ``solc`` dari organisasi ``ethereum``.
Gunakan tag ``stable`` untuk versi rilis terbaru, dan ``nightly`` untuk perubahan yang berpotensi tidak stabil di branch pengembangan.
Image Docker menjalankan kompiler yang dapat dieksekusi, sehingga Anda dapat meneruskan semua argumen kompiler ke dalamnya.
Misalnya, perintah di bawah ini menarik versi stabil dari image ``solc`` (jika Anda belum memilikinya),
dan menjalankannya dalam kontainer baru, melewati argumen ``--help``.
+=======
+Docker images of Solidity builds are available using the ``solc`` image from the ``ethereum`` organization.
+Use the ``stable`` tag for the latest released version, and ``nightly`` for potentially unstable changes in the ``develop`` branch.
+
+The Docker image runs the compiler executable so that you can pass all compiler arguments to it.
+For example, the command below pulls the stable version of the ``solc`` image (if you do not have it already),
+and runs it in a new container, passing the ``--help`` argument.
+>>>>>>> english/develop
.. code-block:: bash
docker run ethereum/solc:stable --help
+<<<<<<< HEAD
Anda juga dapat menentukan versi build rilis di tag, misalnya, untuk rilis 0.5.4.
+=======
+You can specify release build versions in the tag. For example:
+>>>>>>> english/develop
.. code-block:: bash
- docker run ethereum/solc:0.5.4 --help
+ docker run ethereum/solc:stable --help
+<<<<<<< HEAD
Untuk menggunakan image Docker untuk mengkompilasi file Solidity di mesin host, *mount* folder lokal untuk input dan output,
dan tentukan kontrak untuk dikompilasi. Sebagai contoh.
+=======
+Note
+
+Specific compiler versions are supported as the Docker image tag such as `ethereum/solc:0.8.23`. We will be passing the
+`stable` tag here instead of specific version tag to ensure that users get the latest version by default and avoid the issue of
+an out-of-date version.
+
+To use the Docker image to compile Solidity files on the host machine, mount a
+local folder for input and output, and specify the contract to compile. For example:
+>>>>>>> english/develop
.. code-block:: bash
docker run -v /local/path:/sources ethereum/solc:stable -o /sources/output --abi --bin /sources/Contract.sol
+<<<<<<< HEAD
Anda juga dapat menggunakan antarmuka JSON standar (yang direkomendasikan saat menggunakan kompiler dengan *tooling*).
Saat menggunakan antarmuka ini, tidak perlu *me-mount* direktori apa pun selama input JSON
*self-contained* (yaitu tidak merujuk ke file eksternal apa pun yang harus
:ref:`dimuat oleh impor callback `).
+=======
+You can also use the standard JSON interface (which is recommended when using the compiler with tooling).
+When using this interface, it is not necessary to mount any directories as long as the JSON input is
+self-contained (i.e. it does not refer to any external files that would have to be
+:ref:`loaded by the import callback `).
+>>>>>>> english/develop
.. code-block:: bash
@@ -118,9 +194,26 @@ Versi nightly dapat diinstal menggunakan perintah berikut:
sudo apt-get update
sudo apt-get install solc
+<<<<<<< HEAD
Kami juga merilis `paket snap `_,
yang dapat diinstal di semua `distro Linux yang didukung
`_. Untuk menginstal solc versi stabil terbaru:
+=======
+Furthermore, some Linux distributions provide their own packages. These packages are not directly
+maintained by us but usually kept up-to-date by the respective package maintainers.
+
+For example, Arch Linux has packages for the latest development version as AUR packages: `solidity `_
+and `solidity-bin `_.
+
+.. note::
+
+ Please be aware that `AUR `_ packages
+ are user-produced content and unofficial packages. Exercise caution when using them.
+
+There is also a `snap package `_, however, it is **currently unmaintained**.
+It is installable in all the `supported Linux distros `_. To
+install the latest stable version of solc:
+>>>>>>> english/develop
.. code-block:: bash
@@ -139,6 +232,7 @@ dengan perubahan terbaru, silakan gunakan yang berikut ini:
tetapi memiliki batasan, seperti hanya mengakses file di direktori ``/home`` dan ``/media`` Anda.
Untuk informasi selengkapnya, buka `Demystifying Snap Confinement `_.
+<<<<<<< HEAD
Arch Linux juga mempunyai paket, meskipun terbatas pada versi pengembangan terbaru:
.. code-block:: bash
@@ -151,6 +245,8 @@ Setelah overlay diatur, ``solc`` dapat diinstal di arsitektur x86_64 dengan:
.. code-block:: bash
emerge dev-lang/solidity
+=======
+>>>>>>> english/develop
Paket macOS
==============
@@ -172,8 +268,13 @@ dan ``brew install solidity@5``, berturut-turut.
Jika Anda memerlukan versi Solidity tertentu, Anda dapat menginstal
formula Homebrew langsung dari Github.
+<<<<<<< HEAD
Lihat
`solidity.rb commits di Github `_.
+=======
+View
+`solidity.rb commits on GitHub `_.
+>>>>>>> english/develop
Salin comit hash dari versi yang Anda inginkan dan periksa di mesin Anda.
@@ -200,6 +301,7 @@ platform yang didukung di `solc-bin`_. Ini juga merupakan lokasi di mana Anda da
Repositori bukan hanya cara cepat dan mudah bagi pengguna untuk menyiapkan binari agar siap digunakan
*out-of-the-box*, tetapi juga dimaksudkan agar ramah terhadap alat pihak ketiga:
+<<<<<<< HEAD
- Konten di*mirror*kan ke https://binaries.soliditylang.org di mana dapat dengan mudah diunduh
melalui HTTPS tanpa autentikasi, pembatasan kecepatan, atau tanpa menggunakan git.
- Konten disajikan dengan header `Content-Type` yang benar dan konfigurasi CORS yang lunak sehingga
@@ -222,6 +324,30 @@ build untuk platform yang tidak didukung pada saat rilis. Ini hanya terjadi di `
Repositori ``solc-bin`` berisi beberapa direktori Top-level, masing-masing mewakili satu platform.
Masing-masing berisi file ``list.json`` yang mencantumkan binari yang tersedia. Sebagai contoh, di
``emscripten-wasm32/list.json`` Anda akan menemukan informasi berikut tentang versi 0.7.4:
+=======
+- The content is mirrored to https://binaries.soliditylang.org where it can be easily downloaded over
+ HTTPS without any authentication, rate limiting or the need to use git.
+- Content is served with correct `Content-Type` headers and lenient CORS configuration so that it
+ can be directly loaded by tools running in the browser.
+- Binaries do not require installation or unpacking (exception for older Windows builds
+ bundled with necessary DLLs).
+- We strive for a high level of backward-compatibility. Files, once added, are not removed or moved
+ without providing a symlink/redirect at the old location. They are also never modified
+ in place and should always match the original checksum. The only exception would be broken or
+ unusable files with the potential to cause more harm than good if left as is.
+- Files are served over both HTTP and HTTPS. As long as you obtain the file list in a secure way
+ (via git, HTTPS, IPFS or just have it cached locally) and verify hashes of the binaries
+ after downloading them, you do not have to use HTTPS for the binaries themselves.
+
+The same binaries are in most cases available on the `Solidity release page on GitHub`_. The
+difference is that we do not generally update old releases on the GitHub release page. This means
+that we do not rename them if the naming convention changes and we do not add builds for platforms
+that were not supported at the time of release. This only happens in ``solc-bin``.
+
+The ``solc-bin`` repository contains several top-level directories, each representing a single platform.
+Each one includes a ``list.json`` file listing the available binaries. For example in
+``emscripten-wasm32/list.json`` you will find the following information about version 0.7.4:
+>>>>>>> english/develop
.. code-block:: json
@@ -242,6 +368,7 @@ Ini berarti bahwa:
- Anda dapat menemukan biner di direktori yang sama dengan nama
`solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js `_.
+<<<<<<< HEAD
Perhatikan bahwa file tersebut mungkin berupa symlink, dan Anda harus menyelesaikannya sendiri jika tidak menggunakan
git untuk mengunduhnya atau sistem file Anda tidak mendukung symlink.
- Binary juga di*mirror*kan ke https://binaries.soliditylang.org/emscripten-wasm32/solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js.
@@ -254,6 +381,20 @@ Ini berarti bahwa:
pada baris perintah menggunakan utilitas ``keccak256sum`` yang disediakan oleh fungsi `sha3sum`_ atau fungsi `keccak256()
dari ethereumjs-util`_ dalam JavaScript.
- Anda juga dapat memverifikasi integritas biner dengan membandingkan hash sha256 dengan
+=======
+ Note that the file might be a symlink, and you will need to resolve it yourself if you are not using
+ git to download it or your file system does not support symlinks.
+- The binary is also mirrored at https://binaries.soliditylang.org/emscripten-wasm32/solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js.
+ In this case git is not necessary and symlinks are resolved transparently, either by serving a copy
+ of the file or returning a HTTP redirect.
+- The file is also available on IPFS at `QmTLs5MuLEWXQkths41HiACoXDiH8zxyqBHGFDRSzVE5CS`_.
+- The file might in future be available on Swarm at `16c5f09109c793db99fe35f037c6092b061bd39260ee7a677c8a97f18c955ab1`_.
+- You can verify the integrity of the binary by comparing its keccak256 hash to
+ ``0x300330ecd127756b824aa13e843cb1f43c473cb22eaf3750d5fb9c99279af8c3``. The hash can be computed
+ on the command-line using ``keccak256sum`` utility provided by `sha3sum`_ or `keccak256() function
+ from ethereumjs-util`_ in JavaScript.
+- You can also verify the integrity of the binary by comparing its sha256 hash to
+>>>>>>> english/develop
``0x2b55ed5fec4d9625b6c7b3ab1abd2b7fb7dd2a9c68543bf0323db2c7e2d55af2``.
.. warning::
@@ -290,7 +431,7 @@ Ini berarti bahwa:
.. _IPFS: https://ipfs.io
.. _Swarm: https://swarm-gateways.net/bzz:/swarm.eth
.. _solc-bin: https://github.com/ethereum/solc-bin/
-.. _Solidity release page on github: https://github.com/ethereum/solidity/releases
+.. _Solidity release page on GitHub: https://github.com/ethereum/solidity/releases
.. _sha3sum: https://github.com/maandree/sha3sum
.. _keccak256() function from ethereumjs-util: https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/modules/_hash_.md#const-keccak256
.. _WebAssembly builds: https://emscripten.org/docs/compiling/WebAssembly.html
@@ -299,10 +440,16 @@ Ini berarti bahwa:
.. _building-from-source:
+<<<<<<< HEAD
Membangun dari Sumber (Building from source)
============================================
Prasyarat - Semua Sistem Operasi
+=======
+Building from Source
+====================
+Prerequisites - All Operating Systems
+>>>>>>> english/develop
-------------------------------------
Berikut ini adalah dependensi untuk semua build Solidity:
@@ -310,14 +457,15 @@ Berikut ini adalah dependensi untuk semua build Solidity:
+-----------------------------------+-------------------------------------------------------+
| Software | Notes |
+===================================+=======================================================+
-| `CMake`_ (version 3.13+) | Cross-platform build file generator. |
+| `CMake`_ (version 3.21.3+ on | Cross-platform build file generator. |
+| Windows, 3.13+ otherwise) | |
+-----------------------------------+-------------------------------------------------------+
| `Boost`_ (version 1.77+ on | C++ libraries. |
| Windows, 1.65+ otherwise) | |
+-----------------------------------+-------------------------------------------------------+
| `Git`_ | Command-line tool for retrieving source code. |
+-----------------------------------+-------------------------------------------------------+
-| `z3`_ (version 4.8+, Optional) | For use with SMT checker. |
+| `z3`_ (version 4.8.16+, Optional) | For use with SMT checker. |
+-----------------------------------+-------------------------------------------------------+
| `cvc4`_ (Optional) | For use with SMT checker. |
+-----------------------------------+-------------------------------------------------------+
@@ -329,9 +477,15 @@ Berikut ini adalah dependensi untuk semua build Solidity:
.. _z3: https://github.com/Z3Prover/z3
.. note::
+<<<<<<< HEAD
Versi solidity sebelum 0.5.10 dapat gagal menautkan dengan benar ke versi Boost 1.70+.
Solusi yang mungkin adalah mengganti nama sementara ``/lib/cmake/Boost-1.70.0``
sebelum menjalankan perintah cmake untuk mengkonfigurasi solidity.
+=======
+ Solidity versions prior to 0.5.10 can fail to correctly link against Boost versions 1.70+.
+ A possible workaround is to temporarily rename ``/lib/cmake/Boost-1.70.0``
+ prior to running the cmake command to configure Solidity.
+>>>>>>> english/develop
Mulai dari 0.5.10 penautan terhadap Boost 1.70+ seharusnya bekerja tanpa intervensi manual.
@@ -345,7 +499,22 @@ Berikut ini adalah dependensi untuk semua build Solidity:
Namun, jika Anda melakukan ini, harap ingat untuk meneruskan opsi ``--no-smt`` ke ``scripts/tests.sh``
untuk melewati tes SMT.
+<<<<<<< HEAD
Versi Compiler Minimum
+=======
+.. note::
+ By default the build is performed in *pedantic mode*, which enables extra warnings and tells the
+ compiler to treat all warnings as errors.
+ This forces developers to fix warnings as they arise, so they do not accumulate "to be fixed later".
+ If you are only interested in creating a release build and do not intend to modify the source code
+ to deal with such warnings, you can pass ``-DPEDANTIC=OFF`` option to CMake to disable this mode.
+ Doing this is not recommended for general use but may be necessary when using a toolchain we are
+ not testing with or trying to build an older version with newer tools.
+ If you encounter such warnings, please consider
+ `reporting them `_.
+
+Minimum Compiler Versions
+>>>>>>> english/develop
^^^^^^^^^^^^^^^^^^^^^^^^^
Kompiler C++ berikut dan versi minimumnya dapat mem*build* basis kode Solidity:
@@ -357,6 +526,7 @@ Kompiler C++ berikut dan versi minimumnya dapat mem*build* basis kode Solidity:
Prasyarat - macOS
---------------------
+<<<<<<< HEAD
Untuk macOS, pastikan bahwa anda telah menginstal `Xcode `_
versi terbaru.
Yang berisi `Clang C++ compiler `_,
@@ -364,6 +534,16 @@ Yang berisi `Clang C++ compiler `_,
yang dibuthkan untuk membangun aplikasi C++ di OS X.
Jika Anda menginstal Xcode untuk pertama kalinya, atau baru saja menginstal versi baru,
Anda harus menyetujui lisensi sebelum Anda dapat melakukan builds command-line :
+=======
+For macOS builds, ensure that you have the latest version of
+`Xcode installed `_.
+This contains the `Clang C++ compiler `_, the
+`Xcode IDE `_ and other Apple development
+tools that are required for building C++ applications on OS X.
+If you are installing Xcode for the first time, or have just installed a new
+version then you will need to agree to the license before you can do
+command-line builds:
+>>>>>>> english/develop
.. code-block:: bash
@@ -407,7 +587,7 @@ di Visual Studio 2019 Build Tools atau Visual Studio 2019:
* C++/CLI support
.. _Visual Studio 2019: https://www.visualstudio.com/vs/
-.. _Visual Studio 2019 Build Tools: https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2019
+.. _Visual Studio 2019 Build Tools: https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products
Kami memiliki skrip pembantu yang dapat Anda gunakan untuk menginstal semua dependensi eksternal yang diperlukan:
@@ -427,14 +607,20 @@ Untuk mengkloning kode sumber, jalankan perintah berikut:
git clone --recursive https://github.com/ethereum/solidity.git
cd solidity
+<<<<<<< HEAD
Jika Anda ingin membantu mengembangkan Solidity,
anda harus mem*fork* Solidity dan tambahkan fork pribadi Anda sebagai remote kedua:
+=======
+If you want to help develop Solidity,
+you should fork Solidity and add your personal fork as a second remote:
+>>>>>>> english/develop
.. code-block:: bash
git remote add personal git@github.com:[username]/solidity.git
.. note::
+<<<<<<< HEAD
Metode ini akan menghasilkan build prarilis yang mengarah ke mis. sebuah flag
diatur dalam setiap bytecode yang dihasilkan oleh kompiler tersebut.
Jika Anda ingin membangun kembali kompiler Solidity yang dirilis, maka
@@ -443,6 +629,16 @@ anda harus mem*fork* Solidity dan tambahkan fork pribadi Anda sebagai remote ked
https://github.com/ethereum/solidity/releases/download/v0.X.Y/solidity_0.X.Y.tar.gz
(bukan "Kode sumber" yang disediakan oleh github).
+=======
+ This method will result in a pre-release build leading to e.g. a flag
+ being set in each bytecode produced by such a compiler.
+ If you want to re-build a released Solidity compiler, then
+ please use the source tarball on the GitHub release page:
+
+ https://github.com/ethereum/solidity/releases/download/v0.X.Y/solidity_0.X.Y.tar.gz
+
+ (not the "Source code" provided by GitHub).
+>>>>>>> english/develop
Command-Line Build
------------------
@@ -504,8 +700,13 @@ Jika Anda tertarik dengan opsi CMake apa yang tersedia, jalankan ``cmake .. -LH`
SMT Solvers
-----------
+<<<<<<< HEAD
Solidity dapat dibangun bertentangan dengan SMT solver dan akan melakukannya secara default
jika ditemukan dalam sistem. Setiap solver dapat dinonaktifkan dengan opsi `cmake`.
+=======
+Solidity can be built against SMT solvers and will do so by default if
+they are found in the system. Each solver can be disabled by a ``cmake`` option.
+>>>>>>> english/develop
*Note: Dalam beberapa kasus, ini juga bisa menjadi solusi potensial untuk kegagalan build.*
@@ -535,8 +736,13 @@ String versi Solidity berisi empat bagian:
Jika ada modifikasi lokal, komit akan di-postfixed dengan ``.mod``.
+<<<<<<< HEAD
Bagian-bagian ini digabungkan seperti yang dipersyaratkan oleh Semver, di mana tag pra-rilis Solidity sama dengan pra-rilis Semver
dan komit Solidity dan platform yang digabungkan membentuk metadata build Semver.
+=======
+These parts are combined as required by SemVer, where the Solidity pre-release tag equals to the SemVer pre-release
+and the Solidity commit and platform combined make up the SemVer build metadata.
+>>>>>>> english/develop
Contoh rilis: ``0.4.8+commit.60cc1668.Emscripten.clang``.
@@ -545,13 +751,21 @@ Contoh pre-release: ``0.4.9-nightly.2017.1.17+commit.6ecb4aa3.Emscripten.clang``
Informasi Penting Tentang Pembuatan Versi
=========================================
+<<<<<<< HEAD
Setelah rilis dibuat, tingkat versi patch terbentur, karena kami berasumsi bahwa hanya
perubahan tingkat patch yang mengikuti. Saat perubahan digabung, versi harus dibenturkan sesuai
dengan semver dan tingkat keparahan perubahan. Terakhir, rilis selalu dibuat dengan versi nightly build
saat ini, tetapi tanpa specifier ``prerelease``.
+=======
+After a release is made, the patch version level is bumped, because we assume that only
+patch level changes follow. When changes are merged, the version should be bumped according
+to SemVer and the severity of the change. Finally, a release is always made with the version
+of the current nightly build, but without the ``prerelease`` specifier.
+>>>>>>> english/develop
Contoh:
+<<<<<<< HEAD
0. Rilis 0.4.0 dibuat.
1. Nightly build memiliki versi 0.4.1 mulai sekarang.
2. Perubahan non-breaking diperkenalkan --> tidak ada perubahan versi.
@@ -559,3 +773,12 @@ Contoh:
4. Rilis 0.5.0 dibuat.
Perilaku ini berfungsi baik dengan :ref:`versi pragma `.
+=======
+1. The 0.4.0 release is made.
+2. The nightly build has a version of 0.4.1 from now on.
+3. Non-breaking changes are introduced --> no change in version.
+4. A breaking change is introduced --> version is bumped to 0.5.0.
+5. The 0.5.0 release is made.
+
+This behavior works well with the :ref:`version pragma `.
+>>>>>>> english/develop
diff --git a/docs/internals/layout_in_storage.rst b/docs/internals/layout_in_storage.rst
index 8c7a700b83..6306a699c2 100644
--- a/docs/internals/layout_in_storage.rst
+++ b/docs/internals/layout_in_storage.rst
@@ -52,12 +52,21 @@ sebagai nilai individual.
yang terakhir akan menggunakan tiga.
.. note::
+<<<<<<< HEAD
Tata letak variabel state dalam penyimpanan dianggap sebagai bagian dari
antarmuka eksternal Solidity karena fakta bahwa pointer penyimpanan dapat
diteruskan ke library. Ini berarti bahwa setiap perubahan pada aturan yang
diuraikan dalam bagian ini dianggap sebagai perubahan bahasa yang melanggar
dan karena sifatnya yang kritis harus dipertimbangkan dengan sangat hati-hati
sebelum dieksekusi.
+=======
+ The layout of state variables in storage is considered to be part of the external interface
+ of Solidity due to the fact that storage pointers can be passed to libraries. This means that
+ any change to the rules outlined in this section is considered a breaking change
+ of the language and due to its critical nature should be considered very carefully before
+ being executed. In the event of such a breaking change, we would want to release a
+ compatibility mode in which the compiler would generate bytecode supporting the old layout.
+>>>>>>> english/develop
Mapping dan Array Dinamis
@@ -90,8 +99,13 @@ elemen dapat diperoleh dari data slot ``v`` menggunakan ``(v >> ((j % floor(256
Nilai yang sesuai dengan kunci pemetaan ``k`` terletak di ``keccak256(h(k) . p)``
di mana ``.`` adalah rangkaian dan ``h`` adalah fungsi yang diterapkan ke kunci tergantung pada jenisnya:
+<<<<<<< HEAD
- untuk tipe nilai, ``h`` memasukkan nilai ke 32 byte dengan cara yang sama seperti saat menyimpan nilai dalam memori.
- untuk string dan array byte, ``h`` menghitung hash ``keccak256`` dari data yang tidak diisi.
+=======
+- for value types, ``h`` pads the value to 32 bytes in the same way as when storing the value in memory.
+- for strings and byte arrays, ``h(k)`` is just the unpadded data.
+>>>>>>> english/develop
Jika nila mapping adalah
tipe non-value, slot yang dihitung menandai awal dari data. Jika nilainya bertipe struct,
@@ -137,9 +151,14 @@ Untuk array byte yang menyimpan data dengan panjang ``32`` atau lebih byte, slot
Ini berarti bahwa Anda dapat membedakan array pendek dari array panjang dengan memeriksa apakah bit terendah disetel: pendek (tidak disetel) dan panjang (diatur).
.. note::
+<<<<<<< HEAD
Menangani slot yang disandikan secara tidak valid saat ini tidak didukung tetapi dapat ditambahkan di masa mendatang.
Jika Anda mengompilasi melalui pipeline compiler berbasis IR eksperimental, membaca slot yang dikodekan secara tidak
valid akan menghasilkan kesalahan ``Panic(0x22)``.
+=======
+ Handling invalidly encoded slots is currently not supported but may be added in the future.
+ If you are compiling via IR, reading an invalidly encoded slot results in a ``Panic(0x22)`` error.
+>>>>>>> english/develop
JSON Output
===========
@@ -151,7 +170,7 @@ Outputnya adalah objek JSON yang berisi dua kunci, ``storage`` dan ``types``.
Objek ``storage`` adalah array di mana setiap elemen memiliki bentuk berikut:
-.. code::
+.. code-block:: json
{
@@ -177,7 +196,7 @@ dan
``types``, yang berbentuk:
-.. code::
+.. code-block:: json
{
"encoding": "inplace",
@@ -204,9 +223,15 @@ jenis), array memiliki tipe ``base``, dan struct mencantumkan ``members`` mereka
format yang sama dengan ``storage`` tingkat atas (lihat :ref:`di atas
`).
+<<<<<<< HEAD
.. note ::
Format output JSON dari layout penyimpanan kontrak masih dianggap eksperimental
dan dapat berubah dalam rilis Solidity yang tidak melanggar.
+=======
+.. note::
+ The JSON output format of a contract's storage layout is still considered experimental
+ and is subject to change in non-breaking releases of Solidity.
+>>>>>>> english/develop
Contoh berikut menunjukkan kontrak dan tata letak penyimpanannya, yang berisi:
tipe nilai dan referensi, tipe yang encoded packed, dan tipe nested.
@@ -228,13 +253,13 @@ tipe nilai dan referensi, tipe yang encoded packed, dan tipe nested.
uint y;
S s;
address addr;
- mapping (uint => mapping (address => bool)) map;
+ mapping(uint => mapping(address => bool)) map;
uint[] array;
string s1;
bytes b1;
}
-.. code:: json
+.. code-block:: json
{
"storage": [
diff --git a/docs/internals/optimizer.rst b/docs/internals/optimizer.rst
index 747d920e88..2ba54e21cf 100644
--- a/docs/internals/optimizer.rst
+++ b/docs/internals/optimizer.rst
@@ -5,8 +5,16 @@
Optimizer
*********
+<<<<<<< HEAD
Kompiler Solidity menggunakan dua modul pengoptimal yang berbeda: Pengoptimal "lama"
yang beroperasi pada tingkat opcode dan pengoptimal "baru" yang beroperasi pada kode Yul IR.
+=======
+The Solidity compiler involves optimizations at three different levels (in order of execution):
+
+- Optimizations during code generation based on a direct analysis of Solidity code.
+- Optimizing transformations on the Yul IR code.
+- Optimizations at the opcode level.
+>>>>>>> english/develop
Pengoptimal berbasis opcode menerapkan serangkaian `aturan penyederhanaan `_
untuk opcode. Ini juga menggabungkan set kode yang sama dan menghapus kode yang tidak digunakan.
@@ -19,12 +27,43 @@ ulang pemanggilan fungsi.
Demikian pula, jika suatu fungsi bebas efek samping dan hasilnya dikalikan dengan nol, Anda dapat
menghapus panggilan fungsi sepenuhnya.
+<<<<<<< HEAD
Saat ini, parameter ``--optimize`` mengaktifkan pengoptimal berbasis opcode untuk bytecode yang dihasilkan
dan pengoptimal Yuluntuk kode Yul yang dihasilkan secara internal, misalnya untuk ABI coder v2.
Seseorang dapat menggunakan ``solc --ir-optimized --optimize`` untuk menghasilkan Yul IR
eksperimental yang dioptimalkan untuk sumber Soliditas. Demikian pula, seseorang dapat menggunakan ``solc --strict-assembly --optimize`` untuk mode Yul stand-alone.
Anda dapat menemukan detail lebih lanjut tentang modul pengoptimal dan langkah pengoptimalannya di bawah.
+=======
+The codegen-based optimizer affects the initial low-level code produced from the Solidity input.
+In the legacy pipeline, the bytecode is generated immediately and most of the optimizations of this
+kind are implicit and not configurable, the only exception being an optimization which changes the
+order of literals in binary operations.
+The IR-based pipeline takes a different approach and produces Yul IR closely matching the structure
+of the Solidity code, with nearly all optimizations deferred to the Yul optimizer module.
+In that case codegen-level optimization is done only in very limited cases which are difficult to
+handle in Yul IR, but are straightforward with the high-level information from analysis phase at hand.
+An example of such an optimization is the bypass of checked arithmetic when incrementing the counter
+in certain idiomatic ``for`` loops.
+
+Currently, the parameter ``--optimize`` activates the opcode-based optimizer for the
+generated bytecode and the Yul optimizer for the Yul code generated internally, for example for ABI coder v2.
+One can use ``solc --ir-optimized --optimize`` to produce an
+optimized Yul IR for a Solidity source. Similarly, one can use ``solc --strict-assembly --optimize``
+for a stand-alone Yul mode.
+
+.. note::
+ Some optimizer steps, such as, for example, the `peephole optimizer `_
+ and the :ref:`unchecked loop increment optimizer ` are always
+ enabled by default and can only be turned off via the :ref:`Standard JSON `.
+
+.. note::
+ An empty optimizer sequence is accepted even without ``--optimize`` in order to fully disable
+ the user-supplied portion of the Yul :ref:`optimizer sequence `, as by default,
+ even when the optimizer is not turned on, the :ref:`unused pruner ` step will be run.
+
+You can find more details on both optimizer modules and their optimization steps below.
+>>>>>>> english/develop
Manfaat Mengoptimalkan Kode Solidity
====================================
@@ -266,62 +305,103 @@ Langkah-langkah transformasi berikut adalah komponen utama:
- SSA Transform
- Common Subexpression Eliminator
- Expression Simplifier
-- Redundant Assign Eliminator
+- Unused Assign Eliminator
- Full Inliner
+<<<<<<< HEAD
Optimizer Step
--------------
+=======
+.. _optimizer-steps:
+
+Optimizer Steps
+---------------
+>>>>>>> english/develop
Ini adalah daftar semua langkah pengoptimal berbasis Yul yang diurutkan berdasarkan abjad. Anda dapat menemukan informasi
lebih lanjut tentang masing-masing langkah dan urutannya di bawah ini.
-- :ref:`block-flattener`.
-- :ref:`circular-reference-pruner`.
-- :ref:`common-subexpression-eliminator`.
-- :ref:`conditional-simplifier`.
-- :ref:`conditional-unsimplifier`.
-- :ref:`control-flow-simplifier`.
-- :ref:`dead-code-eliminator`.
-- :ref:`equivalent-function-combiner`.
-- :ref:`expression-joiner`.
-- :ref:`expression-simplifier`.
-- :ref:`expression-splitter`.
-- :ref:`for-loop-condition-into-body`.
-- :ref:`for-loop-condition-out-of-body`.
-- :ref:`for-loop-init-rewriter`.
-- :ref:`expression-inliner`.
-- :ref:`full-inliner`.
-- :ref:`function-grouper`.
-- :ref:`function-hoister`.
-- :ref:`function-specializer`.
-- :ref:`literal-rematerialiser`.
-- :ref:`load-resolver`.
-- :ref:`loop-invariant-code-motion`.
-- :ref:`redundant-assign-eliminator`.
-- :ref:`reasoning-based-simplifier`.
-- :ref:`rematerialiser`.
-- :ref:`SSA-reverser`.
-- :ref:`SSA-transform`.
-- :ref:`structural-simplifier`.
-- :ref:`unused-function-parameter-pruner`.
-- :ref:`unused-pruner`.
-- :ref:`var-decl-initializer`.
+============ ===============================
+Abbreviation Full name
+============ ===============================
+``f`` :ref:`block-flattener`
+``l`` :ref:`circular-reference-pruner`
+``c`` :ref:`common-subexpression-eliminator`
+``C`` :ref:`conditional-simplifier`
+``U`` :ref:`conditional-unsimplifier`
+``n`` :ref:`control-flow-simplifier`
+``D`` :ref:`dead-code-eliminator`
+``E`` :ref:`equal-store-eliminator`
+``v`` :ref:`equivalent-function-combiner`
+``e`` :ref:`expression-inliner`
+``j`` :ref:`expression-joiner`
+``s`` :ref:`expression-simplifier`
+``x`` :ref:`expression-splitter`
+``I`` :ref:`for-loop-condition-into-body`
+``O`` :ref:`for-loop-condition-out-of-body`
+``o`` :ref:`for-loop-init-rewriter`
+``i`` :ref:`full-inliner`
+``g`` :ref:`function-grouper`
+``h`` :ref:`function-hoister`
+``F`` :ref:`function-specializer`
+``T`` :ref:`literal-rematerialiser`
+``L`` :ref:`load-resolver`
+``M`` :ref:`loop-invariant-code-motion`
+``m`` :ref:`rematerialiser`
+``V`` :ref:`SSA-reverser`
+``a`` :ref:`SSA-transform`
+``t`` :ref:`structural-simplifier`
+``r`` :ref:`unused-assign-eliminator`
+``p`` :ref:`unused-function-parameter-pruner`
+``S`` :ref:`unused-store-eliminator`
+``u`` :ref:`unused-pruner`
+``d`` :ref:`var-decl-initializer`
+============ ===============================
+
+Some steps depend on properties ensured by ``BlockFlattener``, ``FunctionGrouper``, ``ForLoopInitRewriter``.
+For this reason the Yul optimizer always applies them before applying any steps supplied by the user.
+
+.. _selecting-optimizations:
Meimilih Optimizations
-----------------------
+<<<<<<< HEAD
Secara default, pengoptimal menerapkan urutan langkah pengoptimalan yang telah ditentukan sebelumnya
ke rakitan yang dihasilkan. Anda dapat mengganti urutan ini dan menyediakan urutan Anda sendiri menggunakan
opsi ``--yul-optimizations``:
+=======
+By default the optimizer applies its predefined sequence of optimization steps to the generated assembly.
+You can override this sequence and supply your own using the ``--yul-optimizations`` option:
+>>>>>>> english/develop
.. code-block:: bash
- solc --optimize --ir-optimized --yul-optimizations 'dhfoD[xarrscLMcCTU]uljmul'
+ solc --optimize --ir-optimized --yul-optimizations 'dhfoD[xarrscLMcCTU]uljmul:fDnTOcmu'
+The order of steps is significant and affects the quality of the output.
+Moreover, applying a step may uncover new optimization opportunities for others that were already applied,
+so repeating steps is often beneficial.
+
+<<<<<<< HEAD
Urutan di dalam ``[...]`` akan diterapkan beberapa kali dalam satu lingkaran hingga kode Yul tetap tidak berubah
atau hingga jumlah putaran maksimum (saat ini 12) telah tercapai.
Singkatan yang tersedia tercantum dalam `Yul optimizer docs `_.
+=======
+The sequence inside ``[...]`` will be applied multiple times in a loop until the Yul code
+remains unchanged or until the maximum number of rounds (currently 12) has been reached.
+Brackets (``[]``) may be used multiple times in a sequence, but can not be nested.
+
+An important thing to note, is that there are some hardcoded steps that are always run before and after the
+user-supplied sequence, or the default sequence if one was not supplied by the user.
+
+The cleanup sequence delimiter ``:`` is optional, and is used to supply a custom cleanup sequence
+in order to replace the default one. If omitted, the optimizer will simply apply the default cleanup
+sequence. In addition, the delimiter may be placed at the beginning of the user-supplied sequence,
+which will result in the optimization sequence being empty, whereas conversely, if placed at the end of
+the sequence, will be treated as an empty cleanup sequence.
+>>>>>>> english/develop
Preprocessing
-------------
@@ -425,8 +505,13 @@ diubah menjadi
Body...
}
+<<<<<<< HEAD
Ini memudahkan proses pengoptimalan lainnya karena kita dapat mengabaikan
aturan pelingkupan rumit dari blok untuk inisialisasi loop.
+=======
+This eases the rest of the optimization process because we can ignore
+the complicated scoping rules of the for loop initialization block.
+>>>>>>> english/develop
.. _var-decl-initializer:
@@ -508,19 +593,29 @@ perubahan ini dan membuat kode lebih kompak lagi di akhir.
ExpressionSplitter
^^^^^^^^^^^^^^^^^^
+<<<<<<< HEAD
Pembagi ekspresi mengubah ekspresi seperti ``add(mload(0x123), mul(mload(0x456), 0x20))``
menjadi urutan deklarasi variabel unik yang diberi sub-ekspresi dari ekspresi itu sehingga
setiap pemanggilan fungsi memiliki hanya variabel atau literal sebagai argumen.
+=======
+The expression splitter turns expressions like ``add(mload(0x123), mul(mload(0x456), 0x20))``
+into a sequence of declarations of unique variables that are assigned sub-expressions
+of that expression so that each function call has only variables
+as arguments.
+>>>>>>> english/develop
Di atas akan diubah menjadi
.. code-block:: yul
{
- let _1 := mload(0x123)
- let _2 := mul(_1, 0x20)
- let _3 := mload(0x456)
- let z := add(_3, _2)
+ let _1 := 0x20
+ let _2 := 0x456
+ let _3 := mload(_2)
+ let _4 := mul(_3, _1)
+ let _5 := 0x123
+ let _6 := mload(_5)
+ let z := add(_6, _4)
}
Perhatikan bahwa transformasi ini tidak mengubah urutan opcode atau panggilan fungsi.
@@ -529,9 +624,15 @@ Ini tidak diterapkan pada kondisi iterasi loop, karena aliran kontrol loop tidak
ini dari ekspresi dalam dalam semua kasus. Kita dapat menghindari batasan ini dengan menerapkan
:ref:`for-loop-condition-into-body` untuk memindahkan kondisi iterasi ke dalam loop body.
+<<<<<<< HEAD
Program akhir harus dalam bentuk sedemikian rupa (dengan pengecualian kondisi loop)
panggilan fungsi tidak dapat muncul bersarang di dalam ekspresi
dan semua argumen pemanggilan fungsi harus berupa literal atau variabel.
+=======
+The final program should be in an *expression-split form*, where (with the exception of loop conditions)
+function calls cannot appear nested inside expressions
+and all function call arguments have to be variables.
+>>>>>>> english/develop
Manfaat dari formulir ini adalah lebih mudah untuk mengurutkan ulang urutan opcode
dan juga lebih mudah untuk melakukan inlining panggilan fungsi. Selain itu, lebih sederhana
@@ -590,18 +691,23 @@ blok, variabel SSA baru akan dibuat di lokasi di mana aliran kontrol bergabung,
ini termasuk awal dari loop post/body block dan lokasi tepat setelahnya
Pernyataan If/Switch/ForLoop/Block.
+<<<<<<< HEAD
Setelah tahap ini, Redundant Assign Eliminator direkomendasikan untuk
menghapus tugas perantara yang tidak perlu.
+=======
+After this stage, the Unused Assign Eliminator is recommended to remove the unnecessary
+intermediate assignments.
+>>>>>>> english/develop
Tahap ini memberikan hasil terbaik jika Expression Splitter dan Common Subexpression Eliminator
dijalankan tepat sebelum itu, karena itu tidak menghasilkan jumlah variabel yang berlebihan.
Di sisi lain, Eliminator Subekspresi Umum bisa lebih efisien jika dijalankan setelah
transformasi SSA.
-.. _redundant-assign-eliminator:
+.. _unused-assign-eliminator:
-RedundantAssignEliminator
-^^^^^^^^^^^^^^^^^^^^^^^^^
+UnusedAssignEliminator
+^^^^^^^^^^^^^^^^^^^^^^
Transformasi SSA selalu menghasilkan penugasan dalam bentuk ``a := a_i``, meskipun
ini mungkin tidak diperlukan dalam banyak kasus, seperti contoh berikut:
@@ -629,8 +735,14 @@ Transformasi SSA mengonversi cuplikan ini menjadi yang berikut:
sstore(a_3, 1)
}
+<<<<<<< HEAD
Redundant Assign Eliminator menghapus ketiga penetapan ke ``a``, karena
nilai ``a`` tidak digunakan dan dengan demikian mengubah snippet ini menjadi bentuk strict SSA:
+=======
+The Unused Assign Eliminator removes all the three assignments to ``a``, because
+the value of ``a`` is not used and thus turn this
+snippet into strict SSA form:
+>>>>>>> english/develop
.. code-block:: yul
@@ -641,8 +753,13 @@ nilai ``a`` tidak digunakan dan dengan demikian mengubah snippet ini menjadi ben
sstore(a_3, 1)
}
+<<<<<<< HEAD
Tentu saja bagian-bagian rumit untuk menentukan apakah suatu penugasan berlebihan atau tidak terhubung
dengan aliran kontrol yang bergabung.
+=======
+Of course the intricate parts of determining whether an assignment is unused or not
+are connected to joining control flow.
+>>>>>>> english/develop
Komponen bekerja sebagai berikut secara rinci:
@@ -660,7 +777,7 @@ Nilai-nilai yang bertentangan diselesaikan dengan cara berikut:
- "unused", "undecided" -> "undecided"
- "unused", "used" -> "used"
-- "undecided, "used" -> "used"
+- "undecided", "used" -> "used"
Untuk for-loop, condition, bodi dan post-part dikunjungi dua kali, dengan memperhitungkan aliran
kontrol penyambungan pada condition.
@@ -752,10 +869,18 @@ karena subekspresi tersebut harus dapat dipindahkan.
Semua subekspresi yang merupakan pengidentifikasi itu sendiri diganti dengan nilainya saat ini jika
nilainya adalah pengidentifikasi.
+<<<<<<< HEAD
Kombinasi kedua aturan di atas memungkinkan untuk menghitung penomoran nilai lokal, yang berarti
bahwa jika dua variabel memiliki nilai yang sama, salah satunya akan selalu tidak digunakan. Pemangkas
yang Tidak Digunakan atau
Redundant Assign Eliminator kemudian akan dapat sepenuhnya menghilangkan variabel tersebut.
+=======
+The combination of the two rules above allow to compute a local value
+numbering, which means that if two variables have the same
+value, one of them will always be unused. The Unused Pruner or the
+Unused Assign Eliminator will then be able to fully eliminate such
+variables.
+>>>>>>> english/develop
Langkah ini sangat efisien jika pemisah ekspresi dijalankan sebelumnya. Jika kode dalam bentuk pseudo-SSA,
nilai-nilai variabel tersedia untuk waktu yang lebih lama dan dengan demikian kami memiliki peluang ekspresi yang lebih tinggi untuk dapat diganti.
@@ -764,11 +889,17 @@ Penyederhanaan ekspresi akan dapat melakukan penggantian yang lebih baik jika el
.. _expression-simplifier:
-Expression Simplifier
-^^^^^^^^^^^^^^^^^^^^^
+ExpressionSimplifier
+^^^^^^^^^^^^^^^^^^^^
+<<<<<<< HEAD
Expression Simplifier menggunakan Dataflow Analyzer dan menggunakan daftar transformasi
ekivalensi pada ekspresi seperti ``X + 0 -> X`` untuk menyederhanakan kode.
+=======
+The ExpressionSimplifier uses the Dataflow Analyzer and makes use
+of a list of equivalence transforms on expressions like ``X + 0 -> X``
+to simplify the code.
+>>>>>>> english/develop
Ia mencoba mencocokkan pola seperti ``X + 0`` pada setiap subekspresi.
Selama prosedur pencocokan, ini menyelesaikan variabel ke ekspresi yang saat ini ditetapkan
@@ -798,6 +929,7 @@ Bekerja paling baik jika kode dalam bentuk SSA.
Prasyarat: Disambiguator, ForLoopInitRewriter.
+<<<<<<< HEAD
.. _reasoning-based-simplifier:
ReasoningBasedSimplifier
@@ -814,6 +946,8 @@ Ini hanya efektif pada dialek EVM, tetapi aman digunakan pada dialek lain.
Prasyarat: Disambiguator, SSATransform.
+=======
+>>>>>>> english/develop
Statement-Scale Simplifications
-------------------------------
@@ -892,8 +1026,13 @@ DeadCodeEliminator
Tahap pengoptimalan ini menghapus kode yang tidak dapat dijangkau.
+<<<<<<< HEAD
Kode yang tidak dapat dijangkau adalah kode apa pun dalam blok yang didahului oleh sebuah
leave, return, invalid, break, continue, selfdestruct atau revert.
+=======
+Unreachable code is any code within a block which is preceded by a
+leave, return, invalid, break, continue, selfdestruct, revert or by a call to a user-defined function that recurses infinitely.
+>>>>>>> english/develop
Definisi fungsi dipertahankan seperti yang mungkin dipanggil oleh kode
sebelumnya dan dengan demikian dianggap dapat dijangkau.
@@ -903,6 +1042,22 @@ kami membutuhkan ForLoopInitRewriter untuk dijalankan sebelum langkah ini.
Prasyarat: ForLoopInitRewriter, Function Hoister, Function Grouper
+.. _equal-store-eliminator:
+
+EqualStoreEliminator
+^^^^^^^^^^^^^^^^^^^^
+
+This steps removes ``mstore(k, v)`` and ``sstore(k, v)`` calls if
+there was a previous call to ``mstore(k, v)`` / ``sstore(k, v)``,
+no other store in between and the values of ``k`` and ``v`` did not change.
+
+This simple step is effective if run after the SSA transform and the
+Common Subexpression Eliminator, because SSA will make sure that the variables
+will not change and the Common Subexpression Eliminator re-uses exactly the same
+variable if the value is known to be the same.
+
+Prerequisites: Disambiguator, ForLoopInitRewriter
+
.. _unused-pruner:
UnusedPruner
@@ -939,16 +1094,25 @@ Komponen ini menggunakan Dataflow Analyzer.
BlockFlattener
^^^^^^^^^^^^^^
+<<<<<<< HEAD
Tahap ini menghilangkan nested block dengan memasukkan pernyataan di
inner block pada tempat yang sesuai di outer block:
+=======
+This stage eliminates nested blocks by inserting the statement in the
+inner block at the appropriate place in the outer block. It depends on the
+FunctionGrouper and does not flatten the outermost block to keep the form
+produced by the FunctionGrouper.
+>>>>>>> english/develop
.. code-block:: yul
{
- let x := 2
{
- let y := 3
- mstore(x, y)
+ let x := 2
+ {
+ let y := 3
+ mstore(x, y)
+ }
}
}
@@ -957,9 +1121,11 @@ diubah menjadi
.. code-block:: yul
{
- let x := 2
- let y := 3
- mstore(x, y)
+ {
+ let x := 2
+ let y := 3
+ mstore(x, y)
+ }
}
Selama kode disamarkan, ini tidak menimbulkan masalah karena
@@ -1033,6 +1199,52 @@ Langkah LiteralRematerialiser tidak diperlukan untuk kebenaran. Ini membantu men
``function f(x) -> y { revert(y, y} }`` di mana literal ``y`` akan diganti dengan nilainya ``0``,
memungkinkan kita untuk menulis ulang fungsi.
+.. index:: ! unused store eliminator
+.. _unused-store-eliminator:
+
+UnusedStoreEliminator
+^^^^^^^^^^^^^^^^^^^^^
+
+Optimizer component that removes redundant ``sstore`` and memory store statements.
+In case of an ``sstore``, if all outgoing code paths revert (due to an explicit ``revert()``, ``invalid()``, or infinite recursion) or
+lead to another ``sstore`` for which the optimizer can tell that it will overwrite the first store, the statement will be removed.
+However, if there is a read operation between the initial ``sstore`` and the revert, or the overwriting ``sstore``, the statement
+will not be removed.
+Such read operations include: external calls, user-defined functions with any storage access, and ``sload`` of a slot that cannot be
+proven to differ from the slot written by the initial ``sstore``.
+
+For example, the following code
+
+.. code-block:: yul
+
+ {
+ let c := calldataload(0)
+ sstore(c, 1)
+ if c {
+ sstore(c, 2)
+ }
+ sstore(c, 3)
+ }
+
+will be transformed into the code below after the Unused Store Eliminator step is run
+
+.. code-block:: yul
+
+ {
+ let c := calldataload(0)
+ if c { }
+ sstore(c, 3)
+ }
+
+For memory store operations, things are generally simpler, at least in the outermost yul block as all such
+statements will be removed if they are never read from in any code path.
+At function analysis level, however, the approach is similar to ``sstore``, as we do not know whether the memory location will
+be read once we leave the function's scope, so the statement will be removed only if all code paths lead to a memory overwrite.
+
+Best run in SSA form.
+
+Prerequisites: Disambiguator, ForLoopInitRewriter.
+
.. _equivalent-function-combiner:
EquivalentFunctionCombiner
@@ -1078,6 +1290,7 @@ Komponen ini hanya dapat digunakan pada sumber dengan nama unik.
FullInliner
^^^^^^^^^^^
+<<<<<<< HEAD
Full Inliner menggantikan panggilan tertentu dari fungsi tertentu
oleh tubuh fungsi. Ini tidak terlalu membantu dalam banyak kasus, karena
hanya meningkatkan ukuran kode tetapi tidak memiliki manfaat. Selain itu,
@@ -1085,6 +1298,15 @@ kode biasanya sangat mahal dan kita sering lebih suka memiliki kode yang
lebih pendek daripada kode yang lebih efisien. Namun, dalam kasus yang sama,
penyejajaran fungsi dapat memiliki efek positif pada langkah pengoptimal
berikutnya. Ini adalah kasus jika salah satu argumen fungsi adalah konstanta, misalnya.
+=======
+The FullInliner replaces certain calls of certain functions
+by the function's body. This is not very helpful in most cases, because
+it just increases the code size but does not have a benefit. Furthermore,
+code is usually very expensive and we would often rather have shorter
+code than more efficient code. In some cases, though, inlining a function
+can have positive effects on subsequent optimizer steps. This is the case
+if one of the function arguments is a constant, for example.
+>>>>>>> english/develop
Selama inlining, heuristik digunakan untuk mengetahui apakah fungsi memanggil
harus digarisbawahi atau tidak.
@@ -1102,6 +1324,11 @@ kita dapat menjalankan pengoptimal pada fungsi khusus ini. Jika
menghasilkan keuntungan besar, fungsi khusus dipertahankan,
jika tidak, fungsi asli digunakan sebagai gantinya.
+FunctionHoister and ExpressionSplitter are recommended as prerequisites since they make the step
+more efficient, but are not required for correctness.
+In particular, function calls with other function calls as arguments are not inlined, but running
+ExpressionSplitter beforehand ensures that there are no such calls in the input.
+
Cleanup
-------
@@ -1144,10 +1371,17 @@ Ini adalah langkah kecil yang membantu membalikkan efek transformasi SSA
jika digabungkan dengan Common Subexpression Eliminator dan
Pemangkas yang tidak digunakan.
+<<<<<<< HEAD
Formulir SSA yang kami hasilkan merusak pembuatan kode pada EVM dan
WebAssembly sama karena menghasilkan banyak variabel lokal. Itu akan
lebih baik hanya menggunakan kembali variabel yang ada dengan tugas daripada
deklarasi variabel baru.
+=======
+The SSA form we generate is detrimental to code generation
+because it produces many local variables. It would
+be better to just re-use existing variables with assignments instead of
+fresh variable declarations.
+>>>>>>> english/develop
Transformasi SSA menulis ulang
@@ -1264,14 +1498,69 @@ ke dalam
LiteralRematerialiser harus dijalankan sebelum langkah ini.
+Codegen-Based Optimizer Module
+==============================
-WebAssembly specific
---------------------
+Currently, the codegen-based optimizer module provides two optimizations.
-MainFunction
-^^^^^^^^^^^^
+The first one, available in the legacy code generator, moves literals to the right side of
+commutative binary operators, which helps exploit their associativity.
+<<<<<<< HEAD
Mengubah blok paling atas menjadi fungsi dengan nama tertentu ("main") yang tidak memiliki
input maupun output.
Tergantung pada Fungsi Kerapu.
+=======
+The other one, available in the IR-based code generator, enables the use of unchecked arithmetic
+when generating code for incrementing the counter variable of certain idiomatic ``for`` loops.
+This avoids wasting gas by identifying some conditions that guarantee that the counter variable
+cannot overflow.
+This eliminates the need to use a verbose unchecked arithmetic block inside the loop body to
+increment the counter variable.
+
+.. _unchecked-loop-optimizer:
+
+Unchecked Loop Increment
+------------------------
+
+Introduced in Solidity ``0.8.22``, the overflow check optimization step is concerned with identifying
+the conditions under which the ``for`` loop counter can be safely incremented
+without overflow checks.
+
+This optimization is **only** applied to ``for`` loops of the general form:
+
+.. code-block:: solidity
+
+ for (uint i = X; i < Y; ++i) {
+ // variable i is not modified in the loop body
+ }
+
+The condition and the fact that the counter variable is only ever incremented
+guarantee that it never overflows.
+The precise requirements for the loop to be eligible for the optimization are as follows:
+
+- The loop condition is a comparison of the form ``i < Y``, for a local counter variable ``i``
+ (called the "loop counter" hereon) and an expression ``Y``.
+- The built-in operator ``<`` is necessarily used in the loop condition and is the only operator
+ that triggers the optimization. ``<=`` and the like are intentionally excluded. Additionally,
+ user-defined operators are **not** eligible.
+- The loop expression is a prefix or postfix increment of the counter variable, i.e, ``i++`` or ``++i``.
+- The loop counter is a local variable of a built-in integer type.
+- The loop counter is **not** modified by the loop body or by the expression used as the loop condition.
+- The comparison is performed on the same type as the loop counter, meaning that the type of the
+ right-hand-side expression is implicitly convertible to the type of the counter, such that the latter
+ is not implicitly widened before the comparison.
+
+To clarify the last condition, consider the following example:
+
+.. code-block:: solidity
+
+ for (uint8 i = 0; i < uint16(1000); i++) {
+ // ...
+ }
+
+In this case, the counter ``i`` has its type implicitly converted from ``uint8``
+to ``uint16`` before the comparison and the condition is in fact never false, so
+the overflow check for the increment cannot be removed.
+>>>>>>> english/develop
diff --git a/docs/internals/source_mappings.rst b/docs/internals/source_mappings.rst
index be9e8f699c..e4840610d3 100644
--- a/docs/internals/source_mappings.rst
+++ b/docs/internals/source_mappings.rst
@@ -24,10 +24,17 @@ bagian dari input asli tetapi direferensikan dari sumber
mapping. File sumber ini bersama dengan pengidentifikasinya dapat
diperoleh melalui ``output['contracts'][sourceName][contractName]['evm']['bytecode']['generatedSources']``.
+<<<<<<< HEAD
.. note ::
Dalam hal instruksi yang tidak terkait dengan file sumber tertentu,
mapping sumber menetapkan pengidentifikasi integer ``-1``. Ini mungkin terjadi untuk
bagian bytecode yang berasal dari pernyataan inline assembly yang dihasilkan oleh kompiler.
+=======
+.. note::
+ In the case of instructions that are not associated with any particular source file,
+ the source mapping assigns an integer identifier of ``-1``. This may happen for
+ bytecode sections stemming from compiler-generated inline assembly statements.
+>>>>>>> english/develop
Source mapping di dalam AST menggunakan notasi
berikut:
diff --git a/docs/internals/variable_cleanup.rst b/docs/internals/variable_cleanup.rst
index de1f78315a..59c1a6126e 100644
--- a/docs/internals/variable_cleanup.rst
+++ b/docs/internals/variable_cleanup.rst
@@ -4,6 +4,7 @@
Cleaning Up Variabel
*********************
+<<<<<<< HEAD
Ketika nilai lebih pendek dari 256 bit, dalam beberapa kasus bit yang tersisa harus dibersihkan.
Kompiler Solidity dirancang untuk membersihkan bit yang tersisa sebelum operasi apa pun yang
mungkin terpengaruh oleh potensi sampah dalam bit yang tersisa.
@@ -12,6 +13,18 @@ dibersihkan karena isi memori dapat digunakan untuk komputasi
hash atau dikirim sebagai data panggilan pesan. Demikian pula, sebelumnya
menyimpan nilai dalam penyimpanan, bit yang tersisa perlu dibersihkan
karena jika tidak, nilai *garbled* dapat diamati.
+=======
+Ultimately, all values in the EVM are stored in 256 bit words.
+Thus, in some cases, when the type of a value has less than 256 bits,
+it is necessary to clean the remaining bits.
+The Solidity compiler is designed to do such cleaning before any operations
+that might be adversely affected by the potential garbage in the remaining bits.
+For example, before writing a value to memory, the remaining bits need
+to be cleared because the memory contents can be used for computing
+hashes or sent as the data of a message call. Similarly, before
+storing a value in the storage, the remaining bits need to be cleaned
+because otherwise the garbled value can be observed.
+>>>>>>> english/develop
Perhatikan bahwa akses melalui inline assembly tidak dianggap sebagai operasi seperti itu:
Jika Anda menggunakan inline assembly untuk mengakses variabel Solidityyang lebih pendek
@@ -24,6 +37,7 @@ nilai boolean sebelum digunakan sebagai kondisi untuk ``JUMPI``.
Selain prinsip desain di atas, compiler Solidity
membersihkan data input saat dimuat ke stack.
+<<<<<<< HEAD
Tipe yang berbeda memiliki aturan berbeda untuk membersihkan nilai yang tidak valid:
+---------------+---------------+-------------------+
@@ -46,3 +60,85 @@ Tipe yang berbeda memiliki aturan berbeda untuk membersihkan nilai yang tidak va
| | |depan eksepsi |
| | |akan diberikan |
+---------------+---------------+-------------------+
+=======
+The following table describes the cleaning rules applied to different types,
+where ``higher bits`` refers to the remaining bits in case the type has less than 256 bits.
+
++---------------+---------------+-------------------------+
+|Type |Valid Values |Cleanup of Invalid Values|
++===============+===============+=========================+
+|enum of n |0 until n - 1 |throws exception |
+|members | | |
++---------------+---------------+-------------------------+
+|bool |0 or 1 |results in 1 |
++---------------+---------------+-------------------------+
+|signed integers|higher bits |currently silently |
+| |set to the |signextends to a valid |
+| |sign bit |value, i.e. all higher |
+| | |bits are set to the sign |
+| | |bit; may throw an |
+| | |exception in the future |
++---------------+---------------+-------------------------+
+|unsigned |higher bits |currently silently masks |
+|integers |zeroed |to a valid value, i.e. |
+| | |all higher bits are set |
+| | |to zero; may throw an |
+| | |exception in the future |
++---------------+---------------+-------------------------+
+
+Note that valid and invalid values are dependent on their type size.
+Consider ``uint8``, the unsigned 8-bit type, which has the following valid values:
+
+.. code-block:: none
+
+ 0000...0000 0000 0000
+ 0000...0000 0000 0001
+ 0000...0000 0000 0010
+ ....
+ 0000...0000 1111 1111
+
+Any invalid value will have the higher bits set to zero:
+
+.. code-block:: none
+
+ 0101...1101 0010 1010 invalid value
+ 0000...0000 0010 1010 cleaned value
+
+For ``int8``, the signed 8-bit type, the valid values are:
+
+Negative
+
+.. code-block:: none
+
+ 1111...1111 1111 1111
+ 1111...1111 1111 1110
+ ....
+ 1111...1111 1000 0000
+
+Positive
+
+.. code-block:: none
+
+ 0000...0000 0000 0000
+ 0000...0000 0000 0001
+ 0000...0000 0000 0010
+ ....
+ 0000...0000 1111 1111
+
+The compiler will ``signextend`` the sign bit, which is 1 for negative and 0 for
+positive values, overwriting the higher bits:
+
+Negative
+
+.. code-block:: none
+
+ 0010...1010 1111 1111 invalid value
+ 1111...1111 1111 1111 cleaned value
+
+Positive
+
+.. code-block:: none
+
+ 1101...0101 0000 0100 invalid value
+ 0000...0000 0000 0100 cleaned value
+>>>>>>> english/develop
diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst
index 8459b7c965..9cf89223a2 100644
--- a/docs/introduction-to-smart-contracts.rst
+++ b/docs/introduction-to-smart-contracts.rst
@@ -8,9 +8,15 @@ Pengenalan Smart Kontrak
Smart Kontrak Sederhana
************************
+<<<<<<< HEAD
Mari kita mulai dengan contoh dasar yang menetapkan nilai variabel dan mengeksposnya
untuk dapat diakses oleh kontrak lain. Tidak mengapa jika Anda tidak memahami
semuanya sekarang, kita akan bahas lebih detail nanti.
+=======
+Let us begin with a basic example that sets the value of a variable and exposes
+it for other contracts to access. It is fine if you do not understand
+everything right now, we will go into more details later.
+>>>>>>> english/develop
Contoh Storage
===============
@@ -91,7 +97,7 @@ mendaftar dengan nama pengguna dan kata sandi, yang dibutuhkan hanyalah *keypair
// The keyword "public" makes variables
// accessible from other contracts
address public minter;
- mapping (address => uint) public balances;
+ mapping(address => uint) public balances;
// Events allow clients to react to specific
// contract changes you declare
@@ -151,6 +157,7 @@ Anda tidak perlu melakukan ini, *compiler* akan mencarikannya untuk Anda.
.. index:: mapping
+<<<<<<< HEAD
Baris berikutnya, ``mapping (address => uint) public balances;`` juga
membuat variabel state publik, tetapi ini adalah datatype yang lebih kompleks.
Jenis :ref:`mapping ` memetakan alamat ke :ref:`unsigned integer `.
@@ -161,14 +168,26 @@ ke nilai yang representasi byte-nya adalah semua nol. Namun, tidak mungkin untuk
atau daftar semua values. Catat apa yang Anda tambahkan ke mapping,
atau gunakan dalam konteks di mana ini tidak diperlukan.
bahkan lebih baik, simpan daftar atau gunakan tipe data yang lebih cocok.
+=======
+The next line, ``mapping(address => uint) public balances;`` also
+creates a public state variable, but it is a more complex datatype.
+The :ref:`mapping ` type maps addresses to :ref:`unsigned integers `.
+
+Mappings can be seen as `hash tables `_ which are
+virtually initialized such that every possible key exists from the start and is mapped to a
+value whose byte-representation is all zeros. However, it is neither possible to obtain a list of all keys of
+a mapping, nor a list of all values. Record what you
+added to the mapping, or use it in a context where this is not needed. Or
+even better, keep a list, or use a more suitable data type.
+>>>>>>> english/develop
:ref:`getter function` yang dibuat oleh kata kunci ``public``
lebih kompleks dalam hal mapping. Ini terlihat seperti berikut:
.. code-block:: solidity
- function balances(address _account) external view returns (uint) {
- return balances[_account];
+ function balances(address account) external view returns (uint) {
+ return balances[account];
}
Anda dapat menggunakan fungsi ini untuk menampilkan saldo satu akun.
@@ -183,9 +202,17 @@ biaya. Sesegera setelah dikeluarkan, pendengar menerima
argumen ``from``, ``to`` dan ``amount``, yang memungkinkan untuk
melacak transaksi.
+<<<<<<< HEAD
Untuk mendengarkan event ini, anda harus menggunakan kode
JavaScript berikut, yang menggunakan `web3.js `_ untuk membuat objek kontrak ``Coin``,
dan setiap antarmuka pengguna memanggil fungsi ``balances`` yang dibuat secara otomatis dari atas::
+=======
+To listen for this event, you could use the following
+JavaScript code, which uses `web3.js `_ to create the ``Coin`` contract object,
+and any user interface calls the automatically generated ``balances`` function from above:
+
+.. code-block:: javascript
+>>>>>>> english/develop
Coin.Sent().watch({}, '', function(error, result) {
if (!error) {
@@ -219,6 +246,7 @@ overflows, yaitu, ketika ``balances[receiver] + amount`` dalam aritmatika presis
nilai maksimum ``uint`` (``2**256 - 1``). Hal ini juga berlaku untuk statement
``balances[receiver] += amount;`` dalam fungsi ``send``.
+<<<<<<< HEAD
:ref:`Errors ` memungkinkan Anda memberikan informasi lebih lanjut kepada pemanggil tentang
mengapa suatu kondisi atau operasi gagal. Kesalahan digunakan bersama dengan
:ref:`mengembalikan pernyataan `. Pernyataan revert tanpa syarat membatalkan
@@ -226,6 +254,15 @@ dan mengembalikan semua perubahan yang serupa dengan fungsi ``require``, tetapi
Anda untuk memberikan nama kesalahan dan data tambahan yang akan diberikan ke pemanggil
(dan pada akhirnya ke aplikasi front-end atau block explorer) sehingga
kegagalan dapat lebih mudah di-debug atau direaksikan.
+=======
+:ref:`Errors ` allow you to provide more information to the caller about
+why a condition or operation failed. Errors are used together with the
+:ref:`revert statement `. The ``revert`` statement unconditionally
+aborts and reverts all changes similar to the ``require`` function, but it also
+allows you to provide the name of an error and additional data which will be supplied to the caller
+(and eventually to the front-end application or block explorer) so that
+a failure can more easily be debugged or reacted upon.
+>>>>>>> english/develop
Fungsi ``send`` dapat digunakan oleh siapa saja (yang telah
memiliki beberapa koin ini) untuk mengirim koin kepada orang lain. Jika pengirim tidak memiliki
@@ -273,10 +310,17 @@ sifat transaksional database memastikan bahwa jika jumlahnya
dikurangi dari satu akun tersebut, selalu ditambahkan ke akun lain. Jika karena suatu hal
menambahkan jumlah ke akun target tidak memungkinkan, akun sumber juga tidak akan diubah.
+<<<<<<< HEAD
Selanjutnya, transaksi selalu ditandatangani secara kriptografis oleh pengirim (creator).
Sehingga membuatnya mudah untuk menjaga akses ke modifikasi tertentu dari database.
Dalam contoh mata uang elektronik, pemeriksaan sederhana memastikan bahwa
hanya orang yang memegang kunci akun yang dapat mentransfer uang darinya.
+=======
+Furthermore, a transaction is always cryptographically signed by the sender (creator).
+This makes it straightforward to guard access to specific modifications of the
+database. In the example of the electronic currency, a simple check ensures that
+only the person holding the keys to the account can transfer some compensation, e.g. Ether, from it.
+>>>>>>> english/develop
.. index:: ! block
@@ -294,6 +338,7 @@ dan kemudian akan dieksekusi dan didistribusikan ke semua node yang berpartisipa
Jika dua transaksi bertentangan satu sama lain, salah satu yang berakhir menjadi yang kedua akan
ditolak dan tidak menjadi bagian dari block.
+<<<<<<< HEAD
Block-block ini membentuk urutan linier dalam waktu dan dari situlah kata "blockchain" berasal.
Block ditambahkan ke rantai/(chain) dalam interval yang agak teratur - untuk Ethereum, kira-kira setiap 17 detik.
@@ -301,13 +346,29 @@ Sebagai bagian dari "order selection mechanism" (yang disebut "menambang/*mining
pengembalian blocks dari waktu to waktu, tetapi hanya terjadi di "ujung" rantai/(chain). Semakin banyak
blok ditambahkan di atas blok tertentu, semakin kecil kemungkinan block ini akan dikembalikan. Jadi mungkin saja transaksi Anda dikembalikan
dan bahkan dihapus dari blockchain, tetapi semakin lama Anda menunggu, semakin kecil kemungkinannya.
+=======
+These blocks form a linear sequence in time, and that is where the word "blockchain" derives from.
+Blocks are added to the chain at regular intervals, although these intervals may be subject to change in the future.
+For the most up-to-date information, it is recommended to monitor the network, for example, on `Etherscan `_.
+
+As part of the "order selection mechanism", which is called `attestation `_, it may happen that
+blocks are reverted from time to time, but only at the "tip" of the chain. The more
+blocks are added on top of a particular block, the less likely this block will be reverted. So it might be that your transactions
+are reverted and even removed from the blockchain, but the longer you wait, the less
+likely it will be.
+>>>>>>> english/develop
.. note::
Transaksi tidak dijamin untuk dimasukkan dalam block berikutnya atau block selanjutnya yang spesifik,
karena tidak tergantung pada pengirim transaksi, tetapi tergantung pada penambang untuk menentukan di block mana transaksi tersebut disertakan.
+<<<<<<< HEAD
Jika Anda ingin menjadwalkan panggilan di masa mendatang dari kontrak Anda, Anda dapat menggunakan
`jam alarm `_ atau layanan oracle serupa.
+=======
+ If you want to schedule future calls of your contract, you can use
+ a smart contract automation tool or an oracle service.
+>>>>>>> english/develop
.. _the-ethereum-virtual-machine:
@@ -387,6 +448,7 @@ kode yang mengembalikan kode itu saat dieksekusi.
Gas
===
+<<<<<<< HEAD
Pada saat pembuatan, setiap transaksi dikenakan sejumlah **gas**,
yang tujuannya adalah untuk membatasi jumlah pekerjaan yang diperlukan untuk
melaksanakan transaksi dan untuk membayar biaya eksekusi pada waktu yang sama. Saat EVM melakukan
@@ -399,14 +461,41 @@ Jika beberapa gas tersisa setelah eksekusi, akan dikembalikan ke pengirim dengan
Jika gas habis pada titik tertentu (yaitu akan menjadi negatif),
akan memicu *out-of-gas exception*, yang akan mengembalikan semua perubahan
yang dibuat pada state dalam rentang waktu saat ini.
+=======
+Upon creation, each transaction is charged with a certain amount of **gas**
+that has to be paid for by the originator of the transaction (``tx.origin``).
+While the EVM executes the
+transaction, the gas is gradually depleted according to specific rules.
+If the gas is used up at any point (i.e. it would be negative),
+an out-of-gas exception is triggered, which ends execution and reverts all modifications
+made to the state in the current call frame.
+>>>>>>> english/develop
+
+This mechanism incentivizes economical use of EVM execution time
+and also compensates EVM executors (i.e. miners / stakers) for their work.
+Since each block has a maximum amount of gas, it also limits the amount
+of work needed to validate a block.
+
+The **gas price** is a value set by the originator of the transaction, who
+has to pay ``gas_price * gas`` up front to the EVM executor.
+If some gas is left after execution, it is refunded to the transaction originator.
+In case of an exception that reverts changes, already used up gas is not refunded.
+
+Since EVM executors can choose to include a transaction or not,
+transaction senders cannot abuse the system by setting a low gas price.
.. index:: ! storage, ! memory, ! stack
Storage, Memory dan Stack
=============================
+<<<<<<< HEAD
Mesin Virtual Ethereum memiliki tiga area di mana ia dapat menyimpan data-
storage, memory dan stack, yang akan dijelaskan dalam paragraf berikut.
+=======
+The Ethereum Virtual Machine has three areas where it can store data:
+storage, memory and the stack.
+>>>>>>> english/develop
Setiap akun memiliki area data yang disebut **storage**, yang persisten antara fungsi memanggil
dan transaksi.
@@ -487,8 +576,9 @@ kompleks, loop harus lebih didahulukan daripada panggilan rekursif. Selain itu,
hanya 63/64 gas yang dapat diteruskan dalam pesan panggilan, yang menyebabkan
batas kedalaman sedikit kurang dari 1000 dalam prakteknya.
-.. index:: delegatecall, callcode, library
+.. index:: delegatecall, library
+<<<<<<< HEAD
Delegatecall / Callcode dan Libraries
=====================================
@@ -496,6 +586,15 @@ Terdapat varian khusus dari pesan panggilan, bernama **delegatecall**
yang identik dengan pesan panggilan terlepas dari kenyataan bahwa
kode di alamat target dieksekusi dalam konteks panggilan
kontrak dan ``msg.sender`` dan ``msg.value`` tidak mengubah nilainya.
+=======
+Delegatecall and Libraries
+==========================
+
+There exists a special variant of a message call, named **delegatecall**
+which is identical to a message call apart from the fact that
+the code at the target address is executed in the context (i.e. at the address) of the calling
+contract and ``msg.sender`` and ``msg.value`` do not change their values.
+>>>>>>> english/develop
Ini berarti bahwa kontrak dapat memuat kode secara dinamis dari alamat yang
berbeda saat *runtime*. Storage, alamat saat ini, dan saldo masih mengacu pada panggilan kontrak,
@@ -531,7 +630,7 @@ ijalankan dan hasilnya disimpan sebagai kode dan pemanggil/pembuat
menerima alamat kontrak baru di stack.
-.. index:: selfdestruct, self-destruct, deactivate
+.. index:: ! selfdestruct, deactivate
Nonaktifkan dan penghancuran diri (Deactivate and Self-destruct)
================================================================
@@ -543,6 +642,11 @@ akan dihapus dari state. Menghapus kontrak secara teori terdengar seperti ide
yang bagus, tetapi berpotensi berbahaya, seolah-olah seseorang mengirim Ether untuk menghapus
kontrak, Ether tersebut akan hilang selamanya.
+.. warning::
+ From version 0.8.18 and up, the use of ``selfdestruct`` in both Solidity and Yul will trigger a
+ deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behavior
+ as stated in `EIP-6049 `_.
+
.. warning::
Even if a contract is removed by ``selfdestruct``, it is still part of the
history of the blockchain and probably retained by most Ethereum nodes.
@@ -564,6 +668,7 @@ makes it impossible to use the contract, as it returns Ether immediately.
Kontrak prakompilasi (Precompiled contracts)
============================================
+<<<<<<< HEAD
Ada satu set kecil alamat kontrak yang khusus:
Rentang alamat antara ``1`` dan (termasuk) ``8`` berisi
"kontrak prakompilasi" yang dapat disebut sebagai kontrak lain
@@ -575,4 +680,18 @@ Rantai yang kompatibel dengan EVM yang berbeda mungkin menggunakan kumpulan
kontrak prakompilasi yang berbeda. Mungkin juga kontrak prakompilasi baru
akan ditambahkan ke rantai utama Ethereum di masa depan,
tetapi Anda dapat secara wajar mengharapkannya untuk selalu berada dalam
-kisaran antara ``1`` dan ``0xffff`` (inklusif).
\ No newline at end of file
+kisaran antara ``1`` dan ``0xffff`` (inklusif).
+=======
+There is a small set of contract addresses that are special:
+The address range between ``1`` and (including) ``8`` contains
+"precompiled contracts" that can be called as any other contract
+but their behavior (and their gas consumption) is not defined
+by EVM code stored at that address (they do not contain code)
+but instead is implemented in the EVM execution environment itself.
+
+Different EVM-compatible chains might use a different set of
+precompiled contracts. It might also be possible that new
+precompiled contracts are added to the Ethereum main chain in the future,
+but you can reasonably expect them to always be in the range between
+``1`` and ``0xffff`` (inclusive).
+>>>>>>> english/develop
diff --git a/docs/ir-breaking-changes.rst b/docs/ir-breaking-changes.rst
index e118d1687c..268b9c0ac6 100644
--- a/docs/ir-breaking-changes.rst
+++ b/docs/ir-breaking-changes.rst
@@ -1,9 +1,17 @@
.. index: ir breaking changes
+<<<<<<< HEAD
***********************************
Perubahan Solidity IR-based Codegen
***********************************
+=======
+.. _ir-breaking-changes:
+
+*********************************
+Solidity IR-based Codegen Changes
+*********************************
+>>>>>>> english/develop
Solidity dapat menghasilkan bytecode EVM dengan dua cara berbeda:
Baik secara langsung dari opcode Solidity ke EVM ("codegen lama") atau melalui
@@ -13,6 +21,7 @@ Pembuat kode berbasis IR diperkenalkan dengan tujuan untuk tidak
hanya memungkinkan pembuatan kode menjadi lebih transparan dan dapat diaudit, tetapi juga
untuk memungkinkan pengoptimalan yang lebih kuat yang menjangkau seluruh fungsi.
+<<<<<<< HEAD
Saat ini, pembuat kode berbasis IR masih ditandai eksperimental,
tetapi mendukung semua fitur bahasa dan telah menerima banyak pengujian,
jadi kami menganggapnya hampir siap untuk penggunaan produksi.
@@ -25,6 +34,16 @@ Untuk beberapa alasan, ada perbedaan semantik kecil antara yang lama
dan pembuat kode berbasis IR, sebagian besar di area di mana kami tidak
mengharapkan orang untuk bergantung pada perilaku ini.
Bagian ini menyoroti perbedaan utama antara codegen lama dan IR-based.
+=======
+You can enable it on the command-line using ``--via-ir``
+or with the option ``{"viaIR": true}`` in standard-json and we
+encourage everyone to try it out!
+
+For several reasons, there are tiny semantic differences between the old
+and the IR-based code generator, mostly in areas where we would not
+expect people to rely on this behavior anyway.
+This section highlights the main differences between the old and the IR-based codegen.
+>>>>>>> english/develop
Perubahan Semantik Saja
=======================
@@ -32,6 +51,7 @@ Perubahan Semantik Saja
Bagian ini mencantumkan perubahan yang hanya bersifat semantik, sehingga berpotensi
menyembunyikan perilaku baru dan berbeda dalam kode yang ada.
+<<<<<<< HEAD
- Ketika struct penyimpanan dihapus, setiap slot penyimpanan yang berisi
anggota struct disetel ke nol seluruhnya. Sebelumnya, ruang padding
dibiarkan tak tersentuh.
@@ -39,6 +59,59 @@ menyembunyikan perilaku baru dan berbeda dalam kode yang ada.
(misalnya dalam konteks peningkatan kontrak), Anda harus menyadari bahwa
``delete`` sekarang juga akan menghapus anggota yang ditambahkan (sementara itu
tidak akan dibersihkan di masa lalu).
+=======
+.. _state-variable-initialization-order:
+
+- The order of state variable initialization has changed in case of inheritance.
+
+ The order used to be:
+
+ - All state variables are zero-initialized at the beginning.
+ - Evaluate base constructor arguments from most derived to most base contract.
+ - Initialize all state variables in the whole inheritance hierarchy from most base to most derived.
+ - Run the constructor, if present, for all contracts in the linearized hierarchy from most base to most derived.
+
+ New order:
+
+ - All state variables are zero-initialized at the beginning.
+ - Evaluate base constructor arguments from most derived to most base contract.
+ - For every contract in order from most base to most derived in the linearized hierarchy:
+
+ 1. Initialize state variables.
+ 2. Run the constructor (if present).
+
+ This causes differences in contracts where the initial value of a state
+ variable relies on the result of the constructor in another contract:
+
+ .. code-block:: solidity
+
+ // SPDX-License-Identifier: GPL-3.0
+ pragma solidity >=0.7.1;
+
+ contract A {
+ uint x;
+ constructor() {
+ x = 42;
+ }
+ function f() public view returns(uint256) {
+ return x;
+ }
+ }
+ contract B is A {
+ uint public y = f();
+ }
+
+ Previously, ``y`` would be set to 0. This is due to the fact that we would first initialize state variables: First, ``x`` is set to 0, and when initializing ``y``, ``f()`` would return 0 causing ``y`` to be 0 as well.
+ With the new rules, ``y`` will be set to 42. We first initialize ``x`` to 0, then call A's constructor which sets ``x`` to 42. Finally, when initializing ``y``, ``f()`` returns 42 causing ``y`` to be 42.
+
+- When storage structs are deleted, every storage slot that contains
+ a member of the struct is set to zero entirely. Formerly, padding space
+ was left untouched.
+ Consequently, if the padding space within a struct is used to store data
+ (e.g. in the context of a contract upgrade), you have to be aware that
+ ``delete`` will now also clear the added member (while it wouldn't
+ have been cleared in the past).
+>>>>>>> english/develop
.. code-block:: solidity
@@ -76,14 +149,19 @@ menyembunyikan perilaku baru dan berbeda dalam kode yang ada.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0;
contract C {
- function f(uint _a) public pure mod() returns (uint _r) {
- _r = _a++;
+ function f(uint a) public pure mod() returns (uint r) {
+ r = a++;
}
modifier mod() { _; _; }
}
+<<<<<<< HEAD
Jika Anda menjalankan ``f(0)`` di Generator kode lama, ia akan menghasilkan ``2``, sementara
akan menghasilkan ``1`` saat menggunakan Generator kode baru.
+=======
+ If you execute ``f(0)`` in the old code generator, it will return ``1``, while
+ it will return ``0`` when using the new code generator.
+>>>>>>> english/develop
.. code-block:: solidity
@@ -113,6 +191,7 @@ menyembunyikan perilaku baru dan berbeda dalam kode yang ada.
nilai pertamanya.
- Generator kode baru: ``0`` karena semua parameter, termasuk parameter return, akan diinisialisasi ulang sebelum setiap evaluasi ``_;``.
+<<<<<<< HEAD
- Urutan inisialisasi kontrak telah berubah dalam hal inheritance.
Urutannya dulu:
@@ -185,6 +264,8 @@ Hal ini menyebabkan perbedaan dalam beberapa kontrak, misalnya:
Sekarang itu kan menghasilkan ``0x6465616462656566000000000000000000000000000000000000000000000010`` (memiliki
panjang yang benar, dan elemen yang benar, tetapi tidak mengandung data yang berlebihan).
+=======
+>>>>>>> english/develop
.. index:: ! evaluation order; expression
- For the old code generator, the evaluation order of expressions is unspecified.
@@ -198,15 +279,20 @@ Hal ini menyebabkan perbedaan dalam beberapa kontrak, misalnya:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.1;
contract C {
- function preincr_u8(uint8 _a) public pure returns (uint8) {
- return ++_a + _a;
+ function preincr_u8(uint8 a) public pure returns (uint8) {
+ return ++a + a;
}
}
Fungsi ``preincr_u8(1)`` menghasilkan nilai berikut:
+<<<<<<< HEAD
- Generator kode lama: 3 (``1 + 2``) tetapi secara umum, hasil nilainya tidak ditentukan
- Generator kode baru: 4 (``2 + 2``) tetapi hasil nilainya tidak dijamin
+=======
+ - Old code generator: ``3`` (``1 + 2``) but the return value is unspecified in general
+ - New code generator: ``4`` (``2 + 2``) but the return value is not guaranteed
+>>>>>>> english/develop
.. index:: ! evaluation order; function arguments
@@ -219,11 +305,11 @@ Hal ini menyebabkan perbedaan dalam beberapa kontrak, misalnya:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.1;
contract C {
- function add(uint8 _a, uint8 _b) public pure returns (uint8) {
- return _a + _b;
+ function add(uint8 a, uint8 b) public pure returns (uint8) {
+ return a + b;
}
- function g(uint8 _a, uint8 _b) public pure returns (uint8) {
- return add(++_a + ++_b, _a + _b);
+ function g(uint8 a, uint8 b) public pure returns (uint8) {
+ return add(++a + ++b, a + b);
}
}
@@ -278,7 +364,11 @@ Hal ini menyebabkan perbedaan dalam beberapa kontrak, misalnya:
}
}
+<<<<<<< HEAD
Fungsi `f()` berperilaku sebagai berikut:
+=======
+ The function ``f()`` behaves as follows:
+>>>>>>> english/develop
- Generator kode lama: kehabisan gas saat mengosongkan konten array setelah alokasi memori yang besar
- Generator kode baru: kembali karena pointer memori bebas meluap (tidak kehabisan gas)
@@ -322,13 +412,13 @@ Sebagai contoh:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.1;
contract C {
- function f(uint8 _a) public pure returns (uint _r1, uint _r2)
+ function f(uint8 a) public pure returns (uint r1, uint r2)
{
- _a = ~_a;
+ a = ~a;
assembly {
- _r1 := _a
+ r1 := a
}
- _r2 = _a;
+ r2 = a;
}
}
@@ -337,6 +427,12 @@ Fungsi ``f(1)`` menghasilkan nilai berikut:
- Generator kode lama: (``fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe``, ``00000000000000000000000000000000000000000000000000000000000000fe``)
- Generator kode baru: (``00000000000000000000000000000000000000000000000000000000000000fe``, ``00000000000000000000000000000000000000000000000000000000000000fe``)
+<<<<<<< HEAD
Perhatikan bahwa, tidak seperti generator kode baru, generator kode lama tidak melakukan pembersihan setelah bit-not assignmen (``_a = ~_a``).
Ini menghasilkan nilai yang berbeda yang ditetapkan (dalam blok inline assembly) untuk mengembalikan nilai ``_r1`` antara generator kode lama dan baru.
Namun, kedua generator kode melakukan pembersihan sebelum nilai baru ``_a`` ditetapkan ke ``_r2``.
+=======
+Note that, unlike the new code generator, the old code generator does not perform a cleanup after the bit-not assignment (``a = ~a``).
+This results in different values being assigned (within the inline assembly block) to return value ``r1`` between the old and new code generators.
+However, both code generators perform a cleanup before the new value of ``a`` is assigned to ``r2``.
+>>>>>>> english/develop
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst
index 93388662dd..bb76de4857 100644
--- a/docs/layout-of-source-files.rst
+++ b/docs/layout-of-source-files.rst
@@ -2,9 +2,15 @@
Tata Letak source files Solidity
********************************
+<<<<<<< HEAD
Source files (*kode sumber*) dapat berisi sejumlah arbitrer
:ref:`contract definitions`, import_ directives,
:ref:`pragma directives` and
+=======
+Source files can contain an arbitrary number of
+:ref:`contract definitions`, import_ ,
+:ref:`pragma` and :ref:`using for` directives and
+>>>>>>> english/develop
:ref:`struct`, :ref:`enum`, :ref:`function`, :ref:`error`
and :ref:`constant variable` definitions.
@@ -13,10 +19,18 @@ and :ref:`constant variable` definitions.
Pengidentifikasi Lisensi SPDX
=======================++++++
+<<<<<<< HEAD
Kepercayaan pada smart kontrak dapat dibangun dengan lebih baik jika kode sumbernya tersedia.
Karena menyediakan kode sumber selalu menyentuh masalah hukum yang berkaitan dengan hak cipta,
compiler Solidity mendorong penggunaan `SPDX license identifiers yang dapat dibaca mesin `_.
Setiap kode sumber harus dimulai dengan komentar yang menunjukkan lisensinya:
+=======
+Trust in smart contracts can be better established if their source code
+is available. Since making source code available always touches on legal problems
+with regards to copyright, the Solidity compiler encourages the use
+of machine-readable `SPDX license identifiers `_.
+Every source file should start with a comment indicating its license:
+>>>>>>> english/develop
``// SPDX-License-Identifier: MIT``
@@ -24,8 +38,16 @@ Kompiler tidak memvalidasi bahwa lisensi adalah bagian dari
`daftar yang diizinkan oleh SPDX `_, tapi
itu menyertakan string yang disediakan dalam :ref:`bytecode metadata `.
+<<<<<<< HEAD
Jika Anda tidak ingin menentukan lisensi atau jika kode sumbernya
bukan open-source, harap gunakan nilai khusus ``UNLICENSED``.
+=======
+If you do not want to specify a license or if the source code is
+not open-source, please use the special value ``UNLICENSED``.
+Note that ``UNLICENSED`` (no usage allowed, not present in SPDX license list)
+is different from ``UNLICENSE`` (grants all rights to everyone).
+Solidity follows `the npm recommendation `_.
+>>>>>>> english/develop
Memberikan komentar ini tentu saja tidak membebaskan Anda dari kewajiban lain
yang terkait dengan perizinan seperti harus menyebutkan
@@ -35,8 +57,13 @@ pemegang hak cipta asli.
Komentar dikenali oleh kompiler di mana saja di bagian file,
tetapi disarankan untuk meletakkannya di bagian atas file.
+<<<<<<< HEAD
Informasi lebih lanjut tentang cara menggunakan pengidentifikasi lisensi SPDX
dapat ditemukan di `situs web SPDX `_.
+=======
+More information about how to use SPDX license identifiers
+can be found at the `SPDX website `_.
+>>>>>>> english/develop
.. index:: ! pragma
@@ -53,7 +80,7 @@ Anda jika Anda ingin mengaktifkannya di seluruh proyek Anda.
Jika Anda :ref:`import` file lain, pragma dari file
tersebut *tidak* secara otomatis diterapkan ke file yang diimpor.
-.. index:: ! pragma, version
+.. index:: ! pragma;version
.. _version_pragma:
@@ -85,17 +112,29 @@ dengan menggunakan syntax yang sama yang digunakan `npm >>>>>> english/develop
Kumpulan jenis yang didukung oleh encoder baru adalah strict superset dari yang didukung oleh versi yang lama.
Kontrak yang menggunakannya dapat berinteraksi dengan kontrak yang tidak menggunakannya tanpa batasan.
@@ -116,8 +155,7 @@ Dengan mengaktifkan ``abicoder v2`` untuk kontrak Anda sudah cukup untuk menghil
dengan menggunakan ``pragma experimental ABIEncoderV2``, tetapi itu tidak mungkin
untuk secara eksplisit memilih coder v1 karena itu adalah default.
-.. index:: ! pragma, experimental
-
+.. index:: ! pragma; experimental
.. _experimental_pragma:
Experimental Pragma
@@ -127,6 +165,7 @@ Pragma kedua adalah pragma eksperimental. Ini dapat digunakan untuk mengaktifkan
kompiler atau bahasa yang belum diaktifkan secara default.
Berikut Pragma experimental yang saat ini didukung:
+.. index:: ! pragma; ABIEncoderV2
ABIEncoderV2
~~~~~~~~~~~~
@@ -135,6 +174,7 @@ Karena ABI coder v2 tidak dianggap eksperimental lagi,
itu dapat dipilih melalui ``pragma abicoder v2`` (silakan lihat di atas)
mulai dari Solidity 0.7.4.
+.. index:: ! pragma; SMTChecker
.. _smt_checker:
SMTChecker
@@ -164,9 +204,16 @@ Mengimpor Source Files lain
Syntax and Semantics
--------------------
+<<<<<<< HEAD
Solidity mendukung pernyataan impor untuk membantu memodulasi kode Anda yang
serupa dengan yang tersedia di JavaScript (mulai dari ES6).
Namun, Solidity tidak mendukung konsep `ekspor default `_.
+=======
+Solidity supports import statements to help modularise your code that
+are similar to those available in JavaScript
+(from ES6 on). However, Solidity does not support the concept of
+a `default export `_.
+>>>>>>> english/develop
Di tingkat global, Anda dapat menggunakan pernyataan impor dengan form berikut:
diff --git a/docs/logo.svg b/docs/logo.svg
index 86b9f4995b..19391843b4 100644
--- a/docs/logo.svg
+++ b/docs/logo.svg
@@ -1,27 +1,8 @@
-
-
-
-
-Vector 1
-Created with Sketch.
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/docs/make.bat b/docs/make.bat
index bc06e706e0..d11deb3ffc 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -28,6 +28,7 @@ if "%1" == "help" (
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. latexpdf to make LaTeX files and run them through pdflatex
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
@@ -155,16 +156,6 @@ if "%1" == "latexpdf" (
goto end
)
-if "%1" == "latexpdfja" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- cd %BUILDDIR%/latex
- make all-pdf-ja
- cd %BUILDDIR%/..
- echo.
- echo.Build finished; the PDF files are in %BUILDDIR%/latex.
- goto end
-)
-
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
diff --git a/docs/metadata.rst b/docs/metadata.rst
index 2393f44143..0af382f389 100644
--- a/docs/metadata.rst
+++ b/docs/metadata.rst
@@ -6,6 +6,7 @@ kontrak Metadata
.. index:: metadata, contract verification
+<<<<<<< HEAD
Kompiler Solidity secara otomatis menghasilkan file JSON, metadata kontrak, yang berisi
informasi tentang kontrak yang dikompilasi. Anda dapat menggunakan file ini untuk menanyakan
versi kompiler, sumber yang digunakan, dokumentasi ABI dan NatSpec untuk berinteraksi lebih aman
@@ -26,98 +27,196 @@ File metadata memiliki format berikut. Contoh di bawah ini disajikan dengan cara
dibaca manusia. Metadata yang diformat dengan benar harus menggunakan tanda kutip dengan benar,
mengurangi whitespace seminimal mungkin, dan mengurutkan kunci semua objek untuk sampai pada
pemformatan yang unik. Komentar tidak diizinkan dan digunakan di sini hanya untuk tujuan penjelasan.
+=======
+The Solidity compiler automatically generates a JSON file.
+The file contains two kinds of information about the compiled contract:
+
+- How to interact with the contract: ABI, and NatSpec documentation.
+- How to reproduce the compilation and verify a deployed contract:
+ compiler version, compiler settings, and source files used.
+
+The compiler appends by default the IPFS hash of the metadata file to the end
+of the runtime bytecode (not necessarily the creation bytecode) of each contract,
+so that, if published, you can retrieve the file in an authenticated way without
+having to resort to a centralized data provider. The other available options are
+the Swarm hash and not appending the metadata hash to the bytecode. These can be
+configured via the :ref:`Standard JSON Interface`.
+
+You have to publish the metadata file to IPFS, Swarm, or another service so
+that others can access it. You create the file by using the ``solc --metadata``
+command together with the ``--output-dir`` parameter. Without the parameter,
+the metadata will be written to standard output.
+The metadata contains IPFS and Swarm references to the source code, so you have to
+upload all source files in addition to the metadata file. For IPFS, the hash contained
+in the CID returned by ``ipfs add`` (not the direct sha2-256 hash of the file)
+shall match with the one contained in the bytecode.
+
+The metadata file has the following format. The example below is presented in a
+human-readable way. Properly formatted metadata should use quotes correctly,
+reduce whitespace to a minimum, and sort the keys of all objects in alphabetical order
+to arrive at a canonical formatting. Comments are not permitted and are used here only for
+explanatory purposes.
+>>>>>>> english/develop
.. code-block:: javascript
{
- // Required: The version of the metadata format
- "version": "1",
- // Required: Source code language, basically selects a "sub-version"
- // of the specification
- "language": "Solidity",
// Required: Details about the compiler, contents are specific
// to the language.
"compiler": {
- // Required for Solidity: Version of the compiler
- "version": "0.4.6+commit.2dabbdf0.Emscripten.clang",
// Optional: Hash of the compiler binary which produced this output
- "keccak256": "0x123..."
+ "keccak256": "0x123...",
+ // Required for Solidity: Version of the compiler
+ "version": "0.8.2+commit.661d1103"
},
- // Required: Compilation source files/source units, keys are file names
- "sources":
- {
- "myFile.sol": {
- // Required: keccak256 hash of the source file
- "keccak256": "0x123...",
- // Required (unless "content" is used, see below): Sorted URL(s)
- // to the source file, protocol is more or less arbitrary, but a
- // Swarm URL is recommended
- "urls": [ "bzzr://56ab..." ],
- // Optional: SPDX license identifier as given in the source file
- "license": "MIT"
+ // Required: Source code language, basically selects a "sub-version"
+ // of the specification
+ "language": "Solidity",
+ // Required: Generated information about the contract.
+ "output": {
+ // Required: ABI definition of the contract. See "Contract ABI Specification"
+ "abi": [/* ... */],
+ // Required: NatSpec developer documentation of the contract. See https://docs.soliditylang.org/en/latest/natspec-format.html for details.
+ "devdoc": {
+ // Contents of the @author NatSpec field of the contract
+ "author": "John Doe",
+ // Contents of the @dev NatSpec field of the contract
+ "details": "Interface of the ERC20 standard as defined in the EIP. See https://eips.ethereum.org/EIPS/eip-20 for details",
+ "errors": {
+ "MintToZeroAddress()" : {
+ "details": "Cannot mint to zero address"
+ }
+ },
+ "events": {
+ "Transfer(address,address,uint256)": {
+ "details": "Emitted when `value` tokens are moved from one account (`from`) toanother (`to`).",
+ "params": {
+ "from": "The sender address",
+ "to": "The receiver address",
+ "value": "The token amount"
+ }
+ }
+ },
+ "kind": "dev",
+ "methods": {
+ "transfer(address,uint256)": {
+ // Contents of the @dev NatSpec field of the method
+ "details": "Returns a boolean value indicating whether the operation succeeded. Must be called by the token holder address",
+ // Contents of the @param NatSpec fields of the method
+ "params": {
+ "_value": "The amount tokens to be transferred",
+ "_to": "The receiver address"
+ },
+ // Contents of the @return NatSpec field.
+ "returns": {
+ // Return var name (here "success") if exists. "_0" as key if return var is unnamed
+ "success": "a boolean value indicating whether the operation succeeded"
+ }
+ }
+ },
+ "stateVariables": {
+ "owner": {
+ // Contents of the @dev NatSpec field of the state variable
+ "details": "Must be set during contract creation. Can then only be changed by the owner"
+ }
+ },
+ // Contents of the @title NatSpec field of the contract
+ "title": "MyERC20: an example ERC20",
+ "version": 1 // NatSpec version
},
- "destructible": {
- // Required: keccak256 hash of the source file
- "keccak256": "0x234...",
- // Required (unless "url" is used): literal contents of the source file
- "content": "contract destructible is owned { function destroy() { if (msg.sender == owner) selfdestruct(owner); } }"
+ // Required: NatSpec user documentation of the contract. See "NatSpec Format"
+ "userdoc": {
+ "errors": {
+ "ApprovalCallerNotOwnerNorApproved()": [
+ {
+ "notice": "The caller must own the token or be an approved operator."
+ }
+ ]
+ },
+ "events": {
+ "Transfer(address,address,uint256)": {
+ "notice": "`_value` tokens have been moved from `from` to `to`"
+ }
+ },
+ "kind": "user",
+ "methods": {
+ "transfer(address,uint256)": {
+ "notice": "Transfers `_value` tokens to address `_to`"
+ }
+ },
+ "version": 1 // NatSpec version
}
},
- // Required: Compiler settings
- "settings":
- {
- // Required for Solidity: Sorted list of remappings
- "remappings": [ ":g=/dir" ],
+ // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
+ // Check the documentation of standard JSON input's "settings" field
+ "settings": {
+ // Required for Solidity: File path and the name of the contract or library this
+ // metadata is created for.
+ "compilationTarget": {
+ "myDirectory/myFile.sol": "MyContract"
+ },
+ // Required for Solidity.
+ "evmVersion": "london",
+ // Required for Solidity: Addresses for libraries used.
+ "libraries": {
+ "MyLib": "0x123123..."
+ },
+ "metadata": {
+ // Reflects the setting used in the input json, defaults to "true"
+ "appendCBOR": true,
+ // Reflects the setting used in the input json, defaults to "ipfs"
+ "bytecodeHash": "ipfs",
+ // Reflects the setting used in the input json, defaults to "false"
+ "useLiteralContent": true
+ },
// Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
- // and are only given for backwards-compatibility.
+ // and are only given for backward-compatibility.
"optimizer": {
- "enabled": true,
- "runs": 500,
"details": {
- // peephole defaults to "true"
- "peephole": true,
- // inliner defaults to "true"
- "inliner": true,
+ "constantOptimizer": false,
+ "cse": false,
+ "deduplicate": false,
+ // inliner defaults to "false"
+ "inliner": false,
// jumpdestRemover defaults to "true"
"jumpdestRemover": true,
"orderLiterals": false,
- "deduplicate": false,
- "cse": false,
- "constantOptimizer": false,
+ // peephole defaults to "true"
+ "peephole": true,
"yul": true,
// Optional: Only present if "yul" is "true"
"yulDetails": {
- "stackAllocation": false,
- "optimizerSteps": "dhfoDgvulfnTUtnIf..."
+ "optimizerSteps": "dhfoDgvulfnTUtnIf...",
+ "stackAllocation": false
}
- }
- },
- "metadata": {
- // Reflects the setting used in the input json, defaults to false
- "useLiteralContent": true,
- // Reflects the setting used in the input json, defaults to "ipfs"
- "bytecodeHash": "ipfs"
+ },
+ "enabled": true,
+ "runs": 500
},
- // Required for Solidity: File and name of the contract or library this
- // metadata is created for.
- "compilationTarget": {
- "myFile.sol": "MyContract"
+ // Required for Solidity: Sorted list of import remappings.
+ "remappings": [ ":g=/dir" ]
+ },
+ // Required: Compilation source files/source units, keys are file paths
+ "sources": {
+ "destructible": {
+ // Required (unless "url" is used): literal contents of the source file
+ "content": "contract destructible is owned { function destroy() { if (msg.sender == owner) selfdestruct(owner); } }",
+ // Required: keccak256 hash of the source file
+ "keccak256": "0x234..."
},
- // Required for Solidity: Addresses for libraries used
- "libraries": {
- "MyLib": "0x123123..."
+ "myDirectory/myFile.sol": {
+ // Required: keccak256 hash of the source file
+ "keccak256": "0x123...",
+ // Optional: SPDX license identifier as given in the source file
+ "license": "MIT",
+ // Required (unless "content" is used, see above): Sorted URL(s)
+ // to the source file, protocol is more or less arbitrary, but an
+ // IPFS URL is recommended
+ "urls": [ "bzz-raw://7d7a...", "dweb:/ipfs/QmN..." ]
}
},
- // Required: Generated information about the contract.
- "output":
- {
- // Required: ABI definition of the contract
- "abi": [/* ... */],
- // Required: NatSpec user documentation of the contract
- "userdoc": [/* ... */],
- // Required: NatSpec developer documentation of the contract
- "devdoc": [/* ... */]
- }
+ // Required: The version of the metadata format
+ "version": 1
}
.. warning::
@@ -136,27 +235,60 @@ pemformatan yang unik. Komentar tidak diizinkan dan digunakan di sini hanya untu
Encoding Hash Metadata dalam Bytecode
=====================================
+<<<<<<< HEAD
Karena kami mungkin mendukung cara lain untuk mengambil file metadata di masa mendatang,
mapping ``{"ipfs": , "solc": }`` disimpan `CBOR `_-dikodekan. Karena mapping
mungkin berisi lebih banyak kunci (lihat di bawah) dan awal dari penyandian itu tidak mudah
ditemukan, panjangnya ditambahkan dalam penyandian big-endian dua byte. Versi kompiler Solidity
saat ini biasanya menambahkan yang berikut ini ke akhir bytecode yang digunakan:
+=======
+The compiler currently by default appends the
+`IPFS hash (in CID v0) `_
+of the canonical metadata file and the compiler version to the end of the bytecode.
+Optionally, a Swarm hash instead of the IPFS, or an experimental flag is used.
+Below are all the possible fields:
+>>>>>>> english/develop
-.. code-block:: text
+.. code-block:: javascript
- 0xa2
- 0x64 'i' 'p' 'f' 's' 0x58 0x22 <34 bytes IPFS hash>
- 0x64 's' 'o' 'l' 'c' 0x43 <3 byte version encoding>
- 0x00 0x33
+ {
+ "ipfs": "",
+ // If "bytecodeHash" was "bzzr1" in compiler settings not "ipfs" but "bzzr1"
+ "bzzr1": "",
+ // Previous versions were using "bzzr0" instead of "bzzr1"
+ "bzzr0": "",
+ // If any experimental features that affect code generation are used
+ "experimental": true,
+ "solc": ""
+ }
+<<<<<<< HEAD
Jadi untuk mengambil data, akhir bytecode yang digunakan dapat diperiksa untuk mencocokkan
pola itu dan menggunakan hash IPFS untuk mengambil file.
Sedangkan rilis build solc menggunakan pengkodean 3 byte dari versi seperti yang ditunjukkan
di atas (masing-masing satu byte untuk nomor versi mayor, minor dan patch), build prarilis
akan menggunakan string versi lengkap termasuk hash komit dan tanggal build.
+=======
+Because we might support other ways to retrieve the
+metadata file in the future, this information is stored
+`CBOR `_-encoded. The last two bytes in the bytecode
+indicate the length of the CBOR encoded information. By looking at this length, the
+relevant part of the bytecode can be decoded with a CBOR decoder.
+
+Check the `Metadata Playground `_ to see it in action.
+
+Whereas release builds of solc use a 3 byte encoding of the version as shown
+above (one byte each for major, minor and patch version number), pre-release builds
+will instead use a complete version string including commit hash and build date.
+>>>>>>> english/develop
+
+The commandline flag ``--no-cbor-metadata`` can be used to skip metadata
+from getting appended at the end of the deployed bytecode. Equivalently, the
+boolean field ``settings.metadata.appendCBOR`` in Standard JSON input can be set to false.
.. note::
+<<<<<<< HEAD
CBOR mapping juga dapat berisi kunci lain, jadi lebih baik untuk mendekode
data sepenuhnyadaripada mengandalkannya dimulai dengan ``0xa264``.
Misalnya, jika ada fitur eksperimental yang memengaruhi pembuatan kode
@@ -169,26 +301,47 @@ akan menggunakan string versi lengkap termasuk hash komit dan tanggal build.
menambahkan data tambahan ke struktur CBOR ini, jadi opsi terbaik adalah menggunakan
pengurai CBOR yang tepat.
+=======
+ The CBOR mapping can also contain other keys, so it is better to fully
+ decode the data by looking at the end of the bytecode for the CBOR length,
+ and to use a proper CBOR parser. Do not rely on it starting with ``0xa264``
+ or ``0xa2 0x64 'i' 'p' 'f' 's'``.
+>>>>>>> english/develop
Penggunaan untuk Pembuatan Interface Otomatis dan NatSpec
=========================================================
+<<<<<<< HEAD
Metadata digunakan dengan cara berikut: Komponen yang ingin berinteraksi dengan
kontrak (mis. Mist atau dompet apa pun) mengambil kode kontrak, dari hash IPFS/Swarm
file yang kemudian diambil. File itu didekodekan JSON menjadi struktur seperti di atas.
+=======
+The metadata is used in the following way: A component that wants to interact
+with a contract (e.g. a wallet) retrieves the code of the contract.
+It decodes the CBOR encoded section containing the IPFS/Swarm hash of the
+metadata file. With that hash, the metadata file is retrieved. That file
+is JSON-decoded into a structure like above.
+>>>>>>> english/develop
Komponen kemudian dapat menggunakan ABI untuk secara otomatis menghasilkan
user interface yang belum sempurna untuk kontrak.
+<<<<<<< HEAD
Selanjutnya, dompet dapat menggunakan dokumentasi pengguna NatSpec untuk menampilkan pesan
konfirmasi kepada pengguna setiap kali mereka berinteraksi dengan kontrak, bersama dengan
meminta otorisasi untuk tanda tangan transaksi.
+=======
+Furthermore, the wallet can use the NatSpec user documentation to display a
+human-readable confirmation message to the user whenever they interact with
+the contract, together with requesting authorization for the transaction signature.
+>>>>>>> english/develop
Untuk informasi tambahan, baca :doc:`Ethereum Natural Language Specification (NatSpec) format `.
Penggunaan untuk Verifikasi Kode Sumber
=======================================
+<<<<<<< HEAD
Untuk memverifikasi kompilasi, sumber dapat diambil dari IPFS/Swarm
melalui tautan di file metadata.
Kompiler dari versi yang benar (yang dicentang sebagai bagian dari kompiler "resmi")
@@ -201,3 +354,20 @@ sesuai dengan antarmuka dan disajikan kepada pengguna.
Di repository `sourcify `_
(`npm package `_) anda dapat melihat
contoh kode yang menunjukkan cara menggunakan fitur ini.
+=======
+If pinned/published, it is possible to retrieve the metadata of the contract from IPFS/Swarm.
+The metadata file also contains the URLs or the IPFS hashes of the source files, as well as
+the compilation settings, i.e. everything needed to reproduce a compilation.
+
+With this information it is then possible to verify the source code of a contract by
+reproducing the compilation, and comparing the bytecode from the compilation with
+the bytecode of the deployed contract.
+
+This automatically verifies the metadata since its hash is part of the bytecode, as well
+as the source codes, because their hashes are part of the metadata. Any change in the files
+or settings would result in a different metadata hash. The metadata here serves
+as a fingerprint of the whole compilation.
+
+`Sourcify `_ makes use of this feature for "full/perfect verification",
+as well as pinning the files publicly on IPFS to be accessed with the metadata hash.
+>>>>>>> english/develop
diff --git a/docs/natspec-format.rst b/docs/natspec-format.rst
index 67085932b5..e30fab5f5c 100644
--- a/docs/natspec-format.rst
+++ b/docs/natspec-format.rst
@@ -35,17 +35,30 @@ dicapai melalui tag ``@custom:``, dan kasus penggunaan yang baik adalah al
Contoh Dokumentasi
==================
+<<<<<<< HEAD
Dokumentasi disisipkan di atas masing-masing ``contract``, ``interface``,
``function``, dan ``event`` menggunakn format notasi Doxygen.
``public`` state variable setara dengan ``function``
untuk keperluan NatSpec.
+=======
+Documentation is inserted above each ``contract``, ``interface``, ``library``,
+``function``, and ``event`` using the Doxygen notation format.
+A ``public`` state variable is equivalent to a ``function``
+for the purposes of NatSpec.
+>>>>>>> english/develop
- Untuk Solidity Anda dapat memilih ``///`` untuk single atau multi-line
komentar, atau ``/**`` dan diakhiri dengan ``*/``.
+<<<<<<< HEAD
- Untuk Vyper, gunakan ``"""`` menjorok ke konten dalam dengan
komentar kosong. Lihat `Vyper
documentation `__.
+=======
+- For Vyper, use ``"""`` indented to the inner contents with bare
+ comments. See the `Vyper
+ documentation `__.
+>>>>>>> english/develop
Contoh berikut menunjukkan kontrak dan fungsi menggunakan semua tag yang tersedia.
@@ -57,7 +70,7 @@ Contoh berikut menunjukkan kontrak dan fungsi menggunakan semua tag yang tersedi
Ini mungkin berubah di masa depan.
-.. code-block:: Solidity
+.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 < 0.9.0;
@@ -114,6 +127,7 @@ dengan cara yang sama seperti jika diberi tag dengan ``@notice``.
=============== ====================================================================================== =============================
Tag Context
=============== ====================================================================================== =============================
+<<<<<<< HEAD
``@title`` Judul yang harus menggambarkan kontrak/interface contract, library, interface
``@author`` Nama penulis contract, library, interface
``@notice`` Jelaskan kepada pengguna akhir apa fungsinya contract, library, interface, function, public state variable, event
@@ -122,6 +136,16 @@ Tag
``@return`` Dokumentasikan variabel return dari fungsi kontrak function, public state variable
``@inheritdoc`` Salin semua tag yang hilang dari fungsi dasar (harus diikuti dengan nama kontrak) function, public state variable
``@custom:...`` Tag khusus, semantik ditentukan oleh aplikasi everywhere
+=======
+``@title`` A title that should describe the contract/interface contract, library, interface, struct, enum
+``@author`` The name of the author contract, library, interface, struct, enum
+``@notice`` Explain to an end user what this does contract, library, interface, function, public state variable, event, struct, enum
+``@dev`` Explain to a developer any extra details contract, library, interface, function, state variable, event, struct, enum
+``@param`` Documents a parameter just like in Doxygen (must be followed by parameter name) function, event
+``@return`` Documents the return variables of a contract's function function, public state variable
+``@inheritdoc`` Copies all missing tags from the base function (must be followed by the contract name) function, public state variable
+``@custom:...`` Custom tag, semantics is application-defined everywhere
+>>>>>>> english/develop
=============== ====================================================================================== =============================
Jika fungsi Anda mengembalikan banyak nilai, seperti ``(int quotient, int rest)``
@@ -153,10 +177,13 @@ kepada pengguna akhir sebagai:
jika suatu fungsi dipanggil dan input ``a`` diberi nilai 10.
+<<<<<<< HEAD
Menentukan ekspresi dinamis ini berada di luar cakupan dokumentasi
Solidity dan Anda dapat membaca lebih lanjut di
`the radspec project `__.
+=======
+>>>>>>> english/develop
.. _header-inheritance:
Inheritance Notes
@@ -182,7 +209,7 @@ oleh pengembang.
Jika kontrak di atas disimpan sebagai ``ex1.sol`` maka Anda dapat membuat
dokumentasi menggunakan:
-.. code::
+.. code-block:: shell
solc --userdoc --devdoc ex1.sol
@@ -201,7 +228,7 @@ Dokumentasi User
Dokumentasi di atas akan menghasilkan file JSON dokumentasi pengguna
berikut sebagai output:
-.. code::
+.. code-block:: json
{
"version" : 1,
@@ -229,7 +256,7 @@ Dokumentasi Developer
Terlepas dari file dokumentasi pengguna, dokumentasi pengembang JSON
file juga harus diproduksi dan akan terlihat seperti ini:
-.. code::
+.. code-block:: json
{
"version" : 1,
diff --git a/docs/path-resolution.rst b/docs/path-resolution.rst
index 76e80bfb0e..cf8df5f5b3 100644
--- a/docs/path-resolution.rst
+++ b/docs/path-resolution.rst
@@ -21,7 +21,7 @@ unit sumber diberi *source unit name* unik yang merupakan pengidentifikasi buram
Saat Anda menggunakan :ref:`import statement `, Anda menentukan *import path* yang mereferensikan
nama unit sumber.
-.. index:: ! import callback, ! Host Filesystem Loader
+.. index:: ! import callback, ! Host Filesystem Loader, ! --no-import-callback
.. _import-callback:
Import Callback
@@ -36,6 +36,7 @@ Import callback bebas untuk menafsirkan nama unit sumber dengan cara yang sewena
Jika tidak ada callback yang tersedia saat diperlukan atau jika gagal menemukan kode sumber,
kompilasi gagal.
+<<<<<<< HEAD
Kompilator baris perintah menyediakan *Host Filesystem Loader* - callback yang belum sempurna
yang menafsirkan nama unit sumber sebagai jalur di sistem file lokal.
`Antarmuka JavaScript `_ tidak menyediakan apa pun secara default,
@@ -44,6 +45,17 @@ Mekanisme ini dapat digunakan untuk mendapatkan kode sumber dari lokasi selain s
(yang bahkan mungkin tidak dapat diakses, misalnya ketika kompiler berjalan di browser).
Misalnya `Remix IDE `_ menyediakan callback serbaguna yang
memungkinkan Anda `mengimpor file dari HTTP, IPFS, dan URL Swarm atau merujuk langsung ke paket di registri NPM
+=======
+By default, the command-line compiler provides the *Host Filesystem Loader* - a rudimentary callback
+that interprets a source unit name as a path in the local filesystem.
+This callback can be disabled using the ``--no-import-callback`` command-line option.
+The `JavaScript interface `_ does not provide any by default,
+but one can be provided by the user.
+This mechanism can be used to obtain source code from locations other than the local filesystem
+(which may not even be accessible, e.g. when the compiler is running in a browser).
+For example the `Remix IDE `_ provides a versatile callback that
+lets you `import files from HTTP, IPFS and Swarm URLs or refer directly to packages in NPM registry
+>>>>>>> english/develop
`_.
.. note::
@@ -138,8 +150,13 @@ Konten awal VFS bergantung pada cara Anda memanggil kompiler:
#. **Standard input**
+<<<<<<< HEAD
Pada baris perintah juga dimungkinkan untuk menyediakan sumber dengan mengirimkan input standar
ke kompiler:
+=======
+ On the command-line it is also possible to provide the source by sending it to compiler's
+ standard input:
+>>>>>>> english/develop
.. code-block:: bash
@@ -194,11 +211,19 @@ nama unit sumber.
.. note::
+<<<<<<< HEAD
Nama unit sumber hanyalah pengidentifikasi dan bahkan jika nilainya terlihat seperti jalur, itu
tidak tunduk pada aturan normalisasi yang biasanya Anda harapkan di shell.
Setiap segmen ``/./`` atau ``/../`` atau urutan beberapa garis miring tetap menjadi bagian darinya.
Ketika sumber disediakan melalui antarmuka JSON Standar, sangat mungkin untuk mengaitkan
konten yang berbeda dengan nama unit sumber yang akan merujuk ke file yang sama pada disk.
+=======
+ A source unit name is just an identifier and even if its value happens to look like a path, it
+ is not subject to the normalization rules you would typically expect in a shell.
+ Any ``/./`` or ``/../`` segments or sequences of multiple slashes remain a part of it.
+ When the source is provided via Standard JSON interface it is entirely possible to associate
+ different content with source unit names that would refer to the same file on disk.
+>>>>>>> english/develop
Ketika sumber tidak tersedia di sistem file virtual, kompiler meneruskan nama unit sumber
ke import callback.
@@ -247,6 +272,7 @@ dan dibatasi oleh dua pemisah jalur.
Pemisah adalah garis miring ke depan atau awal/akhir string.
Misalnya dalam ``./abc/..//`` ada tiga segmen jalur: ``.``, ``abc`` dan ``..``.
+<<<<<<< HEAD
Kompilator menghitung nama unit sumber dari jalur impor dengan cara berikut:
1. Pertama sebuah prefix dihitung
@@ -260,6 +286,17 @@ Kompilator menghitung nama unit sumber dari jalur impor dengan cara berikut:
2. Kemudian prefix ditambahkan ke import path yang dinormalisasi.
Jika prefix non-empty, satu garis miring disisipkan di antaranya dan import path.
+=======
+The compiler resolves the import into a source unit name based on the import path, in the following way:
+
+#. We start with the source unit name of the importing source unit.
+#. The last path segment with preceding slashes is removed from the resolved name.
+#. Then, for every segment in the import path, starting from the leftmost one:
+
+ - If the segment is ``.``, it is skipped.
+ - If the segment is ``..``, the last path segment with preceding slashes is removed from the resolved name.
+ - Otherwise, the segment (preceded by a single slash if the resolved name is not empty), is appended to the resolved name.
+>>>>>>> english/develop
Penghapusan segmen jalur terakhir dengan garis miring sebelumnya dipahami
bekerja sebagai berikut:
@@ -267,6 +304,7 @@ bekerja sebagai berikut:
1. Semua yang melewati garis miring terakhir dihapus (yaitu ``a/b//c.sol`` menjadi ``a/b//``).
2. Semua garis miring dihilangkan (yaitu ``a/b//`` menjadi ``a/b``).
+<<<<<<< HEAD
Aturan normalisasinya sama dengan jalur UNIX, yaitu:
- Semua segmen ``.`` internal dihapus.
@@ -277,6 +315,14 @@ Perhatikan bahwa normalisasi dilakukan hanya pada import path.
Nama unit sumber modul pengimporan yang digunakan untuk awalan tetap tidak dinormalisasi.
Ini memastikan bahwa bagian ``protokol://`` tidak berubah menjadi ``protokol:/`` jika file pengimpor
diidentifikasi dengan URL.
+=======
+Note that the process normalizes the part of the resolved source unit name that comes from the import path according
+to the usual rules for UNIX paths, i.e. all ``.`` and ``..`` are removed and multiple slashes are
+squashed into a single one.
+On the other hand, the part that comes from the source unit name of the importing module remains unnormalized.
+This ensures that the ``protocol://`` part does not turn into ``protocol:/`` if the importing file
+is identified with a URL.
+>>>>>>> english/develop
Jika jalur impor Anda sudah dinormalisasi, Anda dapat mengharapkan algoritme di atas menghasilkan hasil yang
sangat intuitif.
@@ -352,6 +398,7 @@ kerja kompiler saat ini.
CLI Path Normalization dan Stripping
------------------------------------
+<<<<<<< HEAD
Pada baris perintah, kompiler berperilaku seperti yang Anda harapkan dari program lain:
ia menerima jalur dalam format asli platform dan relative paths relatif terhadap direktori
kerja saat ini.
@@ -360,6 +407,16 @@ tidak boleh berubah hanya karena proyek sedang dikompilasi pada platform yang be
compiler kebetulan telah dipanggil dari direktori yang berbeda.
Untuk mencapai ini, jalur ke file sumber yang berasal dari baris perintah harus dikonversi ke bentuk
canonical, dan, jika mungkin, dibuat relatif terhadap base path atau salah satu include path.
+=======
+On the command-line the compiler behaves just as you would expect from any other program:
+it accepts paths in a format native to the platform and relative paths are relative to the current
+working directory.
+The source unit names assigned to files whose paths are specified on the command-line, however,
+should not change just because the project is being compiled on a different platform or because the
+compiler happens to have been invoked from a different directory.
+To achieve this, paths to source files coming from the command-line must be converted to a canonical
+form, and, if possible, made relative to the base path or one of the include paths.
+>>>>>>> english/develop
Aturan normalisasi adalah sebagai berikut:
@@ -412,10 +469,17 @@ Jalur file yang dihasilkan menjadi nama unit sumber.
.. note::
+<<<<<<< HEAD
Sebelum versi 0.8.8, CLI path stripping tidak dilakukan dan satu-satunya normalisasi yang diterapkan
adalah konversi pemisah jalur.
Saat bekerja dengan versi kompiler yang lebih lama, disarankan untuk memanggil kompiler dari
jalur dasar dan hanya menggunakan jalur relatif pada baris perintah.
+=======
+ Prior to version 0.8.8, CLI path stripping was not performed and the only normalization applied
+ was the conversion of path separators.
+ When working with older versions of the compiler it is recommended to invoke the compiler from
+ the base path and to only use relative paths on the command-line.
+>>>>>>> english/develop
.. index:: ! allowed paths, ! --allow-paths, remapping; target
.. _allowed-paths:
@@ -428,11 +492,19 @@ lokasi yang dianggap aman secara default:
- Di luar mode JSON Standar:
+<<<<<<< HEAD
- Direktori yang berisi file input yang terdaftar pada baris perintah.
- Direktori yang digunakan sebagai target :ref:`remapping `.
Jika target bukan direktori (yaitu tidak diakhiri dengan ``/``, ``/.`` atau ``/..``) direktori
berisi target digunakan sebagai gantinya.
- Base path dan include path.
+=======
+ - The directories containing input files listed on the command-line.
+ - The directories used as :ref:`remapping ` targets.
+ If the target is not a directory (i.e does not end with ``/``, ``/.`` or ``/..``) the directory
+ containing the target is used instead.
+ - Base path and include paths.
+>>>>>>> english/develop
- Dalam mode JSON Standar:
@@ -520,9 +592,15 @@ Anda dapat menggunakan yang berikut ini di file sumber Anda:
import "github.com/ethereum/dapp-bin/library/math.sol"; // source unit name: dapp-bin/library/math.sol
+<<<<<<< HEAD
Kompilator akan mencari file dalam VFS di bawah ``dapp-bin/library/math.sol``.
Jika file tidak tersedia di sana, nama unit sumber akan diteruskan ke Sistem File Host
Loader, yang kemudian akan mencari di ``/project/dapp-bin/library/iterable_mapping.sol``.
+=======
+The compiler will look for the file in the VFS under ``dapp-bin/library/math.sol``.
+If the file is not available there, the source unit name will be passed to the Host Filesystem
+Loader, which will then look in ``/project/dapp-bin/library/math.sol``.
+>>>>>>> english/develop
.. warning::
@@ -558,7 +636,11 @@ Anda memeriksa ke ``/project/dapp-bin_old``, lalu Anda dapat menjalankan:
Ini berarti bahwa semua impor di ``module2`` mengarah ke versi lama tetapi mengimpor di ``module1``
mengarahkan ke versi baru.
+<<<<<<< HEAD
Berikut adalah aturan terperinci yang mengatur perilaku remapping:
+=======
+Here are the detailed rules governing the behavior of remappings:
+>>>>>>> english/develop
#. **Remappings hanya memengaruhi terjemahan antara jalur impor dan nama unit sumber.**
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 23c8f90432..b1b21a8691 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -4,7 +4,7 @@
sphinx_rtd_theme>=0.5.2
pygments-lexer-solidity>=0.7.0
-sphinx-a4doc>=1.2.1
+sphinx-a4doc>=1.6.0
# Sphinx 2.1.0 is the oldest version that accepts a lexer class in add_lexer()
-sphinx>=2.1.0
+sphinx>=2.1.0, <6.0
diff --git a/docs/resources.rst b/docs/resources.rst
index f9aace4c64..942158d96a 100644
--- a/docs/resources.rst
+++ b/docs/resources.rst
@@ -14,7 +14,7 @@ Sumber Daya Umum
* `Solidity Compiler Developers Chat `_
* `Awesome Solidity `_
* `Solidity by Example `_
-
+* `Solidity Documentation Community Translations `_
Lingkungan Pengembangan Terintegrasi (Ethereum)
===============================================
@@ -23,10 +23,17 @@ Lingkungan Pengembangan Terintegrasi (Ethereum)
Kerangka kerja pengembangan dan pengujian berbasis Python untuk kontrak pintar yang menargetkan Mesin Virtual Ethereum.
* `Dapp `_
+<<<<<<< HEAD
Alat untuk membangun, menguji, dan menerapkan kontrak pintar dari baris perintah.
* `Embark `_
Platform pengembang untuk membangun dan menerapkan aplikasi terdesentralisasi.
+=======
+ Tool for building, testing and deploying smart contracts from the command-line.
+
+ * `Foundry `_
+ Fast, portable and modular toolkit for Ethereum application development written in Rust.
+>>>>>>> english/develop
* `Hardhat `_
Lingkungan pengembangan Ethereum dengan jaringan Ethereum lokal, fitur debugging dan ekosistem plugin.
@@ -34,15 +41,21 @@ Lingkungan Pengembangan Terintegrasi (Ethereum)
* `Remix `_
IDE berbasis browser dengan compiler terintegrasi dan lingkungan runtime Solidity tanpa komponen sisi server.
+<<<<<<< HEAD
* `Scaffold-ETH `_
Tumpukan pengembangan Ethereum berfokus pada iterasi produk yang cepat.
* `Truffle `_
Kerangka pengembangan Ethereum.
+=======
+ * `Truffle