mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10626 from ethereum/howToUpdateYourCode
How to update your code.
This commit is contained in:
commit
eec1e2a66c
@ -118,6 +118,7 @@ This section lists changes that might cause existing contracts to not compile an
|
|||||||
|
|
||||||
* Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences in code.
|
* Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences in code.
|
||||||
They can still be inserted via hexadecimal escapes, e.g. ``\x08``, ``\x0c``, and ``\x0b``, respectively.
|
They can still be inserted via hexadecimal escapes, e.g. ``\x08``, ``\x0c``, and ``\x0b``, respectively.
|
||||||
|
|
||||||
* The global variables ``tx.origin`` and ``msg.sender`` have the type ``address`` instead of
|
* The global variables ``tx.origin`` and ``msg.sender`` have the type ``address`` instead of
|
||||||
``address payable``. One can convert them into ``address payable`` by using an explicit
|
``address payable``. One can convert them into ``address payable`` by using an explicit
|
||||||
conversion, i.e., ``payable(tx.origin)`` or ``payable(msg.sender)``.
|
conversion, i.e., ``payable(tx.origin)`` or ``payable(msg.sender)``.
|
||||||
@ -155,3 +156,18 @@ Interface Changes
|
|||||||
Use the "compact AST" (``--ast-compact--json`` resp. ``AST``) as replacement.
|
Use the "compact AST" (``--ast-compact--json`` resp. ``AST``) as replacement.
|
||||||
|
|
||||||
* The old error reporter (``--old-reporter``) has been removed.
|
* The old error reporter (``--old-reporter``) has been removed.
|
||||||
|
|
||||||
|
|
||||||
|
How to update your code
|
||||||
|
=======================
|
||||||
|
|
||||||
|
- 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``.
|
Loading…
Reference in New Issue
Block a user