0

Can I get someone's perspective on why I'm unable to find the ERC20 contract I've npm install @openzeppelin/contracts.

After import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; I get a flag when trying to inherit from ERC20

Please see attached photo. I've tried without node-modules and without /before the @

enter image description here

2 Answers 2

2

You are trying to inherit ERC20 yet you have imported IERC20.sol

0

// SPDX-License-Identifier: MIT pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 { constructor() ERC20("MyToken", "MTK") {} }

Use This above code...

import "@openzeppelin/contracts/token/ERC20/IERC20.sol" will only import the interface for the ERC20...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.