File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed
pages/position-details/state Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @stakekit/widget " : patch
3+ ---
4+
5+ fix: unstake limits for ERC4626
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type { SupportedSKChains } from "./chains";
1111import type { InitParams } from "./init-params" ;
1212import type { PositionsData } from "./positions" ;
1313import type { TokenString } from "./tokens" ;
14+ import { isBittensorStaking } from "./yields" ;
1415
1516const amountGreaterThanZero = ( val : TokenBalanceScanResponseDto ) =>
1617 new BigNumber ( val . amount ) . isGreaterThan ( 0 ) ;
@@ -197,9 +198,9 @@ export const getMinUnstakeAmount = (
197198
198199 const pricePerShareBN = new BigNumber ( pricePerShare ?? 0 ) ;
199200
200- if ( pricePerShareBN . isZero ( ) ) {
201+ if ( pricePerShareBN . isZero ( ) || ! isBittensorStaking ( yieldDto . id ) ) {
201202 return integrationMin ;
202203 }
203204
204- return integrationMin . dividedBy ( pricePerShareBN ) . decimalPlaces ( 8 ) ;
205+ return integrationMin . dividedBy ( pricePerShareBN ) . decimalPlaces ( 16 ) ;
205206} ;
Original file line number Diff line number Diff line change @@ -194,3 +194,6 @@ export const getComputedRewardRate = (yieldDto: YieldDto) => {
194194
195195 return yieldDto . rewardRate ;
196196} ;
197+
198+ export const isERC4626 = ( yieldDto : YieldDto ) =>
199+ yieldDto . metadata . supportedStandards ?. includes ( "ERC4626" ) ?? false ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818} from "react" ;
1919import { config } from "../../../config" ;
2020import { isForceMaxAmount } from "../../../domain/types/stake" ;
21+ import { isERC4626 } from "../../../domain/types/yields" ;
2122import { usePrices } from "../../../hooks/api/use-prices" ;
2223import { useYieldOpportunity } from "../../../hooks/api/use-yield-opportunity" ;
2324import { useUnstakeOrPendingActionParams } from "../../../hooks/navigation/use-unstake-or-pending-action-params" ;
@@ -158,7 +159,8 @@ export const UnstakeOrPendingActionProvider = ({
158159 } ) ;
159160
160161 const canChangeUnstakeAmount = integrationData . map (
161- ( d ) => ! ! ( ! isForceMax && d . args . exit ?. args ?. amount ?. required )
162+ ( d ) =>
163+ ! ! ( ! isForceMax && ( d . args . exit ?. args ?. amount ?. required || isERC4626 ( d ) ) )
162164 ) ;
163165
164166 const positionBalancesByTypePendingActions = useMemo (
You can’t perform that action at this time.
0 commit comments