Skip to content

Commit

Permalink
Merge pull request #44 from mars-protocol/v1.7.0
Browse files Browse the repository at this point in the history
v1.7.0
  • Loading branch information
linkielink authored Oct 10, 2023
2 parents 7db7a2b + 7cd4472 commit c28c178
Show file tree
Hide file tree
Showing 51 changed files with 2,159 additions and 1,184 deletions.
7 changes: 1 addition & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# OSMOSIS-1 #
NEXT_PUBLIC_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com
NEXT_PUBLIC_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com
NEXT_PUBLIC_OSMOSIS_GQL=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql

# OSMO-TEST-5 #
NEXT_PUBLIC_OSMOSIS_TEST_RPC=https://rpc.osmotest5.osmosis.zone
NEXT_PUBLIC_OSMOSIS_TEST_REST=https://lcd.osmotest5.osmosis.zone
NEXT_PUBLIC_OSMOSIS_TEST_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql
NEXT_PUBLIC_OSMOSIS_GQL=https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql

# PION-1 #
NEXT_PUBLIC_NEUTRON_TEST_RPC=https://rpc-palvus.pion-1.ntrn.tech/
Expand Down
5 changes: 0 additions & 5 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ NEXT_PUBLIC_OSMOSIS_RPC=APP_NEXT_OSMOSIS_RPC
NEXT_PUBLIC_OSMOSIS_REST=APP_NEXT_OSMOSIS_REST
NEXT_PUBLIC_OSMOSIS_GQL=APP_NEXT_OSMOSIS_GQL

# OSMO-TEST-5 #
NEXT_PUBLIC_OSMOSIS_TEST_RPC=APP_NEXT_OSMOSIS_TEST_RPC
NEXT_PUBLIC_OSMOSIS_TEST_REST=APP_NEXT_OSMOSIS_TEST_REST
NEXT_PUBLIC_OSMOSIS_TEST_GQL=APP_NEXT_OSMOSIS_TEST_GQL

# PION-1 #
NEXT_PUBLIC_NEUTRON_TEST_RPC=APP_NEXT_NEUTRON_TEST_RPC
NEXT_PUBLIC_NEUTRON_TEST_REST=APP_NEXT_NEUTRON_TEST_REST
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ We allow the use of environment variables to be passed to the Docker container t

