Around $400 for a new engine, parts cost, that’s a very good deal. This is one of the advantages of buying a Corolla, excellent availability of frugally-priced parts from wrecks.
Whether that particular engine will work well after installed in your car, no idea. Most suggestions here on engine replacement is to secure a guarantee from the installer/& engine vendor that the engine actually works correctly, or they will replace it with one that does gratis. If it is from a wrecked Corolla and the wreck didn’t involve the engine, it will probably work fine. Do you know how many miles is on that engine?
I think @UncleTurbo 's estimate of 10 hours to remove and replace the engine is a good estimate provided the replacement engine has all the needed parts installed on it already. In other words the engine install is a turn-key operation. If the shop has to move parts from your current engine to the replacement, then diagnose why they don’t work, add as much as 4-6 hours. If you have AC, add another hour to that.
In my part of the USA hourly cost is around $100 per hour, so you’d be looking at maybe $1500 labor plus $400 for the engine, around $1900. That’s a pretty good deal if the engine works. I don’t think there will be a guarantee at that price though. That’s the gambling man’s price.