@@ -28,6 +28,7 @@ describe("PoolERC20", () => {
2828 let sdk : ReturnType < typeof interfaceSdk . createInterfaceSdk > ;
2929 let backendSdk : ReturnType < typeof createBackendSdk > ;
3030 let CompleteWaAddress : typeof import ( "../sdk" ) . sdk . CompleteWaAddress ;
31+ let TokenAmount : typeof import ( "../sdk" ) . sdk . TokenAmount ;
3132 snapshottedBeforeEach ( async ( ) => {
3233 [ alice , bob , charlie ] = await ethers . getSigners ( ) ;
3334 await typedDeployments . fixture ( ) ;
@@ -42,8 +43,9 @@ describe("PoolERC20", () => {
4243 await usdc . mintForTests ( alice , await parseUnits ( usdc , "1000000" ) ) ;
4344 await usdc . connect ( alice ) . approve ( pool , ethers . MaxUint256 ) ;
4445
45- CompleteWaAddress = ( await tsImport ( "../sdk" , __filename ) ) . sdk
46- . CompleteWaAddress ;
46+ ( { CompleteWaAddress, TokenAmount } = (
47+ await tsImport ( "../sdk" , __filename )
48+ ) . sdk ) ;
4749 } ) ;
4850
4951 before ( async ( ) => {
@@ -203,7 +205,10 @@ describe("PoolERC20", () => {
203205
204206 // interact
205207 const [ note ] = await sdk . poolErc20 . getBalanceNotesOf ( usdc , aliceSecretKey ) ;
206- const transferAmount = 123n ;
208+ const transferAmount = await TokenAmount . from ( {
209+ token : await usdc . getAddress ( ) ,
210+ amount : 123n ,
211+ } ) ;
207212 const { nullifier, changeNote, toNote } = await sdk . poolErc20 . transfer ( {
208213 secretKey : aliceSecretKey ,
209214 fromNote : note ,
@@ -230,10 +235,10 @@ describe("PoolERC20", () => {
230235 await backendSdk . rollup . rollup ( ) ;
231236
232237 expect ( await sdk . poolErc20 . balanceOf ( usdc , aliceSecretKey ) ) . to . equal (
233- amount - transferAmount ,
238+ amount - transferAmount . amount ,
234239 ) ;
235240 expect ( await sdk . poolErc20 . balanceOf ( usdc , bobSecretKey ) ) . to . equal (
236- transferAmount ,
241+ transferAmount . amount ,
237242 ) ;
238243 } ) ;
239244
@@ -254,7 +259,10 @@ describe("PoolERC20", () => {
254259 secretKey : aliceSecretKey ,
255260 fromNote : shieldedNote ,
256261 to : await CompleteWaAddress . fromSecretKey ( bobSecretKey ) ,
257- amount : 30n ,
262+ amount : await TokenAmount . from ( {
263+ token : await usdc . getAddress ( ) ,
264+ amount : 30n ,
265+ } ) ,
258266 } ) ;
259267 // TODO: split notes even if they are not rolled up
260268 // const { } = await sdk.poolErc20.transfer({
@@ -270,7 +278,10 @@ describe("PoolERC20", () => {
270278 secretKey : bobSecretKey ,
271279 fromNote : bobNote ,
272280 to : await CompleteWaAddress . fromSecretKey ( charlieSecretKey ) ,
273- amount : 10n ,
281+ amount : await TokenAmount . from ( {
282+ token : await usdc . getAddress ( ) ,
283+ amount : 10n ,
284+ } ) ,
274285 } ) ;
275286 await backendSdk . rollup . rollup ( ) ;
276287
@@ -284,11 +295,14 @@ describe("PoolERC20", () => {
284295 } ) ;
285296
286297 it ( "can't double spend a note" , async ( ) => {
287- const amount = 100n ;
298+ const amount = await TokenAmount . from ( {
299+ token : await usdc . getAddress ( ) ,
300+ amount : 100n ,
301+ } ) ;
288302 await sdk . poolErc20 . shield ( {
289303 account : alice ,
290304 token : usdc ,
291- amount,
305+ amount : amount . amount ,
292306 secretKey : aliceSecretKey ,
293307 } ) ;
294308 await backendSdk . rollup . rollup ( ) ;
@@ -338,7 +352,10 @@ describe("PoolERC20", () => {
338352 secretKey : aliceSecretKey ,
339353 fromNote : note ,
340354 to : await CompleteWaAddress . fromSecretKey ( bobSecretKey ) ,
341- amount : 100n ,
355+ amount : await TokenAmount . from ( {
356+ token : await usdc . getAddress ( ) ,
357+ amount : 100n ,
358+ } ) ,
342359 } ) ;
343360 expect (
344361 await sdk . poolErc20 . getBalanceNotesOf ( usdc , aliceSecretKey ) ,
0 commit comments