Implement dynamic routes + price impact
This commit is contained in:
parent
7cfe05ebb7
commit
8e2e16e286
@ -13,13 +13,12 @@ import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
|||||||
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
||||||
import useAllAssets from 'hooks/assets/useAllAssets'
|
import useAllAssets from 'hooks/assets/useAllAssets'
|
||||||
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
||||||
|
import useRouteInfo from 'hooks/trade/useRouteInfo'
|
||||||
import useLiquidationPrice from 'hooks/useLiquidationPrice'
|
import useLiquidationPrice from 'hooks/useLiquidationPrice'
|
||||||
import usePrice from 'hooks/usePrice'
|
import usePrice from 'hooks/usePrice'
|
||||||
import useSwapFee from 'hooks/useSwapFee'
|
|
||||||
import useToggle from 'hooks/useToggle'
|
import useToggle from 'hooks/useToggle'
|
||||||
import { BNCoin } from 'types/classes/BNCoin'
|
import { BNCoin } from 'types/classes/BNCoin'
|
||||||
import { byDenom } from 'utils/array'
|
import { formatAmountWithSymbol, formatPercent, formatValue } from 'utils/formatters'
|
||||||
import { formatAmountWithSymbol, formatPercent } from 'utils/formatters'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
borrowAmount: BigNumber
|
borrowAmount: BigNumber
|
||||||
@ -32,7 +31,6 @@ interface Props {
|
|||||||
estimatedFee: StdFee
|
estimatedFee: StdFee
|
||||||
isMargin?: boolean
|
isMargin?: boolean
|
||||||
liquidationPrice: number | null
|
liquidationPrice: number | null
|
||||||
route: Route[]
|
|
||||||
sellAmount: BigNumber
|
sellAmount: BigNumber
|
||||||
sellAsset: Asset
|
sellAsset: Asset
|
||||||
showProgressIndicator: boolean
|
showProgressIndicator: boolean
|
||||||
@ -52,7 +50,6 @@ export default function TradeSummary(props: Props) {
|
|||||||
borrowAmount,
|
borrowAmount,
|
||||||
estimatedFee,
|
estimatedFee,
|
||||||
showProgressIndicator,
|
showProgressIndicator,
|
||||||
route,
|
|
||||||
sellAmount,
|
sellAmount,
|
||||||
buyAmount,
|
buyAmount,
|
||||||
isAdvanced,
|
isAdvanced,
|
||||||
@ -61,34 +58,24 @@ export default function TradeSummary(props: Props) {
|
|||||||
const [slippage] = useLocalStorage<number>(LocalStorageKeys.SLIPPAGE, DEFAULT_SETTINGS.slippage)
|
const [slippage] = useLocalStorage<number>(LocalStorageKeys.SLIPPAGE, DEFAULT_SETTINGS.slippage)
|
||||||
const assets = useAllAssets()
|
const assets = useAllAssets()
|
||||||
const sellAssetPrice = usePrice(sellAsset.denom)
|
const sellAssetPrice = usePrice(sellAsset.denom)
|
||||||
// FIXME: ⛓️ Swap fee needs to be chainagnostic!
|
|
||||||
const swapFee = useSwapFee(route.map((route) => route.pool_id))
|
|
||||||
const [showSummary, setShowSummary] = useToggle()
|
const [showSummary, setShowSummary] = useToggle()
|
||||||
const { liquidationPrice, isUpdatingLiquidationPrice } = useLiquidationPrice(
|
const { liquidationPrice, isUpdatingLiquidationPrice } = useLiquidationPrice(
|
||||||
props.liquidationPrice,
|
props.liquidationPrice,
|
||||||
)
|
)
|
||||||
|
const { data: routeInfo } = useRouteInfo(sellAsset.denom, buyAsset.denom, sellAmount)
|
||||||
|
|
||||||
const minReceive = useMemo(() => {
|
const minReceive = useMemo(() => {
|
||||||
return buyAmount.times(1 - swapFee).times(1 - slippage)
|
return buyAmount.times(1 - (routeInfo?.fee.toNumber() || 0)).times(1 - slippage)
|
||||||
}, [buyAmount, slippage, swapFee])
|
}, [buyAmount, routeInfo?.fee, slippage])
|
||||||
|
|
||||||
const swapFeeValue = useMemo(() => {
|
const swapFeeValue = useMemo(() => {
|
||||||
return sellAssetPrice.times(swapFee).times(sellAmount)
|
return sellAmount.times(routeInfo?.fee || 0).times(sellAssetPrice)
|
||||||
}, [sellAmount, sellAssetPrice, swapFee])
|
}, [routeInfo?.fee, sellAmount, sellAssetPrice])
|
||||||
|
|
||||||
const parsedRoutes = useMemo(() => {
|
|
||||||
if (!route.length) return '-'
|
|
||||||
|
|
||||||
const routeSymbols = route.map((r) => assets.find(byDenom(r.token_out_denom))?.symbol)
|
|
||||||
routeSymbols.unshift(sellAsset.symbol)
|
|
||||||
|
|
||||||
return routeSymbols.join(' -> ')
|
|
||||||
}, [assets, route, sellAsset.symbol])
|
|
||||||
|
|
||||||
const buttonText = useMemo(() => {
|
const buttonText = useMemo(() => {
|
||||||
if (!isAdvanced && direction === 'short') return `Sell ${sellAsset.symbol}`
|
if (!isAdvanced && direction === 'short') return `Sell ${sellAsset.symbol}`
|
||||||
return route.length ? `Buy ${buyAsset.symbol}` : 'No route found'
|
return `Buy ${buyAsset.symbol}`
|
||||||
}, [buyAsset.symbol, route, sellAsset.symbol, isAdvanced, direction])
|
}, [isAdvanced, direction, sellAsset.symbol, buyAsset.symbol])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -155,7 +142,26 @@ export default function TradeSummary(props: Props) {
|
|||||||
</div>
|
</div>
|
||||||
{showSummary && (
|
{showSummary && (
|
||||||
<>
|
<>
|
||||||
<SummaryLine label={`Swap fees (${(swapFee || 0.002) * 100}%)`} className='mt-2'>
|
<SummaryLine label='Price impact' className='mt-2'>
|
||||||
|
{routeInfo?.priceImpact ? (
|
||||||
|
<FormattedNumber
|
||||||
|
amount={routeInfo?.priceImpact.times(100).toNumber() || 0}
|
||||||
|
options={{ suffix: '%' }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
'-'
|
||||||
|
)}
|
||||||
|
</SummaryLine>
|
||||||
|
<SummaryLine
|
||||||
|
label={`Swap fees ${
|
||||||
|
routeInfo?.fee
|
||||||
|
? formatValue(routeInfo.fee.times(100).decimalPlaces(2).toNumber(), {
|
||||||
|
prefix: '(',
|
||||||
|
suffix: '%)',
|
||||||
|
})
|
||||||
|
: ''
|
||||||
|
}`}
|
||||||
|
>
|
||||||
<DisplayCurrency coin={BNCoin.fromDenomAndBigNumber(sellAsset.denom, swapFeeValue)} />
|
<DisplayCurrency coin={BNCoin.fromDenomAndBigNumber(sellAsset.denom, swapFeeValue)} />
|
||||||
</SummaryLine>
|
</SummaryLine>
|
||||||
<SummaryLine label='Transaction fees'>
|
<SummaryLine label='Transaction fees'>
|
||||||
@ -172,7 +178,7 @@ export default function TradeSummary(props: Props) {
|
|||||||
/>
|
/>
|
||||||
</SummaryLine>
|
</SummaryLine>
|
||||||
<Divider className='my-2' />
|
<Divider className='my-2' />
|
||||||
<SummaryLine label='Route'>{parsedRoutes}</SummaryLine>
|
<SummaryLine label='Route'>{routeInfo?.description}</SummaryLine>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,10 +24,10 @@ import useMarketEnabledAssets from 'hooks/assets/useMarketEnabledAssets'
|
|||||||
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
||||||
import useMarketAssets from 'hooks/markets/useMarketAssets'
|
import useMarketAssets from 'hooks/markets/useMarketAssets'
|
||||||
import useMarketBorrowings from 'hooks/markets/useMarketBorrowings'
|
import useMarketBorrowings from 'hooks/markets/useMarketBorrowings'
|
||||||
|
import useRouteInfo from 'hooks/trade/useRouteInfo'
|
||||||
import useAutoLend from 'hooks/useAutoLend'
|
import useAutoLend from 'hooks/useAutoLend'
|
||||||
import useChainConfig from 'hooks/useChainConfig'
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
import useHealthComputer from 'hooks/useHealthComputer'
|
import useHealthComputer from 'hooks/useHealthComputer'
|
||||||
import useSwapRoute from 'hooks/useSwapRoute'
|
|
||||||
import useToggle from 'hooks/useToggle'
|
import useToggle from 'hooks/useToggle'
|
||||||
import { useUpdatedAccount } from 'hooks/useUpdatedAccount'
|
import { useUpdatedAccount } from 'hooks/useUpdatedAccount'
|
||||||
import useStore from 'store'
|
import useStore from 'store'
|
||||||
@ -61,10 +61,6 @@ export default function SwapForm(props: Props) {
|
|||||||
if (tradeDirection === 'long') return [sellAsset, buyAsset]
|
if (tradeDirection === 'long') return [sellAsset, buyAsset]
|
||||||
return [buyAsset, sellAsset]
|
return [buyAsset, sellAsset]
|
||||||
}, [buyAsset, sellAsset, tradeDirection, isAdvanced])
|
}, [buyAsset, sellAsset, tradeDirection, isAdvanced])
|
||||||
const { data: route, isLoading: isRouteLoading } = useSwapRoute(
|
|
||||||
inputAsset.denom,
|
|
||||||
outputAsset.denom,
|
|
||||||
)
|
|
||||||
const isBorrowEnabled = !!marketAssets.find(byDenom(inputAsset.denom))?.borrowEnabled
|
const isBorrowEnabled = !!marketAssets.find(byDenom(inputAsset.denom))?.borrowEnabled
|
||||||
const isRepayable = !!account?.debts.find(byDenom(outputAsset.denom))
|
const isRepayable = !!account?.debts.find(byDenom(outputAsset.denom))
|
||||||
const [isMarginChecked, setMarginChecked] = useToggle(isBorrowEnabled ? useMargin : false)
|
const [isMarginChecked, setMarginChecked] = useToggle(isBorrowEnabled ? useMargin : false)
|
||||||
@ -85,6 +81,7 @@ export default function SwapForm(props: Props) {
|
|||||||
const { computeLiquidationPrice } = useHealthComputer(updatedAccount)
|
const { computeLiquidationPrice } = useHealthComputer(updatedAccount)
|
||||||
const chainConfig = useChainConfig()
|
const chainConfig = useChainConfig()
|
||||||
const assets = useMarketEnabledAssets()
|
const assets = useMarketEnabledAssets()
|
||||||
|
const { data: routeInfo } = useRouteInfo(sellAsset.denom, buyAsset.denom, inputAssetAmount)
|
||||||
|
|
||||||
const depositCapReachedCoins: BNCoin[] = useMemo(() => {
|
const depositCapReachedCoins: BNCoin[] = useMemo(() => {
|
||||||
const outputMarketAsset = marketAssets.find(byDenom(outputAsset.denom))
|
const outputMarketAsset = marketAssets.find(byDenom(outputAsset.denom))
|
||||||
@ -165,6 +162,8 @@ export default function SwapForm(props: Props) {
|
|||||||
}, [marginRatio, maxOutputAmountEstimation])
|
}, [marginRatio, maxOutputAmountEstimation])
|
||||||
|
|
||||||
const swapTx = useMemo(() => {
|
const swapTx = useMemo(() => {
|
||||||
|
if (!routeInfo) return
|
||||||
|
|
||||||
const borrowCoin = inputAssetAmount.isGreaterThan(imputMarginThreshold)
|
const borrowCoin = inputAssetAmount.isGreaterThan(imputMarginThreshold)
|
||||||
? BNCoin.fromDenomAndBigNumber(inputAsset.denom, inputAssetAmount.minus(imputMarginThreshold))
|
? BNCoin.fromDenomAndBigNumber(inputAsset.denom, inputAssetAmount.minus(imputMarginThreshold))
|
||||||
: undefined
|
: undefined
|
||||||
@ -178,16 +177,18 @@ export default function SwapForm(props: Props) {
|
|||||||
slippage,
|
slippage,
|
||||||
isMax: inputAssetAmount.isEqualTo(maxInputAmount),
|
isMax: inputAssetAmount.isEqualTo(maxInputAmount),
|
||||||
repay: isAutoRepayChecked,
|
repay: isAutoRepayChecked,
|
||||||
|
route: routeInfo.route,
|
||||||
})
|
})
|
||||||
}, [
|
}, [
|
||||||
removedLends,
|
routeInfo,
|
||||||
account?.id,
|
inputAssetAmount,
|
||||||
outputAsset.denom,
|
|
||||||
imputMarginThreshold,
|
imputMarginThreshold,
|
||||||
inputAsset.denom,
|
inputAsset.denom,
|
||||||
inputAssetAmount,
|
|
||||||
slippage,
|
|
||||||
swap,
|
swap,
|
||||||
|
account?.id,
|
||||||
|
removedLends,
|
||||||
|
outputAsset.denom,
|
||||||
|
slippage,
|
||||||
maxInputAmount,
|
maxInputAmount,
|
||||||
isAutoRepayChecked,
|
isAutoRepayChecked,
|
||||||
])
|
])
|
||||||
@ -227,14 +228,14 @@ export default function SwapForm(props: Props) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
swapTx.estimateFee().then(setEstimatedFee)
|
swapTx?.estimateFee().then(setEstimatedFee)
|
||||||
}, [swapTx])
|
}, [swapTx])
|
||||||
|
|
||||||
const handleBuyClick = useCallback(async () => {
|
const handleBuyClick = useCallback(async () => {
|
||||||
if (account?.id) {
|
if (account?.id) {
|
||||||
setIsConfirming(true)
|
setIsConfirming(true)
|
||||||
|
|
||||||
const isSucceeded = await swapTx.execute()
|
const isSucceeded = await swapTx?.execute()
|
||||||
|
|
||||||
if (isSucceeded) {
|
if (isSucceeded) {
|
||||||
setInputAssetAmount(BN_ZERO)
|
setInputAssetAmount(BN_ZERO)
|
||||||
@ -332,9 +333,8 @@ export default function SwapForm(props: Props) {
|
|||||||
() =>
|
() =>
|
||||||
inputAssetAmount.isZero() ||
|
inputAssetAmount.isZero() ||
|
||||||
depositCapReachedCoins.length > 0 ||
|
depositCapReachedCoins.length > 0 ||
|
||||||
borrowAmount.isGreaterThan(availableLiquidity) ||
|
borrowAmount.isGreaterThan(availableLiquidity),
|
||||||
route.length === 0,
|
[inputAssetAmount, depositCapReachedCoins, borrowAmount, availableLiquidity],
|
||||||
[inputAssetAmount, depositCapReachedCoins, borrowAmount, availableLiquidity, route],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -453,11 +453,10 @@ export default function SwapForm(props: Props) {
|
|||||||
borrowRate={borrowAsset?.borrowRate}
|
borrowRate={borrowAsset?.borrowRate}
|
||||||
buyAction={handleBuyClick}
|
buyAction={handleBuyClick}
|
||||||
buyButtonDisabled={isSwapDisabled}
|
buyButtonDisabled={isSwapDisabled}
|
||||||
showProgressIndicator={isConfirming || isRouteLoading}
|
showProgressIndicator={isConfirming}
|
||||||
isMargin={isMarginChecked}
|
isMargin={isMarginChecked}
|
||||||
borrowAmount={borrowAmount}
|
borrowAmount={borrowAmount}
|
||||||
estimatedFee={estimatedFee}
|
estimatedFee={estimatedFee}
|
||||||
route={route}
|
|
||||||
liquidationPrice={liquidationPrice}
|
liquidationPrice={liquidationPrice}
|
||||||
sellAmount={inputAssetAmount}
|
sellAmount={inputAssetAmount}
|
||||||
buyAmount={outputAssetAmount}
|
buyAmount={outputAssetAmount}
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
|
|
||||||
|
import useAllAssets from 'hooks/assets/useAllAssets'
|
||||||
import useChainConfig from 'hooks/useChainConfig'
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
import useDebounce from 'hooks/useDebounce'
|
||||||
import { ChainInfoID } from 'types/enums/wallet'
|
import { ChainInfoID } from 'types/enums/wallet'
|
||||||
|
import { byDenom } from 'utils/array'
|
||||||
import { BN } from 'utils/helpers'
|
import { BN } from 'utils/helpers'
|
||||||
|
|
||||||
export default function useRoutes(denomIn: string, denomOut: string, amount: BigNumber) {
|
export default function useRouteInfo(denomIn: string, denomOut: string, amount: BigNumber) {
|
||||||
const chainConfig = useChainConfig()
|
const chainConfig = useChainConfig()
|
||||||
const isOsmosis = [ChainInfoID.Osmosis1, ChainInfoID.OsmosisDevnet].includes(chainConfig.id)
|
const isOsmosis = [ChainInfoID.Osmosis1, ChainInfoID.OsmosisDevnet].includes(chainConfig.id)
|
||||||
|
const assets = useAllAssets()
|
||||||
|
const debouncedAmount = useDebounce<string>(amount.toString(), 500)
|
||||||
|
|
||||||
const osmosisRoute = useSWR<SwapRouteInfo | null>(
|
const osmosisRoute = useSWR<SwapRouteInfo | null>(
|
||||||
isOsmosis &&
|
isOsmosis &&
|
||||||
`${chainConfig.endpoints.routes}/quote?tokenIn=${denomIn}&tokenOutDenom=${denomOut}&amount=${amount}`,
|
`${chainConfig.endpoints.routes}/quote?tokenIn=${debouncedAmount}${denomIn}&tokenOutDenom=${denomOut}`,
|
||||||
async (url: string) => {
|
async (url: string) => {
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url)
|
const resp = await fetch(url)
|
||||||
@ -19,15 +24,24 @@ export default function useRoutes(denomIn: string, denomOut: string, amount: Big
|
|||||||
return {
|
return {
|
||||||
priceImpact: BN(route.price_impact),
|
priceImpact: BN(route.price_impact),
|
||||||
fee: BN(route.effective_fee),
|
fee: BN(route.effective_fee),
|
||||||
|
description: [
|
||||||
|
assets.find(byDenom(denomIn))?.symbol,
|
||||||
|
...route.route[0].pools.map(
|
||||||
|
(pool) => assets.find(byDenom(pool.token_out_denom))?.symbol,
|
||||||
|
),
|
||||||
|
].join(' -> '),
|
||||||
route: {
|
route: {
|
||||||
osmo: {
|
osmo: {
|
||||||
swaps: route.route[0].pools.map((pool) => ({
|
swaps: route.route[0].pools.map(
|
||||||
pool_id: pool.id.toString(),
|
(pool) =>
|
||||||
to: pool.token_out_denom,
|
({
|
||||||
})),
|
pool_id: pool.id.toString(),
|
||||||
|
to: pool.token_out_denom,
|
||||||
|
}) as unknown,
|
||||||
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
} as SwapRouteInfo
|
||||||
} catch {
|
} catch {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -36,7 +50,7 @@ export default function useRoutes(denomIn: string, denomOut: string, amount: Big
|
|||||||
|
|
||||||
const astroportRoute = useSWR<SwapRouteInfo | null>(
|
const astroportRoute = useSWR<SwapRouteInfo | null>(
|
||||||
!isOsmosis &&
|
!isOsmosis &&
|
||||||
`${chainConfig.endpoints.routes}?start=${denomIn}&end=${denomOut}&amount=${amount}&chainId=${chainConfig.id}&limit=1`,
|
`${chainConfig.endpoints.routes}?start=${denomIn}&end=${denomOut}&amount=${debouncedAmount}&chainId=${chainConfig.id}&limit=1`,
|
||||||
async (url: string) => {
|
async (url: string) => {
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url)
|
const resp = await fetch(url)
|
||||||
@ -45,6 +59,10 @@ export default function useRoutes(denomIn: string, denomOut: string, amount: Big
|
|||||||
return {
|
return {
|
||||||
priceImpact: BN(route.price_impact),
|
priceImpact: BN(route.price_impact),
|
||||||
fee: BN(0), // TODO: Fees are not implemented yet on Astroport endpoint
|
fee: BN(0), // TODO: Fees are not implemented yet on Astroport endpoint
|
||||||
|
description: [
|
||||||
|
assets.find(byDenom(denomIn))?.symbol,
|
||||||
|
...route.swaps.map((swap) => assets.find(byDenom(swap.to))?.symbol),
|
||||||
|
].join(' -> '),
|
||||||
route: {
|
route: {
|
||||||
astro: {
|
astro: {
|
||||||
swaps: route.swaps.map((swap) => ({
|
swaps: route.swaps.map((swap) => ({
|
@ -1,23 +0,0 @@
|
|||||||
import useSWR from 'swr'
|
|
||||||
|
|
||||||
import getOsmosisSwapFee from 'api/swap/getOsmosisSwapFee'
|
|
||||||
import useChainConfig from 'hooks/useChainConfig'
|
|
||||||
import { ChainInfoID } from 'types/enums/wallet'
|
|
||||||
import { STANDARD_SWAP_FEE } from 'utils/constants'
|
|
||||||
|
|
||||||
export default function useSwapFee(poolIds: string[]) {
|
|
||||||
const chainConfig = useChainConfig()
|
|
||||||
const { data: swapFee } = useSWR(
|
|
||||||
`chains/${chainConfig.id}/swapFees/${poolIds.join(',')}`,
|
|
||||||
() => {
|
|
||||||
if (chainConfig.id === ChainInfoID.Pion1) {
|
|
||||||
return STANDARD_SWAP_FEE
|
|
||||||
}
|
|
||||||
|
|
||||||
return getOsmosisSwapFee(chainConfig, poolIds)
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
)
|
|
||||||
|
|
||||||
return swapFee ?? STANDARD_SWAP_FEE
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
import useSWR from 'swr'
|
|
||||||
|
|
||||||
import getSwapRoute from 'api/swap/getSwapRoute'
|
|
||||||
import useChainConfig from 'hooks/useChainConfig'
|
|
||||||
|
|
||||||
export default function useSwapRoute(denomIn: string, denomOut: string) {
|
|
||||||
const chainConfig = useChainConfig()
|
|
||||||
return useSWR(
|
|
||||||
`swapRoute-${denomIn}-${denomOut}`,
|
|
||||||
() => getSwapRoute(chainConfig, denomIn, denomOut),
|
|
||||||
{
|
|
||||||
fallbackData: [],
|
|
||||||
revalidateOnFocus: false,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
@ -15,6 +15,7 @@ import {
|
|||||||
Action as CreditManagerAction,
|
Action as CreditManagerAction,
|
||||||
ExecuteMsg as CreditManagerExecuteMsg,
|
ExecuteMsg as CreditManagerExecuteMsg,
|
||||||
ExecuteMsg,
|
ExecuteMsg,
|
||||||
|
SwapperRoute,
|
||||||
} from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
} from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
||||||
import { AccountKind } from 'types/generated/mars-rover-health-types/MarsRoverHealthTypes.types'
|
import { AccountKind } from 'types/generated/mars-rover-health-types/MarsRoverHealthTypes.types'
|
||||||
import { byDenom, bySymbol } from 'utils/array'
|
import { byDenom, bySymbol } from 'utils/array'
|
||||||
@ -764,6 +765,7 @@ export default function createBroadcastSlice(
|
|||||||
slippage: number
|
slippage: number
|
||||||
isMax?: boolean
|
isMax?: boolean
|
||||||
repay: boolean
|
repay: boolean
|
||||||
|
route: SwapperRoute
|
||||||
}) => {
|
}) => {
|
||||||
const msg: CreditManagerExecuteMsg = {
|
const msg: CreditManagerExecuteMsg = {
|
||||||
update_credit_account: {
|
update_credit_account: {
|
||||||
@ -776,6 +778,7 @@ export default function createBroadcastSlice(
|
|||||||
coin_in: options.coinIn.toActionCoin(options.isMax),
|
coin_in: options.coinIn.toActionCoin(options.isMax),
|
||||||
denom_out: options.denomOut,
|
denom_out: options.denomOut,
|
||||||
slippage: options.slippage.toString(),
|
slippage: options.slippage.toString(),
|
||||||
|
route: options.route as SwapperRoute,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...(options.repay
|
...(options.repay
|
||||||
|
@ -28,62 +28,62 @@ export interface InstantiateMsg {
|
|||||||
}
|
}
|
||||||
export type ExecuteMsg =
|
export type ExecuteMsg =
|
||||||
| {
|
| {
|
||||||
create_credit_account: AccountKind
|
create_credit_account: AccountKind
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_credit_account: {
|
update_credit_account: {
|
||||||
account_id: string
|
account_id: string
|
||||||
actions: Action[]
|
actions: Action[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
repay_from_wallet: {
|
repay_from_wallet: {
|
||||||
account_id: string
|
account_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_config: {
|
update_config: {
|
||||||
updates: ConfigUpdates
|
updates: ConfigUpdates
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_owner: OwnerUpdate
|
update_owner: OwnerUpdate
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_nft_config: {
|
update_nft_config: {
|
||||||
config?: NftConfigUpdates | null
|
config?: NftConfigUpdates | null
|
||||||
ownership?: Action2 | null
|
ownership?: Action2 | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
callback: CallbackMsg
|
callback: CallbackMsg
|
||||||
}
|
}
|
||||||
export type AccountKind = 'default' | 'high_levered_strategy'
|
export type AccountKind = 'default' | 'high_levered_strategy'
|
||||||
export type Action =
|
export type Action =
|
||||||
| {
|
| {
|
||||||
deposit: Coin
|
deposit: Coin
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
withdraw: ActionCoin
|
withdraw: ActionCoin
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
borrow: Coin
|
borrow: Coin
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
lend: ActionCoin
|
lend: ActionCoin
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
reclaim: ActionCoin
|
reclaim: ActionCoin
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
claim_rewards: {}
|
claim_rewards: {}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
repay: {
|
repay: {
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
recipient_account_id?: string | null
|
recipient_account_id?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
open_perp: {
|
open_perp: {
|
||||||
denom: string
|
denom: string
|
||||||
@ -102,166 +102,173 @@ export type Action =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
exit_vault: {
|
exit_vault: {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForString
|
vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
request_vault_unlock: {
|
request_vault_unlock: {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForString
|
vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
exit_vault_unlocked: {
|
exit_vault_unlocked: {
|
||||||
id: number
|
id: number
|
||||||
vault: VaultBaseForString
|
vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
liquidate: {
|
liquidate: {
|
||||||
debt_coin: Coin
|
debt_coin: Coin
|
||||||
liquidatee_account_id: string
|
liquidatee_account_id: string
|
||||||
request: LiquidateRequestForVaultBaseForString
|
request: LiquidateRequestForVaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
swap_exact_in: {
|
swap_exact_in: {
|
||||||
coin_in: ActionCoin
|
coin_in: ActionCoin
|
||||||
denom_out: string
|
denom_out: string
|
||||||
slippage: Decimal
|
route?: SwapperRoute | null
|
||||||
}
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
provide_liquidity: {
|
provide_liquidity: {
|
||||||
coins_in: ActionCoin[]
|
coins_in: ActionCoin[]
|
||||||
lp_token_out: string
|
lp_token_out: string
|
||||||
slippage: Decimal
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
withdraw_liquidity: {
|
withdraw_liquidity: {
|
||||||
lp_token: ActionCoin
|
lp_token: ActionCoin
|
||||||
slippage: Decimal
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
refund_all_coin_balances: {}
|
refund_all_coin_balances: {}
|
||||||
}
|
}
|
||||||
export type ActionAmount =
|
export type ActionAmount =
|
||||||
| 'account_balance'
|
| 'account_balance'
|
||||||
| {
|
| {
|
||||||
exact: Uint128
|
exact: Uint128
|
||||||
}
|
}
|
||||||
export type LiquidateRequestForVaultBaseForString =
|
export type LiquidateRequestForVaultBaseForString =
|
||||||
| {
|
| {
|
||||||
deposit: string
|
deposit: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
lend: string
|
lend: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault: {
|
vault: {
|
||||||
position_type: VaultPositionType
|
position_type: VaultPositionType
|
||||||
request_vault: VaultBaseForString
|
request_vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g'
|
export type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g'
|
||||||
|
export type SwapperRoute =
|
||||||
|
| {
|
||||||
|
astro: AstroRoute
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
osmo: OsmoRoute
|
||||||
|
}
|
||||||
export type AccountNftBaseForString = string
|
export type AccountNftBaseForString = string
|
||||||
export type PerpsBaseForString = string
|
|
||||||
export type OwnerUpdate =
|
export type OwnerUpdate =
|
||||||
| {
|
| {
|
||||||
propose_new_owner: {
|
propose_new_owner: {
|
||||||
proposed: string
|
proposed: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| 'clear_proposed'
|
| 'clear_proposed'
|
||||||
| 'accept_proposed'
|
| 'accept_proposed'
|
||||||
| 'abolish_owner_role'
|
| 'abolish_owner_role'
|
||||||
| {
|
| {
|
||||||
set_emergency_owner: {
|
set_emergency_owner: {
|
||||||
emergency_owner: string
|
emergency_owner: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| 'clear_emergency_owner'
|
| 'clear_emergency_owner'
|
||||||
export type Action2 =
|
export type Action2 =
|
||||||
| {
|
| {
|
||||||
transfer_ownership: {
|
transfer_ownership: {
|
||||||
expiry?: Expiration | null
|
expiry?: Expiration | null
|
||||||
new_owner: string
|
new_owner: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| 'accept_ownership'
|
| 'accept_ownership'
|
||||||
| 'renounce_ownership'
|
| 'renounce_ownership'
|
||||||
export type Expiration =
|
export type Expiration =
|
||||||
| {
|
| {
|
||||||
at_height: number
|
at_height: number
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
at_time: Timestamp
|
at_time: Timestamp
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
never: {}
|
never: {}
|
||||||
}
|
}
|
||||||
export type Timestamp = Uint64
|
export type Timestamp = Uint64
|
||||||
export type Uint64 = string
|
export type Uint64 = string
|
||||||
export type CallbackMsg =
|
export type CallbackMsg =
|
||||||
| {
|
| {
|
||||||
withdraw: {
|
withdraw: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
recipient: Addr
|
recipient: Addr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
borrow: {
|
borrow: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coin: Coin
|
coin: Coin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
repay: {
|
repay: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
repay_for_recipient: {
|
repay_for_recipient: {
|
||||||
benefactor_account_id: string
|
benefactor_account_id: string
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
recipient_account_id: string
|
recipient_account_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
lend: {
|
lend: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
reclaim: {
|
reclaim: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
claim_rewards: {
|
claim_rewards: {
|
||||||
account_id: string
|
account_id: string
|
||||||
recipient: Addr
|
recipient: Addr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
assert_max_ltv: {
|
assert_max_ltv: {
|
||||||
account_id: string
|
account_id: string
|
||||||
prev_health_state: HealthState
|
prev_health_state: HealthState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
assert_deposit_caps: {
|
assert_deposit_caps: {
|
||||||
denoms: string[]
|
denoms: string[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
open_perp: {
|
open_perp: {
|
||||||
account_id: string
|
account_id: string
|
||||||
@ -283,119 +290,120 @@ export type CallbackMsg =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
exit_vault: {
|
exit_vault: {
|
||||||
account_id: string
|
account_id: string
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_vault_coin_balance: {
|
update_vault_coin_balance: {
|
||||||
account_id: string
|
account_id: string
|
||||||
previous_total_balance: Uint128
|
previous_total_balance: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
request_vault_unlock: {
|
request_vault_unlock: {
|
||||||
account_id: string
|
account_id: string
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
exit_vault_unlocked: {
|
exit_vault_unlocked: {
|
||||||
account_id: string
|
account_id: string
|
||||||
position_id: number
|
position_id: number
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
liquidate: {
|
liquidate: {
|
||||||
debt_coin: Coin
|
debt_coin: Coin
|
||||||
liquidatee_account_id: string
|
liquidatee_account_id: string
|
||||||
liquidator_account_id: string
|
liquidator_account_id: string
|
||||||
request: LiquidateRequestForVaultBaseForAddr
|
request: LiquidateRequestForVaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
swap_exact_in: {
|
swap_exact_in: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coin_in: ActionCoin
|
coin_in: ActionCoin
|
||||||
denom_out: string
|
denom_out: string
|
||||||
slippage: Decimal
|
route?: SwapperRoute | null
|
||||||
}
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
update_coin_balance: {
|
update_coin_balance: {
|
||||||
account_id: string
|
account_id: string
|
||||||
change: ChangeExpected
|
change: ChangeExpected
|
||||||
previous_balance: Coin
|
previous_balance: Coin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_coin_balance_after_vault_liquidation: {
|
update_coin_balance_after_vault_liquidation: {
|
||||||
account_id: string
|
account_id: string
|
||||||
previous_balance: Coin
|
previous_balance: Coin
|
||||||
protocol_fee: Decimal
|
protocol_fee: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
provide_liquidity: {
|
provide_liquidity: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coins_in: ActionCoin[]
|
coins_in: ActionCoin[]
|
||||||
lp_token_out: string
|
lp_token_out: string
|
||||||
slippage: Decimal
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
withdraw_liquidity: {
|
withdraw_liquidity: {
|
||||||
account_id: string
|
account_id: string
|
||||||
lp_token: ActionCoin
|
lp_token: ActionCoin
|
||||||
slippage: Decimal
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
refund_all_coin_balances: {
|
refund_all_coin_balances: {
|
||||||
account_id: string
|
account_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
assert_hls_rules: {
|
assert_hls_rules: {
|
||||||
account_id: string
|
account_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
remove_reentrancy_guard: {}
|
remove_reentrancy_guard: {}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
send_rewards_to_addr: {
|
send_rewards_to_addr: {
|
||||||
account_id: string
|
account_id: string
|
||||||
previous_balances: Coin[]
|
previous_balances: Coin[]
|
||||||
recipient: Addr
|
recipient: Addr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type Addr = string
|
export type Addr = string
|
||||||
export type HealthState =
|
export type HealthState =
|
||||||
| 'healthy'
|
| 'healthy'
|
||||||
| {
|
| {
|
||||||
unhealthy: {
|
unhealthy: {
|
||||||
max_ltv_health_factor: Decimal
|
max_ltv_health_factor: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type LiquidateRequestForVaultBaseForAddr =
|
export type LiquidateRequestForVaultBaseForAddr =
|
||||||
| {
|
| {
|
||||||
deposit: string
|
deposit: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
lend: string
|
lend: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault: {
|
vault: {
|
||||||
position_type: VaultPositionType
|
position_type: VaultPositionType
|
||||||
request_vault: VaultBaseForAddr
|
request_vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type ChangeExpected = 'increase' | 'decrease'
|
export type ChangeExpected = 'increase' | 'decrease'
|
||||||
export interface Coin {
|
export interface Coin {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
@ -414,6 +422,20 @@ export interface SignedDecimal {
|
|||||||
export interface VaultBaseForString {
|
export interface VaultBaseForString {
|
||||||
address: string
|
address: string
|
||||||
}
|
}
|
||||||
|
export interface AstroRoute {
|
||||||
|
swaps: AstroSwap[]
|
||||||
|
}
|
||||||
|
export interface AstroSwap {
|
||||||
|
from: string
|
||||||
|
to: string
|
||||||
|
}
|
||||||
|
export interface OsmoRoute {
|
||||||
|
swaps: OsmoSwap[]
|
||||||
|
}
|
||||||
|
export interface OsmoSwap {
|
||||||
|
pool_id: number
|
||||||
|
to: string
|
||||||
|
}
|
||||||
export interface ConfigUpdates {
|
export interface ConfigUpdates {
|
||||||
account_nft?: AccountNftBaseForString | null
|
account_nft?: AccountNftBaseForString | null
|
||||||
health_contract?: HealthContractBaseForString | null
|
health_contract?: HealthContractBaseForString | null
|
||||||
@ -438,80 +460,80 @@ export interface VaultBaseForAddr {
|
|||||||
}
|
}
|
||||||
export type QueryMsg =
|
export type QueryMsg =
|
||||||
| {
|
| {
|
||||||
account_kind: {
|
account_kind: {
|
||||||
account_id: string
|
account_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
accounts: {
|
accounts: {
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
owner: string
|
owner: string
|
||||||
start_after?: string | null
|
start_after?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
config: {}
|
config: {}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_utilization: {
|
vault_utilization: {
|
||||||
vault: VaultBaseForString
|
vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
positions: {
|
positions: {
|
||||||
account_id: string
|
account_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
all_coin_balances: {
|
all_coin_balances: {
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: [string, string] | null
|
start_after?: [string, string] | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
all_debt_shares: {
|
all_debt_shares: {
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: [string, string] | null
|
start_after?: [string, string] | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
total_debt_shares: string
|
total_debt_shares: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
all_total_debt_shares: {
|
all_total_debt_shares: {
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: string | null
|
start_after?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
all_vault_positions: {
|
all_vault_positions: {
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: [string, string] | null
|
start_after?: [string, string] | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
estimate_provide_liquidity: {
|
estimate_provide_liquidity: {
|
||||||
coins_in: Coin[]
|
coins_in: Coin[]
|
||||||
lp_token_out: string
|
lp_token_out: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
estimate_withdraw_liquidity: {
|
estimate_withdraw_liquidity: {
|
||||||
lp_token: Coin
|
lp_token: Coin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_position_value: {
|
vault_position_value: {
|
||||||
vault_position: VaultPosition
|
vault_position: VaultPosition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type VaultPositionAmount =
|
export type VaultPositionAmount =
|
||||||
| {
|
| {
|
||||||
unlocked: VaultAmount
|
unlocked: VaultAmount
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
locking: LockingVaultAmount
|
locking: LockingVaultAmount
|
||||||
}
|
}
|
||||||
export type VaultAmount = string
|
export type VaultAmount = string
|
||||||
export type VaultAmount1 = string
|
export type VaultAmount1 = string
|
||||||
export type UnlockingPositions = VaultUnlockingPosition[]
|
export type UnlockingPositions = VaultUnlockingPosition[]
|
||||||
|
21
src/types/interfaces/route.d.ts
vendored
21
src/types/interfaces/route.d.ts
vendored
@ -42,25 +42,8 @@ type OsmosisRoutePool = {
|
|||||||
type SwapRouteInfo = {
|
type SwapRouteInfo = {
|
||||||
priceImpact: BigNumber
|
priceImpact: BigNumber
|
||||||
fee: BigNumber
|
fee: BigNumber
|
||||||
route: OsmosisSwap | AstroportSwap
|
route: import('types/generated/mars-credit-manager/MarsCreditManager.types').SwapperRoute
|
||||||
}
|
description: string
|
||||||
|
|
||||||
type OsmosisSwap = {
|
|
||||||
osmo: {
|
|
||||||
swaps: {
|
|
||||||
pool_id: string
|
|
||||||
to: string
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type AstroportSwap = {
|
|
||||||
astro: {
|
|
||||||
swaps: {
|
|
||||||
from: string
|
|
||||||
to: string
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AstroportRouteResponse = {
|
type AstroportRouteResponse = {
|
||||||
|
1
src/types/interfaces/store/broadcast.d.ts
vendored
1
src/types/interfaces/store/broadcast.d.ts
vendored
@ -141,6 +141,7 @@ interface BroadcastSlice {
|
|||||||
slippage: number
|
slippage: number
|
||||||
isMax?: boolean
|
isMax?: boolean
|
||||||
repay: boolean
|
repay: boolean
|
||||||
|
route: import('types/generated/mars-credit-manager/MarsCreditManager.types').SwapperRoute
|
||||||
}) => ExecutableTx
|
}) => ExecutableTx
|
||||||
toast: ToastResponse | ToastPending | null
|
toast: ToastResponse | ToastPending | null
|
||||||
unlock: (options: {
|
unlock: (options: {
|
||||||
|
Loading…
Reference in New Issue
Block a user