ComplianceFacet
Facet for managing compliance conditions and transfer validation
Diamond facet providing embedded compliance functionality
Functions
addComplianceCondition
Add a compliance condition to the asset
function addComplianceCondition(address condition, string memory conditionName) external;
Parameters
condition
address
The address of the condition contract
conditionName
string
The name of the condition for lookup
removeComplianceCondition
Remove a compliance condition from the asset
function removeComplianceCondition(address condition, string memory conditionName) external;
Parameters
condition
address
The address of the condition contract
conditionName
string
The name of the condition
addLotCondition
Add a condition to a specific lot
function addLotCondition(uint256 customLotId, address condition) external;
Parameters
customLotId
uint256
The custom lot ID
condition
address
The address of the condition
removeLotCondition
Remove a condition from a specific lot
function removeLotCondition(uint256 customLotId, address condition) external;
Parameters
customLotId
uint256
The custom lot ID
condition
address
The address of the condition
getAllComplianceConditions
Get all global compliance conditions
function getAllComplianceConditions() external view returns (address[] memory);
Returns
<none>
address[]
Array of condition addresses
getLotConditions
Get conditions for a specific lot
function getLotConditions(uint256 customLotId) external view returns (address[] memory);
Parameters
customLotId
uint256
The custom lot ID
Returns
<none>
address[]
Array of condition addresses
getConditionByName
Get condition address by name
function getConditionByName(string memory conditionName) external view returns (address);
Parameters
conditionName
string
The name of the condition
Returns
<none>
address
The condition address
setOrUpdateCustomLotId
Set or update custom lot ID for a hash-based lot
function setOrUpdateCustomLotId(bytes32 hashLotId, uint256 desiredId) external returns (uint256);
Parameters
hashLotId
bytes32
The hash-based lot ID
desiredId
uint256
The desired custom ID (0 for auto-increment)
Returns
<none>
uint256
The actual custom ID assigned
getCustomLotId
Get custom lot ID for a hash-based lot
function getCustomLotId(bytes32 hashLotId) external view returns (uint256);
Parameters
hashLotId
bytes32
The hash-based lot ID
Returns
<none>
uint256
The custom lot ID (0 if not set)
getHashLotId
Get hash lot ID from custom ID
function getHashLotId(uint256 customId) external view returns (bytes32);
Parameters
customId
uint256
The custom lot ID
Returns
<none>
bytes32
The hash-based lot ID
validateTransfer
Validate if a transfer is compliant
function validateTransfer(address from, address to, bytes32 hashLotId, uint256 quantity) external view returns (bool);
Parameters
from
address
The sender address
to
address
The recipient address
hashLotId
bytes32
The hash-based lot ID
quantity
uint256
The quantity being transferred
Returns
<none>
bool
True if transfer is compliant
processTransfer
Process a transfer through compliance conditions
function processTransfer(address from, address to, bytes32 hashLotId, uint256 quantity) external;
Parameters
from
address
The sender address
to
address
The recipient address
hashLotId
bytes32
The hash-based lot ID
quantity
uint256
The quantity being transferred
processIssuance
Process an issuance through compliance conditions
function processIssuance(address to, bytes32 hashLotId, uint256 quantity, bytes memory data) external;
Parameters
to
address
The recipient address
hashLotId
bytes32
The hash-based lot ID
quantity
uint256
The quantity being issued
data
bytes
Additional data for the issuance
processRedemption
Process a redemption through compliance conditions
function processRedemption(address from, bytes32 hashLotId, uint256 quantity) external;
Parameters
from
address
The sender address
hashLotId
bytes32
The hash-based lot ID
quantity
uint256
The quantity being redeemed
notifyLotAdjusted
Notify conditions about lot adjustment
function notifyLotAdjusted(bytes32 oldLotId, bytes32 newLotId) external;
Parameters
oldLotId
bytes32
The old hash-based lot ID
newLotId
bytes32
The new hash-based lot ID
freezeAccount
Freeze an account, preventing transfers from this account
function freezeAccount(address account) external;
Parameters
account
address
The address to freeze
unfreezeAccount
Unfreeze a previously frozen account
function unfreezeAccount(address account) external;
Parameters
account
address
The address to unfreeze
freezeLot
Freeze a specific lot, preventing transfers
function freezeLot(bytes32 lotId) external;
Parameters
lotId
bytes32
The ID of the lot to freeze
unfreezeLot
Unfreeze a previously frozen lot
function unfreezeLot(bytes32 lotId) external;
Parameters
lotId
bytes32
The ID of the lot to unfreeze
isAccountFrozen
Check if an account is frozen
function isAccountFrozen(address account) external view returns (bool);
Parameters
account
address
The address to check
Returns
<none>
bool
True if the account is frozen
isLotFrozen
Check if a lot is frozen
function isLotFrozen(bytes32 lotId) external view returns (bool);
Parameters
lotId
bytes32
The lot ID to check
Returns
<none>
bool
True if the lot is frozen
getComplianceStatus
Get compliance status for an account
function getComplianceStatus(address account)
external
view
returns (bool frozenAccount, uint256 lotCount, uint256 totalBalance);
Parameters
account
address
The account to check
Returns
frozenAccount
bool
Whether the account is frozen
lotCount
uint256
Number of lots owned
totalBalance
uint256
Total balance across all lots
batchFreezeAccounts
Batch freeze multiple accounts
function batchFreezeAccounts(address[] calldata accounts) external;
Parameters
accounts
address[]
Array of addresses to freeze
batchUnfreezeAccounts
Batch unfreeze multiple accounts
function batchUnfreezeAccounts(address[] calldata accounts) external;
Parameters
accounts
address[]
Array of addresses to unfreeze
batchFreezeLots
Batch freeze multiple lots
function batchFreezeLots(bytes32[] calldata lotIds) external;
Parameters
lotIds
bytes32[]
Array of lot IDs to freeze
batchUnfreezeLots
Batch unfreeze multiple lots
function batchUnfreezeLots(bytes32[] calldata lotIds) external;
Parameters
lotIds
bytes32[]
Array of lot IDs to unfreeze
Events
ComplianceConditionAdded
event ComplianceConditionAdded(address indexed condition, string name);
ComplianceConditionRemoved
event ComplianceConditionRemoved(address indexed condition, string name);
LotConditionAdded
event LotConditionAdded(uint256 indexed customLotId, address indexed condition);
LotConditionRemoved
event LotConditionRemoved(uint256 indexed customLotId, address indexed condition);
CustomLotIdSet
event CustomLotIdSet(bytes32 indexed hashLotId, uint256 customId);
CustomLotIdUpdated
event CustomLotIdUpdated(bytes32 indexed hashLotId, uint256 oldCustomId, uint256 newCustomId);
AccountFrozen
event AccountFrozen(address indexed account, bool frozen);
LotFrozen
event LotFrozen(bytes32 indexed lotId, bool frozen);
Errors
Compliance_InvalidCondition
error Compliance_InvalidCondition();
Compliance_ConditionAlreadyRegistered
error Compliance_ConditionAlreadyRegistered();
Compliance_ConditionNotRegistered
error Compliance_ConditionNotRegistered();
Compliance_MaxConditionsReached
error Compliance_MaxConditionsReached();
Compliance_InvalidLotId
error Compliance_InvalidLotId();
Compliance_CustomLotIdAlreadySet
error Compliance_CustomLotIdAlreadySet();
Compliance_CustomLotIdNotSet
error Compliance_CustomLotIdNotSet();
Compliance_CustomLotIdInUse
error Compliance_CustomLotIdInUse();
Compliance_TransferNotAllowed
error Compliance_TransferNotAllowed();
Last updated
Was this helpful?