I wait to sell them throughout the chapter. If you sell them all at once, you get wayyyyyyy too much coins and supplies. Yet, just a month or so later (depending on your rate of play) you're struggling for those same materials. So ideally, selling Mines and Foundries as you run low is the way to go. But trying to fit all the old Mines and Foundries while building Fairy Portals and Day Farms is quite the challenge.