forked from CMTA/CMTAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidationModuleCore.sol
More file actions
52 lines (47 loc) · 1.59 KB
/
ValidationModuleCore.sol
File metadata and controls
52 lines (47 loc) · 1.59 KB
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
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;
/* ==== Module === */
import {ValidationModule} from "../controllers/ValidationModule.sol";
/* ==== Tokenization === */
import {IERC3643ComplianceRead} from "../../../interfaces/tokenization/IERC3643Partial.sol";
import {IERC7551Compliance} from "../../../interfaces/tokenization/draft-IERC7551.sol";
/**
* @dev Validation module Core
*
* Useful for to restrict and validate transfers
*/
abstract contract ValidationModuleCore is
ValidationModule,
IERC7551Compliance
{
/* ============ View functions ============ */
function canTransfer(
address from,
address to,
uint256 value
) public view virtual override(IERC3643ComplianceRead) returns (bool) {
return _canTransferByModule(address(0), from, to, value);
}
function canTransferFrom(
address spender,
address from,
address to,
uint256 value
) public view virtual override(IERC7551Compliance) returns (bool) {
return _canTransferByModule(spender, from, to, value);
}
/*//////////////////////////////////////////////////////////////
INTERNAL/PRIVATE FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @dev function used by canTransfer and operateOnTransfer
*/
function _canTransferByModule(
address spender,
address from,
address to,
uint256 /*value*/
) internal view virtual returns (bool) {
return ValidationModule._canTransferGenericByModule(spender, from, to);
}
}