contract SpecificAddressTransferController is TransferController, WhitelistedRole {

    // Only address in this mapping can be the sender
    mapping(address => bool) public _allowFromMapping;

    constructor() public {
        _addWhitelisted(msg.sender);
    }

    function addAllowedFrom(address from) external onlyWhitelisted {
        _allowFromMapping[from] = true;
    }

    function removeAllowedFrom(address from) external onlyWhitelisted {
        _allowFromMapping[from] = false;
    }

    /**
     * @dev Only allow transfers to and from allowed addresses
     * @param from address the ether address of sender
     * @param to address the ether address of receiver
     * @return 0 if successful, positive integer if error occurred
     */
    function check(
        address from,
        address to,
        address /*initiator*/,
        address /*tokenAddress*/,
        uint256 /*tokenAmount*/
    ) external virtual override view returns (uint256) {
        if (_allowFromMapping[from] == false && _allowFromMapping[to] == false) {
            return 500;
        }

        return 0;
    }
}
/**
 * @title SpecificAddressTransferController
 * @dev Allow transfer only to and from certain addresses
 */
function check(
    address from,
    address to,
    address /*initiator*/,
    address /*tokenAddress*/,
    uint256 /*tokenAmount*/
) external virtual override view returns (uint256) {
    if (_allowFromMapping[from] == false && _allowFromMapping[to] == false) {
        return 500;
    }

    return 0;
}

/**
 * @dev Only allow transfers to and from allowed addresses
 * @param from address the ether address of sender
 * @param to address the ether address of receiver
 * @return 0 if successful, positive integer if error occurred
 */