IFrictionlessModularCompliance

Git Source

Inherits: IModularCompliance

Author: DEFYCA Labs S.à.r.l

Copyright © 2023 DEFYCA Labs S.à.r.l Permission is hereby granted, free of charge, to any person obtaining a copy of the Frictionless protocol smart contracts (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DEFYCA LABS S.à.r.l BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The IFrictionlessModularCompliance is responsible for the compliant transfer of the various Tokens in the Frictionless protocol.

Functions

init

Initializes the modular compliance, sets the maximum allowable modules per token and adds the modules provided

function init(address[] calldata modules_, uint256 maxModulesCount_) external;

Parameters

Name
Type
Description

modules_

address[]

the array of module addresses to be added

maxModulesCount_

uint256

maximum number of allowable modules which can be bound. throws FrictionlessModularComplianceMaxModuleCountReached if the maximum amount of modules has been reached as per the maxModulesCount throws FrictionlessModularComplianceModuleIsAlreadyBound if the module is already bound throws FrictionlessIsZeroAddress if the module address is a zero address throws FrictionlessModularComplianceZeroMaxModulesCount if an attempt to set the maximum number of allowable modules to zero is made in updateMaxModulesCount emits ModulesAdded upon sucessful addition emits MaxModulesCountUpdated upon successful update of the maximum modules count.

updateMaxModulesCount

Set the maximum number of allowable modules which can be bound.

function updateMaxModulesCount(uint256 newMaxModulesCount_) external;

Parameters

Name
Type
Description

newMaxModulesCount_

uint256

maximum number of allowable modules which can be bound. throws FrictionlessModularComplianceZeroMaxModulesCount if an attempt to set the maximum number of allowable modules to zero is made in updateMaxModulesCount emits MaxModulesCountUpdated upon successful update of the maximum modules count.

addModules

Adds modules based on the array of module addresses provided

function addModules(address[] calldata modulesToAdd_) external;

Parameters

Name
Type
Description

modulesToAdd_

address[]

the array of module addresses to be added throws FrictionlessModularComplianceMaxModuleCountReached if the maximum amount of modules has been reached as per the maxModulesCount throws FrictionlessModularComplianceModuleIsAlreadyBound if the module is already bound throws FrictionlessIsZeroAddress if the module address is a zero address emits ModulesAdded upon sucessful addition

removeModules

Removes modules based on the array of module addresses provided

function removeModules(address[] calldata modulesToRemove_) external;

Parameters

Name
Type
Description

modulesToRemove_

address[]

the array of module addresses to be removed throws FrictionlessModularComplianceModuleDoesNotExist if module for the given address is not already bound emits ModulesRemoved upon sucessful removal

maxModulesCount

Returns the maximum number of allowable modules which can be bound.

function maxModulesCount() external view returns (uint256);

Returns

Name
Type
Description

<none>

uint256

maximum number of allowable modules which can be bound.

Events

MaxModulesCountUpdated

Emitted during updateMaxModulesCount to inform of new modules max count updates

event MaxModulesCountUpdated(uint256 newMaxModulesCount, uint256 oldMaxModulesCount);

ModulesAdded

Emitted during addModules to inform of new modules added

event ModulesAdded(address[] modules);

ModulesRemoved

Emitted during removeModules to inform of modules removed

event ModulesRemoved(address[] modules);

Errors

FrictionlessIsZeroAddress

thrown if specific address is zero.

error FrictionlessIsZeroAddress(string);

FrictionlessModularComplianceZeroMaxModulesCount

thrown if an attempt to set the maximum number of allowable modules to zero is made in updateMaxModulesCount

error FrictionlessModularComplianceZeroMaxModulesCount();

FrictionlessModularComplianceModuleIsAlreadyBound

thrown if an attempt to add an already existing module during addModules

error FrictionlessModularComplianceModuleIsAlreadyBound(address module);

FrictionlessModularComplianceModuleDoesNotExist

thrown if module for the given address is not already bound by the modifier onlyExistingModule

error FrictionlessModularComplianceModuleDoesNotExist(address module);

FrictionlessModularComplianceMaxModuleCountReached

thrown if an attempt to add more than the allowable modules during addModules

error FrictionlessModularComplianceMaxModuleCountReached();

FrictionlessModularComplianceCallerNotATokenOrOwner

thrown during bindToken or unBindToken if the caller is not the owner or the bound token address

error FrictionlessModularComplianceCallerNotATokenOrOwner(address caller);

FrictionlessModularComplianceCallerNotAToken

thrown if the the msg.sender is not the bound token address during modifier onlyToken

error FrictionlessModularComplianceCallerNotAToken(address caller);
Logo

Copyright © 2024 Frictionless Markets S.à.r.l