-
Notifications
You must be signed in to change notification settings - Fork 14
/
UniV3RelayerFactory.sol
50 lines (37 loc) · 1.58 KB
/
UniV3RelayerFactory.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.19;
import {IUniV3RelayerFactory} from '@interfaces/factories/IUniV3RelayerFactory.sol';
import {IBaseOracle} from '@interfaces/oracles/IBaseOracle.sol';
import {UniV3RelayerChild} from '@contracts/factories/UniV3RelayerChild.sol';
import {Authorizable} from '@contracts/utils/Authorizable.sol';
import {EnumerableSet} from '@openzeppelin/utils/structs/EnumerableSet.sol';
/**
* @title UniV3RelayerFactory
* @notice This contract is used to deploy UniV3Relayer contracts
* @dev The deployed contracts are UniV3RelayerChild instances
*/
contract UniV3RelayerFactory is Authorizable, IUniV3RelayerFactory {
using EnumerableSet for EnumerableSet.AddressSet;
// --- Data ---
/// @notice The enumerable set of deployed UniV3Relayer contracts
EnumerableSet.AddressSet internal _uniV3Relayers;
// --- Init ---
constructor() Authorizable(msg.sender) {}
// --- Methods ---
/// @inheritdoc IUniV3RelayerFactory
function deployUniV3Relayer(
address _baseToken,
address _quoteToken,
uint24 _feeTier,
uint32 _quotePeriod
) external isAuthorized returns (IBaseOracle _uniV3Relayer) {
_uniV3Relayer = new UniV3RelayerChild(_baseToken, _quoteToken, _feeTier, _quotePeriod);
_uniV3Relayers.add(address(_uniV3Relayer));
emit NewUniV3Relayer(address(_uniV3Relayer), _baseToken, _quoteToken, _feeTier, _quotePeriod);
}
// --- Views ---
/// @inheritdoc IUniV3RelayerFactory
function uniV3RelayersList() external view returns (address[] memory _uniV3RelayersList) {
return _uniV3Relayers.values();
}
}