This contract is used by the ATR Module and is responsible for managing a whitelist of assets which are permitted to have their transfer rights tokenized.
canBeTokenized
Overview
A getter function to see if a certain asset or asset collection is whitelisted to be tokenised. The function returns a boolean.
This function takes one argument supplied by the caller:
address
assetAddress
- Address of the asset or asset collection to check
Implementation
Copy function canBeTokenized(address assetAddress) external view returns (bool) {
if (!useWhitelist)
return true;
return isWhitelisted[assetAddress];
}
setUseWhitelist
Overview
A setter function to turn the whitelist on and off. It can be called only by the owner.
This function takes one argument supplied by the owner:
bool
_useWhitelist
- A boolean to update the useWhitelist
flag
Implementation
Copy function setUseWhitelist(bool _useWhitelist) external onlyOwner {
useWhitelist = _useWhitelist;
}
setIsWhitelisted
Overview
A setter function to add or remove an address from the whitelist. It can be called only by the owner.
This function takes two arguments supplied by the owner:
address
assetAddress
- Address of the asset being modified
bool
_isWhitelisted
- Boolean determining the addition or removal from the whitelist
Implementation
Copy function setIsWhitelisted(
address assetAddress,
bool _isWhitelisted
) public onlyOwner {
isWhitelisted[assetAddress] = _isWhitelisted;
}
setIsWhitelistedBatch
Overview
A setter function to add or remove multiple addresses from the whitelist. It can be called only by the owner.
This function takes two arguments supplied by the caller:
address[] calldata
assetAddresses
- Array of addresses being modified
bool
_isWhitelisted
- Boolean determining the addition or removal from the whitelist
Implementation
Copy function setIsWhitelistedBatch(
address[] calldata assetAddresses,
bool _isWhitelisted
) external onlyWhitelistManager {
uint256 length = assetAddresses.length;
for (uint256 i; i < length; ) {
setIsWhitelisted(assetAddresses[i], _isWhitelisted);
unchecked {
++i;
}
}
}
setIsWhitelistedLib
Overview
A setter function to add or remove a library address from the whitelist. It can be called only by the owner.
This function takes two arguments supplied by the owner:
address
libAddress
- Address of the library being modified
bool
_isWhitelisted
- Boolean determining the addition or removal from the whitelist
Implementation
Copy function setIsWhitelistedLib(address libAddress, bool _isWhitelisted) public onlyOwner {
isWhitelistedLib[libAddress] = _isWhitelisted;
}
The Whitelist contract defines one event and no custom errors.
Copy event AssetWhitelisted(address indexed assetAddress, bool indexed isWhitelisted);
AssetWhitelisted
AssetWhitelisted event is emitted when an asset address is whitelisted or removed from the whitelist.
This event has two parameters:
address indexed
assetAddress
- Address of the whitelisted asset
bool
indexed
isWhitelisted
- True if the asset was whitelisted and false if the asset was removed from the whitelist