File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ pub enum CommonError {
3333 InsufficientSpokePoolBalanceToExecuteLeaf ,
3434 #[ msg( "Invalid exclusive relayer!" ) ]
3535 InvalidExclusiveRelayer ,
36+ #[ msg( "Invalid output token!" ) ]
37+ InvalidOutputToken ,
3638}
3739
3840// SVM specific errors.
Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ pub fn _deposit(
9595 let state = & mut ctx. accounts . state ;
9696 let current_time = get_current_time ( state) ?;
9797
98+ if output_token == Pubkey :: default ( ) {
99+ return err ! ( CommonError :: InvalidOutputToken ) ;
100+ }
101+
98102 if current_time. checked_sub ( quote_timestamp) . unwrap_or ( u32:: MAX ) > state. deposit_quote_time_buffer {
99103 return err ! ( CommonError :: InvalidQuoteTimestamp ) ;
100104 }
Original file line number Diff line number Diff line change @@ -774,6 +774,17 @@ describe("svm_spoke.deposit", () => {
774774 assertSE ( vaultAccount . amount , depositData . inputAmount , "Vault balance should equal the deposited amount" ) ;
775775 } ) ;
776776
777+ it ( "Output token cannot be zero address" , async ( ) => {
778+ const invalidDepositData = { ...depositData , outputToken : new PublicKey ( "11111111111111111111111111111111" ) } ;
779+
780+ try {
781+ await approvedDeposit ( invalidDepositData ) ;
782+ assert . fail ( "Should not be able to process deposit with zero output token address" ) ;
783+ } catch ( err : any ) {
784+ assert . include ( err . toString ( ) , "Error Code: InvalidOutputToken" , "Expected InvalidOutputToken error" ) ;
785+ }
786+ } ) ;
787+
777788 describe ( "codama client and solana kit" , ( ) => {
778789 it ( "Deposit with with solana kit and codama client" , async ( ) => {
779790 // typescript is not happy with the depositData object
You can’t perform that action at this time.
0 commit comments