Hello im trying to revert a custom error in YUL inline-assembly
function mint(uint256 amountToMint) external onlyOwner() {
assembly {
// check if exceed maxSupply
let maxSupplySlot := sload(maxSupply.slot)
let res := lt(add(amountToMint, mload(counter.slot)), add(maxSupplySlot, 1))
let ptrError := mload(0x40)
mstore(ptrError, 14)
mstore(add(ptrError, 0x20), 0x4d6178537570706c795265616368) // => "MaxSupplyReach"
if iszero(res) { revert(ptrError, 0x40) }
// populate mapping balanceOf
let ptr := mload(0x40)
mstore(ptr, caller())
mstore(add(ptr, 0x20), balanceOf.slot)
let slot := keccak256(ptr, 0x40)
sstore(slot, amountToMint)
// increment counter
let counterSlot := sload(counter.slot)
let resCounter := add(counterSlot, amountToMint)
sstore(counter.slot, resCounter)
}
}
dont know if i do it correctly my output is like that.
0x000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000004d6178537570706c795265616368
my foundry error when i revert with revert(0,0) it pass but dont pass with custom error
thank's for ur help :)