Cyfrin Updraft.

Допис

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

Serpent0x.
May 30, 2024
Обговорення

Reentrancy Vulnerability

Hello everyone , I've noticed that the offer function uses the .call{value: amount}("") method to send Ether to the recipient's address.

Could anyone provide insight into whether this function is indeed vulnerable to reentrancy and suggest any best practices or modifications to mitigate such risks?

function _offer(address to, uint256 amount) internal {

      balance -= amount;

      (bool success, ) = to.call{value: amount}("");
      if (!success) {
          revert TransferFailed(address(0), address(this), to, amount);
      }
  }
  • Foundry
  • Security
  • Solidity
  • Blockchain
  • Smart Contract
0
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.

Ми використовуємо файли cookie, щоб гарантувати вам найкращий досвід на нашому сайті.
Детальніше