Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dianakocsis committed Sep 26, 2024
1 parent a4892e3 commit c08ccd9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_permit.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
79064
79076
2 changes: 1 addition & 1 deletion src/PositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ contract PositionManager is
)
BaseActionsRouter(_poolManager)
Permit2Forwarder(_permit2)
ERC721Permit_v4("Uniswap V4 Positions NFT", "UNI-V4-POSM")
ERC721Permit_v4("Uniswap v4 Positions NFT", "UNI-V4-POSM")
Notifier(_unsubscribeGasLimit)
{
tokenDescriptor = _tokenDescriptor;
Expand Down
2 changes: 1 addition & 1 deletion src/V4Router.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {Actions} from "./libraries/Actions.sol";
import {ActionConstants} from "./libraries/ActionConstants.sol";

/// @title UniswapV4Router
/// @notice Abstract contract that contains all internal logic needed for routing through Uniswap V4 pools
/// @notice Abstract contract that contains all internal logic needed for routing through Uniswap v4 pools
/// @dev the entry point to executing actions in this contract is calling `BaseActionsRouter._executeActions`
/// An inheriting contract should call _executeActions at the point that they wish actions to be executed
abstract contract V4Router is IV4Router, BaseActionsRouter, DeltaResolver {
Expand Down
4 changes: 4 additions & 0 deletions src/libraries/CurrencyRatioSortOrder.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/// @title CurrencyRatioSortOrder
/// @notice Provides constants for sorting currencies when displaying price ratios
/// Currencies given larger values will be in the numerator of the price ratio
/// @dev Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/TokenRatioSortOrder.sol
library CurrencyRatioSortOrder {
int256 constant NUMERATOR_MOST = 300;
int256 constant NUMERATOR_MORE = 200;
Expand Down
24 changes: 14 additions & 10 deletions src/libraries/Descriptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.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 {SVG} from "./SVG.sol";
Expand Down Expand Up @@ -46,12 +47,12 @@ library Descriptor {
string memory descriptionPartOne = generateDescriptionPartOne(
escapeQuotes(params.quoteCurrencySymbol),
escapeQuotes(params.baseCurrencySymbol),
addressToString(params.poolManager),
addressToString(Currency.unwrap(params.quoteCurrency))
addressToString(params.poolManager)
);
string memory descriptionPartTwo = generateDescriptionPartTwo(
params.tokenId.toString(),
escapeQuotes(params.baseCurrencySymbol),
addressToString(Currency.unwrap(params.quoteCurrency)),
addressToString(Currency.unwrap(params.baseCurrency)),
addressToString(params.hooks),
feeToPercentString(params.fee)
Expand Down Expand Up @@ -111,18 +112,16 @@ library Descriptor {
/// @param quoteCurrencySymbol The symbol of the quote currency
/// @param baseCurrencySymbol The symbol of the base currency
/// @param poolManager The address of the pool manager
/// @param quoteCurrency The address of the quote currency
/// @return The first part of the description
function generateDescriptionPartOne(
string memory quoteCurrencySymbol,
string memory baseCurrencySymbol,
string memory poolManager,
string memory quoteCurrency
string memory poolManager
) private pure returns (string memory) {
// displays quote currency first, then base currency
return string(
abi.encodePacked(
"This NFT represents a liquidity position in a Uniswap V4 ",
"This NFT represents a liquidity position in a Uniswap v4 ",
quoteCurrencySymbol,
"-",
baseCurrencySymbol,
Expand All @@ -131,30 +130,32 @@ library Descriptor {
"\\nPool Manager Address: ",
poolManager,
"\\n",
quoteCurrencySymbol,
" Address: ",
quoteCurrency,
"\\n"
quoteCurrencySymbol
)
);
}
/// @notice Generates the second part of the description for a Uniswap v4 NFTs
/// @param tokenId The token ID
/// @param baseCurrencySymbol The symbol of the base currency
/// @param quoteCurrency The address of the quote currency
/// @param baseCurrency The address of the base currency
/// @param hooks The address of the hooks contract
/// @param feeTier The fee tier of the pool
/// @return The second part of the description
function generateDescriptionPartTwo(
string memory tokenId,
string memory baseCurrencySymbol,
string memory quoteCurrency,
string memory baseCurrency,
string memory hooks,
string memory feeTier
) private pure returns (string memory) {
return string(
abi.encodePacked(
' Address: ',
quoteCurrency,
"\\n",
baseCurrencySymbol,
" Address: ",
baseCurrency,
Expand Down Expand Up @@ -402,6 +403,9 @@ library Descriptor {
/// @param fee fee amount
/// @return fee as a decimal string with percent sign
function feeToPercentString(uint24 fee) internal pure returns (string memory) {
if (fee == LPFeeLibrary.DYNAMIC_FEE_FLAG) {
return "Dynamic";
}
if (fee == 0) {
return "0%";
}
Expand Down
6 changes: 0 additions & 6 deletions src/libraries/SVG.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ library SVG {
/// @param params The SVGParams struct containing the parameters for the SVG
/// @return svg The SVG string associated with the NFT
function generateSVG(SVGParams memory params) internal pure returns (string memory svg) {
/*
address: "0xe8ab59d3bcde16a29912de83a90eb39628cfc163",
msg: "Forged in SVG for Uniswap in 2021 by 0xe8ab59d3bcde16a29912de83a90eb39628cfc163",
sig: "0x2df0e99d9cbfec33a705d83f75666d98b22dea7c1af412c584f7d626d83f02875993df740dc87563b9c73378f8462426da572d7989de88079a382ad96c57b68d1b",
version: "2"
*/
return string(
abi.encodePacked(
generateSVGDefs(params),
Expand Down
2 changes: 1 addition & 1 deletion test/position-managers/Permit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract PermitTest is Test, PosmTestSetup {
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"),
keccak256("Uniswap V4 Positions NFT"), // storage is private on EIP712.sol so we need to hardcode these
keccak256("Uniswap v4 Positions NFT"), // storage is private on EIP712.sol so we need to hardcode these
block.chainid,
address(lpm)
)
Expand Down

0 comments on commit c08ccd9

Please sign in to comment.