Skip to content

Commit c28c178

Browse files
authored
Merge pull request #44 from mars-protocol/v1.7.0
v1.7.0
2 parents 7db7a2b + 7cd4472 commit c28c178

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2159
-1184
lines changed

.env.example

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# OSMOSIS-1 #
22
NEXT_PUBLIC_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com
33
NEXT_PUBLIC_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com
4-
NEXT_PUBLIC_OSMOSIS_GQL=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql
5-
6-
# OSMO-TEST-5 #
7-
NEXT_PUBLIC_OSMOSIS_TEST_RPC=https://rpc.osmotest5.osmosis.zone
8-
NEXT_PUBLIC_OSMOSIS_TEST_REST=https://lcd.osmotest5.osmosis.zone
9-
NEXT_PUBLIC_OSMOSIS_TEST_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql
4+
NEXT_PUBLIC_OSMOSIS_GQL=https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql
105

116
# PION-1 #
127
NEXT_PUBLIC_NEUTRON_TEST_RPC=https://rpc-palvus.pion-1.ntrn.tech/

.env.production

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ NEXT_PUBLIC_OSMOSIS_RPC=APP_NEXT_OSMOSIS_RPC
66
NEXT_PUBLIC_OSMOSIS_REST=APP_NEXT_OSMOSIS_REST
77
NEXT_PUBLIC_OSMOSIS_GQL=APP_NEXT_OSMOSIS_GQL
88

9-
# OSMO-TEST-5 #
10-
NEXT_PUBLIC_OSMOSIS_TEST_RPC=APP_NEXT_OSMOSIS_TEST_RPC
11-
NEXT_PUBLIC_OSMOSIS_TEST_REST=APP_NEXT_OSMOSIS_TEST_REST
12-
NEXT_PUBLIC_OSMOSIS_TEST_GQL=APP_NEXT_OSMOSIS_TEST_GQL
13-
149
# PION-1 #
1510
NEXT_PUBLIC_NEUTRON_TEST_RPC=APP_NEXT_NEUTRON_TEST_RPC
1611
NEXT_PUBLIC_NEUTRON_TEST_REST=APP_NEXT_NEUTRON_TEST_REST

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ We allow the use of environment variables to be passed to the Docker container t
3030

3131
| Variable | Description | Default |
3232
| --------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
33-
| URL_OSMOSIS_GQL | The Osmosis Hive GraphQL endpoint to use | https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql |
33+
| URL_OSMOSIS_GQL | The Osmosis Hive GraphQL endpoint to use | https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql |
3434
| URL_OSMOSIS_REST | The Osmosis node REST endpoint to use | https://lcd-osmosis.blockapsis.com |
3535
| URL_OSMOSIS_RPC | The Osmosis node RPC endpoint to use | https://rpc-osmosis.blockapsis.com |
36-
| URL_OSMOSIS_TEST_GQL | The Osmosis Testnet Hive GraphQL endpoint to use | https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql |
37-
| URL_OSMOSIS_TEST_REST | The Osmosis Testnet node REST endpoint to use | https://lcd.osmotest5.osmosis.zone |
38-
| URL_OSMOSIS_TEST_RPC | The Osmosis Testnet node RPC endpoint to use | https://rpc.osmotest5.osmosis.zone |
3936
| URL_NEUTRON_GQL | The Neutron Hive GraphQL endpoint to use | https://neutron.rpc.p2p.world/qgrnU6PsQZA8F9S5Fb8Fn3tV3kXmMBl2M9bcc9jWLjQy8p/hive/graphql |
4037
| URL_NEUTRON_REST | The Neutron node REST endpoint to use | https://rest-kralum.neutron-1.neutron.org |
4138
| URL_NEUTRON_RPC | The Neutron node RPC endpoint to use | https://rpc-kralum.neutron-1.neutron.org |
@@ -52,9 +49,6 @@ docker run -it -p 3000:3000 \
5249
-e URL_OSMOSIS_GQL=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql \
5350
-e URL_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com \
5451
-e URL_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com \
55-
-e URL_OSMOSIS_TEST_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql \
56-
-e URL_OSMOSIS_TEST_REST=https://lcd.osmotest5.osmosis.zone \
57-
-e URL_OSMOSIS_TEST_RPC=https://rpc.osmotest5.osmosis.zone \
5852
-e URL_NEUTRON_GQL=https://neutron.rpc.p2p.world/qgrnU6PsQZA8F9S5Fb8Fn3tV3kXmMBl2M9bcc9jWLjQy8p/hive/graphql \
5953
-e URL_NEUTRON_REST=https://rest-kralum.neutron-1.neutron.org \
6054
-e URL_NEUTRON_RPC=https://rpc-kralum.neutron-1.neutron.org \

