Skip to content

Commit 838ec87

Browse files
authored
Merge pull request #1312 from mars-protocol/develop
v2.8.6
2 parents 8bccad9 + 6eda832 commit 838ec87

19 files changed

+27
-223
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mars-v2-frontend",
3-
"version": "2.8.5",
3+
"version": "2.8.6",
44
"homepage": "./",
55
"private": false,
66
"license": "SEE LICENSE IN LICENSE FILE",

src/components/Modals/Hls/Manage/ChangeLeverage.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import LeverageSummary from 'components/Modals/Hls/Deposit/LeverageSummary'
55
import { BN_ZERO } from 'constants/math'
66
import { useUpdatedAccount } from 'hooks/accounts/useUpdatedAccount'
77
import useDepositEnabledAssets from 'hooks/assets/useDepositEnabledAssets'
8-
import useIsOsmosis from 'hooks/chain/useIsOsmosis'
98
import useHealthComputer from 'hooks/health-computer/useHealthComputer'
109
import useSlippage from 'hooks/settings/useSlippage'
1110
import useRouteInfo from 'hooks/trade/useRouteInfo'
@@ -37,7 +36,6 @@ export default function ChangeLeverage(props: Props) {
3736
leverage,
3837
addedTrades,
3938
} = useUpdatedAccount(props.account)
40-
const isOsmosis = useIsOsmosis()
4139

4240
const changeHlsStakingLeverage = useStore((s) => s.changeHlsStakingLeverage)
4341
const { computeMaxBorrowAmount } = useHealthComputer(props.account)
@@ -141,7 +139,6 @@ export default function ChangeLeverage(props: Props) {
141139
slippage,
142140
routeInfo,
143141
swapInAmount,
144-
isOsmosis,
145142
)
146143
changeHlsStakingLeverage({ accountId: props.account.id, actions })
147144
}, [
@@ -153,7 +150,6 @@ export default function ChangeLeverage(props: Props) {
153150
props.account.id,
154151
slippage,
155152
swapInAmount,
156-
isOsmosis,
157153
changeHlsStakingLeverage,
158154
])
159155

src/components/Modals/Hls/Manage/Deposit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default function Deposit(props: Props) {
132132
props.borrowMarket.liquidity,
133133
])
134134

135-
const actions = useDepositActions({ depositCoin, borrowCoin, chainConfig, routeInfo })
135+
const actions = useDepositActions({ depositCoin, borrowCoin, routeInfo })
136136

