You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/source/migration-guides.rst
+44-1
Original file line number
Diff line number
Diff line change
@@ -263,7 +263,7 @@ We updated the following dependencies:
263
263
264
264
- :code:`typechain` - bumped version from ^2.0.0 to ^9.0.0. Now every Waffle package uses the same version of the package. Also the package was moved to the :code:`peerDependencies` section - you now need to install :code:`typechain` manually when using Waffle.
265
265
- :code:`ethers` - bumped version from to ^5.5.4. Now every Waffle package uses the same version of the package. Also the package was moved to the :code:`peerDependencies` section - you now need to install :code:`ethers` manually when using Waffle.
266
-
- :code:`solc` - the package is used by :code:`waffle-compiler` package to provide the default option for compiling Soldity code. Was moved to the :code:`peerDependencies` section and has no version restrictions - you now have to install :code:`solc` manually when using Waffle.
266
+
- :code:`solc` - the package is used by :code:`waffle-compiler` package to provide the default option for compiling Solidity code. Was moved to the :code:`peerDependencies` section and has no version restrictions - you now have to install :code:`solc` manually when using Waffle.
267
267
- Deprecated :code:`ganache-core` package has been replaced with :code:`ganache` version ^7.0.3. It causes slight differences in the parameters of :code:`MockProvider` from :code:`@ethereum-waffle/provider`. Now the :code:`MockProvider` uses :code:`berlin` hardfork by default.
268
268
269
269
Changes to :code:`MockProvider` parameters
@@ -490,3 +490,46 @@ Note that in both cases you can use :code:`chai` negation :code:`not`. In a case
490
490
.and.not
491
491
.to.emit(complex, 'UnusedEvent') // This is negated
492
492
.and.to.changeEtherBalances([sender, receiver], [-100, 100]) // This is negated as well
493
+
494
+
495
+
Custom errors
496
+
~~~~~~~~~~~~~
497
+
498
+
Custom errors were introduced in Solidity v0.8.4. It is a convenient and gas-efficient way to explain to users why an operation failed. Custom errors are defined in a similar way as events:
499
+
500
+
.. code-block:: solidity
501
+
502
+
// SPDX-License-Identifier: GPL-3.0
503
+
pragma solidity ^0.8.4;
504
+
505
+
/// Insufficient balance for transfer. Needed `required` but only
When using Waffle v4.0.0-alpha.* with Hardhat, you can test transactions being reverted with custom errors as well. Using the :code:`.revertedWith` matcher you can capture the custom error's name (:code:`expect(tx).to.be.revertedWith('InsufficientBalance')`). If you want to access arguments of a custom error you should use :code:`.withArgs` matcher after the :code:`.revertedWith` matcher.
0 commit comments