Open code423n4 opened 3 years ago
a_delamo
In Visor.sol, the functions are using memory keyword, but using storage would reduce the gas cost.
function _removeNft(address nftContract, uint256 tokenId) internal { uint256 len = nfts.length; for (uint256 i = 0; i < len; i++) { Nft memory nftInfo = nfts[i]; if ( nftContract == nftInfo.nftContract && tokenId == nftInfo.tokenId ) { if (i != len - 1) { nfts[i] = nfts[len - 1]; } nfts.pop(); emit RemoveNftToken(nftContract, tokenId); break; } } }
https://docs.soliditylang.org/en/v0.4.21/types.html#reference-types
None
sponsor confirmed We will be applying this optimization in our next version
patch link
Handle
a_delamo
Vulnerability details
Impact
In Visor.sol, the functions are using memory keyword, but using storage would reduce the gas cost.
Proof of Concept
https://docs.soliditylang.org/en/v0.4.21/types.html#reference-types
Tools Used
None
Recommended Mitigation Steps