Issue ID
LDN-11
Risk Level
Severity: Informational
Code Segment
function onERC721Received(
address operator,
address user,
uint256 poolId,
bytes calldata data
)
/// @notice Creates the collateral provider
/// @param data Rebuilder struct containing mainCoin data
/// @param collateralFinishTime Finish time for refund
/// @return poolId Collateral pool ID
function _createCollateralProvider(
Rebuilder memory data,
uint256 collateralFinishTime
) internal firewallProtectedSig(0x4516d406) returns (uint256 poolId) {
/// @notice Iterates over user data to create refund pools for each user
/// @param data Users data, paramsData, tokenPoolId, simple provider address
function _userDataIterator(
Rebuilder memory data
) internal firewallProtectedSig(0xbbc1f709)
Description
In the functions mentioned above, the poolId is described as "the ID of the Collateral NFT". Given the presence of multiple ID types within the codebase (simple pool ID, refund pool ID, collateral pool ID), it is advisable to rename it to collateralPoolId. This adjustment helps prevent confusion when interpreting the code, rather than relying solely on NatSpec documentation.
Moreover, the _userDataIterator function's name lacks clarity regarding its functionality, which involves the creation of bulk refund pools. Therefore, renaming it to something like _buildMassPools would enhance readability and comprehension.
Code Location
LockDealNFT.Builders/contracts/SimpleRefundBuilder/SimpleRefundBuilder.sol
LockDealNFT.Builders/contracts/SimpleRefundBuilder/RefundBuilderInternal.sol
Recommendation
Consider changing to:
function onERC721Received(
address operator,
address user,
uint256 collateralPoolId,
bytes calldata data
)
function _createCollateralProvider(
Rebuilder memory data,
uint256 collateralFinishTime
) internal firewallProtectedSig(0x4516d406) returns (uint256 collateralPoolId) {
function _buildMassPools(
Rebuilder memory data
) internal firewallProtectedSig(0xbbc1f709) {