File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed
src/swapService/strategies Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,9 @@ export class StrategyPendleCrossChainPT {
8484 getAddress ( swapParams . tokenIn . metadata . pendleCrossChainPTPaired ) ,
8585 )
8686 ) {
87- result . quotes = [ await this . exactInFromPTToUnderlying ( swapParams ) ]
87+ result . quotes = includesCustomProvider ( swapParams )
88+ ? [ await this . exactInFromPTToUnderlying ( swapParams ) ]
89+ : [ ]
8890 } else {
8991 result . quotes = await this . exactInFromPTToAny ( swapParams )
9092 }
@@ -97,7 +99,9 @@ export class StrategyPendleCrossChainPT {
9799 getAddress ( swapParams . tokenIn . metadata . pendleCrossChainPTPaired ) ,
98100 )
99101 ) {
100- result . quotes = await this . targetDebtFromPTToUnderlying ( swapParams )
102+ result . quotes = includesCustomProvider ( swapParams )
103+ ? await this . targetDebtFromPTToUnderlying ( swapParams )
104+ : [ ]
101105 } else {
102106 result . quotes = await this . targetDebtFromPTToAny ( swapParams )
103107 }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717 encodeSwapMulticallItem ,
1818 encodeTargetDebtAsExactInMulticall ,
1919 findToken ,
20+ includesCustomProvider ,
2021 isExactInRepay ,
2122 matchParams ,
2223} from "../utils"
@@ -73,15 +74,19 @@ export class StrategyPendleLP {
7374 if ( swapParams . tokenIn . metadata ?. isPendleWrappedLP ) {
7475 result . quotes = await this . exactInFromWrappedLPToAny ( swapParams )
7576 } else {
76- result . quotes = await this . exactInFromAnyToWrappedLP ( swapParams )
77+ result . quotes = includesCustomProvider ( swapParams )
78+ ? await this . exactInFromAnyToWrappedLP ( swapParams )
79+ : [ ]
7780 }
7881 break
7982 }
8083 case SwapperMode . TARGET_DEBT : {
8184 if ( swapParams . tokenIn . metadata ?. isPendleWrappedLP ) {
8285 result . quotes = await this . targetDebtFromWrappedLPToAny ( swapParams )
8386 } else {
84- result . quotes = await this . targetDebtFromAnyToWrappedLP ( swapParams )
87+ result . quotes = includesCustomProvider ( swapParams )
88+ ? await this . targetDebtFromAnyToWrappedLP ( swapParams )
89+ : [ ]
8590 }
8691 break
8792 }
Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ export class StrategyStrata {
9595
9696 if ( ! result . supports || ! result . match ) return result
9797
98+ if ( this . isDirectSwap ( swapParams ) && ! includesCustomProvider ( swapParams ) ) {
99+ result . quotes = [ ] // this ends the pipeline and returns empty results
100+ return result
101+ }
102+
98103 try {
99104 switch ( swapParams . swapperMode ) {
100105 case SwapperMode . EXACT_IN : {
@@ -686,6 +691,19 @@ export class StrategyStrata {
686691 return ! ! asset && isAddressEqual ( asset , underlying )
687692 }
688693
694+ isDirectSwap ( swapParams : SwapParams ) {
695+ return (
696+ this . isSupportedVaultUnderlying ( {
697+ vault : swapParams . tokenIn . address ,
698+ underlying : swapParams . tokenOut . address ,
699+ } ) ||
700+ this . isSupportedVaultUnderlying ( {
701+ vault : swapParams . tokenOut . address ,
702+ underlying : swapParams . tokenIn . address ,
703+ } )
704+ )
705+ }
706+
689707 getSupportedVault ( vault : Address ) {
690708 const supportedVault = this . config . supportedVaults . find ( ( v ) =>
691709 isAddressEqual ( v . vault , vault ) ,
You can’t perform that action at this time.
0 commit comments