Hats-Protocol/hats-protocol

Handle overriding erc1155.balanceOf to enable wearer checking magic

Closed this issue · 3 comments

Need to fork the solmate code to enable this

should we fork the solmate repo into our org?

Hats.balanceOf() override is here:

hats-protocol/src/Hats.sol

Lines 575 to 591 in 7bdc497

function balanceOf(address wearer, uint256 id)
public
view
override
returns (uint256 balance)
{
uint64 hatId = uint64(id); // QUESTION do we need to cast this? what happens if it overflows?
Hat memory hat = hats[hatId];
balance = 0;
if (_isActive(hat) && _isInGoodStanding(wearer, hat)) {
balance = super.balanceOf(wearer, hatId);
}
return balance;
}