From 3a1f512b3d72bfdeaccca8507457010961996603 Mon Sep 17 00:00:00 2001 From: Iaroslav Mazur Date: Thu, 22 Aug 2024 14:50:59 +0300 Subject: [PATCH] fix: make the library's balanceOf() func only callable by contracts 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. --- src/precompiles/native-tokens/NativeTokens.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/precompiles/native-tokens/NativeTokens.sol b/src/precompiles/native-tokens/NativeTokens.sol index 80f5a98..0a63d8f 100644 --- a/src/precompiles/native-tokens/NativeTokens.sol +++ b/src/precompiles/native-tokens/NativeTokens.sol @@ -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));