-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
ODHack8app:solidityWork on the Ethereum part of the application; you need to know Solidity.Work on the Ethereum part of the application; you need to know Solidity.
Description
From Cyfrin/2024-07-ark-project#2
[Low-1] Factory lacks existence checks
When utilizing a factory pattern to deploy contracts based on user input, it's crucial to ensure that the contract isn't being deployed at an address already in use. Deploying to an existing address can lead to unintentional overwrites or unexpected behavior. To prevent this, the factory contract should maintain a mapping or a list of deployed contract addresses. Before creating a new contract, the factory should check if the intended address is already in the list. If it is, the creation should be halted or rerouted. Implementing such checks minimizes risks, ensuring that contracts are only deployed to fresh, uncontaminated addresses, preserving the integrity of the protocol.
function deployERC721Bridgeable(
string memory name,
string memory symbol
)
public
returns (address)
{
address impl = address(new ERC721Bridgeable()); // <= FOUND
bytes memory dataInit = abi.encodeWithSelector(
ERC721Bridgeable.initialize.selector,
abi.encode(name, symbol)
return address(new ERC1967Proxy(impl, dataInit));
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ODHack8app:solidityWork on the Ethereum part of the application; you need to know Solidity.Work on the Ethereum part of the application; you need to know Solidity.