Skip to content

Commit

Permalink
fix: trailing zeros problem solved
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmikko committed Aug 27, 2024
1 parent d65a1c0 commit 0c252b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/global/AddressProviderV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ import {
NO_VERSION_CONTROL
} from "../libraries/ContractLiterals.sol";

import {LibString} from "@solady/utils/LibString.sol";

/// @title Address provider V3
/// @notice Stores addresses of important contracts
contract AddressProviderV3_1 is Ownable2Step, IAddressProviderV3 {
using EnumerableSet for EnumerableSet.AddressSet;
// using LibString for string;
using LibString for bytes32;

/// @notice Contract version
uint256 public constant override version = 3_10;
Expand Down Expand Up @@ -76,7 +80,7 @@ contract AddressProviderV3_1 is Ownable2Step, IAddressProviderV3 {

/// @notice Returns the address of a contract with a given key and version
function getAddressOrRevert(bytes32 key, uint256 _version) public view virtual override returns (address result) {
return getAddressOrRevert(string(abi.encodePacked(key)), _version);
return getAddressOrRevert(key.fromSmallString(), _version);
}

/// @notice Returns the address of a contract with a given key and version
Expand All @@ -86,7 +90,7 @@ contract AddressProviderV3_1 is Ownable2Step, IAddressProviderV3 {

/// @notice Returns the address of a contract with a given key and version
function getLatestAddressOrRevert(bytes32 _key) public view virtual returns (address result) {
string memory key = string(abi.encodePacked(_key));
string memory key = _key.fromSmallString();
return getAddressOrRevert(key, latestVersions[key]);
}

Expand Down

0 comments on commit 0c252b4

Please sign in to comment.