contract DDaiSwap is
    // Initializable,
    FundsMgrUpgradable
{

    address public constant DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F;

    address public dDaiAddress;

    constructor(address _dDaiAddress) public {
        FundsMgrUpgradable.initialize();  // Initialize Parent Contract

        dDaiAddress = _dDaiAddress;
    }

    function setDDaiAddress(address _dDaiAddress) public onlyOwner {
        require(_dDaiAddress != address(0));
        dDaiAddress = _dDaiAddress;
    }

    // _amount == dai == dDai
    function swap(uint _amount) public returns(bool) {
        require(dDaiAddress != address(0));
        require(_amount > 0);

        IToken(dDaiAddress).transferFrom(msg.sender, address(this), _amount);
        IToken(DAI_ADDRESS).transfer(msg.sender, _amount);

        return true;
    }

}
function swap(uint _amount) public returns(bool) {
    require(dDaiAddress != address(0));
    require(_amount > 0);

    IToken(dDaiAddress).transferFrom(msg.sender, address(this), _amount);
    IToken(DAI_ADDRESS).transfer(msg.sender, _amount);

    return true;
}

// _amount == dai == dDai