@@ -205,7 +205,13 @@ pub contract Token {
205
205
206
206
#[public]
207
207
fn transfer_public_to_public (from : AztecAddress , to : AztecAddress , amount : U128 , nonce : Field ) {
208
- _validate_from_public (&mut context , from , nonce );
208
+ // _validate_from_public(from, nonce);
209
+ // TODO(#34): we cannot call `assert_current_call_valid_authwit_public` from library methods
210
+ if (!from .eq (context .msg_sender ())) {
211
+ assert_current_call_valid_authwit_public (&mut context , from );
212
+ } else {
213
+ assert (nonce == 0 , "invalid nonce" );
214
+ }
209
215
_decrease_public_balance (storage .public_balances , from , amount );
210
216
_increase_public_balance (storage .public_balances , to , amount );
211
217
}
@@ -220,7 +226,13 @@ pub contract Token {
220
226
hiding_point_slot : Field ,
221
227
nonce : Field ,
222
228
) {
223
- _validate_from_public (&mut context , from , nonce );
229
+ // _validate_from_public(from, nonce);
230
+ // TODO(#34): we cannot call `assert_current_call_valid_authwit_public` from library methods
231
+ if (!from .eq (context .msg_sender ())) {
232
+ assert_current_call_valid_authwit_public (&mut context , from );
233
+ } else {
234
+ assert (nonce == 0 , "invalid nonce" );
235
+ }
224
236
_finalize_transfer_public_to_private (
225
237
&mut context ,
226
238
storage .public_balances ,
@@ -356,7 +368,13 @@ pub contract Token {
356
368
357
369
#[public]
358
370
fn burn_public (from : AztecAddress , amount : U128 , nonce : Field ) {
359
- _validate_from_public (&mut context , from , nonce );
371
+ // _validate_from_public(from, nonce);
372
+ // TODO(#34): we cannot call `assert_current_call_valid_authwit_public` from library methods
373
+ if (!from .eq (context .msg_sender ())) {
374
+ assert_current_call_valid_authwit_public (&mut context , from );
375
+ } else {
376
+ assert (nonce == 0 , "invalid nonce" );
377
+ }
360
378
_decrease_public_balance (storage .public_balances , from , amount );
361
379
_decrease_total_supply (storage .total_supply , amount );
362
380
}
0 commit comments