| Variable | Description | Default |
| --------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| URL_OSMOSIS_GQL | The Osmosis Hive GraphQL endpoint to use | https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql |
| URL_OSMOSIS_GQL | The Osmosis Hive GraphQL endpoint to use | https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql |
| URL_OSMOSIS_REST | The Osmosis node REST endpoint to use | https://lcd-osmosis.blockapsis.com |
| URL_OSMOSIS_RPC | The Osmosis node RPC endpoint to use | https://rpc-osmosis.blockapsis.com |
| URL_OSMOSIS_TEST_GQL | The Osmosis Testnet Hive GraphQL endpoint to use | https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql |
| URL_OSMOSIS_TEST_REST | The Osmosis Testnet node REST endpoint to use | https://lcd.osmotest5.osmosis.zone |
| URL_OSMOSIS_TEST_RPC | The Osmosis Testnet node RPC endpoint to use | https://rpc.osmotest5.osmosis.zone |
| URL_NEUTRON_GQL | The Neutron Hive GraphQL endpoint to use | https://neutron.rpc.p2p.world/qgrnU6PsQZA8F9S5Fb8Fn3tV3kXmMBl2M9bcc9jWLjQy8p/hive/graphql |
| URL_NEUTRON_REST | The Neutron node REST endpoint to use | https://rest-kralum.neutron-1.neutron.org |
| URL_NEUTRON_RPC | The Neutron node RPC endpoint to use | https://rpc-kralum.neutron-1.neutron.org |
Expand All @@ -52,9 +49,6 @@ docker run -it -p 3000:3000 \
-e URL_OSMOSIS_GQL=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql \
-e URL_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com \
-e URL_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com \
-e URL_OSMOSIS_TEST_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql \
-e URL_OSMOSIS_TEST_REST=https://lcd.osmotest5.osmosis.zone \
-e URL_OSMOSIS_TEST_RPC=https://rpc.osmotest5.osmosis.zone \
-e URL_NEUTRON_GQL=https://neutron.rpc.p2p.world/qgrnU6PsQZA8F9S5Fb8Fn3tV3kXmMBl2M9bcc9jWLjQy8p/hive/graphql \
-e URL_NEUTRON_REST=https://rest-kralum.neutron-1.neutron.org \
-e URL_NEUTRON_RPC=https://rpc-kralum.neutron-1.neutron.org \
Expand Down
3 changes: 0 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ envFilename='override.conf'
echo "APP_NEXT_OSMOSIS_RPC=$URL_OSMOSIS_RPC" >> $envFilename
echo "APP_NEXT_OSMOSIS_REST=$URL_OSMOSIS_REST" >> $envFilename
echo "APP_NEXT_OSMOSIS_GQL=$URL_OSMOSIS_GQL" >> $envFilename
echo "APP_NEXT_OSMOSIS_TEST_RPC=$URL_OSMOSIS_TEST_RPC" >> $envFilename
echo "APP_NEXT_OSMOSIS_TEST_REST=$URL_OSMOSIS_TEST_REST" >> $envFilename
echo "APP_NEXT_OSMOSIS_TEST_GQL=$URL_OSMOSIS_TEST_GQL" >> $envFilename
echo "APP_NEXT_NEUTRON_RPC=$URL_NEUTRON_RPC" >> $envFilename
echo "APP_NEXT_NEUTRON_REST=$URL_NEUTRON_REST" >> $envFilename
echo "APP_NEXT_NEUTRON_GQL=$URL_NEUTRON_GQL" >> $envFilename
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mars",
"homepage": "./",
"version": "1.6.5",
"version": "1.7.0",
"private": false,
"license": "SEE LICENSE IN LICENSE FILE",
"scripts": {
Expand All @@ -22,7 +22,7 @@
"@cosmjs/launchpad": "^0.27.1",
"@cosmjs/proto-signing": "^0.31.1",
"@cosmjs/stargate": "^0.31.1",
"@marsprotocol/wallet-connector": "^2.1.2",
"@marsprotocol/wallet-connector": "^2.1.3",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@ramonak/react-progress-bar": "^5.0.3",
Expand Down
11 changes: 11 additions & 0 deletions src/components/common/Containers/CommonContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import {
useUserDebt,
useUserIcns,
} from 'hooks/queries'
import { useAssetParams } from 'hooks/queries/useAssetParams'
import { useMarsPrice } from 'hooks/queries/useMarsPrice'
import { usePythVaa } from 'hooks/queries/usePythVaa'
import { useUserCollaterals } from 'hooks/queries/useUserCollaterals'
import { ReactNode, useEffect, useState } from 'react'
import useStore from 'store'
import { State } from 'types/enums'
import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client'

import { MigrationInProgress } from '../MigrationInProgress/MigrationInProgress'

Expand All @@ -31,6 +33,8 @@ interface CommonContainerProps {
}

export const CommonContainer = ({ children }: CommonContainerProps) => {
useAssetParams()

// ------------------
// EXTERNAL HOOKS
// ---------------
Expand All @@ -52,6 +56,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
const marketDeposits = useStore((s) => s.marketDeposits)
const marketInfo = useStore((s) => s.marketInfo)
const migrationInProgress = useStore((s) => s.migrationInProgress)
const paramsAddress = useStore((s) => s.networkConfig.contracts.params)
const redBankState = useStore((s) => s.redBankState)
const rpc = useStore((s) => s.networkConfig.rpcUrl)
const userBalances = useStore((s) => s.userBalances)
Expand All @@ -76,6 +81,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
client: undefined,
creditManagerClient: undefined,
accountNftClient: undefined,
paramsClient: undefined,
userWalletAddress: '',
})
}
Expand Down Expand Up @@ -133,6 +139,11 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
})
}, [simulate, sign, connectedWallet, cosmWasmClient, broadcast, networkConfig, chainId])

useEffect(() => {
if (!paramsAddress || !cosmWasmClient) return
useStore.setState({ paramsClient: new MarsParamsQueryClient(cosmWasmClient, paramsAddress) })
}, [cosmWasmClient, paramsAddress])

