@@ -108,20 +108,6 @@ export default function createBroadcastSlice(
108108 } )
109109 }
110110
111- // USDC lending is being disabled. Auto-lend should never append a `lend` action for USDC.
112- // We intentionally key off chainConfig.stables (stable denoms) to avoid matching LP tokens
113- // whose symbols may contain "USDC" but are not the USDC stable itself.
114- const isUsdcDenom = ( denom : string ) : boolean => {
115- const stables = get ( ) . chainConfig . stables
116- if ( ! stables . includes ( denom ) ) return false
117-
118- const symbol = get ( ) . assets . find ( byDenom ( denom ) ) ?. symbol
119- if ( symbol ) return symbol . toUpperCase ( ) . includes ( 'USDC' )
120-
121- // Fallback: if assets aren't loaded yet, assume the primary stable is USDC.
122- return denom === stables [ 0 ]
123- }
124-
125111 return {
126112 toast : null ,
127113 addToStakingStrategy : async ( options : {
@@ -290,8 +276,7 @@ export default function createBroadcastSlice(
290276 if (
291277 ! options . borrowToWallet &&
292278 checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) &&
293- get ( ) . assets . find ( byDenom ( options . coin . denom ) ) ?. isAutoLendEnabled &&
294- ( isOsmosis || ! isUsdcDenom ( options . coin . denom ) )
279+ get ( ) . assets . find ( byDenom ( options . coin . denom ) ) ?. isAutoLendEnabled
295280 ) {
296281 msg . update_credit_account . actions . push ( {
297282 lend : { denom : options . coin . denom , amount : 'account_balance' } ,
@@ -432,11 +417,7 @@ export default function createBroadcastSlice(
432417 for ( const reward of stakedAstroLpRewards ) {
433418 for ( const coin of reward . rewards ) {
434419 const asset = assets . find ( byDenom ( coin . denom ) )
435- if (
436- asset ?. isAutoLendEnabled &&
437- ( isOsmosis || ! isUsdcDenom ( coin . denom ) ) &&
438- ! lendCoins . find ( byDenom ( coin . denom ) )
439- ) {
420+ if ( asset ?. isAutoLendEnabled && ! lendCoins . find ( byDenom ( coin . denom ) ) ) {
440421 lendCoins . push ( coin )
441422 actions . push ( {
442423 lend : {
@@ -452,11 +433,7 @@ export default function createBroadcastSlice(
452433 if ( ! isV1 && options . lend && redBankRewards . length ) {
453434 for ( const coin of redBankRewards ) {
454435 const asset = assets . find ( byDenom ( coin . denom ) )
455- if (
456- asset ?. isAutoLendEnabled &&
457- ( isOsmosis || ! isUsdcDenom ( coin . denom ) ) &&
458- ! lendCoins . find ( byDenom ( coin . denom ) )
459- ) {
436+ if ( asset ?. isAutoLendEnabled && ! lendCoins . find ( byDenom ( coin . denom ) ) ) {
460437 actions . push ( {
461438 lend : {
462439 denom : coin . denom ,
@@ -515,11 +492,7 @@ export default function createBroadcastSlice(
515492 const isOsmosis = get ( ) . chainConfig . isOsmosis
516493 msg . update_credit_account . actions . push (
517494 ...options . coins
518- . filter (
519- ( coin ) =>
520- get ( ) . assets . find ( byDenom ( coin . denom ) ) ?. isAutoLendEnabled &&
521- ( isOsmosis || ! isUsdcDenom ( coin . denom ) ) ,
522- )
495+ . filter ( ( coin ) => get ( ) . assets . find ( byDenom ( coin . denom ) ) ?. isAutoLendEnabled )
523496 . map ( ( coin ) => ( { lend : coin . toActionCoin ( ) } ) ) ,
524497 )
525498 }
@@ -591,11 +564,7 @@ export default function createBroadcastSlice(
591564 actions . push ( {
592565 withdraw_from_perp_vault : { } ,
593566 } )
594- const isOsmosis = get ( ) . chainConfig . isOsmosis
595- if (
596- checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) &&
597- ( isOsmosis || ! isUsdcDenom ( vault . denoms . lp ) )
598- ) {
567+ if ( checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) ) {
599568 actions . push ( {
600569 lend : { denom : vault . denoms . lp , amount : 'account_balance' } ,
601570 } )
@@ -614,7 +583,7 @@ export default function createBroadcastSlice(
614583 for ( const vault of options . vaults ) {
615584 for ( const symbol of Object . values ( vault . symbols ) ) {
616585 const asset = get ( ) . assets . find ( bySymbol ( symbol ) )
617- if ( asset ?. isAutoLendEnabled && ( isOsmosis || ! isUsdcDenom ( asset . denom ) ) ) {
586+ if ( asset ?. isAutoLendEnabled ) {
618587 msg . update_credit_account . actions . push ( {
619588 lend : { denom : asset . denom , amount : 'account_balance' } ,
620589 } )
@@ -713,7 +682,7 @@ export default function createBroadcastSlice(
713682 for ( const astroLp of options . astroLps ) {
714683 for ( const symbol of Object . values ( astroLp . symbols ) ) {
715684 const asset = get ( ) . assets . find ( bySymbol ( symbol ) )
716- if ( asset ?. isAutoLendEnabled && ( isOsmosis || ! isUsdcDenom ( asset . denom ) ) ) {
685+ if ( asset ?. isAutoLendEnabled ) {
717686 msg . update_credit_account . actions . push ( {
718687 lend : { denom : asset . denom , amount : 'account_balance' } ,
719688 } )
@@ -940,9 +909,7 @@ export default function createBroadcastSlice(
940909 } ,
941910 depositAndLend : async ( options : { accountId : string ; coin : BNCoin } ) => {
942911 const asset = get ( ) . assets . find ( byDenom ( options . coin . denom ) )
943- const isOsmosis = get ( ) . chainConfig . isOsmosis
944- if ( ( ! isOsmosis && isUsdcDenom ( options . coin . denom ) ) || ! asset ?. isAutoLendEnabled ) {
945- // USDC lending is disabled on Neutron (or asset is deposit-only/unknown) - fall back to deposit without lending.
912+ if ( ! asset ?. isAutoLendEnabled ) {
946913 return get ( ) . depositSingle ( options )
947914 }
948915
@@ -1041,7 +1008,6 @@ export default function createBroadcastSlice(
10411008 if (
10421009 checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) &&
10431010 get ( ) . assets . find ( byDenom ( options . denomOut ) ) ?. isAutoLendEnabled &&
1044- ( isOsmosis || ! isUsdcDenom ( options . denomOut ) ) &&
10451011 ! options . repay
10461012 ) {
10471013 msg . update_credit_account . actions . push ( {
@@ -1125,8 +1091,7 @@ export default function createBroadcastSlice(
11251091 } ,
11261092 } ,
11271093 ]
1128- const isOsmosis = get ( ) . chainConfig . isOsmosis
1129- if ( options . autolend && ( isOsmosis || ! isUsdcDenom ( options . keeperFee . denom ) ) )
1094+ if ( options . autolend )
11301095 triggerActions . push ( {
11311096 lend : {
11321097 denom : options . keeperFee . denom ,
@@ -1237,7 +1202,7 @@ export default function createBroadcastSlice(
12371202 } ,
12381203 } ,
12391204 ]
1240- if ( order . autolend && ( isOsmosis || ! isUsdcDenom ( order . keeperFee . denom ) ) )
1205+ if ( order . autolend )
12411206 triggerActions . push ( {
12421207 lend : {
12431208 denom : order . keeperFee . denom ,
@@ -1303,8 +1268,7 @@ export default function createBroadcastSlice(
13031268 conditionalTriggers ?: { sl : string | null ; tp : string | null }
13041269 keeperFee ?: BNCoin
13051270 } ) => {
1306- const isOsmosis = get ( ) . chainConfig . isOsmosis
1307- const autoLend = options . autolend && ( isOsmosis || ! isUsdcDenom ( options . baseDenom ) )
1271+ const autoLend = options . autolend
13081272 const actions : Action [ ] = [
13091273 {
13101274 execute_perp_order : {
@@ -1445,8 +1409,7 @@ export default function createBroadcastSlice(
14451409 } )
14461410 }
14471411
1448- const isOsmosis = get ( ) . chainConfig . isOsmosis
1449- if ( options . autolend && ( isOsmosis || ! isUsdcDenom ( options . baseDenom ) ) ) {
1412+ if ( options . autolend ) {
14501413 actions . push ( {
14511414 lend : {
14521415 denom : options . baseDenom ,
@@ -1600,8 +1563,7 @@ export default function createBroadcastSlice(
16001563 }
16011564 }
16021565
1603- const isOsmosis = get ( ) . chainConfig . isOsmosis
1604- if ( options . autolend && ( isOsmosis || ! isUsdcDenom ( options . baseDenom ) ) ) {
1566+ if ( options . autolend ) {
16051567 actions . push ( {
16061568 lend : {
16071569 denom : options . baseDenom ,
@@ -1640,8 +1602,7 @@ export default function createBroadcastSlice(
16401602 } ,
16411603 } ,
16421604 ]
1643- const isOsmosis = get ( ) . chainConfig . isOsmosis
1644- if ( options . autolend && ( isOsmosis || ! isUsdcDenom ( options . baseDenom ) ) )
1605+ if ( options . autolend )
16451606 actions . push ( {
16461607 lend : {
16471608 denom : options . baseDenom ,
@@ -1875,19 +1836,16 @@ export default function createBroadcastSlice(
18751836 {
18761837 withdraw_from_perp_vault : { } ,
18771838 } ,
1878- ...( ( ) => {
1879- const isOsmosis = get ( ) . chainConfig . isOsmosis
1880- return options . isAutoLend && ( isOsmosis || ! isUsdcDenom ( options . vaultDenom ) )
1881- ? [
1882- {
1883- lend : {
1884- denom : options . vaultDenom ,
1885- amount : 'account_balance' as ActionAmount ,
1886- } ,
1839+ ...( options . isAutoLend
1840+ ? [
1841+ {
1842+ lend : {
1843+ denom : options . vaultDenom ,
1844+ amount : 'account_balance' as ActionAmount ,
18871845 } ,
1888- ]
1889- : [ ]
1890- } ) ( ) ,
1846+ } ,
1847+ ]
1848+ : [ ] ) ,
18911849 ] ,
18921850 } ,
18931851 }
0 commit comments