transmissions11/solmate

virtual 1155.balanceOf function

spengrah opened this issue · 1 comments

Currently, the 1155 implementation relies on solc to generate a balanceOf getter function from the public balanceOf mapping, which means that the resulting getter cannot be overriden by contracts inheriting from 1155.

However, balanceOfBatch() is a virtual function, creating a disparity between the two methods of reading balances.

Please consider:

  1. Adding a virtual balanceOf function
function balanceOf(address owner, uint256 id) public view virtual returns (uint256 balance) {
        balance = balanceOf[owner][id];
    }
  1. Marking balanceOf mapping private to avoid declaring a duplicate identifier

thanks for the issue and PR, but sadly this is not something im interested in including at this time