Skip to content

Commit

Permalink
more review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dianakocsis committed Oct 1, 2024
1 parent 40904b0 commit 8a6033e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 102 deletions.
24 changes: 0 additions & 24 deletions script/DeployPositionDescriptor.s.sol

This file was deleted.

17 changes: 12 additions & 5 deletions script/DeployPosm.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,28 @@ import {StateView} from "../src/lens/StateView.sol";
import {PositionManager} from "../src/PositionManager.sol";
import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol";
import {IPositionDescriptor} from "../src/interfaces/IPositionDescriptor.sol";
import {PositionDescriptor} from "../src/PositionDescriptor.sol";

contract DeployPosmTest is Script {
function setUp() public {}

function run(address poolManager, address permit2, uint256 unsubscribeGasLimit, address positionDescriptor)
public
returns (PositionManager posm)
{
function run(
address poolManager,
address permit2,
uint256 unsubscribeGasLimit,
address weth,
string memory nativeCurrencyLabel
) public returns (PositionDescriptor positionDescriptor, PositionManager posm) {
vm.startBroadcast();

positionDescriptor = new PositionDescriptor(IPoolManager(poolManager), weth, nativeCurrencyLabel);
console2.log("PositionDescriptor", address(positionDescriptor));

posm = new PositionManager{salt: hex"03"}(
IPoolManager(poolManager),
IAllowanceTransfer(permit2),
unsubscribeGasLimit,
IPositionDescriptor(positionDescriptor)
IPositionDescriptor(address(positionDescriptor))
);
console2.log("PositionManager", address(posm));

Expand Down
10 changes: 5 additions & 5 deletions src/PositionDescriptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {IPositionDescriptor} from "./interfaces/IPositionDescriptor.sol";
import {PositionInfo, PositionInfoLibrary} from "./libraries/PositionInfoLibrary.sol";
import {Descriptor} from "./libraries/Descriptor.sol";
import {CurrencyRatioSortOrder} from "./libraries/CurrencyRatioSortOrder.sol";
import {SafeERC20Namer} from "./libraries/SafeERC20Namer.sol";
import {SafeERC20Metadata} from "./libraries/SafeERC20Metadata.sol";

/// @title Describes NFT token positions
/// @notice Produces a string containing the data URI for a JSON metadata string
Expand Down Expand Up @@ -67,16 +67,16 @@ contract PositionDescriptor is IPositionDescriptor {
baseCurrency: baseCurrency,
quoteCurrencySymbol: quoteCurrency.isAddressZero()
? nativeCurrencyLabel
: SafeERC20Namer.tokenSymbol(Currency.unwrap(quoteCurrency)),
: SafeERC20Metadata.tokenSymbol(Currency.unwrap(quoteCurrency)),
baseCurrencySymbol: baseCurrency.isAddressZero()
? nativeCurrencyLabel
: SafeERC20Namer.tokenSymbol(Currency.unwrap(baseCurrency)),
: SafeERC20Metadata.tokenSymbol(Currency.unwrap(baseCurrency)),
quoteCurrencyDecimals: quoteCurrency.isAddressZero()
? 18
: IERC20Metadata(Currency.unwrap(quoteCurrency)).decimals(),
: SafeERC20Metadata.tokenDecimals(Currency.unwrap(quoteCurrency)),
baseCurrencyDecimals: baseCurrency.isAddressZero()
? 18
: IERC20Metadata(Currency.unwrap(baseCurrency)).decimals(),
: SafeERC20Metadata.tokenDecimals(Currency.unwrap(baseCurrency)),
flipRatio: _flipRatio,
tickLower: positionInfo.tickLower(),
tickUpper: positionInfo.tickUpper(),
Expand Down
3 changes: 2 additions & 1 deletion src/libraries/Descriptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ library Descriptor {
using TickMath for int24;
using Strings for uint256;
using HexStrings for uint256;
using LPFeeLibrary for uint24;

uint256 constant sqrt10X128 = 1076067327063303206878105757264492625226;

Expand Down Expand Up @@ -403,7 +404,7 @@ 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) {
if (fee.isDynamicFee()) {
return "Dynamic";
}
if (fee == 0) {
Expand Down
67 changes: 0 additions & 67 deletions src/libraries/SafeERC20Namer.sol

This file was deleted.

0 comments on commit 8a6033e

Please sign in to comment.