-
Notifications
You must be signed in to change notification settings - Fork 1
/
SwingTraderManagerExtension.sol
32 lines (26 loc) · 1.21 KB
/
SwingTraderManagerExtension.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "../interfaces/ISwingTrader.sol";
/// @title Swing Trader Manager Extension
/// @author 0xScotch <scotch@malt.money>
/// @notice An abstract contract inherited by all contracts that need access to the SwingTrader
/// @dev This helps reduce boilerplate across the codebase declaring all the other contracts in the pool
abstract contract SwingTraderManagerExtension {
ISwingTrader public swingTraderManager;
event SetSwingTraderManager(address swingTraderManager);
/// @notice Method for setting the address of the swingTraderManager
/// @param _swingTraderManager The contract address of the SwingTraderManager instance
/// @dev Only callable via the PoolUpdater contract
function setSwingTraderManager(address _swingTraderManager) external {
_accessControl();
require(_swingTraderManager != address(0), "Cannot use addr(0)");
_beforeSetSwingTraderManager(_swingTraderManager);
swingTraderManager = ISwingTrader(_swingTraderManager);
emit SetSwingTraderManager(_swingTraderManager);
}
function _beforeSetSwingTraderManager(address _swingTraderManager)
internal
virtual
{}
function _accessControl() internal virtual;
}