-
Notifications
You must be signed in to change notification settings - Fork 13
/
LeverageMacroReference.sol
57 lines (49 loc) · 1.76 KB
/
LeverageMacroReference.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
51
52
53
54
55
56
57
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {LeverageMacroBase} from "./LeverageMacroBase.sol";
/**
* @title Reference implementation of LeverageMacro
* @notice Deploy a copy of this via `LeverageMacroFactory` to use it for yourself
* @dev You can deploy a copy of this via a clone or similar to save users gas
*/
contract LeverageMacroReference is LeverageMacroBase {
address internal immutable theOwner;
// Leverage Macro should receive a request and set that data
// Then perform the request
constructor(
address _borrowerOperationsAddress,
address _activePool,
address _cdpManager,
address _ebtc,
address _coll,
address _sortedCdps,
address _owner
)
LeverageMacroBase(
_borrowerOperationsAddress,
_activePool,
_cdpManager,
_ebtc,
_coll,
_sortedCdps,
true // Sweep to caller since this is not supposed to hold funds
)
{
theOwner = _owner;
// set allowance for flashloan lender/CDP open
ebtcToken.approve(_borrowerOperationsAddress, type(uint256).max);
stETH.approve(_borrowerOperationsAddress, type(uint256).max);
stETH.approve(_activePool, type(uint256).max);
}
function owner() public override returns (address) {
return theOwner;
}
/// @notice use this if you broke the approvals
/// @dev diamond wallets can re-approve separately
function resetApprovals() external {
_assertOwner();
ebtcToken.approve(address(borrowerOperations), type(uint256).max);
stETH.approve(address(borrowerOperations), type(uint256).max);
stETH.approve(address(activePool), type(uint256).max);
}
}