mirror of
https://github.com/cerc-io/mars-interface.git
synced 2024-11-17 03:09:20 +00:00
v1.5.3
This commit is contained in:
parent
397a1bf49a
commit
ee445b1272
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "mars",
|
||||
"homepage": "./",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.3",
|
||||
"license": "SEE LICENSE IN LICENSE FILE",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
@ -82,7 +82,7 @@ export const Footer = () => {
|
||||
</a>
|
||||
<a
|
||||
className={styles.item}
|
||||
href={DocURL.TERMS_OF_SERVICE_URL}
|
||||
href={DocURL.TERMS_OF_SERVICE}
|
||||
rel='noopener noreferrer'
|
||||
target='_blank'
|
||||
title={t('global.termsOfService')}
|
||||
@ -91,7 +91,7 @@ export const Footer = () => {
|
||||
</a>
|
||||
<a
|
||||
className={styles.item}
|
||||
href={DocURL.COOKIE_POLICY_URL}
|
||||
href={DocURL.COOKIE_POLICY}
|
||||
rel='noopener noreferrer'
|
||||
target='_blank'
|
||||
title={t('global.cookiePolicy')}
|
||||
@ -100,7 +100,7 @@ export const Footer = () => {
|
||||
</a>
|
||||
<a
|
||||
className={styles.item}
|
||||
href={DocURL.PRIVACY_POLICY_URL}
|
||||
href={DocURL.PRIVACY_POLICY}
|
||||
rel='noopener noreferrer'
|
||||
target='_blank'
|
||||
title={t('global.privacyPolicy')}
|
||||
|
@ -29,7 +29,7 @@ export const TermsOfService = () => {
|
||||
Please check the boxes below to confirm your agreement to the{' '}
|
||||
</span>
|
||||
<a
|
||||
href={DocURL.TERMS_OF_SERVICE_URL}
|
||||
href={DocURL.TERMS_OF_SERVICE}
|
||||
rel='noreferrer'
|
||||
target='_blank'
|
||||
className={classNames('xs')}
|
||||
|
@ -1,8 +1,5 @@
|
||||
import { ChainInfoID } from '@marsprotocol/wallet-connector'
|
||||
|
||||
/* cosmos:network */
|
||||
export const FORUM_URL = 'https://forum.marsprotocol.io/'
|
||||
|
||||
/* asset:unit */
|
||||
export const MARS_SYMBOL = 'MARS'
|
||||
export const MARS_DECIMALS = 6
|
||||
|
@ -23,24 +23,26 @@ export const useEditPosition = (props: Props) => {
|
||||
const slippage = useStore((s) => s.slippage)
|
||||
|
||||
const [editPosition, coinsAfterSwap] = useMemo<[Position, Coin[]]>(() => {
|
||||
const primaryAmount =
|
||||
props.position.amounts.primary - (props.prevPosition?.amounts.primary || 0)
|
||||
const secondaryAmount =
|
||||
props.position.amounts.secondary - (props.prevPosition?.amounts.secondary || 0)
|
||||
const borrowedPrimaryAmount =
|
||||
props.position.amounts.borrowedPrimary - (props.prevPosition?.amounts.borrowedPrimary || 0)
|
||||
|
||||
const borrowedSecondaryAmount =
|
||||
props.position.amounts.borrowedSecondary -
|
||||
(props.prevPosition?.amounts.borrowedSecondary || 0)
|
||||
const primaryAmount = new BigNumber(props.position.amounts.primary)
|
||||
.minus(props.prevPosition?.amounts.primary || 0)
|
||||
.integerValue(BigNumber.ROUND_CEIL)
|
||||
const secondaryAmount = new BigNumber(props.position.amounts.secondary)
|
||||
.minus(props.prevPosition?.amounts.secondary || 0)
|
||||
.integerValue(BigNumber.ROUND_CEIL)
|
||||
const borrowedPrimaryAmount = new BigNumber(props.position.amounts.borrowedPrimary)
|
||||
.minus(props.prevPosition?.amounts.borrowedPrimary || 0)
|
||||
.integerValue(BigNumber.ROUND_CEIL)
|
||||
const borrowedSecondaryAmount = new BigNumber(props.position.amounts.borrowedSecondary)
|
||||
.minus(props.prevPosition?.amounts.borrowedSecondary || 0)
|
||||
.integerValue(BigNumber.ROUND_CEIL)
|
||||
|
||||
const editPosition = {
|
||||
...props.position,
|
||||
amounts: {
|
||||
primary: primaryAmount,
|
||||
secondary: secondaryAmount,
|
||||
borrowedPrimary: borrowedPrimaryAmount,
|
||||
borrowedSecondary: borrowedSecondaryAmount,
|
||||
primary: primaryAmount.toNumber(),
|
||||
secondary: secondaryAmount.toNumber(),
|
||||
borrowedPrimary: borrowedPrimaryAmount.toNumber(),
|
||||
borrowedSecondary: borrowedSecondaryAmount.toNumber(),
|
||||
lp: {
|
||||
amount: '0',
|
||||
primary: 0,
|
||||
@ -52,11 +54,11 @@ export const useEditPosition = (props: Props) => {
|
||||
|
||||
const primaryBaseAmount = convertToBaseCurrency({
|
||||
denom: props.vault.denoms.primary,
|
||||
amount: (primaryAmount + borrowedPrimaryAmount).toString(),
|
||||
amount: primaryAmount.plus(borrowedPrimaryAmount).toString(),
|
||||
})
|
||||
const secondaryBaseAmount = convertToBaseCurrency({
|
||||
denom: props.vault.denoms.secondary,
|
||||
amount: (secondaryAmount + borrowedSecondaryAmount).toString(),
|
||||
amount: secondaryAmount.plus(borrowedSecondaryAmount).toString(),
|
||||
})
|
||||
|
||||
let primaryAfterSwap = new BigNumber(primaryAmount).plus(borrowedPrimaryAmount)
|
||||
@ -71,7 +73,7 @@ export const useEditPosition = (props: Props) => {
|
||||
const amount = Math.floor(
|
||||
convertValueToAmount({
|
||||
denom: props.vault.denoms[swapTarget],
|
||||
amount: inputAmount.toString(),
|
||||
amount: new BigNumber(inputAmount).toString(),
|
||||
}),
|
||||
)
|
||||
|
||||
@ -126,12 +128,12 @@ export const useEditPosition = (props: Props) => {
|
||||
|
||||
const primary = editPosition.amounts.primary && {
|
||||
denom: props.vault.denoms.primary,
|
||||
amount: editPosition.amounts.primary.toString(),
|
||||
amount: new BigNumber(editPosition.amounts.primary).toString(),
|
||||
}
|
||||
|
||||
const secondary = editPosition.amounts.secondary && {
|
||||
denom: props.vault.denoms.secondary,
|
||||
amount: editPosition.amounts.secondary.toString(),
|
||||
amount: new BigNumber(editPosition.amounts.secondary).toString(),
|
||||
}
|
||||
|
||||
const borrow = editPosition.borrowDenom && {
|
||||
@ -148,12 +150,16 @@ export const useEditPosition = (props: Props) => {
|
||||
|
||||
const primaryBaseAmount = convertToBaseCurrency({
|
||||
denom: props.vault.denoms.primary,
|
||||
amount: (editPosition.amounts.primary + editPosition.amounts.borrowedPrimary).toString(),
|
||||
amount: new BigNumber(editPosition.amounts.primary)
|
||||
.plus(editPosition.amounts.borrowedPrimary)
|
||||
.toString(),
|
||||
})
|
||||
|
||||
const secondaryBaseAmount = convertToBaseCurrency({
|
||||
denom: props.vault.denoms.secondary,
|
||||
amount: (editPosition.amounts.secondary + editPosition.amounts.borrowedSecondary).toString(),
|
||||
amount: new BigNumber(editPosition.amounts.secondary)
|
||||
.plus(editPosition.amounts.borrowedSecondary)
|
||||
.toString(),
|
||||
})
|
||||
|
||||
const swapMessage: Action[] = []
|
||||
@ -164,15 +170,21 @@ export const useEditPosition = (props: Props) => {
|
||||
if (Math.abs(difference) > SWAP_THRESHOLD) {
|
||||
const inputDenom = difference > 0 ? props.vault.denoms.primary : props.vault.denoms.secondary
|
||||
const outputDenom = difference < 0 ? props.vault.denoms.primary : props.vault.denoms.secondary
|
||||
const amount = new BigNumber(difference).abs().div(2).toString()
|
||||
const swapAmount = Math.ceil(convertValueToAmount({ denom: inputDenom, amount: amount }))
|
||||
const amount = new BigNumber(difference)
|
||||
.abs()
|
||||
.div(2)
|
||||
.integerValue(BigNumber.ROUND_CEIL)
|
||||
.toString()
|
||||
const swapAmount = new BigNumber(
|
||||
Math.ceil(convertValueToAmount({ denom: inputDenom, amount: amount })),
|
||||
).toString()
|
||||
|
||||
swapMessage.push({
|
||||
swap_exact_in: {
|
||||
coin_in: {
|
||||
denom: inputDenom,
|
||||
amount: {
|
||||
exact: swapAmount.toString(),
|
||||
exact: swapAmount,
|
||||
},
|
||||
},
|
||||
denom_out: outputDenom,
|
||||
@ -184,7 +196,7 @@ export const useEditPosition = (props: Props) => {
|
||||
BigNumber.config({ EXPONENTIAL_AT: [-7, 30] })
|
||||
const minimumReceive = new BigNumber(minLpToReceive)
|
||||
.times(1 - slippage)
|
||||
.dp(0)
|
||||
.integerValue(BigNumber.ROUND_CEIL)
|
||||
.toString()
|
||||
|
||||
const actions: Action[] = [
|
||||
|
@ -6,18 +6,18 @@ export function getCouncilLink(currentNetwork: ChainInfoID, currentProvider?: Wa
|
||||
const isTestnet =
|
||||
SUPPORTED_CHAINS.find((chain) => chain.chainId === currentNetwork)?.type === 'testnet'
|
||||
|
||||
if (isTestnet) return DocURL.COUNCIL_TESTNET_URL
|
||||
if (isTestnet) return DocURL.COUNCIL_TESTNET
|
||||
|
||||
if (!currentProvider) return DocURL.COUNCIL_URL
|
||||
if (!currentProvider) return DocURL.COUNCIL
|
||||
|
||||
switch (currentProvider) {
|
||||
case WalletID.Leap:
|
||||
return DocURL.COUNCIL_LEAP_URL
|
||||
return DocURL.COUNCIL_LEAP
|
||||
|
||||
case WalletID.StationWallet || WalletID.StationWalletMobile:
|
||||
return DocURL.COUNCIL_STATION_URL
|
||||
return DocURL.COUNCIL_STATION
|
||||
|
||||
default:
|
||||
return DocURL.COUNCIL_KEPLR_URL
|
||||
return DocURL.COUNCIL_KEPLR
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import { useUpdateAccount } from 'hooks/mutations'
|
||||
import { useRequestUnlockPosition } from 'hooks/queries/useRequestUnlockPosition'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { DocURL } from 'types/enums/docURL'
|
||||
|
||||
import styles from './UnlockDisclaimer.module.scss'
|
||||
|
||||
@ -59,7 +60,7 @@ const Unlock = () => {
|
||||
<p className={`${styles.title} xxlCaps`}>{t('fields.disclaimers.unlock.title')}</p>
|
||||
<p>
|
||||
{t('fields.disclaimers.unlock.description')}{' '}
|
||||
<a href='' rel='noreferrer' target='_blank'>
|
||||
<a href={DocURL.UNLOCK_POSITION} rel='noreferrer' target='_blank'>
|
||||
{t('common.learnMore')}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -633,8 +633,8 @@ $borderRadiusRound: 50%;
|
||||
/* Dimensions */
|
||||
$headerHeight: rem-calc(86);
|
||||
$mobileNavHeight: rem-calc(64);
|
||||
$footerHeight: rem-calc(300);
|
||||
$footerHeightMedium: rem-calc(300);
|
||||
$footerHeight: rem-calc(380);
|
||||
$footerHeightMedium: rem-calc(380);
|
||||
$footerHeightSmall: rem-calc(800);
|
||||
$contentWidth: 1248px;
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
export enum DocURL {
|
||||
COOKIE_POLICY_URL = 'https://docs.marsprotocol.io/docs/overview/legal/cookie-policy',
|
||||
COUNCIL_URL = 'https://council.marsprotocol.io',
|
||||
COUNCIL_LEAP_URL = 'https://cosmos.leapwallet.io/chains/mars/governance',
|
||||
COUNCIL_STATION_URL = 'https://station.terra.money/gov#PROPOSAL_STATUS_VOTING_PERIOD',
|
||||
COUNCIL_TESTNET_URL = 'https://testnet.keplr.app/chains/mars-hub-testnet',
|
||||
COUNCIL_KEPLR_URL = 'https://wallet.keplr.app/chains/mars-hub',
|
||||
COOKIE_POLICY = 'https://docs.marsprotocol.io/docs/overview/legal/cookie-policy',
|
||||
COUNCIL = 'https://council.marsprotocol.io',
|
||||
COUNCIL_LEAP = 'https://cosmos.leapwallet.io/chains/mars/governance',
|
||||
COUNCIL_STATION = 'https://station.terra.money/gov#PROPOSAL_STATUS_VOTING_PERIOD',
|
||||
COUNCIL_TESTNET = 'https://testnet.keplr.app/chains/mars-hub-testnet',
|
||||
COUNCIL_KEPLR = 'https://wallet.keplr.app/chains/mars-hub',
|
||||
FIELDS = 'https://docs.marsprotocol.io/docs/learn/rover/rover-intro',
|
||||
LANDING = 'https://docs.marsprotocol.io/',
|
||||
PRIVACY_POLICY_URL = 'https://docs.marsprotocol.io/docs/overview/legal/privacy-policy',
|
||||
PRIVACY_POLICY = 'https://docs.marsprotocol.io/docs/overview/legal/privacy-policy',
|
||||
RED_BANK = 'https://docs.marsprotocol.io/docs/learn/red-bank/red-bank-intro',
|
||||
RED_BANK_LIQUIDATIONS = 'https://docs.marsprotocol.io/docs/learn/red-bank/red-bank-liquidations',
|
||||
SECURITY = 'https://docs.marsprotocol.io/docs/overview/security/audits',
|
||||
TERMS_OF_SERVICE_URL = 'https://docs.marsprotocol.io/docs/overview/legal/terms-of-service',
|
||||
TERMS_OF_SERVICE = 'https://docs.marsprotocol.io/docs/overview/legal/terms-of-service',
|
||||
UNLOCK_POSITION = 'https://docs.marsprotocol.io/docs/learn/workstation/vaults/unlocking',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user