-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPool.sol
39 lines (31 loc) · 1 KB
/
Pool.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";
interface IManager {
function finalize(address) external;
}
contract Pool {
using SafeTransferLib for address;
address public vault;
address public manager;
address public client;
address public mainToken;
modifier onlyManager() virtual {
require(manager == msg.sender);
_;
}
constructor(address _vault, address _manager, address _client, address _mainToken) {
vault = _vault;
manager = _manager;
client = _client;
mainToken = _mainToken;
}
function withdrawFromPool(address otherToken, uint256 amount) external onlyManager {
otherToken.safeTransfer(address(vault), amount);
uint256 balance = mainToken.balanceOf(address(this));
if (balance > 0) {
mainToken.safeTransfer(address(vault), balance);
}
IManager(manager).finalize(client);
}
}