The WhitelistToken.sol
example contract inherits from SimpleRestrictedToken.sol
and Whitelist.sol
. SimpleRestrictedToken.sol
provides a basic ERC1404 implementation and standard ERC20 functionality. OpenZeppelin's Whitelist.sol
provides a simplification of user permissions and the onlyOwner
modifier.
For control over counterparty permissions, the issuer is able to update addresses included in the whitelist. This is achieved by overloading SimpleRestrictedToken.sol
's detectTransferRestriction
and messageForTransferRestriction
functions to accomodate the whitelist restriction. In detectTransferRestriction
, the whitelisted status of the sender/recipient is checked and a restriction code is returned if either counterparty is not whitelisted. Accordingly, messageForTransferRestriction
is modified to return the appropriate error message, given the aforementioned code.
Commented at the bottom of the contract are some relevant inherited functions. Of particular interest to issuers are addAddressToWhitelist
, removeAddressFromWhitelist
, and transferOwnership
. It is with these functions primarliy, that the issuer will update their token's trading permissions.