@@ -1209,3 +1209,138 @@ async fn confidential_mint_burn_with_option(option: ConfidentialTransferOption)
1209
1209
0 ,
1210
1210
) ;
1211
1211
}
1212
+
1213
+ #[ tokio:: test]
1214
+ async fn pause_confidential_mint_burn ( ) {
1215
+ let pausable_authority = Keypair :: new ( ) ;
1216
+
1217
+ let confidential_transfer_authority = Keypair :: new ( ) ;
1218
+ let auto_approve_new_accounts = true ;
1219
+ let auditor_elgamal_keypair = ElGamalKeypair :: new_rand ( ) ;
1220
+ let auditor_elgamal_pubkey = ( * auditor_elgamal_keypair. pubkey ( ) ) . into ( ) ;
1221
+
1222
+ let supply_elgamal_keypair = ElGamalKeypair :: new_rand ( ) ;
1223
+ let supply_elgamal_pubkey = ( * supply_elgamal_keypair. pubkey ( ) ) . into ( ) ;
1224
+ let supply_aes_key = AeKey :: new_rand ( ) ;
1225
+ let decryptable_supply = supply_aes_key. encrypt ( 0 ) . into ( ) ;
1226
+
1227
+ let mut context = TestContext :: new ( ) . await ;
1228
+ context
1229
+ . init_token_with_mint ( vec ! [
1230
+ ExtensionInitializationParams :: ConfidentialTransferMint {
1231
+ authority: Some ( confidential_transfer_authority. pubkey( ) ) ,
1232
+ auto_approve_new_accounts,
1233
+ auditor_elgamal_pubkey: Some ( auditor_elgamal_pubkey) ,
1234
+ } ,
1235
+ ExtensionInitializationParams :: ConfidentialMintBurn {
1236
+ supply_elgamal_pubkey,
1237
+ decryptable_supply,
1238
+ } ,
1239
+ ExtensionInitializationParams :: PausableConfig {
1240
+ authority: pausable_authority. pubkey( ) ,
1241
+ } ,
1242
+ ] )
1243
+ . await
1244
+ . unwrap ( ) ;
1245
+
1246
+ let TokenContext {
1247
+ token,
1248
+ mint_authority,
1249
+ alice,
1250
+ ..
1251
+ } = context. token_context . unwrap ( ) ;
1252
+
1253
+ let alice_meta = ConfidentialTokenAccountMeta :: new ( & token, & alice) . await ;
1254
+
1255
+ // add some token in advance to try burning later
1256
+ token
1257
+ . confidential_transfer_mint (
1258
+ & mint_authority. pubkey ( ) ,
1259
+ & alice_meta. token_account ,
1260
+ None ,
1261
+ None ,
1262
+ None ,
1263
+ 120 ,
1264
+ & supply_elgamal_keypair,
1265
+ alice_meta. elgamal_keypair . pubkey ( ) ,
1266
+ Some ( auditor_elgamal_keypair. pubkey ( ) ) ,
1267
+ & supply_aes_key,
1268
+ None ,
1269
+ & [ & mint_authority] ,
1270
+ )
1271
+ . await
1272
+ . unwrap ( ) ;
1273
+
1274
+ token
1275
+ . confidential_transfer_apply_pending_balance (
1276
+ & alice_meta. token_account ,
1277
+ & alice. pubkey ( ) ,
1278
+ None ,
1279
+ alice_meta. elgamal_keypair . secret ( ) ,
1280
+ & alice_meta. aes_key ,
1281
+ & [ & alice] ,
1282
+ )
1283
+ . await
1284
+ . unwrap ( ) ;
1285
+
1286
+ token
1287
+ . pause ( & pausable_authority. pubkey ( ) , & [ & pausable_authority] )
1288
+ . await
1289
+ . unwrap ( ) ;
1290
+
1291
+ let error = token
1292
+ . confidential_transfer_mint (
1293
+ & mint_authority. pubkey ( ) ,
1294
+ & alice_meta. token_account ,
1295
+ None ,
1296
+ None ,
1297
+ None ,
1298
+ 10 ,
1299
+ & supply_elgamal_keypair,
1300
+ alice_meta. elgamal_keypair . pubkey ( ) ,
1301
+ Some ( auditor_elgamal_keypair. pubkey ( ) ) ,
1302
+ & supply_aes_key,
1303
+ None ,
1304
+ & [ & mint_authority] ,
1305
+ )
1306
+ . await
1307
+ . unwrap_err ( ) ;
1308
+
1309
+ assert_eq ! (
1310
+ error,
1311
+ TokenClientError :: Client ( Box :: new( TransportError :: TransactionError (
1312
+ TransactionError :: InstructionError (
1313
+ 0 ,
1314
+ InstructionError :: Custom ( TokenError :: MintPaused as u32 )
1315
+ )
1316
+ ) ) )
1317
+ ) ;
1318
+
1319
+ let error = token
1320
+ . confidential_transfer_burn (
1321
+ & alice. pubkey ( ) ,
1322
+ & alice_meta. token_account ,
1323
+ None ,
1324
+ None ,
1325
+ None ,
1326
+ 10 ,
1327
+ & alice_meta. elgamal_keypair ,
1328
+ supply_elgamal_keypair. pubkey ( ) ,
1329
+ Some ( auditor_elgamal_keypair. pubkey ( ) ) ,
1330
+ & alice_meta. aes_key ,
1331
+ None ,
1332
+ & [ & alice] ,
1333
+ )
1334
+ . await
1335
+ . unwrap_err ( ) ;
1336
+
1337
+ assert_eq ! (
1338
+ error,
1339
+ TokenClientError :: Client ( Box :: new( TransportError :: TransactionError (
1340
+ TransactionError :: InstructionError (
1341
+ 0 ,
1342
+ InstructionError :: Custom ( TokenError :: MintPaused as u32 )
1343
+ )
1344
+ ) ) )
1345
+ ) ;
1346
+ }
0 commit comments