Whitelist
CapyFi caTokens can be configured with an optional Whitelist contract that gates participation. When active, only whitelisted addresses can supply, borrow, or hold the caToken.
Introduction
When the Whitelist applies
The Whitelist is an upgradeable, per-caToken access control contract. Each caToken can store a Whitelist address via _setWhitelist on the cToken. While isActive() returns true, the cToken denies operations from non-whitelisted addresses.
If a caToken has no Whitelist set, or its Whitelist is deactivated, market access is fully permissionless.
Roles
AccessControl roles
DEFAULT_ADMIN_ROLE— controls upgrades and grants/revokes other roles.WHITELISTED_ROLE— granted to addresses permitted to use the gated market.
Interface
Selected methods
isWhitelisted(address)
function isWhitelisted(address account) view returns (bool)True if account holds WHITELISTED_ROLE.
isActive() / isWhitelistAccess()
function isActive() view returns (bool)function isWhitelistAccess() view returns (bool)Whether enforcement is currently on.
Activation controls
function activate()function deactivate()Admin-only. Toggles enforcement without changing the role assignments.
Role management
function grantRole(bytes32 role, address account)function revokeRole(bytes32 role, address account)function getRoleMember(bytes32 role, uint256 index) view returns (address)function getRoleMemberCount(bytes32 role) view returns (uint256)Upgradeability
function upgradeTo(address newImplementation)function upgradeToAndCall(address newImplementation, bytes data) payablefunction proxiableUUID() view returns (bytes32)Whitelist is deployed behind a UUPS proxy.
Events
Important events
event WhitelistActivated(address indexed admin)event WhitelistDeactivated(address indexed admin)event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)event WhitelistUpgraded(address indexed implementation)