God explicitly states that a main factor for getting rid of the humans (except Noah) was because they were "too immoral" or something along those lines.
My point is that where is this code or law they were being held to by penalty of instant death (instead of gradual death, which is the documented punishment for sin).
Ah, I see , yes a good point you make there.
Well, according to the account, it wasn't a question of immorality, it was a question of them "running amok" doing all kinds of horrible violent stuff:
5 b The Lord saw that the wickedness of man was great in the earth, and that every c intention of the thoughts of his heart was only evil continually. 6 And d the Lord was sorry that he had made man on the earth, and it e grieved him to his heart. 7 So the Lord said, “I will blot out man whom I have created from the face of the land, man and animals and creeping things and birds of the heavens, for I am sorry that I have made them.”
11 Now the earth was corrupt in God’s sight, and the earth was filled with violence. 12 And God j saw the earth, and behold, it was corrupt, k for all flesh had corrupted their way on the earth. 13 And God said to Noah, l “I have determined to make an end of all flesh, 3 for the earth is filled with violence through them. Behold, I will destroy them with the earth.