Using assembly helper function for checking address(0) can reduce gas.
Using assembly helper function for checking address(0) can reduce gas.
The below pattern will help reduce gas. You can use your own custom error.
error ZeroAddress();
function assembly_notZero(address toCheck) public pure returns(bool success) {
assembly {
if iszero(toCheck) {
let ptr := mload(0x40)
mstore(ptr, 0xd92e233d00000000000000000000000000000000000000000000000000000000) // selector for
// `ZeroAddress()`.
revert(ptr, 0x4)
}
}
return true;
}
can cost more gas
Manual review
Using assembly helper function for checking address(0) can reduce gas.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.