Time Based Transfer Limits Module
This module limits the total volume of transfers an investor can execute within a customizable timeframe, focusing on peer-to-peer transactions rather than deposits to CEXs. It ensures that the overall volume of transfers remains within predefined limits, excluding transfers between an investor's own wallets to prevent self-transfer loopholes.
How Does It Work?
- Compliance contracts set the limits that will apply to investors.
- There can be a maximum of 4 different time intervals per compliance. Each limit contains the period of time (in seconds) and value (for example, 1000 tokens can be transferred monthly -2592000 seconds-).
- There are transfer counters for each investor and limit definition. When an investor transfers tokens to another investor, the total transferred amounts in the counters are updated.
- Investor counters are reset when their period ends.
- The 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
);
TimeTransferLimitUpdated
This event is emitted whenever a transfer limit is updated for the given compliance address and limit time
the event is emitted by 'setTimeTransferLimit'
compliance
is the compliance contract address
_limitValue
is the new limit value for the given limit time
_limitTime
is the time of the limit
event TimeTransferLimitUpdated(
address indexed compliance,
uint32 limitTime,
uint256 limitValue
);
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);
setTimeTransferLimit
Sets the limit of tokens allowed to be transferred in the given time frame
This function can only be called by a compliance smart contract
parameter 1: _limit
Limit time and value
emits a TimeTransferLimitUpdated
event
function setTimeTransferLimit(
Limit calldata _limit
) external;
getTimeTransferLimits
Function for getting transfer limits belongs to the compliance.
parameter 1: compliance
the compliance smart contract address
Returns the array of limits set for that compliance.
function getTimeTransferLimits(
address compliance
) external view returns (Limit[] memory);
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. This function is not implemented in this contract.
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. This function is not implemented in this contract.
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