Skip to content

Commit ede638e

Browse files
authored
🪲 Replace ganache-core with ganache (#652)
1 parent d7715fa commit ede638e

33 files changed

Lines changed: 783 additions & 3298 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ethereum-waffle/provider": patch
3+
---
4+
5+
Replaced deprecated `ganache-core` package with `ganache`.

‎docs/source/migration-guides.rst‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,53 @@ We updated the following dependencies:
264264
- :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.
265265
- :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.
266266
- :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.
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+
269+
Changes to :code:`MockProvider` parameters
270+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
271+
272+
Previous (optional) parameters of :code:`MockProvider` included override options for the Ganache provider:
273+
274+
.. code-block:: ts
275+
276+
interface MockProviderOptions {
277+
ganacheOptions: {
278+
account_keys_path?: string;
279+
accounts?: object[];
280+
allowUnlimitedContractSize?: boolean;
281+
blockTime?: number;
282+
db_path?: string;
283+
debug?: boolean;
284+
default_balance_ether?: number;
285+
fork?: string | object;
286+
fork_block_number?: string | number;
287+
forkCacheSize?: number;
288+
gasLimit?: string | number;
289+
gasPrice?: string;
290+
hardfork?: "byzantium" | "constantinople" | "petersburg" | "istanbul" | "muirGlacier";
291+
hd_path?: string;
292+
locked?: boolean;
293+
logger?: {
294+
log(msg: string): void;
295+
};
296+
mnemonic?: string;
297+
network_id?: number;
298+
networkId?: number;
299+
port?: number;
300+
seed?: any;
301+
time?: Date;
302+
total_accounts?: number;
303+
unlocked_accounts?: string[];
304+
verbose?: boolean;
305+
vmErrorsOnRPCResponse?: boolean;
306+
ws?: boolean;
307+
}
308+
}
309+
310+
Current :code:`ganacheOptions` parameter are documented `here <https://github.com/trufflesuite/ganache/blob/386771d84a9985f6d4b61b262f2be3cda896162e/src/chains/ethereum/options/src/index.ts#L22-L29>`_.
311+
312+
Typechain changes
313+
~~~~~~~~~~~~~~~~~
267314

268315
If you used type generation (:code:`typechainEnabled` option set to :code:`true` in :code:`waffle.json`), you need to update your code to conform to the new naming convention used by :code:`typechain`. Contract factories now have postfix :code:`__factory` instead of :code:`Factory`. For example, :code:`MyContractFactory` becomes :code:`MyContract__factory`. Example refactoring:
269316

‎examples/basic/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"eslint": "^6.8.0",
1919
"eslint-plugin-import": "^2.20.2",
2020
"ethereum-waffle": "workspace:*",
21-
"ethers": "4.0.47",
21+
"ethers": "^5.6.1",
2222
"mocha": "^7.1.2",
2323
"ts-node": "^8.9.1",
2424
"typescript": "^4.6.2",

‎examples/called-on-contract/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"eslint": "^6.8.0",
1919
"eslint-plugin-import": "^2.20.2",
2020
"ethereum-waffle": "workspace:*",
21-
"ethers": "4.0.47",
21+
"ethers": "^5.6.1",
2222
"mocha": "^7.1.2",
2323
"ts-node": "^8.9.1",
2424
"typescript": "^4.6.2",

‎examples/change-balance/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"eslint": "^6.8.0",
1919
"eslint-plugin-import": "^2.20.2",
2020
"ethereum-waffle": "workspace:*",
21-
"ethers": "4.0.47",
21+
"ethers": "^5.6.1",
2222
"mocha": "^7.1.2",
2323
"ts-node": "^8.9.1",
2424
"typescript": "^4.6.2"

‎examples/dynamic-mocking-and-testing-calls/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"eslint": "^6.8.0",
1919
"eslint-plugin-import": "^2.20.2",
2020
"ethereum-waffle": "workspace:*",
21-
"ethers": "^5.0.17",
21+
"ethers": "^5.6.1",
2222
"mocha": "^7.1.2",
2323
"ts-node": "^8.9.1",
2424
"typescript": "^4.6.2"

‎examples/ens/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint:fix": "eslint --fix '{src,test}/**/*.ts'"
1111
},
1212
"devDependencies": {
13-
"ethers": "4.0.47",
13+
"ethers": "^5.6.1",
1414
"@types/chai": "^4.2.3",
1515
"@types/mocha": "^5.2.7",
1616
"@typescript-eslint/eslint-plugin": "^5.15.0",

‎examples/mock-contracts/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint:fix": "eslint --fix '{src,test}/**/*.ts'"
1111
},
1212
"devDependencies": {
13-
"ethers": "4.0.47",
13+
"ethers": "^5.6.1",
1414
"@types/chai": "^4.2.3",
1515
"@types/mocha": "^5.2.7",
1616
"@typescript-eslint/eslint-plugin": "^5.15.0",

‎patches/ganache-core+2.13.2.patch‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)