I'm exploring a design for a token contract where the 'user' can be a non-zkApp or a zkApp account. That means i want to design an approval method that will take e.g. two account updates and approve them as long as they cancel each other out (no minting or burning)
Here's what i'm thinking of:
Mina.transaction(..., () => {
const fromAccountUpdate = AccountUpdate.create();
fromAccountUpdate.balance.subInPlace(amount);
fromAccountUpdate.requireSignature();
// zkAppTokenHolder.balance.addInPlace(amount), but with a proof
zkAppTokenHolder.deposit(amount);
const toAccountUpdate = zkAppTokenHolder.self;
Token.approveAccountUpdates(fromAccountUpdate, toAccountUpdate);
});
My question is: will the fromAccountUpdate fail, if the from account is a non-zkApp account , therefore has permisssions.send = signature, and a signature for that account update is missing (.requireSignature() is omitted?)
Reasoning behind this is that the 'fromAccountUpdate' can be issued with a signature, or a proof in case the user is a zkApp, assuming permissions.send = proof.
I am unsure if the Token owner approval of a ill-authorized fromAccountUpdate will override the signature permission or not, i hope not 😄