-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLiquidatorStreamBasicVault.sol
55 lines (49 loc) · 2.19 KB
/
LiquidatorStreamBasicVault.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
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { InitializableToken } from "../../tokens/InitializableToken.sol";
import { VaultManagerRole } from "../../shared/VaultManagerRole.sol";
import { AbstractVault } from "../AbstractVault.sol";
import { LiquidatorAbstractVault } from "./LiquidatorAbstractVault.sol";
import { LiquidatorStreamAbstractVault } from "./LiquidatorStreamAbstractVault.sol";
/**
* @notice A simple implementation of the abstract liquidator vault that streams donated assets for testing purposes.
* Rewards are added to the vault by simply transferring them to the vault.
* @author mStable
* @dev VERSION: 1.0
* DATE: 2022-05-30
*/
contract LiquidatorStreamBasicVault is LiquidatorStreamAbstractVault, Initializable {
/**
* @param _nexus Address of the Nexus contract that resolves protocol modules and roles.
* @param _asset Address of the vault's asset.
* @param _streamDuration Number of seconds the increased asssets per share will be streamed after tokens are donated.
*/
constructor(
address _nexus,
address _asset,
uint256 _streamDuration
)
AbstractVault(_asset)
VaultManagerRole(_nexus)
LiquidatorStreamAbstractVault(_streamDuration)
{}
function initialize(
string calldata _nameArg,
string calldata _symbolArg,
address _vaultManager,
address[] memory _rewardTokens,
uint256 _assetToBurn
) external initializer {
// Set the vault's decimals to the same as the reference asset.
uint8 decimals = InitializableToken(address(_asset)).decimals();
InitializableToken._initialize(_nameArg, _symbolArg, decimals);
VaultManagerRole._initialize(_vaultManager);
LiquidatorAbstractVault._initialize(_rewardTokens);
AbstractVault._initialize(_assetToBurn);
}
function totalAssets() public view override returns (uint256 totalManagedAssets) {
totalManagedAssets = _asset.balanceOf(address(this));
}
}