v1-contracts icon indicating copy to clipboard operation
v1-contracts copied to clipboard

Add Reentrancy Guard

Open haydenadams opened this issue 6 years ago • 2 comments

Uniswap is safe from re-entrancy for tokens that don't allow arbitrary callbacks in transfer functions. However, for tokens that do allow arbitrary callbacks (such as ERC777), a re-entrancy guard could make the contract more secure.

Implementation: https://github.com/protofire/zeppelin-solidity/blob/master/contracts/ReentrancyGuard.sol

This would add ~5000-1000 gas until https://eips.ethereum.org/EIPS/eip-1283 is merged

haydenadams avatar Jan 24 '19 22:01 haydenadams

https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/utils/ReentrancyGuard.sol looks like it has had a few updates.

I haven't been able to find a similar library written in vyper though.

BlinkyStitt avatar Feb 18 '19 22:02 BlinkyStitt

Can now add the decorator

@nonreentrant(key)

https://github.com/ethereum/vyper/pull/1264

haydenadams avatar Jun 04 '19 19:06 haydenadams