is that legal if I'm not a resident of the country?
Don't know exactly what the main residence requirements of the founders are to open a company in that country. As a reference, if you opened a branch company specifically serving local residents like Binance did, I think that would be fine. It is recommended that you contact your local law firm for an accurate answer.
For now, the Singapore government seems to be tightening the regulation of cryptocurrency sector companies more. Several large companies have been banned one by one. After binance, this time huobi got
a service shutdown warning.