I am thinking of easy account security

If there is FreezeToken in the wallet, freeze the wallet.
And if there is ThawToken in the wallet, it cancels the freeze.
This code is an example of failure.

let FreezeToken = base58'GwmXnsF3Z5tANgHwmDW7Lf4SwyYNEp4S3QZM3aBFLHwS'
let ThawToken = base58'GK7ZV8xFbh1Qz14Cnr6mLkV93svaZGrurVuaBZocwLZZ'
    match tx {
         case m : TransferTransaction =>
             if (assetBalance(e.sender,ThawToken) >= 1 ) then{true}
             else if (assetBalance(e.sender,ThawToken) >= 1 ) then{false}
             else true
         case _ => false
    }

How do I change this code? please tell me.

I’m sorry. This I want to know the code to be executed in the ExchangeTransaction.