137137
const currentDebt: BigNumber = useMemo(
138138
() => props.account.debts.find(byDenom(props.borrowMarket.asset.denom))?.amount || BN_ZERO,

src/hooks/hls/useDepositActions.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,20 @@ import { getSwapExactInAction } from 'utils/swap'
77
interface Props {
88
borrowCoin: BNCoin
99
depositCoin: BNCoin
10-
chainConfig: ChainConfig
1110
routeInfo?: SwapRouteInfo | null
1211
}
1312

1413
export default function useDepositActions(props: Props) {
15-
const { borrowCoin, depositCoin, routeInfo, chainConfig } = props
14+
const { borrowCoin, depositCoin, routeInfo } = props
1615

1716
const [slippage] = useSlippage()
18-
const isOsmosis = chainConfig.isOsmosis
1917

2018
const swapAction = useMemo(
2119
() =>
2220
routeInfo
23-
? getSwapExactInAction(
24-
borrowCoin.toActionCoin(),
25-
depositCoin.denom,
26-
routeInfo,
27-
slippage,
28-
isOsmosis,
29-
)
21+
? getSwapExactInAction(borrowCoin.toActionCoin(), depositCoin.denom, routeInfo, slippage)
3022
: null,
31-
[borrowCoin, depositCoin, routeInfo, slippage, isOsmosis],
23+
[borrowCoin, depositCoin, routeInfo, slippage],
3224
)
3325
return useMemo(
3426
() => [

src/hooks/hls/useDepositHlsStaking.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import useDepositEnabledAssets from 'hooks/assets/useDepositEnabledAssets'
2-
import useChainConfig from 'hooks/chain/useChainConfig'
31
import { BN_ZERO } from 'constants/math'
4-
import { useMemo, useState } from 'react'
2+
import useDepositEnabledAssets from 'hooks/assets/useDepositEnabledAssets'
53
import useSlippage from 'hooks/settings/useSlippage'
64
import useRouteInfo from 'hooks/trade/useRouteInfo'
5+
import { useMemo, useState } from 'react'
76
import { BNCoin } from 'types/classes/BNCoin'
87
import { Action } from 'types/generated/mars-credit-manager/MarsCreditManager.types'
98
import { getCoinValue } from 'utils/formatters'
@@ -16,7 +15,6 @@ interface Props {
1615
export default function useDepositHlsStaking(props: Props) {
1716
const [slippage] = useSlippage()
1817
const assets = useDepositEnabledAssets()
19-
const chainConfig = useChainConfig()
2018

2119
const [depositAmount, setDepositAmount] = useState<BigNumber>(BN_ZERO)
2220
const [borrowAmount, setBorrowAmount] = useState<BigNumber>(BN_ZERO)
@@ -83,7 +81,6 @@ export default function useDepositHlsStaking(props: Props) {
8381
props.collateralDenom,
8482
route,
8583
slippage,
86-
chainConfig.isOsmosis,
8784
),
8885
]),
8986
]
@@ -95,7 +92,6 @@ export default function useDepositHlsStaking(props: Props) {
9592
props.borrowDenom,
9693
props.collateralDenom,
9794
slippage,
98-
chainConfig.isOsmosis,
9995
])
10096

10197
return {

src/hooks/hls/useHlsCloseFarmingPositionActions.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import BigNumber from 'bignumber.js'
22

33
import { BN_ZERO } from 'constants/math'
44
import useAssets from 'hooks/assets/useAssets'
5-
import useIsOsmosis from 'hooks/chain/useIsOsmosis'
65
import useStakedAstroLpRewards from 'hooks/incentives/useStakedAstroLpRewards'
76
import useMarkets from 'hooks/markets/useMarkets'
87
import useSlippage from 'hooks/settings/useSlippage'
@@ -28,7 +27,6 @@ export default function useHlsCloseFarmingPositionActions(props: Props): {
2827
const { account, farm, borrowAsset } = props.hlsFarm
2928
const { data: assets } = useAssets()
3029
const [slippage] = useSlippage()
31-
const isOsmosis = useIsOsmosis()
3230
const markets = useMarkets()
3331
const borrowDenom = borrowAsset.denom
3432
const zeroCoin = BNCoin.fromDenomAndBigNumber(farm.denoms.primary, BN_ZERO)
@@ -129,7 +127,6 @@ export default function useHlsCloseFarmingPositionActions(props: Props): {
129127
borrowDenom,
130128
routeInfo,
131129
slippage,
132-
isOsmosis,
133130
)
134131

135132
return {
@@ -182,7 +179,6 @@ export default function useHlsCloseFarmingPositionActions(props: Props): {
182179
currentLpRewards,
183180
debtAmount,
184181
fundsLeftAfterSwap,
185-
isOsmosis,
186182
routeInfo,
187183
slippage,
188184
swapInAmount,

src/hooks/hls/useHlsCloseStakingPositionActions.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import BigNumber from 'bignumber.js'
22

33
import { BN_ZERO } from 'constants/math'
4-
import useIsOsmosis from 'hooks/chain/useIsOsmosis'
54
import useSlippage from 'hooks/settings/useSlippage'
65
import useRouteInfo from 'hooks/trade/useRouteInfo'
76
import { useMemo } from 'react'
@@ -19,7 +18,6 @@ export default function useHlsCloseStakingPositionActions(props: Props): {
1918
isLoadingRoute: boolean
2019
} {
2120
const [slippage] = useSlippage()
22-
const isOsmosis = useIsOsmosis()
2321
const collateralDenom = props.account.strategy.denoms.deposit
2422
const borrowDenom = props.account.strategy.denoms.borrow
2523

@@ -73,7 +71,6 @@ export default function useHlsCloseStakingPositionActions(props: Props): {
7371
borrowDenom,
7472
routeInfo,
7573
slippage,
76-
isOsmosis,
7774
)
7875

7976
return {
@@ -117,7 +114,6 @@ export default function useHlsCloseStakingPositionActions(props: Props): {
117114
collateralAmount,
118115
collateralDenom,
119116
debtAmount,
120-
isOsmosis,
121117
routeInfo,
122118
slippage,
123119
swapInAmount,

src/store/slices/broadcast.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,14 +682,11 @@ export default function createBroadcastSlice(
682682
repay: boolean
683683
routeInfo: SwapRouteInfo
684684
}) => {
685-
const isOsmosis = get().chainConfig.isOsmosis
686-
687685
const swapExactIn = getSwapExactInAction(
688686
options.coinIn.toActionCoin(options.isMax),
689687
options.denomOut,
690688
options.routeInfo,
691689
options.slippage ?? 0,
692-
isOsmosis,
693690
)
694691

695692
const msg: CreditManagerExecuteMsg = {

src/types/generated/mars-credit-manager/MarsCreditManager.types.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface InstantiateMsg {
2323
oracle: OracleBaseForString
2424
owner: string
2525
params: ParamsBaseForString
26+
perps_liquidation_bonus_ratio: Decimal
2627
red_bank: RedBankUnchecked
2728
swapper: SwapperBaseForString
2829
zapper: ZapperBaseForString
@@ -188,8 +189,7 @@ export type Action =
188189
swap_exact_in: {
189190
coin_in: ActionCoin
190191
denom_out: string
191-
min_receive?: Uint128
192-
slippage?: Decimal
192+
min_receive: Uint128
193193
route?: SwapperRoute | null
194194
}
195195
}
@@ -595,6 +595,7 @@ export interface ConfigUpdates {
595595
oracle?: OracleBaseForString | null
596596
params?: ParamsBaseForString | null
597597
perps?: PerpsBaseForString | null
598+
perps_liquidation_bonus_ratio?: Decimal | null
598599
red_bank?: RedBankUnchecked | null
599600
rewards_collector?: string | null
600601
swapper?: SwapperBaseForString | null
@@ -616,7 +617,7 @@ export interface HealthValuesResponse {
616617
liquidation_threshold_adjusted_collateral: Uint128
617618
max_ltv_adjusted_collateral: Uint128
618619
max_ltv_health_factor?: Decimal | null
619-
perps_pnl_losses: Uint128
620+
perps_pnl_loss: Uint128
620621
perps_pnl_profit: Uint128
621622
total_collateral_value: Uint128
622623
total_debt_value: Uint128
@@ -802,6 +803,7 @@ export interface ConfigResponse {
802803
ownership: OwnerResponse
803804
params: string
804805
perps: string
806+
perps_liquidation_bonus_ratio: Decimal
805807
red_bank: string
806808
rewards_collector?: RewardsCollector | null
807809
swapper: string

src/types/generated/mars-incentives/MarsIncentives.client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
Addr,
1616
ActionAmount,
1717
OwnerUpdate,
18-
MigrateV2ToV2_0_1,
18+
MigrateV2_1_0ToV2_2_0,
1919
WhitelistEntry,
2020
Coin,
2121
ActionCoin,
@@ -451,7 +451,7 @@ export interface MarsIncentivesInterface extends MarsIncentivesReadOnlyInterface
451451
_funds?: Coin[],
452452
) => Promise<ExecuteResult>
453453
migrate: (
454-
migrateV2ToV201: MigrateV2ToV2_0_1,
454+
migrateV210ToV220: MigrateV2_1_0ToV2_2_0,
455455
fee?: number | StdFee | 'auto',
456456
memo?: string,
457457
_funds?: Coin[],
@@ -739,7 +739,7 @@ export class MarsIncentivesClient
739739
)
740740
}
741741
migrate = async (
742-
migrateV2ToV201: MigrateV2ToV2_0_1,
742+
migrateV210ToV220: MigrateV2_1_0ToV2_2_0,
743743
fee: number | StdFee | 'auto' = 'auto',
744744
memo?: string,
745745
_funds?: Coin[],
@@ -748,7 +748,7 @@ export class MarsIncentivesClient
748748
this.sender,
749749
this.contractAddress,
750750
{
751-
migrate: migrateV2ToV201,
751+
migrate: migrateV210ToV220,
752752
},
753753
fee,
754754
memo,

src/types/generated/mars-incentives/MarsIncentives.react-query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
Addr,
1717
ActionAmount,
1818
OwnerUpdate,
19-
MigrateV2ToV2_0_1,
19+
MigrateV2_1_0ToV2_2_0,
2020
WhitelistEntry,
2121
Coin,
2222
ActionCoin,
@@ -445,7 +445,7 @@ export function useMarsIncentivesStakedAstroLpRewardsQuery<
445445
}
446446
export interface MarsIncentivesMigrateMutation {
447447
client: MarsIncentivesClient
448-
msg: MigrateV2ToV2_0_1
448+
msg: MigrateV2_1_0ToV2_2_0
449449
args?: {
450450
fee?: number | StdFee | 'auto'
451451
memo?: string

src/types/generated/mars-incentives/MarsIncentives.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export type ExecuteMsg =
7575
update_owner: OwnerUpdate
7676
}
7777
| {
78-
migrate: MigrateV2ToV2_0_1
78+
migrate: MigrateV2_1_0ToV2_2_0
7979
}
8080
export type Uint128 = string
8181
export type IncentiveKind = 'red_bank' | 'perp_vault'
@@ -100,7 +100,7 @@ export type OwnerUpdate =
100100
}
101101
}
102102
| 'clear_emergency_owner'
103-
export type MigrateV2ToV2_0_1 =
103+
export type MigrateV2_1_0ToV2_2_0 =
104104
| {
105105
user_unclaimed_rewards: {
106106
limit: number

src/types/generated/mars-red-bank/MarsRedBank.client.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
OwnerUpdate,
1515
Decimal,
1616
Uint128,
17-
MigrateV1ToV2,
1817
InitOrUpdateAssetParams,
1918
InterestRateModel,
2019
QueryMsg,
@@ -489,12 +488,6 @@ export interface MarsRedBankInterface extends MarsRedBankReadOnlyInterface {
489488
memo?: string,
490489
_funds?: Coin[],
491490
) => Promise<ExecuteResult>
492-
migrate: (
493-
migrateV1ToV2: MigrateV1ToV2,
494-
fee?: number | StdFee | 'auto',
495-
memo?: string,
496-
_funds?: Coin[],
497-
) => Promise<ExecuteResult>
498491
}
499492
export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRedBankInterface {
500493
client: SigningCosmWasmClient
@@ -515,7 +508,6 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
515508
this.repay = this.repay.bind(this)
516509
this.liquidate = this.liquidate.bind(this)
517510
this.updateAssetCollateralStatus = this.updateAssetCollateralStatus.bind(this)
518-
this.migrate = this.migrate.bind(this)
519511
}
520512
updateOwner = async (
521513
ownerUpdate: OwnerUpdate,
@@ -777,21 +769,4 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
777769
_funds,
778770
)
779771
}
780-
migrate = async (
781-
migrateV1ToV2: MigrateV1ToV2,
782-
fee: number | StdFee | 'auto' = 'auto',
783-
memo?: string,
784-
_funds?: Coin[],
785-
): Promise<ExecuteResult> => {
786-
return await this.client.execute(
787-
this.sender,
788-
this.contractAddress,
789-
{
790-
migrate: migrateV1ToV2,
791-
},
792-
fee,
793-
memo,
794-
_funds,
795-
)
796-
}
797772
}

src/types/generated/mars-red-bank/MarsRedBank.react-query.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
OwnerUpdate,
1616
Decimal,
1717
Uint128,
18-
MigrateV1ToV2,
1918
InitOrUpdateAssetParams,
2019
InterestRateModel,
2120
QueryMsg,
@@ -616,26 +615,6 @@ export function useMarsRedBankConfigQuery<TData = ConfigResponse>({
616615
},
617616
)
618617
}
619-
export interface MarsRedBankMigrateMutation {
620-
client: MarsRedBankClient
621-
msg: MigrateV1ToV2
622-
args?: {
623-
fee?: number | StdFee | 'auto'
624-
memo?: string
625-
funds?: Coin[]
626-
}
627-
}
628-
export function useMarsRedBankMigrateMutation(
629-
options?: Omit<
630-
UseMutationOptions<ExecuteResult, Error, MarsRedBankMigrateMutation>,
631-
'mutationFn'
632-
>,
633-
) {
634-
return useMutation<ExecuteResult, Error, MarsRedBankMigrateMutation>(
635-
({ client, msg, args: { fee, memo, funds } = {} }) => client.migrate(msg, fee, memo, funds),
636-
options,
637-
)
638-
}
639618
export interface MarsRedBankUpdateAssetCollateralStatusMutation {
640619
client: MarsRedBankClient
641620
msg: {

0 commit comments

Comments
 (0)