This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOCT_ZVL.sol
89 lines (59 loc) · 2.77 KB
/
OCT_ZVL.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import "../Utility/ZivoeSwapper.sol";
import "../../ZivoeLocker.sol";
import "../../../lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
interface IZivoeGlobals_OCT_ZVL {
/// @notice Returns the address of ZivoeToken ($ZVE) contract.
function ZVE() external view returns (address);
/// @notice Returns the address of Zivoe Laboratory.
function ZVL() external view returns (address);
}
/// @notice This contract escrows ZVE and enables ZVL to claim directly.
contract OCT_ZVL is ZivoeLocker, ZivoeSwapper, ReentrancyGuard {
using SafeERC20 for IERC20;
// ---------------------
// State Variables
// ---------------------
address public immutable GBL; /// @dev The ZivoeGlobals contract.
// -----------------
// Constructor
// -----------------
/// @notice Initializes the OCT_ZVL contract.
/// @param DAO The administrator of this contract (intended to be ZivoeDAO).
/// @param _GBL The ZivoeGlobals contract.
constructor(address DAO, address _GBL) {
transferOwnershipAndLock(DAO);
GBL = _GBL;
}
// ------------
// Events
// ------------
/// @notice Emitted during claim().
/// @param asset The "asset" being claimed.
/// @param amount The amount being claimed.
event Claimed(address indexed asset, uint256 amount);
// ---------------
// Functions
// ---------------
/// @notice Permission for owner to call pushToLocker().
function canPush() public override pure returns (bool) { return true; }
/// @notice Permission for owner to call pushToLockerMulti().
function canPushMulti() public override pure returns (bool) { return true; }
/// @notice Permission for owner to call pullFromLocker().
function canPull() public override pure returns (bool) { return true; }
/// @notice Permission for owner to call pullFromLockerMulti().
function canPullMulti() public override pure returns (bool) { return true; }
/// @notice Permission for owner to call pullFromLockerPartial().
function canPullPartial() public override pure returns (bool) { return true; }
/// @notice Permission for owner to call pullFromLockerMultiPartial().
function canPullMultiPartial() public override pure returns (bool) { return true; }
/// @notice Claims $ZVE.
function claim() external nonReentrant {
require(_msgSender() == IZivoeGlobals_OCT_ZVL(GBL).ZVL(), "_msgSender() != IZivoeGlobals_OCT_ZVL(GBL).ZVL()");
address ZVE = IZivoeGlobals_OCT_ZVL(GBL).ZVE();
uint256 amount = IERC20(ZVE).balanceOf(address(this));
IERC20(ZVE).safeTransfer(_msgSender(), amount);
emit Claimed(ZVE, amount);
}
}