Max Balance Limits Module
Aimed at regulating the concentration of token ownership, this module enables the setting of maximum token balances that an investor can hold. Unlike other balance restrictions that might apply at the wallet level, this module enforces the limit at the identity level, ensuring that an investor cannot circumvent the rule by distributing tokens across multiple wallets. This feature is particularly useful for maintaining a broad distribution of token ownership or complying with regulatory caps on investment amounts.
How Does It Work?
- Compliance contracts set the maximum balance limits that will apply to investors.
- There are balance counters for each investor, and the investor's counter value is updated after mint, burn and transfer transactions.
- If a token that is already in use (with totalSupply > 0) is to be bound to this module, the balances of existing investors must be preset (with the preSetModuleState or batchPreSetModuleState functions).
- The mint/transfer transaction is blocked if the investor's counter value exceeds the limit.
Events
ComplianceBound
This event is emitted when the compliance contract is bound to the module
the event is emitted by 'bindCompliance'
_compliance
is the address of the compliance contract being bound
event ComplianceBound(
address indexed _compliance
);
ComplianceUnbound
This event is emitted when the compliance contract is unbound from the module
the event is emitted by 'unbindCompliance'
_compliance
is the address of the compliance contract being unbound
event ComplianceUnbound(
address indexed _compliance
);
MaxBalanceSet
This event is emitted when the max balance has been set for a compliance bound
the event is emitted by 'setMaxBalance'
_compliance
is the compliance contract address
_maxBalance
is the max amount of tokens that a user can hold
event MaxBalanceSet(
address indexed _compliance,
uint256 indexed _maxBalance
);
IDBalancePreSet
This event is emitted when the token holder's balance is preset per ONCHAINID
the event is emitted by 'preSetModuleState' and 'batchPreSetModuleState'
_compliance
is the compliance contract address
_id
is the ONCHAINID address of the token holder
_balance
is the current balance of the token holder
event IDBalancePreSet(
address indexed _compliance,
address indexed _id,
uint256 _balance
);
Functions
bindCompliance
Binds the module to a compliance contract. Once the module is bound, the compliance contract can interact with the module.
parameter 1: _compliance
the address of the compliance contract
emits a ComplianceBound
event
This function can be called ONLY by the compliance contract itself (_compliance), through the addModule function, which calls bindCompliance the module cannot be already bound to the compliance.
function bindCompliance(
address _compliance
) external;
unbindCompliance
Unbinds the module from a compliance contract. Once the module is unbound, the compliance contract cannot interact with the module anymore.
parameter 1: _compliance
the address of the compliance contract.
emits a ComplianceUnbound
event
This function can be called ONLY by the compliance contract itself (_compliance), removeModule function, which calls unbindCompliance.
function unbindCompliance(
address _compliance
) external;
isComplianceBound
Getter for compliance binding status on module
parameter 1: _compliance
the address of the compliance contract.
returns TRUE if the compliance is bound to the module, FALSE otherwise
function isComplianceBound(
address _compliance
) external view returns (bool);
setMaxBalance
Sets the max balance limit for a bound compliance contract
This function can only be called by a compliance smart contract
parameter 1: _max
The max amount of tokens owned by an individual
emits a MaxBalanceSet
event
This function can be called ONLY by the compliance contract itself (_compliance)
function setMaxBalance(
uint256 _max
) external;
getIDBalance
Function for getting compliance identity balance
parameter 1: compliance
the compliance smart contract address
parameter 2: _identity
the ONCHAINID address
Returns the balance of the given ID
function getIDBalance(
address compliance,
address _identity
) external view returns (uint256);
preSetModuleState
Pre-sets the balance of a token holder per ONCHAINID
parameter 1: compliance
the compliance smart contract address
parameter 2: _id
the ONCHAINID address of the token holder
parameter 3: _balance
the current balance of the token holder
emits a IDBalancePreSet
event
This function can be called ONLY by the compliance contract itself (_compliance)
function preSetModuleState(
address _compliance,
address _id,
uint256 _balance
) public;
batchPreSetModuleState
Makes a batch transaction calling preSetModuleState multiple times
parameter 1: compliance
the compliance smart contract address
parameter 2: _id
the ONCHAINID addresses of the token holders
parameter 3: _balance
the current balances of the token holders
emits a IDBalancePreSet
event
This function can be called ONLY by the compliance contract itself (_compliance)
function batchPreSetModuleState(
address _compliance,
address[] calldata _id,
uint256[] calldata _balance
) external;
moduleCheck
The compliance check on the module for a specific transaction on a specific compliance contract. This function is used to check if the transfer is allowed by the module.
parameter 1: _from
the address of the transfer sender
parameter 2: _to
the address of the transfer receiver
parameter 3: _value
the amount of tokens sent
parameter 4: _compliance
the address of the compliance contract concerned by the transfer action
Returns TRUE if the module allows the transfer, FALSE otherwise
function moduleCheck(
address _from,
address _to,
uint256 _value,
address _compliance
) external view;
moduleTransferAction
The action performed on the module during a transfer action. It increases the transfer counters.
parameter 1: _from
the address of the transfer sender
parameter 2: _to
the address of the transfer receiver
parameter 3: _value
the amount of tokens sent
This function can be called only on a compliance contract that is bound to the module
function moduleTransferAction(
address _from,
address _to,
uint256 _value
) external;
moduleMintAction
The action performed on the module during a mint action. This function is used to update variables of the module upon minting if it is required.
parameter 1: _to
the address used for minting
parameter 2: _value
the amount of tokens minted
This function can be called only on a compliance contract that is bound to the module
function moduleMintAction(
address _to,
uint256 _value
) external;
moduleBurnAction
The action performed on the module during a burn action. This function is used to update variables of the module upon burning if it is required.
parameter 1: _from
the address on which tokens are burnt
parameter 2: _value
the amount of tokens burnt
This function can be called only on a compliance contract that is bound to the module
function moduleBurnAction(
address _from,
uint256 _value
) external;
upgradeTo (UUPS)
Upgrade the implementation of the proxy to newImplementation
parameter 1: newImplementation
the address of the new implementation contract.
This function can only be called by the proxy contract.
function upgradeTo(address newImplementation) public;
Updated 4 months ago