I am currently working part-time as an independent contractor, software developer, in the United States for a startup my friend founded. I saw it mostly as helping a friend, so we never formalized the agreement (i.e. I have not signed any statement of work or otherwise agreements with the startup), however I am clearly paid with the startup's money.
Over the last few months the startup has been having troubles with one of the three founders, and long story short, my friend and one other founder are deciding to leave the company and create a competitor business on their own. The three current founders have equal equity and voting rights, so technically the two leaving could instead push out the third partner, but they are worried that partner would torpedo the company's reputation if they did so they would prefer to just quietly start fresh.
So on to the question, my friend would like to take the code I have written with them to their new company. I understand if I were an employee, all my work would inherently be the IP of the original company, however because I am a contractor - and notably have not signed any formal agreements to the current company, could we have any legal claim that I independently own my code and get to chose who I allow to use it?
One idea I had was, since I have not yet signed any agreement with the current company, we could enter into a licensing agreement that clearly indicates I own the code and they are simply licensing it from me. At which point the new company could also license my code from me. However I'm not sure if it's legal to enter such an agreement at this stage, given the intent is clearly to take the IP with them.
Another consideration I had was that since the two founders have majority voting, and could technically vote / sign whatever they wanted without the third founder's agreement, they could just make the decision before leaving to give me ownership of the code (e.g. "sell" it to me for $1). But here again I'm not sure if that's legal, given they would be clearly acting against the best interest of their current company and could probably be sued by external shareholders.
Are there any legal options we can take to move the IP I've developed to the new company? And would I be putting myself at legal risk by agreeing to any of this (e.g. if the founders decided f- it and to just take the code, is it illegal for me to keep working on it)?