entrypoint.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ envFilename='override.conf'
77
echo "APP_NEXT_OSMOSIS_RPC=$URL_OSMOSIS_RPC" >> $envFilename
88
echo "APP_NEXT_OSMOSIS_REST=$URL_OSMOSIS_REST" >> $envFilename
99
echo "APP_NEXT_OSMOSIS_GQL=$URL_OSMOSIS_GQL" >> $envFilename
10-
echo "APP_NEXT_OSMOSIS_TEST_RPC=$URL_OSMOSIS_TEST_RPC" >> $envFilename
11-
echo "APP_NEXT_OSMOSIS_TEST_REST=$URL_OSMOSIS_TEST_REST" >> $envFilename
12-
echo "APP_NEXT_OSMOSIS_TEST_GQL=$URL_OSMOSIS_TEST_GQL" >> $envFilename
1310
echo "APP_NEXT_NEUTRON_RPC=$URL_NEUTRON_RPC" >> $envFilename
1411
echo "APP_NEXT_NEUTRON_REST=$URL_NEUTRON_REST" >> $envFilename
1512
echo "APP_NEXT_NEUTRON_GQL=$URL_NEUTRON_GQL" >> $envFilename

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mars",
33
"homepage": "./",
4-
"version": "1.6.5",
4+
"version": "1.7.0",
55
"private": false,
66
"license": "SEE LICENSE IN LICENSE FILE",
77
"scripts": {
@@ -22,7 +22,7 @@
2222
"@cosmjs/launchpad": "^0.27.1",
2323
"@cosmjs/proto-signing": "^0.31.1",
2424
"@cosmjs/stargate": "^0.31.1",
25-
"@marsprotocol/wallet-connector": "^2.1.2",
25+
"@marsprotocol/wallet-connector": "^2.1.3",
2626
"@material-ui/core": "^4.12.4",
2727
"@material-ui/icons": "^4.11.3",
2828
"@ramonak/react-progress-bar": "^5.0.3",

src/components/common/Containers/CommonContainer.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ import {
1717
useUserDebt,
1818
useUserIcns,
1919
} from 'hooks/queries'
20+
import { useAssetParams } from 'hooks/queries/useAssetParams'
2021
import { useMarsPrice } from 'hooks/queries/useMarsPrice'
2122
import { usePythVaa } from 'hooks/queries/usePythVaa'
2223
import { useUserCollaterals } from 'hooks/queries/useUserCollaterals'
2324
import { ReactNode, useEffect, useState } from 'react'
2425
import useStore from 'store'
2526
import { State } from 'types/enums'
27+
import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client'
2628

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

@@ -31,6 +33,8 @@ interface CommonContainerProps {
3133
}
3234

3335
export const CommonContainer = ({ children }: CommonContainerProps) => {
36+
useAssetParams()
37+
3438
// ------------------
3539
// EXTERNAL HOOKS
3640
// ---------------
@@ -52,6 +56,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
5256
const marketDeposits = useStore((s) => s.marketDeposits)
5357
const marketInfo = useStore((s) => s.marketInfo)
5458
const migrationInProgress = useStore((s) => s.migrationInProgress)
59+
const paramsAddress = useStore((s) => s.networkConfig.contracts.params)
5560
const redBankState = useStore((s) => s.redBankState)
5661
const rpc = useStore((s) => s.networkConfig.rpcUrl)
5762
const userBalances = useStore((s) => s.userBalances)
@@ -76,6 +81,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
7681
client: undefined,
7782
creditManagerClient: undefined,
7883
accountNftClient: undefined,
84+
paramsClient: undefined,
7985
userWalletAddress: '',
8086
})
8187
}
@@ -133,6 +139,11 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
133139
})
134140
}, [simulate, sign, connectedWallet, cosmWasmClient, broadcast, networkConfig, chainId])
135141

