-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathIERC3643Compliance.sol
More file actions
86 lines (75 loc) · 3.78 KB
/
Copy pathIERC3643Compliance.sol
File metadata and controls
86 lines (75 loc) · 3.78 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
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
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;
/* ==== CMTAT === */
import {IERC3643ComplianceRead, IERC3643IComplianceContract} from "CMTAT/interfaces/tokenization/IERC3643Partial.sol";
interface IERC3643Compliance is IERC3643ComplianceRead, IERC3643IComplianceContract {
/* ============ Events ============ */
/**
* @notice Emitted when a token is successfully bound to the compliance contract.
* @param token The address of the token that was bound.
*/
event TokenBound(address token);
/**
* @notice Emitted when a token is successfully unbound from the compliance contract.
* @param token The address of the token that was unbound.
*/
event TokenUnbound(address token);
/* ============ Functions ============ */
/**
* @notice Associates a token contract with this compliance contract.
* @dev The compliance contract may restrict operations on the bound token
* according to the compliance logic.
* Security note: a "multi-tenant" setup means multiple token contracts
* share one RuleEngine instance (all are bound via {bindToken}).
* In that setup, all bound tokens must be equally trusted and governed together.
* ERC-3643 callbacks do not carry the token address to rules, so stateful
* rules with per-address accounting are unsafe across mutually untrusted tokens.
* Reverts if the token is already bound.
* Complexity: O(1).
* @param token The address of the token to bind.
*/
function bindToken(address token) external;
/**
* @notice Removes the association of a token contract from this compliance contract.
* @dev Security note: unbinding does not retroactively isolate rule state from
* previously shared multi-token operation. "Multi-tenant" means one RuleEngine
* shared by multiple token contracts. Avoid multi-tenant binding unless
* all tokens are equally trusted and governed together.
* Reverts if the token is not currently bound.
* Complexity: O(1).
* @param token The address of the token to unbind.
*/
function unbindToken(address token) external;
/**
* @notice Checks whether a token is currently bound to this compliance contract.
* @dev
* Complexity: O(1).
* Note that there are no guarantees on the ordering of values inside the array,
* and it may change when more values are added or removed.
* @param token The token address to verify.
* @return isBound True if the token is bound, false otherwise.
*/
function isTokenBound(address token) external view returns (bool isBound);
/**
* @notice Returns the single token currently bound to this compliance contract.
* @dev If multiple tokens are supported, consider using getTokenBounds().
* @return token The address of the currently bound token.
*/
function getTokenBound() external view returns (address token);
/**
* @notice Updates the compliance contract state when tokens are created (minted).
* @dev Called by the token contract when new tokens are issued to an account.
* Reverts if the minting does not comply with the rules.
* @param to The address receiving the minted tokens.
* @param value The number of tokens created.
*/
function created(address to, uint256 value) external;
/**
* @notice Updates the compliance contract state when tokens are destroyed (burned).
* @dev Called by the token contract when tokens are redeemed or burned.
* Reverts if the burning does not comply with the rules.
* @param from The address whose tokens are being destroyed.
* @param value The number of tokens destroyed.
*/
function destroyed(address from, uint256 value) external;
}