Skip to content

Commit cb3fc08

Browse files
committed
make upgradable
1 parent e594110 commit cb3fc08

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/Numo.sol

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import {BalanceDelta} from "@uniswap/v4-core/types/BalanceDelta.sol";
99
import {BeforeSwapDelta, toBeforeSwapDelta} from "@uniswap/v4-core/types/BeforeSwapDelta.sol";
1010
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
1111
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
12+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
13+
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
14+
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
15+
1216
import "./lib/SwapLib.sol";
1317

1418
/// @title Numo
@@ -19,7 +23,7 @@ import "./lib/SwapLib.sol";
1923
/// @dev The width is the width of the log-normal distribution.
2024
/// @dev The mean and width are used to calculate the spot price of the pool.
2125

22-
contract Numo is BaseCustomCurve {
26+
contract Numo is Initializable, UUPSUpgradeable, Ownable2StepUpgradeable, BaseCustomCurve {
2327
using FixedPointMathLib for uint256;
2428
using FixedPointMathLib for int256;
2529

@@ -28,18 +32,30 @@ contract Numo is BaseCustomCurve {
2832
uint256 public totalLiquidity;
2933
uint256 public reserve0;
3034
uint256 public reserve1;
35+
uint256 public controllerFee; // defaults to 0
36+
37+
uint256 public constant SWAP_FEE_WAD = 1e13; // 0.001% base fee
38+
39+
bool public paused;
3140

32-
uint256 public constant SWAP_FEE_WAD = 1e14; // 0.01%
41+
uint256[50] private __gap;
3342

3443
event Swap(address indexed sender, bool zeroForOne, uint256 amountIn, uint256 amountOut);
3544
event LiquidityAdded(address indexed sender, uint256 amount0, uint256 amount1, uint256 shares);
3645
event LiquidityRemoved(address indexed sender, uint256 amount0, uint256 amount1, uint256 shares);
3746

38-
constructor(IPoolManager _poolManager, uint256 _mean, uint256 _width) BaseCustomCurve(_poolManager) {
47+
function initialize(IPoolManager _poolManager, uint256 _mean, uint256 _width) public initializer {
48+
__Ownable_init(msg.sender);
49+
__UUPSUpgradeable_init(_poolManager);
50+
BaseCustomCurve.__BaseCustomCurve_init(_poolManager);
51+
3952
mean = _mean;
4053
width = _width;
4154
}
4255

56+
/// @dev UUPS upgrade authorization
57+
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
58+
4359
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
4460
return Hooks.Permissions({
4561
beforeInitialize: true,

0 commit comments

Comments
 (0)