@@ -108,6 +108,20 @@ 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+
111125 return {
112126 toast : null ,
113127 addToStakingStrategy : async ( options : {
@@ -275,7 +289,8 @@ export default function createBroadcastSlice(
275289 if (
276290 ! options . borrowToWallet &&
277291 checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) &&
278- get ( ) . assets . find ( byDenom ( options . coin . denom ) ) ?. isAutoLendEnabled
292+ get ( ) . assets . find ( byDenom ( options . coin . denom ) ) ?. isAutoLendEnabled &&
293+ ! isUsdcDenom ( options . coin . denom )
279294 ) {
280295 msg . update_credit_account . actions . push ( {
281296 lend : { denom : options . coin . denom , amount : 'account_balance' } ,
@@ -415,7 +430,11 @@ export default function createBroadcastSlice(
415430 for ( const reward of stakedAstroLpRewards ) {
416431 for ( const coin of reward . rewards ) {
417432 const asset = assets . find ( byDenom ( coin . denom ) )
418- if ( asset ?. isAutoLendEnabled && ! lendCoins . find ( byDenom ( coin . denom ) ) ) {
433+ if (
434+ asset ?. isAutoLendEnabled &&
435+ ! isUsdcDenom ( coin . denom ) &&
436+ ! lendCoins . find ( byDenom ( coin . denom ) )
437+ ) {
419438 lendCoins . push ( coin )
420439 actions . push ( {
421440 lend : {
@@ -431,7 +450,11 @@ export default function createBroadcastSlice(
431450 if ( ! isV1 && options . lend && redBankRewards . length ) {
432451 for ( const coin of redBankRewards ) {
433452 const asset = assets . find ( byDenom ( coin . denom ) )
434- if ( asset ?. isAutoLendEnabled && ! lendCoins . find ( byDenom ( coin . denom ) ) ) {
453+ if (
454+ asset ?. isAutoLendEnabled &&
455+ ! isUsdcDenom ( coin . denom ) &&
456+ ! lendCoins . find ( byDenom ( coin . denom ) )
457+ ) {
435458 actions . push ( {
436459 lend : {
437460 denom : coin . denom ,
@@ -489,7 +512,11 @@ export default function createBroadcastSlice(
489512 if ( options . lend ) {
490513 msg . update_credit_account . actions . push (
491514 ...options . coins
492- . filter ( ( coin ) => get ( ) . assets . find ( byDenom ( coin . denom ) ) ?. isAutoLendEnabled )
515+ . filter (
516+ ( coin ) =>
517+ get ( ) . assets . find ( byDenom ( coin . denom ) ) ?. isAutoLendEnabled &&
518+ ! isUsdcDenom ( coin . denom ) ,
519+ )
493520 . map ( ( coin ) => ( { lend : coin . toActionCoin ( ) } ) ) ,
494521 )
495522 }
@@ -561,7 +588,10 @@ export default function createBroadcastSlice(
561588 actions . push ( {
562589 withdraw_from_perp_vault : { } ,
563590 } )
564- if ( checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) ) {
591+ if (
592+ checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) &&
593+ ! isUsdcDenom ( vault . denoms . lp )
594+ ) {
565595 actions . push ( {
566596 lend : { denom : vault . denoms . lp , amount : 'account_balance' } ,
567597 } )
@@ -579,7 +609,7 @@ export default function createBroadcastSlice(
579609 for ( const vault of options . vaults ) {
580610 for ( const symbol of Object . values ( vault . symbols ) ) {
581611 const asset = get ( ) . assets . find ( bySymbol ( symbol ) )
582- if ( asset ?. isAutoLendEnabled ) {
612+ if ( asset ?. isAutoLendEnabled && ! isUsdcDenom ( asset . denom ) ) {
583613 msg . update_credit_account . actions . push ( {
584614 lend : { denom : asset . denom , amount : 'account_balance' } ,
585615 } )
@@ -677,7 +707,7 @@ export default function createBroadcastSlice(
677707 for ( const astroLp of options . astroLps ) {
678708 for ( const symbol of Object . values ( astroLp . symbols ) ) {
679709 const asset = get ( ) . assets . find ( bySymbol ( symbol ) )
680- if ( asset ?. isAutoLendEnabled ) {
710+ if ( asset ?. isAutoLendEnabled && ! isUsdcDenom ( asset . denom ) ) {
681711 msg . update_credit_account . actions . push ( {
682712 lend : { denom : asset . denom , amount : 'account_balance' } ,
683713 } )
@@ -904,8 +934,8 @@ export default function createBroadcastSlice(
904934 } ,
905935 depositAndLend : async ( options : { accountId : string ; coin : BNCoin } ) => {
906936 const asset = get ( ) . assets . find ( byDenom ( options . coin . denom ) )
907- if ( ! asset ?. isAutoLendEnabled ) {
908- // Asset is deposit-only (or unknown) - fall back to deposit without lending.
937+ if ( isUsdcDenom ( options . coin . denom ) || ! asset ?. isAutoLendEnabled ) {
938+ // USDC lending is disabled (or asset is deposit-only/ unknown) - fall back to deposit without lending.
909939 return get ( ) . depositSingle ( options )
910940 }
911941
@@ -1003,6 +1033,7 @@ export default function createBroadcastSlice(
10031033 if (
10041034 checkAutoLendEnabled ( options . accountId , get ( ) . chainConfig . id ) &&
10051035 get ( ) . assets . find ( byDenom ( options . denomOut ) ) ?. isAutoLendEnabled &&
1036+ ! isUsdcDenom ( options . denomOut ) &&
10061037 ! options . repay
10071038 ) {
10081039 msg . update_credit_account . actions . push ( {
@@ -1086,7 +1117,7 @@ export default function createBroadcastSlice(
10861117 } ,
10871118 } ,
10881119 ]
1089- if ( options . autolend )
1120+ if ( options . autolend && ! isUsdcDenom ( options . keeperFee . denom ) )
10901121 triggerActions . push ( {
10911122 lend : {
10921123 denom : options . keeperFee . denom ,
@@ -1196,7 +1227,7 @@ export default function createBroadcastSlice(
11961227 } ,
11971228 } ,
11981229 ]
1199- if ( order . autolend )
1230+ if ( order . autolend && ! isUsdcDenom ( order . keeperFee . denom ) )
12001231 triggerActions . push ( {
12011232 lend : {
12021233 denom : order . keeperFee . denom ,
@@ -1272,7 +1303,7 @@ export default function createBroadcastSlice(
12721303 } ,
12731304 } ,
12741305 ]
1275- if ( options . autolend )
1306+ if ( options . autolend && ! isUsdcDenom ( options . baseDenom ) )
12761307 actions . push ( {
12771308 lend : {
12781309 denom : options . baseDenom ,
@@ -1401,7 +1432,7 @@ export default function createBroadcastSlice(
14011432 } )
14021433 }
14031434
1404- if ( options . autolend ) {
1435+ if ( options . autolend && ! isUsdcDenom ( options . baseDenom ) ) {
14051436 actions . push ( {
14061437 lend : {
14071438 denom : options . baseDenom ,
@@ -1555,7 +1586,7 @@ export default function createBroadcastSlice(
15551586 }
15561587 }
15571588
1558- if ( options . autolend ) {
1589+ if ( options . autolend && ! isUsdcDenom ( options . baseDenom ) ) {
15591590 actions . push ( {
15601591 lend : {
15611592 denom : options . baseDenom ,
@@ -1594,7 +1625,7 @@ export default function createBroadcastSlice(
15941625 } ,
15951626 } ,
15961627 ]
1597- if ( options . autolend )
1628+ if ( options . autolend && ! isUsdcDenom ( options . baseDenom ) )
15981629 actions . push ( {
15991630 lend : {
16001631 denom : options . baseDenom ,
@@ -1828,7 +1859,7 @@ export default function createBroadcastSlice(
18281859 {
18291860 withdraw_from_perp_vault : { } ,
18301861 } ,
1831- ...( options . isAutoLend
1862+ ...( options . isAutoLend && ! isUsdcDenom ( options . vaultDenom )
18321863 ? [
18331864 {
18341865 lend : {
0 commit comments