142+
useEffect(() => {
143+
if (!paramsAddress || !cosmWasmClient) return
144+
useStore.setState({ paramsClient: new MarsParamsQueryClient(cosmWasmClient, paramsAddress) })
145+
}, [cosmWasmClient, paramsAddress])
146+
136147
useEffect(() => {
137148
setRedBankAssets()
138149
}, [

src/components/common/Containers/FieldsContainer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useVaultParams } from 'hooks/queries/useVaultParams'
12
import { ReactNode, useEffect } from 'react'
23
import useStore from 'store'
34
import { AccountNftClient, CreditManagerClient } from 'types/classes'
@@ -7,6 +8,7 @@ interface FieldsContainerProps {
78
}
89

910
export const FieldsContainer = ({ children }: FieldsContainerProps) => {
11+
const { data: vaultParams } = useVaultParams()
1012
const client = useStore((s) => s.client)
1113
const currentNetwork = useStore((s) => s.currentNetwork)
1214
const networkConfig = useStore((s) => s.networkConfig)
@@ -20,6 +22,7 @@ export const FieldsContainer = ({ children }: FieldsContainerProps) => {
2022
useEffect(() => {
2123
if (!networkConfig.isFieldsEnabled || !creditManagerAddress || !accountNftContractAddress)
2224
return
25+
2326
if (!client || client.connectedWallet.network.chainId !== currentNetwork) return
2427
useStore.setState({
2528
creditManagerClient: new CreditManagerClient(creditManagerAddress, client),
@@ -35,6 +38,7 @@ export const FieldsContainer = ({ children }: FieldsContainerProps) => {
3538
creditManagerAddress,
3639
currentNetwork,
3740
getVaults,
41+
vaultParams,
3842
])
3943

4044
useEffect(() => {

src/components/common/Notification/Notification.module.scss

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
width: 100%;
55
min-height: rem-calc(48);
66
display: flex;
7-
align-items: center;
87
@include layoutPopover;
98
margin-bottom: space(8) !important;
109
@include padding(2, 3);
@@ -22,7 +21,10 @@
2221
}
2322

2423
.icon {
25-
@include margin(0, 4);
24+
height: 100%;
25+
display: flex;
26+
align-items: flex-start;
27+
@include margin(2.5);
2628
}
2729

2830
&.info {
@@ -59,7 +61,7 @@
5961
position: absolute;
6062
right: 0;
6163
top: 0;
62-
@include margin(4, 4, 0, 0);
64+
@include margin(3, 3, 0, 0);
6365
border: none;
6466
background: transparent;
6567
@include padding(0);
@@ -75,3 +77,18 @@
7577
}
7678
}
7779
}
80+
81+
@media only screen and (min-width: $bpMediumHigh) {
82+
.notification {
83+
align-items: center;
84+
85+
.icon {
86+
align-items: center;
87+
@include margin(0, 4);
88+
}
89+
90+
.closeNotification {
91+
@include margin(4, 4, 0, 0);
92+
}
93+
}
94+
}

src/components/common/Tooltip/Apy.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ interface Props {
1313

1414
export const Apy = ({ apyData, leverage, borrowRate }: Props) => {
1515
const { t } = useTranslation()
16-
1716
const totalApy = useMemo(
1817
() => (apyData.total ?? 0) * leverage - borrowRate ?? 0,
1918
[apyData, leverage, borrowRate],
2019
)
2120
const leveragedApy = useMemo(() => (apyData.total ?? 0) * leverage, [apyData, leverage])
22-
const performanceFee = apyData.fees && apyData.fees[0].value > 0 ? apyData.fees[0] : null
2321

2422
return (
2523
<div className={styles.container}>
@@ -31,16 +29,6 @@ export const Apy = ({ apyData, leverage, borrowRate }: Props) => {
3129
{formatValue(apyData.total ?? 0, 2, 2, true, false, '%', true)}
3230
</span>
3331
</div>
34-
<ul className={styles.list}>
35-
{apyData.apys
36-
?.filter((apy) => apy.value > 0.009)
37-
.map((item, index) => (
38-
<li className={styles.listItem} key={index}>
39-
<span>- {item.type}</span>
40-
<span>{formatValue(item.value, 2, 2, true, false, '%', true)}</span>
41-
</li>
42-
))}
43-
</ul>
4432
</div>
4533
{leverage > 1 && (
4634
<>
@@ -55,21 +43,13 @@ export const Apy = ({ apyData, leverage, borrowRate }: Props) => {
5543
</span>
5644
</div>
5745
{borrowRate > 0 && (
58-
<div className={classNames(styles.item, !performanceFee && styles.border)}>
46+
<div className={classNames(styles.item, styles.border)}>
5947
<span className={styles.label}>{t('fields.borrowRateApy')}</span>
6048
<span className={styles.value}>
6149
{formatValue(borrowRate, 2, 2, true, '-', '%', true)}
6250
</span>
6351
</div>
6452
)}
65-
{performanceFee && (
66-
<div className={classNames(styles.item, styles.border)}>
67-
<span className={styles.label}>{performanceFee.type}</span>
68-
<span className={styles.value}>
69-
{formatValue(performanceFee.value, 2, 2, true, '-', '%', true)}
70-
</span>
71-
</div>
72-
)}
7353
</>
7454
)}
7555
<div className={classNames(styles.item, styles.total)}>

src/components/fields/ActiveVaultsTable/useActiveVaultsColumns.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,11 @@ export const useActiveVaultsColumns = () => {
256256
</>
257257
)
258258
case 'active':
259-
if (row.original.position.apy?.net !== null) {
259+
if (
260+
row.original.position.apy?.net !== null &&
261+
row.original.position.apy?.borrow !== 0
262+
) {
260263
const apy = new BigNumber(row.original.position.apy.net).toNumber()
261-
262264
return (
263265
<>
264266
<TextTooltip

src/components/fields/UnlockingNotification/UnlockingNotification.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Notification } from 'components/common'
22
import { produceCountdown } from 'libs/parse'
3-
import React, { useEffect, useState } from 'react'
3+
import { useEffect, useState } from 'react'
44
import { useTranslation } from 'react-i18next'
55
import useStore from 'store'
66
import { NotificationType } from 'types/enums'
@@ -69,6 +69,6 @@ export const UnlockingNotification = () => {
6969
content={unlockedContent()}
7070
showNotification
7171
hideCloseBtn
72-
></Notification>
72+
/>
7373
)
7474
}

0 commit comments

Comments
 (0)