I cant' really tell what all of that is under the soot.
So what you will want to do is carefully clean the connections (beofre disconnecting anything) and check for loose bolts/nuts that should be tightly holding them in place.
If there was a loose connection, it could have arced and caused exactly what you see.
If there was a connection that acutally came off and touched something esle, it could also do that.
In either of those cases, replacing the cable and connector lug, and then ensuring it's all properly fastened down would probably fix it. It is still psosible that the RF from the arcing could have blown semiconductors (FETs, etc) in the power path (BMS, controller), but the cables have to be replaced first if theyr'e damaged.
If that is the top of the controller itself, then it is also possible that the ocntroller FETs blew up inside it and failed shorted from battery positive to battery negative (rare, but...) whcih could also do waht you see. If that happened, then you'll need a new controller.
If you want it to do exactly the same things the same way you'll probably need the same kind, already programmed to work with the rest of the bike.