Skip to content

Provide mock ERC-20 and ERC-721 contracts #469

@PaulRBerg

Description

@PaulRBerg

In OpenZeppelin v5, they have made the ERC20 and ERC721 contracts abstract:

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/793d92a3331538d126033cbacb1ee5b8a7d95adc/contracts/token/ERC20/ERC20.sol#L34

This means that for testing purposes we all need to define a dummy ERC-20 contract like this:

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.20;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract ERC20Mock is ERC20 {
    constructor(string memory name, string memory symbol) ERC20(name, symbol) { }
}

The same requirement applies to ERC-721.

It would be helpful if Forge Std provided these mocks for users so they don't end up re-implemented all over GitHub.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions