Cyfrin Updraft.

Допис

Діліться своїми знаннями.

Cyfrin Moderator Pst.
Mar 29, 2024
Питання та відповіді експертів

How is IERC20 imported from ERC20?

In the provided Solidity contract for a vault handling ERC20 tokens, the import statement for IERC20 is from '@openzeppelin/contracts/token/ERC20/ERC20.sol'. Typically, IERC20 is imported from IERC20.sol. How does this import work in this context, and what implications does it have for the contract's functionality?

  • erc20
  • Security
  • Solidity
0
1
Поділитися
Коментарі
.

Відповіді

1
Cyfrin Moderator Ans.
Mar 29 2024, 10:49

You have the ability to import a contract from any contract that contains it. For instance, the ERC20.sol contract imports IERC20.sol, allowing us to extract the IERC20.sol from the ERC20.sol. However, for the sake of simplicity and clarity, it is recommended to import directly from the IERC20.sol file.

0
Офіційна відповідь
Коментарі
.

Ви знаєте відповідь?

Будь ласка, увійдіть та поділіться нею.

Cyfrin Updraft is an education platform specializing on teaching the next generation of smart contract developers

200Пости201Відповіді
Sui.X.Peera.

Зароби свою частку з 1000 Sui

Заробляй бали репутації та отримуй винагороди за допомогу в розвитку спільноти Sui.