The contract is not legally binding, because there is no mutual “consideration.” Consideration, here, means that each party is giving each other something for the contract. Without consideration, the supposed narc "contract" is nothing more than a signed statement that s/he is not a narc. It has no more weight than a similar statement made orally.
Additionally, since undercover police ARE allowed to lie about their narc status, the “contract” is meaningless. By the way, if you are thinking that the “consideration” was to buy drugs, then there’s no contract at any rate: committing a crime can never be “consideration” for a legal contract.
This sounds like an extension of the usual “Are you a cop?” issue, created by an imaginative officer with a sense of humor. The idea of bringing a “contract” to court to enforce a drug suspect’s right to avoid getting caught is comical to the point of absurdity. Think about it. This "contract" puts you in the position of trying to enforce a right to evade getting caught committing a crime. Unless you were coerced into buying drugs from the undercover officer, he did nothing wrong in telling you he was not a cop.