-
Notifications
You must be signed in to change notification settings - Fork 5
/
UniswapFactory_matt.sol
34 lines (27 loc) · 1.36 KB
/
UniswapFactory_matt.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pragma solidity =0.7.6;
import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import './UserPosition.sol';
import './ISuperToken.sol';
import './IUniswapV2Router02.sol';
contract UniswapFactory {
INonfungiblePositionManager public immutable nonfungiblePositionManager;
ISwapRouter public immutable iSwapRouter;
IUniswapV2Router02 public immutable iUniswapV2Router02;
// Not sure if we will need this:
mapping(address => UserPosition) positions;
constructor(INonfungiblePositionManager _nonfungiblePositionManager, ISwapRouter _iSwapRouter, IUniswapV2Router02 _iUniswapV2Router02) {
nonfungiblePositionManager = _nonfungiblePositionManager;
iSwapRouter = _iSwapRouter;
iUniswapV2Router02 = _iUniswapV2Router02;
}
function createUserPositionContract(ISuperToken acceptedToken, address userAddress) external returns (address) {
UserPosition pos = new UserPosition(nonfungiblePositionManager, acceptedToken, userAddress, iSwapRouter, iUniswapV2Router02);
positions[userAddress] = pos;
return address(pos);
}
function callPositionContract(address userAddress) external {
// Take the address and call the respective position contracts function
positions[userAddress].updatePosition();
}
}