88 toWei ,
99 randomAddress ,
1010 BigNumber ,
11- hexZeroPadAddressLowercase ,
12- hexZeroPadAddress ,
11+ addressToBytes ,
1312 bytes32ToAddress ,
1413} from "../../../utils/utils" ;
1514import {
@@ -108,18 +107,18 @@ describe("SpokePool Depositor Logic", async function () {
108107 )
109108 . to . emit ( spokePool , "V3FundsDeposited" )
110109 . withArgs (
111- hexZeroPadAddressLowercase ( erc20 . address ) ,
112- hexZeroPadAddressLowercase ( ZERO_ADDRESS ) ,
110+ addressToBytes ( erc20 . address ) ,
111+ addressToBytes ( ZERO_ADDRESS ) ,
113112 amountToDeposit ,
114113 amountReceived ,
115114 destinationChainId ,
116115 0 ,
117116 quoteTimestamp ,
118117 MAX_UINT32 ,
119118 0 ,
120- hexZeroPadAddressLowercase ( depositor . address ) ,
121- hexZeroPadAddressLowercase ( recipient . address ) ,
122- hexZeroPadAddressLowercase ( ZERO_ADDRESS ) ,
119+ addressToBytes ( depositor . address ) ,
120+ addressToBytes ( recipient . address ) ,
121+ addressToBytes ( ZERO_ADDRESS ) ,
123122 "0x"
124123 ) ;
125124
@@ -148,18 +147,18 @@ describe("SpokePool Depositor Logic", async function () {
148147 )
149148 . to . emit ( spokePool , "V3FundsDeposited" )
150149 . withArgs (
151- hexZeroPadAddressLowercase ( erc20 . address ) ,
152- hexZeroPadAddressLowercase ( ZERO_ADDRESS ) ,
150+ addressToBytes ( erc20 . address ) ,
151+ addressToBytes ( ZERO_ADDRESS ) ,
153152 amountToDeposit ,
154153 amountReceived ,
155154 destinationChainId ,
156155 0 ,
157156 quoteTimestamp ,
158157 BigNumber . from ( "0xFFFFFFFF" ) ,
159158 0 ,
160- hexZeroPadAddressLowercase ( newDepositor ) , // Depositor is overridden.
161- hexZeroPadAddressLowercase ( recipient . address ) ,
162- hexZeroPadAddressLowercase ( ZERO_ADDRESS ) ,
159+ addressToBytes ( newDepositor ) , // Depositor is overridden.
160+ addressToBytes ( recipient . address ) ,
161+ addressToBytes ( ZERO_ADDRESS ) ,
163162 "0x"
164163 ) ;
165164 } ) ;
@@ -374,16 +373,16 @@ describe("SpokePool Depositor Logic", async function () {
374373 _isAddressOverload = false
375374 ) {
376375 return [
377- _isAddressOverload ? bytes32ToAddress ( _relayData . depositor ) : hexZeroPadAddress ( _relayData . depositor ) ,
378- _isAddressOverload ? bytes32ToAddress ( _relayData . recipient ) : hexZeroPadAddress ( _relayData . recipient ) ,
379- _isAddressOverload ? bytes32ToAddress ( _relayData . inputToken ) : hexZeroPadAddress ( _relayData . inputToken ) ,
380- _isAddressOverload ? bytes32ToAddress ( _relayData . outputToken ) : hexZeroPadAddress ( _relayData . outputToken ) ,
376+ _isAddressOverload ? bytes32ToAddress ( _relayData . depositor ) : addressToBytes ( _relayData . depositor ) ,
377+ _isAddressOverload ? bytes32ToAddress ( _relayData . recipient ) : addressToBytes ( _relayData . recipient ) ,
378+ _isAddressOverload ? bytes32ToAddress ( _relayData . inputToken ) : addressToBytes ( _relayData . inputToken ) ,
379+ _isAddressOverload ? bytes32ToAddress ( _relayData . outputToken ) : addressToBytes ( _relayData . outputToken ) ,
381380 _relayData . inputAmount ,
382381 _relayData . outputAmount ,
383382 _destinationChainId ,
384383 _isAddressOverload
385384 ? bytes32ToAddress ( _relayData . exclusiveRelayer )
386- : hexZeroPadAddress ( _relayData . exclusiveRelayer ) ,
385+ : addressToBytes ( _relayData . exclusiveRelayer ) ,
387386 _quoteTimestamp ,
388387 _relayData . fillDeadline ,
389388 _relayData . exclusivityDeadline ,
@@ -392,11 +391,11 @@ describe("SpokePool Depositor Logic", async function () {
392391 }
393392 beforeEach ( async function ( ) {
394393 relayData = {
395- depositor : hexZeroPadAddress ( depositor . address ) ,
396- recipient : hexZeroPadAddress ( recipient . address ) ,
397- exclusiveRelayer : hexZeroPadAddress ( ZERO_ADDRESS ) ,
398- inputToken : hexZeroPadAddress ( erc20 . address ) ,
399- outputToken : hexZeroPadAddress ( randomAddress ( ) ) ,
394+ depositor : addressToBytes ( depositor . address ) ,
395+ recipient : addressToBytes ( recipient . address ) ,
396+ exclusiveRelayer : addressToBytes ( ZERO_ADDRESS ) ,
397+ inputToken : addressToBytes ( erc20 . address ) ,
398+ outputToken : addressToBytes ( randomAddress ( ) ) ,
400399 inputAmount : amountToDeposit ,
401400 outputAmount : amountToDeposit . sub ( 19 ) ,
402401 originChainId : originChainId ,
@@ -511,23 +510,23 @@ describe("SpokePool Depositor Logic", async function () {
511510 spokePool
512511 . connect ( depositor )
513512 [ depositV3NowBytes ] (
514- hexZeroPadAddress ( relayData . depositor ) ,
515- hexZeroPadAddress ( relayData . recipient ) ,
516- hexZeroPadAddress ( relayData . inputToken ) ,
517- hexZeroPadAddress ( relayData . outputToken ) ,
513+ addressToBytes ( relayData . depositor ) ,
514+ addressToBytes ( relayData . recipient ) ,
515+ addressToBytes ( relayData . inputToken ) ,
516+ addressToBytes ( relayData . outputToken ) ,
518517 relayData . inputAmount ,
519518 relayData . outputAmount ,
520519 destinationChainId ,
521- hexZeroPadAddress ( relayData . exclusiveRelayer ) ,
520+ addressToBytes ( relayData . exclusiveRelayer ) ,
522521 fillDeadlineOffset ,
523522 exclusivityDeadline ,
524523 relayData . message
525524 )
526525 )
527526 . to . emit ( spokePool , "V3FundsDeposited" )
528527 . withArgs (
529- hexZeroPadAddressLowercase ( relayData . inputToken ) ,
530- hexZeroPadAddressLowercase ( relayData . outputToken ) ,
528+ addressToBytes ( relayData . inputToken ) ,
529+ addressToBytes ( relayData . outputToken ) ,
531530 relayData . inputAmount ,
532531 relayData . outputAmount ,
533532 destinationChainId ,
@@ -536,9 +535,9 @@ describe("SpokePool Depositor Logic", async function () {
536535 currentTime , // quoteTimestamp should be current time
537536 currentTime + fillDeadlineOffset , // fillDeadline should be current time + offset
538537 currentTime ,
539- hexZeroPadAddressLowercase ( relayData . depositor ) ,
540- hexZeroPadAddressLowercase ( relayData . recipient ) ,
541- hexZeroPadAddressLowercase ( relayData . exclusiveRelayer ) ,
538+ addressToBytes ( relayData . depositor ) ,
539+ addressToBytes ( relayData . recipient ) ,
540+ addressToBytes ( relayData . exclusiveRelayer ) ,
542541 relayData . message
543542 ) ;
544543 } ) ;
@@ -565,8 +564,8 @@ describe("SpokePool Depositor Logic", async function () {
565564 )
566565 . to . emit ( spokePool , "V3FundsDeposited" )
567566 . withArgs (
568- hexZeroPadAddressLowercase ( relayData . inputToken ) ,
569- hexZeroPadAddressLowercase ( relayData . outputToken ) ,
567+ addressToBytes ( relayData . inputToken ) ,
568+ addressToBytes ( relayData . outputToken ) ,
570569 relayData . inputAmount ,
571570 relayData . outputAmount ,
572571 destinationChainId ,
@@ -575,9 +574,9 @@ describe("SpokePool Depositor Logic", async function () {
575574 currentTime , // quoteTimestamp should be current time
576575 currentTime + fillDeadlineOffset , // fillDeadline should be current time + offset
577576 currentTime ,
578- hexZeroPadAddressLowercase ( relayData . depositor ) ,
579- hexZeroPadAddressLowercase ( relayData . recipient ) ,
580- hexZeroPadAddressLowercase ( relayData . exclusiveRelayer ) ,
577+ addressToBytes ( relayData . depositor ) ,
578+ addressToBytes ( relayData . recipient ) ,
579+ addressToBytes ( relayData . exclusiveRelayer ) ,
581580 relayData . message
582581 ) ;
583582 } ) ;
@@ -586,8 +585,8 @@ describe("SpokePool Depositor Logic", async function () {
586585 await expect ( spokePool . connect ( depositor ) [ depositV3Bytes ] ( ...depositArgs ) )
587586 . to . emit ( spokePool , "V3FundsDeposited" )
588587 . withArgs (
589- hexZeroPadAddressLowercase ( relayData . inputToken ) ,
590- hexZeroPadAddressLowercase ( relayData . outputToken ) ,
588+ addressToBytes ( relayData . inputToken ) ,
589+ addressToBytes ( relayData . outputToken ) ,
591590 relayData . inputAmount ,
592591 relayData . outputAmount ,
593592 destinationChainId ,
@@ -596,9 +595,9 @@ describe("SpokePool Depositor Logic", async function () {
596595 quoteTimestamp ,
597596 relayData . fillDeadline ,
598597 currentTime ,
599- hexZeroPadAddressLowercase ( relayData . depositor ) ,
600- hexZeroPadAddressLowercase ( relayData . recipient ) ,
601- hexZeroPadAddressLowercase ( relayData . exclusiveRelayer ) ,
598+ addressToBytes ( relayData . depositor ) ,
599+ addressToBytes ( relayData . recipient ) ,
600+ addressToBytes ( relayData . exclusiveRelayer ) ,
602601 relayData . message
603602 ) ;
604603 } ) ;
@@ -617,8 +616,8 @@ describe("SpokePool Depositor Logic", async function () {
617616 )
618617 . to . emit ( spokePool , "V3FundsDeposited" )
619618 . withArgs (
620- hexZeroPadAddressLowercase ( relayData . inputToken ) ,
621- hexZeroPadAddressLowercase ( relayData . outputToken ) ,
619+ addressToBytes ( relayData . inputToken ) ,
620+ addressToBytes ( relayData . outputToken ) ,
622621 relayData . inputAmount ,
623622 relayData . outputAmount ,
624623 destinationChainId ,
@@ -627,9 +626,9 @@ describe("SpokePool Depositor Logic", async function () {
627626 relayData . fillDeadline ,
628627 currentTime ,
629628 // New depositor
630- hexZeroPadAddressLowercase ( newDepositor ) ,
631- hexZeroPadAddressLowercase ( relayData . recipient ) ,
632- hexZeroPadAddressLowercase ( relayData . exclusiveRelayer ) ,
629+ addressToBytes ( newDepositor ) ,
630+ addressToBytes ( relayData . recipient ) ,
631+ addressToBytes ( relayData . exclusiveRelayer ) ,
633632 relayData . message
634633 ) ;
635634 expect ( await erc20 . balanceOf ( depositor . address ) ) . to . equal ( balanceBefore . sub ( amountToDeposit ) ) ;
@@ -658,27 +657,27 @@ describe("SpokePool Depositor Logic", async function () {
658657 depositId ,
659658 originChainId ,
660659 updatedOutputAmount ,
661- hexZeroPadAddress ( updatedRecipient ) ,
660+ addressToBytes ( updatedRecipient ) ,
662661 updatedMessage
663662 ) ;
664663 await spokePool [ verifyUpdateV3DepositMessageBytes ] (
665- hexZeroPadAddress ( depositor . address ) ,
664+ addressToBytes ( depositor . address ) ,
666665 depositId ,
667666 originChainId ,
668667 updatedOutputAmount ,
669- hexZeroPadAddress ( updatedRecipient ) ,
668+ addressToBytes ( updatedRecipient ) ,
670669 updatedMessage ,
671670 signature
672671 ) ;
673672
674673 // Reverts if passed in depositor is the signer or if signature is incorrect
675674 await expect (
676675 spokePool [ verifyUpdateV3DepositMessageBytes ] (
677- hexZeroPadAddress ( updatedRecipient ) ,
676+ addressToBytes ( updatedRecipient ) ,
678677 depositId ,
679678 originChainId ,
680679 updatedOutputAmount ,
681- hexZeroPadAddress ( updatedRecipient ) ,
680+ addressToBytes ( updatedRecipient ) ,
682681 updatedMessage ,
683682 signature
684683 )
@@ -690,16 +689,16 @@ describe("SpokePool Depositor Logic", async function () {
690689 depositId + 1 ,
691690 originChainId ,
692691 updatedOutputAmount ,
693- hexZeroPadAddress ( updatedRecipient ) ,
692+ addressToBytes ( updatedRecipient ) ,
694693 updatedMessage
695694 ) ;
696695 await expect (
697696 spokePool [ verifyUpdateV3DepositMessageBytes ] (
698- hexZeroPadAddress ( depositor . address ) ,
697+ addressToBytes ( depositor . address ) ,
699698 depositId ,
700699 originChainId ,
701700 updatedOutputAmount ,
702- hexZeroPadAddress ( updatedRecipient ) ,
701+ addressToBytes ( updatedRecipient ) ,
703702 updatedMessage ,
704703 invalidSignature
705704 )
@@ -713,17 +712,17 @@ describe("SpokePool Depositor Logic", async function () {
713712 depositId ,
714713 spokePoolChainId ,
715714 updatedOutputAmount ,
716- hexZeroPadAddress ( updatedRecipient ) ,
715+ addressToBytes ( updatedRecipient ) ,
717716 updatedMessage
718717 ) ;
719718 await expect (
720719 spokePool
721720 . connect ( depositor )
722721 [ speedUpV3DepositBytes ] (
723- hexZeroPadAddress ( depositor . address ) ,
722+ addressToBytes ( depositor . address ) ,
724723 depositId ,
725724 updatedOutputAmount ,
726- hexZeroPadAddress ( updatedRecipient ) ,
725+ addressToBytes ( updatedRecipient ) ,
727726 updatedMessage ,
728727 expectedSignature
729728 )
@@ -732,8 +731,8 @@ describe("SpokePool Depositor Logic", async function () {
732731 . withArgs (
733732 updatedOutputAmount ,
734733 depositId ,
735- hexZeroPadAddressLowercase ( depositor . address ) ,
736- hexZeroPadAddressLowercase ( updatedRecipient ) ,
734+ addressToBytes ( depositor . address ) ,
735+ addressToBytes ( updatedRecipient ) ,
737736 updatedMessage ,
738737 expectedSignature
739738 ) ;
@@ -745,16 +744,16 @@ describe("SpokePool Depositor Logic", async function () {
745744 depositId ,
746745 otherChainId ,
747746 updatedOutputAmount ,
748- hexZeroPadAddress ( updatedRecipient ) ,
747+ addressToBytes ( updatedRecipient ) ,
749748 updatedMessage
750749 ) ;
751750 await expect (
752751 spokePool [ verifyUpdateV3DepositMessageBytes ] (
753- hexZeroPadAddress ( depositor . address ) ,
752+ addressToBytes ( depositor . address ) ,
754753 depositId ,
755754 otherChainId ,
756755 updatedOutputAmount ,
757- hexZeroPadAddress ( updatedRecipient ) ,
756+ addressToBytes ( updatedRecipient ) ,
758757 updatedMessage ,
759758 invalidSignatureForChain
760759 )
@@ -763,10 +762,10 @@ describe("SpokePool Depositor Logic", async function () {
763762 spokePool
764763 . connect ( depositor )
765764 [ speedUpV3DepositBytes ] (
766- hexZeroPadAddress ( depositor . address ) ,
765+ addressToBytes ( depositor . address ) ,
767766 depositId ,
768767 updatedOutputAmount ,
769- hexZeroPadAddress ( updatedRecipient ) ,
768+ addressToBytes ( updatedRecipient ) ,
770769 updatedMessage ,
771770 invalidSignatureForChain
772771 )
@@ -815,8 +814,8 @@ describe("SpokePool Depositor Logic", async function () {
815814 . withArgs (
816815 updatedOutputAmount ,
817816 depositId ,
818- hexZeroPadAddressLowercase ( depositor . address ) ,
819- hexZeroPadAddressLowercase ( updatedRecipient ) ,
817+ addressToBytes ( depositor . address ) ,
818+ addressToBytes ( updatedRecipient ) ,
820819 updatedMessage ,
821820 signature
822821 ) ;
0 commit comments