useEffect(() => {
setRedBankAssets()
}, [
Expand Down
4 changes: 4 additions & 0 deletions src/components/common/Containers/FieldsContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useVaultParams } from 'hooks/queries/useVaultParams'
import { ReactNode, useEffect } from 'react'
import useStore from 'store'
import { AccountNftClient, CreditManagerClient } from 'types/classes'
Expand All @@ -7,6 +8,7 @@ interface FieldsContainerProps {
}

export const FieldsContainer = ({ children }: FieldsContainerProps) => {
const { data: vaultParams } = useVaultParams()
const client = useStore((s) => s.client)
const currentNetwork = useStore((s) => s.currentNetwork)
const networkConfig = useStore((s) => s.networkConfig)
Expand All @@ -20,6 +22,7 @@ export const FieldsContainer = ({ children }: FieldsContainerProps) => {
useEffect(() => {
if (!networkConfig.isFieldsEnabled || !creditManagerAddress || !accountNftContractAddress)
return

if (!client || client.connectedWallet.network.chainId !== currentNetwork) return
useStore.setState({
creditManagerClient: new CreditManagerClient(creditManagerAddress, client),
Expand All @@ -35,6 +38,7 @@ export const FieldsContainer = ({ children }: FieldsContainerProps) => {
creditManagerAddress,
currentNetwork,
getVaults,
vaultParams,
])

useEffect(() => {
Expand Down
23 changes: 20 additions & 3 deletions src/components/common/Notification/Notification.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
width: 100%;
min-height: rem-calc(48);
display: flex;
align-items: center;
@include layoutPopover;
margin-bottom: space(8) !important;
@include padding(2, 3);
Expand All @@ -22,7 +21,10 @@
}

.icon {
@include margin(0, 4);
height: 100%;
display: flex;
align-items: flex-start;
@include margin(2.5);
}

&.info {
Expand Down Expand Up @@ -59,7 +61,7 @@
position: absolute;
right: 0;
top: 0;
@include margin(4, 4, 0, 0);
@include margin(3, 3, 0, 0);
border: none;
background: transparent;
@include padding(0);
Expand All @@ -75,3 +77,18 @@
}
}
}

@media only screen and (min-width: $bpMediumHigh) {
.notification {
align-items: center;

.icon {
align-items: center;
@include margin(0, 4);
}

.closeNotification {
@include margin(4, 4, 0, 0);
}
}
}
22 changes: 1 addition & 21 deletions src/components/common/Tooltip/Apy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ interface Props {

export const Apy = ({ apyData, leverage, borrowRate }: Props) => {
const { t } = useTranslation()

const totalApy = useMemo(
() => (apyData.total ?? 0) * leverage - borrowRate ?? 0,
[apyData, leverage, borrowRate],
)
const leveragedApy = useMemo(() => (apyData.total ?? 0) * leverage, [apyData, leverage])
const performanceFee = apyData.fees && apyData.fees[0].value > 0 ? apyData.fees[0] : null

return (
<div className={styles.container}>
Expand All @@ -31,16 +29,6 @@ export const Apy = ({ apyData, leverage, borrowRate }: Props) => {
{formatValue(apyData.total ?? 0, 2, 2, true, false, '%', true)}
</span>
</div>
<ul className={styles.list}>
{apyData.apys
?.filter((apy) => apy.value > 0.009)
.map((item, index) => (
<li className={styles.listItem} key={index}>
<span>- {item.type}</span>
<span>{formatValue(item.value, 2, 2, true, false, '%', true)}</span>
</li>
))}
</ul>
</div>
{leverage > 1 && (
<>
Expand All @@ -55,21 +43,13 @@ export const Apy = ({ apyData, leverage, borrowRate }: Props) => {
</span>
</div>
{borrowRate > 0 && (
<div className={classNames(styles.item, !performanceFee && styles.border)}>
<div className={classNames(styles.item, styles.border)}>
<span className={styles.label}>{t('fields.borrowRateApy')}</span>
<span className={styles.value}>
{formatValue(borrowRate, 2, 2, true, '-', '%', true)}
</span>
</div>
)}
{performanceFee && (
<div className={classNames(styles.item, styles.border)}>
<span className={styles.label}>{performanceFee.type}</span>
<span className={styles.value}>
{formatValue(performanceFee.value, 2, 2, true, '-', '%', true)}
</span>
</div>
)}
</>
)}
<div className={classNames(styles.item, styles.total)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ export const useActiveVaultsColumns = () => {
</>
)
case 'active':
if (row.original.position.apy?.net !== null) {
if (
row.original.position.apy?.net !== null &&
row.original.position.apy?.borrow !== 0
) {
const apy = new BigNumber(row.original.position.apy.net).toNumber()

return (
<>
<TextTooltip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Notification } from 'components/common'
import { produceCountdown } from 'libs/parse'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import useStore from 'store'
import { NotificationType } from 'types/enums'
Expand Down Expand Up @@ -69,6 +69,6 @@ export const UnlockingNotification = () => {
content={unlockedContent()}
showNotification
hideCloseBtn
></Notification>
/>
)
}
Loading

0 comments on commit c28c178

Please sign in to comment.