Skip to content

Commit eec1e2a

Browse files
authored
Merge pull request #10626 from ethereum/howToUpdateYourCode
How to update your code.
2 parents 8f833f4 + f31cf6b commit eec1e2a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/080-breaking-changes.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ This section lists changes that might cause existing contracts to not compile an
118118

119119
* Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences in code.
120120
They can still be inserted via hexadecimal escapes, e.g. ``\x08``, ``\x0c``, and ``\x0b``, respectively.
121+
121122
* The global variables ``tx.origin`` and ``msg.sender`` have the type ``address`` instead of
122123
``address payable``. One can convert them into ``address payable`` by using an explicit
123124
conversion, i.e., ``payable(tx.origin)`` or ``payable(msg.sender)``.
@@ -155,3 +156,18 @@ Interface Changes
155156
Use the "compact AST" (``--ast-compact--json`` resp. ``AST``) as replacement.
156157

157158
* The old error reporter (``--old-reporter``) has been removed.
159+
160+
161+
How to update your code
162+
=======================
163+
164+
- If you rely on wrapping arithmetic, surround each operation with ``unchecked { ... }``.
165+
- Optional: If you use SafeMath or a similar library, change ``x.add(y)`` to ``x + y``, ``x.mul(y)`` to ``x * y`` etc.
166+
- Add ``pragma abicoder v1;`` if you want to stay with the old ABI coder.
167+
- Optionally remove ``pragma experimental ABIEncoderV2`` or ``pragma abicoder v2`` since it is redundant.
168+
- Change ``byte`` to ``bytes1``.
169+
- Add intermediate explicit type conversions if required.
170+
- Combine ``c.f{gas: 10000}{value: 1}()`` to ``c.f{gas: 10000, value: 1}()``.
171+
- Change ``msg.sender.transfer(x)`` to ``payable(msg.sender).transfer(x)`` or use a stored variable of ``address payable`` type.
172+
- Change ``x**y**z`` to ``(x**y)**z``.
173+
- Use inline assembly as a replacement for ``log0``, ..., ``log4``.

0 commit comments

Comments
 (0)