-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNestedReserve.sol
32 lines (28 loc) · 1.17 KB
/
NestedReserve.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
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./abstracts/OwnableFactoryHandler.sol";
/// @title Stores underlying assets of NestedNFTs.
/// @notice The factory itself can only trigger a transfer after verification that the user
/// holds funds present in this contract. Only the factory can withdraw/transfer assets.
contract NestedReserve is OwnableFactoryHandler {
using SafeERC20 for IERC20;
/// @notice Release funds to a recipient
/// @param _recipient The receiver
/// @param _token The token to transfer
/// @param _amount The amount to transfer
function transfer(
address _recipient,
IERC20 _token,
uint256 _amount
) external onlyFactory {
require(_recipient != address(0), "NRS: INVALID_ADDRESS");
_token.safeTransfer(_recipient, _amount);
}
/// @notice Release funds to the factory
/// @param _token The ERC20 to transfer
/// @param _amount The amount to transfer
function withdraw(IERC20 _token, uint256 _amount) external onlyFactory {
_token.safeTransfer(msg.sender, _amount);
}
}