We are working on a security token sale and are aware we may need to be able to "lock" our tokens, not from being transferred from person to person but from being listed on any exchanges decentralized or otherwise (the tokens will be RegA so will be able to be transferred to nonaccredited investors, however it can't be listed on an unregulated exchanges such as Etherdelta).

I am aware that StartEngine offers this code for their projects but we are not with them. Is anyone aware of how this lock can be implemented in our smart contracts or have any publicly available examples?

Thanks in advance.


You cannot generally block exchanges. Exchanges are just accounts like any other account of a person. However, you could blacklist individual addresses that you identified as exchanges. This could be done by making your token Ownable and then adding the following to your token

mapping(address => bool) blacklisted;

function changeBlacklist(address recipient, bool status) onlyOwner {
    blacklisted[recipient] = status;

modifier isNotBlacklisted(address recipient) {

You can then use that modifier in your transfer and transferFrom function. I'd just check against the recipient and not the origin of a token transfer to allow exchanges that have been added to the blacklist and already did have some tokens earlier, to transfer them out to the rightful owner and not lock tokens forever.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.