Skip to content

Commit

Permalink
Address: explain dangers of isContract (OpenZeppelin#2994)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivo Georgiev <ivo@strem.io>
  • Loading branch information
frangio and Ivo Georgiev committed Dec 8, 2021
1 parent 8ef7655 commit 04109f8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/utils/Address.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ library Address {
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
Expand Down

0 comments on commit 04109f8

Please sign in to comment.