@@ -48,16 +48,16 @@ describe('ConfidentialFungibleToken', function () {
4848 } ) ;
4949 } ) ;
5050
51- describe ( 'balanceOf ' , function ( ) {
51+ describe ( 'confidentialBalanceOf ' , function ( ) {
5252 it ( 'handle can be reencryped by owner' , async function ( ) {
53- const balanceOfHandleHolder = await this . token . balanceOf ( this . holder ) ;
53+ const balanceOfHandleHolder = await this . token . confidentialBalanceOf ( this . holder ) ;
5454 await expect (
5555 fhevm . userDecryptEuint ( FhevmType . euint64 , balanceOfHandleHolder , this . token . target , this . holder ) ,
5656 ) . to . eventually . equal ( 1000 ) ;
5757 } ) ;
5858
5959 it ( 'handle cannot be reencryped by non-owner' , async function ( ) {
60- const balanceOfHandleHolder = await this . token . balanceOf ( this . holder ) ;
60+ const balanceOfHandleHolder = await this . token . confidentialBalanceOf ( this . holder ) ;
6161 await expect (
6262 fhevm . userDecryptEuint ( FhevmType . euint64 , balanceOfHandleHolder , this . token . target , this . accounts [ 0 ] ) ,
6363 ) . to . be . rejectedWith ( generateReencryptionErrorMessage ( balanceOfHandleHolder , this . accounts [ 0 ] . address ) ) ;
@@ -78,13 +78,13 @@ describe('ConfidentialFungibleToken', function () {
7878 [ '$_mint(address,bytes32,bytes)' ] ( this . holder , encryptedInput . handles [ 0 ] , encryptedInput . inputProof ) ;
7979 }
8080
81- const balanceOfHandleHolder = await this . token . balanceOf ( this . holder ) ;
81+ const balanceOfHandleHolder = await this . token . confidentialBalanceOf ( this . holder ) ;
8282 await expect (
8383 fhevm . userDecryptEuint ( FhevmType . euint64 , balanceOfHandleHolder , this . token . target , this . holder ) ,
8484 ) . to . eventually . equal ( existingUser ? 2000 : 1000 ) ;
8585
8686 // Check total supply
87- const totalSupplyHandle = await this . token . totalSupply ( ) ;
87+ const totalSupplyHandle = await this . token . confidentialTotalSupply ( ) ;
8888 await expect (
8989 fhevm . userDecryptEuint ( FhevmType . euint64 , totalSupplyHandle , this . token . target , this . holder ) ,
9090 ) . to . eventually . equal ( existingUser ? 2000 : 1000 ) ;
@@ -121,13 +121,13 @@ describe('ConfidentialFungibleToken', function () {
121121 . connect ( this . holder )
122122 [ '$_burn(address,bytes32,bytes)' ] ( this . holder , encryptedInput . handles [ 0 ] , encryptedInput . inputProof ) ;
123123
124- const balanceOfHandleHolder = await this . token . balanceOf ( this . holder ) ;
124+ const balanceOfHandleHolder = await this . token . confidentialBalanceOf ( this . holder ) ;
125125 await expect (
126126 fhevm . userDecryptEuint ( FhevmType . euint64 , balanceOfHandleHolder , this . token . target , this . holder ) ,
127127 ) . to . eventually . equal ( sufficientBalance ? 600 : 1000 ) ;
128128
129129 // Check total supply
130- const totalSupplyHandle = await this . token . totalSupply ( ) ;
130+ const totalSupplyHandle = await this . token . confidentialTotalSupply ( ) ;
131131 await expect (
132132 fhevm . userDecryptEuint ( FhevmType . euint64 , totalSupplyHandle , this . token . target , this . holder ) ,
133133 ) . to . eventually . equal ( sufficientBalance ? 600 : 1000 ) ;
@@ -286,8 +286,8 @@ describe('ConfidentialFungibleToken', function () {
286286 expect ( transferEvent . args [ 1 ] ) . to . equal ( this . recipient . address ) ;
287287
288288 const transferAmountHandle = transferEvent . args [ 2 ] ;
289- const holderBalanceHandle = await this . token . balanceOf ( this . holder ) ;
290- const recipientBalanceHandle = await this . token . balanceOf ( this . recipient ) ;
289+ const holderBalanceHandle = await this . token . confidentialBalanceOf ( this . holder ) ;
290+ const recipientBalanceHandle = await this . token . confidentialBalanceOf ( this . recipient ) ;
291291
292292 await expect (
293293 fhevm . userDecryptEuint ( FhevmType . euint64 , transferAmountHandle , this . token . target , this . holder ) ,
@@ -341,14 +341,14 @@ describe('ConfidentialFungibleToken', function () {
341341 }
342342
343343 it ( 'full balance' , async function ( ) {
344- const fullBalanceHandle = await this . token . balanceOf ( this . holder ) ;
344+ const fullBalanceHandle = await this . token . confidentialBalanceOf ( this . holder ) ;
345345
346346 await callTransfer ( this . token , this . holder , this . recipient , fullBalanceHandle ) ;
347347
348348 await expect (
349349 fhevm . userDecryptEuint (
350350 FhevmType . euint64 ,
351- await this . token . balanceOf ( this . recipient ) ,
351+ await this . token . confidentialBalanceOf ( this . recipient ) ,
352352 this . token . target ,
353353 this . recipient ,
354354 ) ,
@@ -365,7 +365,7 @@ describe('ConfidentialFungibleToken', function () {
365365 . connect ( this . holder )
366366 [ '$_mint(address,bytes32,bytes)' ] ( this . recipient , encryptedInput . handles [ 0 ] , encryptedInput . inputProof ) ;
367367
368- const recipientBalanceHandle = await this . token . balanceOf ( this . recipient ) ;
368+ const recipientBalanceHandle = await this . token . confidentialBalanceOf ( this . recipient ) ;
369369 await expect ( callTransfer ( this . token , this . holder , this . recipient , recipientBalanceHandle ) )
370370 . to . be . revertedWithCustomError ( this . token , 'ConfidentialFungibleTokenUnauthorizedUseOfEncryptedAmount' )
371371 . withArgs ( recipientBalanceHandle , this . holder ) ;
@@ -375,7 +375,7 @@ describe('ConfidentialFungibleToken', function () {
375375 describe ( 'without operator approval' , function ( ) {
376376 beforeEach ( async function ( ) {
377377 await this . token . connect ( this . holder ) . setOperator ( this . operator . address , 0 ) ;
378- await allowHandle ( hre , this . holder , this . operator , await this . token . balanceOf ( this . holder ) ) ;
378+ await allowHandle ( hre , this . holder , this . operator , await this . token . confidentialBalanceOf ( this . holder ) ) ;
379379 } ) ;
380380
381381 it ( 'should revert' , async function ( ) {
@@ -384,7 +384,7 @@ describe('ConfidentialFungibleToken', function () {
384384 this . token ,
385385 this . holder ,
386386 this . recipient ,
387- await this . token . balanceOf ( this . holder ) ,
387+ await this . token . confidentialBalanceOf ( this . holder ) ,
388388 this . operator ,
389389 ) ,
390390 )
@@ -442,7 +442,7 @@ describe('ConfidentialFungibleToken', function () {
442442 await expect (
443443 fhevm . userDecryptEuint (
444444 FhevmType . euint64 ,
445- await this . token . balanceOf ( this . holder ) ,
445+ await this . token . confidentialBalanceOf ( this . holder ) ,
446446 this . token . target ,
447447 this . holder ,
448448 ) ,
@@ -509,7 +509,7 @@ describe('ConfidentialFungibleToken', function () {
509509 '0x' ,
510510 ) ;
511511
512- const balanceOfHandle = await this . token . balanceOf ( this . recipient ) ;
512+ const balanceOfHandle = await this . token . confidentialBalanceOf ( this . recipient ) ;
513513 await expect (
514514 fhevm . userDecryptEuint ( FhevmType . euint64 , balanceOfHandle , this . token . target , this . recipient ) ,
515515 ) . to . eventually . equal ( 1000 ) ;
@@ -526,7 +526,7 @@ describe('ConfidentialFungibleToken', function () {
526526 } ) ;
527527
528528 it ( 'user balance' , async function ( ) {
529- const holderBalanceHandle = await this . token . balanceOf ( this . holder ) ;
529+ const holderBalanceHandle = await this . token . confidentialBalanceOf ( this . holder ) ;
530530
531531 await this . token . connect ( this . holder ) . discloseEncryptedAmount ( holderBalanceHandle ) ;
532532
@@ -556,15 +556,15 @@ describe('ConfidentialFungibleToken', function () {
556556 } ) ;
557557
558558 it ( "other user's balance" , async function ( ) {
559- const holderBalanceHandle = await this . token . balanceOf ( this . holder ) ;
559+ const holderBalanceHandle = await this . token . confidentialBalanceOf ( this . holder ) ;
560560
561561 await expect ( this . token . connect ( this . recipient ) . discloseEncryptedAmount ( holderBalanceHandle ) )
562562 . to . be . revertedWithCustomError ( this . token , 'ConfidentialFungibleTokenUnauthorizedUseOfEncryptedAmount' )
563563 . withArgs ( holderBalanceHandle , this . recipient ) ;
564564 } ) ;
565565
566566 it ( 'invalid signature reverts' , async function ( ) {
567- const holderBalanceHandle = await this . token . balanceOf ( this . holder ) ;
567+ const holderBalanceHandle = await this . token . confidentialBalanceOf ( this . holder ) ;
568568 await this . token . connect ( this . holder ) . discloseEncryptedAmount ( holderBalanceHandle ) ;
569569
570570 await expect ( this . token . connect ( this . holder ) . finalizeDiscloseEncryptedAmount ( 0 , 0 , [ ] ) ) . to . be . reverted ;
@@ -576,7 +576,7 @@ describe('ConfidentialFungibleToken', function () {
576576 await fhevm . awaitDecryptionOracle ( ) ;
577577
578578 // Check that event was correctly emitted
579- const eventFilter = this . token . filters . EncryptedAmountDisclosed ( ) ;
579+ const eventFilter = this . token . filters . AmountDisclosed ( ) ;
580580 const discloseEvent = ( await this . token . queryFilter ( eventFilter ) ) [ 0 ] ;
581581 expect ( discloseEvent . args [ 0 ] ) . to . equal ( expectedHandle ) ;
582582 expect ( discloseEvent . args [ 1 ] ) . to . equal ( expectedAmount ) ;
0 commit comments