Skip to content

Commit 3afa1b5

Browse files
authored
Use contracts exposed with imports to remove mocks (#178)
1 parent 0f78794 commit 3afa1b5

File tree

11 files changed

+14
-47
lines changed

11 files changed

+14
-47
lines changed

contracts/mocks/Create2Mock.sol

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

contracts/mocks/ERC1155Mock.sol

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

contracts/mocks/ERC20Mock.sol

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

contracts/mocks/ERC721Mock.sol

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

contracts/mocks/import.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
pragma solidity ^0.8.20;
44

5-
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
65
import {ECDSAOwnedDKIMRegistry} from "@zk-email/email-tx-builder/src/utils/ECDSAOwnedDKIMRegistry.sol";
6+
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
7+
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
8+
import {ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
9+
import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
710
import {ERC1271WalletMock} from "@openzeppelin/contracts/mocks/ERC1271WalletMock.sol";
811
import {CallReceiverMock} from "@openzeppelin/contracts/mocks/CallReceiverMock.sol";

hardhat.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ module.exports = {
5151
hardfork: argv.hardfork,
5252
},
5353
},
54+
exposed: {
55+
imports: true,
56+
initializers: true,
57+
},
5458
gasReporter: {
5559
enabled: argv.gas,
5660
showMethodSig: true,

test/account/Account.behavior.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function shouldBehaveLikeAccountHolder() {
9393
const data = '0x12345678';
9494

9595
beforeEach(async function () {
96-
this.token = await ethers.deployContract('$ERC1155Mock', ['https://somedomain.com/{id}.json']);
96+
this.token = await ethers.deployContract('$ERC1155', ['https://somedomain.com/{id}.json']);
9797
await this.token.$_mintBatch(this.other, ids, values, '0x');
9898
});
9999

@@ -130,7 +130,7 @@ function shouldBehaveLikeAccountHolder() {
130130
const tokenId = 1n;
131131

132132
beforeEach(async function () {
133-
this.token = await ethers.deployContract('$ERC721Mock', ['Some NFT', 'SNFT']);
133+
this.token = await ethers.deployContract('$ERC721', ['Some NFT', 'SNFT']);
134134
await this.token.$_mint(this.other, tokenId);
135135
});
136136

test/account/paymaster/PaymasterERC20.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async function fixture() {
1717
// EOAs and environment
1818
const [admin, receiver, other] = await ethers.getSigners();
1919
const target = await ethers.deployContract('CallReceiverMock');
20-
const token = await ethers.deployContract('$ERC20Mock', ['Name', 'Symbol']);
20+
const token = await ethers.deployContract('$ERC20', ['Name', 'Symbol']);
2121

2222
// signers
2323
const accountSigner = ethers.Wallet.createRandom();

test/account/paymaster/PaymasterERC20Guarantor.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async function fixture() {
1717
// EOAs and environment
1818
const [admin, receiver, guarantor, other] = await ethers.getSigners();
1919
const target = await ethers.deployContract('CallReceiverMock');
20-
const token = await ethers.deployContract('$ERC20Mock', ['Name', 'Symbol']);
20+
const token = await ethers.deployContract('$ERC20', ['Name', 'Symbol']);
2121

2222
// signers
2323
const accountSigner = ethers.Wallet.createRandom();

test/account/paymaster/PaymasterERC721Owner.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ for (const [name, opts] of Object.entries({
1515
// EOAs and environment
1616
const [admin, receiver, other] = await ethers.getSigners();
1717
const target = await ethers.deployContract('CallReceiverMock');
18-
const token = await ethers.deployContract('$ERC721Mock', ['Some NFT', 'SNFT']);
18+
const token = await ethers.deployContract('$ERC721Enumerable', ['Some NFT', 'SNFT']);
1919

2020
// signers
2121
const accountSigner = ethers.Wallet.createRandom();

0 commit comments

Comments
 (0)