-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVault.sol
29 lines (23 loc) · 882 Bytes
/
Vault.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IVault.sol";
import "@poolzfinance/poolz-helper-v2/contracts/ERC20Helper.sol";
contract Vault is IVault, ERC20Helper {
address public override tokenAddress;
address public override vaultManager;
constructor(address _tokenAddress){
tokenAddress = _tokenAddress;
vaultManager = msg.sender;
}
modifier onlyManager(){
require(msg.sender == vaultManager, "Vault: Only manager can call this function");
_;
}
function tokenBalance() public view override returns(uint) {
return IERC20(tokenAddress).balanceOf(address(this));
}
function withdraw(address to, uint _amount) external override onlyManager {
require(tokenBalance() >= _amount, "Vault: Not enough balance");
transferToken(IERC20(tokenAddress), to, _amount);
}
}