Skip to content

Commit

Permalink
oz remapping and memory
Browse files Browse the repository at this point in the history
  • Loading branch information
dianakocsis committed Oct 8, 2024
1 parent 7706c80 commit 126f56d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .forge-snapshots/positionDescriptor bytecode size.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4522
8 changes: 4 additions & 4 deletions src/libraries/Descriptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol
import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
import {FullMath} from "@uniswap/v4-core/src/libraries/FullMath.sol";
import {LPFeeLibrary} from "@uniswap/v4-core/src/libraries/LPFeeLibrary.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Base64} from "@openzeppelin/contracts/utils/Base64.sol";
import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol";
import {Base64} from "openzeppelin-contracts/contracts/utils/Base64.sol";
import {SVG} from "./SVG.sol";
import {HexStrings} from "./HexStrings.sol";

Expand Down Expand Up @@ -42,7 +42,7 @@ library Descriptor {
/// @notice Constructs the token URI for a Uniswap v4 NFT
/// @param params Parameters needed to construct the token URI
/// @return The token URI as a string
function constructTokenURI(ConstructTokenURIParams calldata params) public pure returns (string memory) {
function constructTokenURI(ConstructTokenURIParams memory params) public pure returns (string memory) {
string memory name = generateName(params, feeToPercentString(params.fee));
string memory descriptionPartOne = generateDescriptionPartOne(
escapeQuotes(params.quoteCurrencySymbol),
Expand Down Expand Up @@ -175,7 +175,7 @@ library Descriptor {
/// @param params Parameters needed to generate the name
/// @param feeTier The fee tier of the pool
/// @return The name of the NFT
function generateName(ConstructTokenURIParams calldata params, string memory feeTier)
function generateName(ConstructTokenURIParams memory params, string memory feeTier)
private
pure
returns (string memory)
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/SVG.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.0;
import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol";
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol";
import {BitMath} from "@uniswap/v4-core/src/libraries/BitMath.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Base64} from "@openzeppelin/contracts/utils/Base64.sol";
import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol";
import {Base64} from "openzeppelin-contracts/contracts/utils/Base64.sol";

/// @title SVG
/// @notice Provides a function for generating an SVG associated with a Uniswap NFT
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/SafeCurrencyMetadata.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {IERC20Metadata} from "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol";
import {AddressStringUtil} from "./AddressStringUtil.sol";

Expand Down
7 changes: 6 additions & 1 deletion test/PositionDescriptor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {PositionConfig} from "./shared/PositionConfig.sol";
import {PosmTestSetup} from "./shared/PosmTestSetup.sol";
import {ActionConstants} from "../src/libraries/ActionConstants.sol";
import {Base64} from "./base64.sol";
import {GasSnapshot} from "forge-gas-snapshot/GasSnapshot.sol";

contract PositionDescriptorTest is Test, PosmTestSetup {
contract PositionDescriptorTest is Test, PosmTestSetup, GasSnapshot {
using Base64 for string;

address public WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
Expand All @@ -36,6 +37,10 @@ contract PositionDescriptorTest is Test, PosmTestSetup {
deployAndApprovePosm(manager);
}

function test_bytecodeSize_positionDescriptor() public {
snapSize("positionDescriptor bytecode size", address(positionDescriptor));
}

function test_setup_succeeds() public view {
assertEq(address(positionDescriptor.poolManager()), address(manager));
assertEq(positionDescriptor.wrappedNative(), WETH9);
Expand Down

0 comments on commit 126f56d

Please sign in to comment.