@@ -1209,3 +1209,137 @@ 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
+ token
1256
+ . confidential_transfer_mint (
1257
+ & mint_authority. pubkey ( ) ,
1258
+ & alice_meta. token_account ,
1259
+ None ,
1260
+ None ,
1261
+ None ,
1262
+ 120 ,
1263
+ & supply_elgamal_keypair,
1264
+ alice_meta. elgamal_keypair . pubkey ( ) ,
1265
+ Some ( auditor_elgamal_keypair. pubkey ( ) ) ,
1266
+ & supply_aes_key,
1267
+ None ,
1268
+ & [ & mint_authority] ,
1269
+ )
1270
+ . await
1271
+ . unwrap ( ) ;
1272
+
1273
+ token
1274
+ . confidential_transfer_apply_pending_balance (
1275
+ & alice_meta. token_account ,
1276
+ & alice. pubkey ( ) ,
1277
+ None ,
1278
+ alice_meta. elgamal_keypair . secret ( ) ,
1279
+ & alice_meta. aes_key ,
1280
+ & [ & alice] ,
1281
+ )
1282
+ . await
1283
+ . unwrap ( ) ;
1284
+
1285
+ token
1286
+ . pause ( & pausable_authority. pubkey ( ) , & [ & pausable_authority] )
1287
+ . await
1288
+ . unwrap ( ) ;
1289
+
1290
+ let error = token
1291
+ . confidential_transfer_mint (
1292
+ & mint_authority. pubkey ( ) ,
1293
+ & alice_meta. token_account ,
1294
+ None ,
1295
+ None ,
1296
+ None ,
1297
+ 10 ,
1298
+ & supply_elgamal_keypair,
1299
+ alice_meta. elgamal_keypair . pubkey ( ) ,
1300
+ Some ( auditor_elgamal_keypair. pubkey ( ) ) ,
1301
+ & supply_aes_key,
1302
+ None ,
1303
+ & [ & mint_authority] ,
1304
+ )
1305
+ . await
1306
+ . unwrap_err ( ) ;
1307
+
1308
+ assert_eq ! (
1309
+ error,
1310
+ TokenClientError :: Client ( Box :: new( TransportError :: TransactionError (
1311
+ TransactionError :: InstructionError (
1312
+ 0 ,
1313
+ InstructionError :: Custom ( TokenError :: MintPaused as u32 )
1314
+ )
1315
+ ) ) )
1316
+ ) ;
1317
+
1318
+ let error = token
1319
+ . confidential_transfer_burn (
1320
+ & alice. pubkey ( ) ,
1321
+ & alice_meta. token_account ,
1322
+ None ,
1323
+ None ,
1324
+ None ,
1325
+ 10 ,
1326
+ & alice_meta. elgamal_keypair ,
1327
+ supply_elgamal_keypair. pubkey ( ) ,
1328
+ Some ( auditor_elgamal_keypair. pubkey ( ) ) ,
1329
+ & alice_meta. aes_key ,
1330
+ None ,
1331
+ & [ & alice] ,
1332
+ )
1333
+ . await
1334
+ . unwrap_err ( ) ;
1335
+
1336
+ assert_eq ! (
1337
+ error,
1338
+ TokenClientError :: Client ( Box :: new( TransportError :: TransactionError (
1339
+ TransactionError :: InstructionError (
1340
+ 0 ,
1341
+ InstructionError :: Custom ( TokenError :: MintPaused as u32 )
1342
+ )
1343
+ ) ) )
1344
+ ) ;
1345
+ }
0 commit comments