Skip to content

Commit

Permalink
fix: make the library's balanceOf() func only callable by contracts
Browse files Browse the repository at this point in the history
Having it also callable by EOAs (i.e. with the `public` modifier) leads
to the to-be-linked dependencies/references inserted into the bytecode
of the contracts using the Native Tokens library. The latter was not
compatible with the testing framework/methodology we use in the SabVM
repo.
  • Loading branch information
IaroslavMazur committed Aug 22, 2024
1 parent f360b70 commit 3a1f512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/precompiles/native-tokens/NativeTokens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library NativeTokens {
/// @param tokenID The ID of the native token to query the balance of.
/// @param account The address to query the balance of.
/// @return The balance of the `account` for the native token `tokenID`, denoted in 18 decimals.
function balanceOf(address account, uint256 tokenID) public view returns (uint256) {
function balanceOf(address account, uint256 tokenID) internal view returns (uint256) {
// ABI encode the input parameters.
bytes memory callData = abi.encodeCall(INativeTokens.balanceOf, (account, tokenID));

Expand Down

0 comments on commit 3a1f512

Please sign in to comment.