Skip to content

Commit 3bf8b96

Browse files
authored
Merge pull request #5 from mars-protocol/v1.2.0
v1.2.0
2 parents 79db467 + 5d7f866 commit 3bf8b96

Some content is hidden

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

62 files changed

+771
-1156
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
NEXT_PUBLIC_NETWORK=mainnet
2+
NEXT_PUBLIC_STAGE=production

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,5 @@ yarn-error.log*
3333
# vercel
3434
.vercel
3535

36-
# Sentry
37-
.sentryclirc
38-
3936
# IDE
40-
.idea
37+
.idea

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Typescript is added and utilised (but optional if you want to create .jsx or .ts
1212

1313
SCSS with [CSS modules](https://create-react-app.dev/docs/adding-a-css-modules-stylesheet) (webpack allows importing css files into javascript, use the CSS module technique to avoid className clashes).
1414

15-
Sentry is used for front end error logging/exception & bug reporting.
16-
1715
## 2. Deployment
1816

1917
Start web server

next.config.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @type {import('next').NextConfig} */
22

3-
const { withSentryConfig } = require('@sentry/nextjs')
43
const path = require('path')
54

65
const moduleExports = {
@@ -50,18 +49,4 @@ const moduleExports = {
5049
},
5150
}
5251

53-
const sentryWebpackPluginOptions = {
54-
// Additional config options for the Sentry Webpack plugin. Keep in mind that
55-
// the following options are set automatically, and overriding them is not
56-
// recommended:
57-
// release, url, org, project, authToken, configFile, stripPrefix,
58-
// urlPrefix, include, ignore
59-
60-
silent: true, // Suppresses all logs
61-
// For all available options, see:
62-
// https://github.com/getsentry/sentry-webpack-plugin#options.
63-
}
64-
65-
// Make sure adding Sentry options is the last code to run before exporting, to
66-
// ensure that your source maps include changes from all other Webpack plugins
67-
module.exports = withSentryConfig(moduleExports, sentryWebpackPluginOptions)
52+
module.exports = moduleExports

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mars",
33
"homepage": "./",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"private": false,
66
"license": "SEE LICENSE IN LICENSE FILE",
77
"scripts": {
@@ -22,11 +22,10 @@
2222
"@cosmjs/launchpad": "^0.27.1",
2323
"@cosmjs/proto-signing": "^0.29.5",
2424
"@cosmjs/stargate": "^0.29.5",
25-
"@marsprotocol/wallet-connector": "^1.2.3",
25+
"@marsprotocol/wallet-connector": "^1.3.0",
2626
"@material-ui/core": "^4.12.4",
2727
"@material-ui/icons": "^4.11.3",
2828
"@ramonak/react-progress-bar": "^5.0.3",
29-
"@sentry/nextjs": "^7.34.0",
3029
"@tanstack/react-query": "^4.24.4",
3130
"@tanstack/react-table": "^8.7.9",
3231
"@testing-library/dom": "^8.20.0",
@@ -53,14 +52,14 @@
5352
"ramda": "^0.28.0",
5453
"react": "^18.2.0",
5554
"react-chartjs-2": "^5.2.0",
56-
"react-currency-input-field": "^3.6.9",
55+
"react-currency-input-field": "^3.6.10",
5756
"react-device-detect": "^2.2.2",
5857
"react-dom": "^18.2.0",
59-
"react-i18next": "^12.1.4",
58+
"react-i18next": "^12.1.5",
6059
"react-spring": "^9.6.1",
6160
"react-table": "^7.8.0",
6261
"react-use-clipboard": "^1.0.9",
63-
"sass": "^1.57.1",
62+
"sass": "^1.58.0",
6463
"typescript": "^4.9.5",
6564
"web-vitals": "^3.1.1",
6665
"zustand": "^4.3.2"
@@ -84,7 +83,7 @@
8483
"@types/lodash.clonedeep": "^4.5.7",
8584
"@types/lodash.isequal": "^4.5.6",
8685
"@types/lodash.throttle": "^4.1.7",
87-
"@types/node": "^18.11.18",
86+
"@types/node": "^18.13.0",
8887
"@types/numeral": "^2.0.2",
8988
"@types/prettier": "^2.7.2",
9089
"@types/ramda": "^0.28.22",

public/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="https://app.marsprotocol.io/favicon.svg" />
5+
<link rel="icon" href="https://osmosis.marsprotocol.io/favicon.svg" />
66
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
77
<link rel="manifest" href="/site.webmanifest" />
88
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#dd5b65" />
9+
<link rel="canonical" href="https://osmosis.marsprotocol.io" />
910
<meta name="robots" content="index,follow" />
1011
<meta
1112
name="description"
@@ -14,13 +15,13 @@
1415
<meta name="twitter:card" content="summary_large_image" />
1516
<meta name="twitter:site" content="@mars_protocol" />
1617
<meta name="twitter:creator" content="@mars_protocol" />
17-
<meta property="og:url" content="https://app.marsprotocol.io" />
18+
<meta property="og:url" content="https://osmosis.marsprotocol.io" />
1819
<meta property="og:title" content="Mars Protocol Application - Powered by Terra" />
1920
<meta
2021
property="og:description"
2122
content="Lend, borrow and earn on the galaxy's most powerful credit protocol or enter the Fields of Mars for advanced DeFi strategies."
2223
/>
23-
<meta property="og:image" content="https://app.marsprotocol.io/banner.png" />
24+
<meta property="og:image" content="https://osmosis.marsprotocol.io/banner.png" />
2425
<meta property="og:site_name" content="Mars Protocol" />
2526
<meta name="msapplication-TileColor" content="#ffffff" />
2627
<meta name="theme-color" content="#ffffff" />

src/components/common/BorrowCapacity/BorrowCapacity.tsx

Lines changed: 57 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import Tippy from '@tippyjs/react'
21
import classNames from 'classnames'
3-
import { AnimatedNumber, DisplayCurrency } from 'components/common'
2+
import { AnimatedNumber, DisplayCurrency, TextTooltip } from 'components/common'
43
import { formatValue } from 'libs/parse'
54
import { useMemo, useState } from 'react'
65
import { useTranslation } from 'react-i18next'
@@ -82,73 +81,66 @@ export const BorrowCapacity = ({
8281
/>
8382
)}
8483
</div>
85-
<Tippy
86-
appendTo={() => document.body}
87-
interactive={true}
88-
animation={false}
89-
render={(attrs) => {
90-
return (
91-
<div className='tippyContainer' {...attrs}>
92-
{t('redbank.borrowingBarTooltip', {
93-
limit: formatValue(
94-
convertToDisplayCurrency({
95-
amount: limit.toString(),
96-
denom: baseCurrency.denom,
97-
}),
98-
2,
99-
2,
100-
true,
101-
'$',
102-
),
103-
liquidation: formatValue(
104-
convertToDisplayCurrency({
105-
amount: max.toString(),
106-
denom: baseCurrency.denom,
107-
}),
108-
2,
109-
2,
110-
true,
111-
'$',
112-
),
113-
})}
114-
</div>
115-
)
116-
}}
117-
>
118-
<div className={styles.progressbarContainer} style={{ height: barHeight }}>
119-
<div className={styles.progressbar}>
120-
<div className={styles.limitLine} style={{ left: `${limitPercentOfMax || 0}%` }} />
121-
<div
122-
className={styles.limitBar}
123-
style={{
124-
right: `${limitPercentOfMax ? 100 - limitPercentOfMax : 100}%`,
125-
}}
126-
></div>
127-
128-
<div className={styles.ltvContainer}>
84+
<TextTooltip
85+
hideUnderline
86+
tooltip={t('redbank.tooltips.borrow.bar', {
87+
limit: formatValue(
88+
convertToDisplayCurrency({
89+
amount: limit.toString(),
90+
denom: baseCurrency.denom,
91+
}),
92+
2,
93+
2,
94+
true,
95+
'$',
96+
),
97+
liquidation: formatValue(
98+
convertToDisplayCurrency({
99+
amount: max.toString(),
100+
denom: baseCurrency.denom,
101+
}),
102+
2,
103+
2,
104+
true,
105+
'$',
106+
),
107+
})}
108+
text={
109+
<div className={styles.progressbarContainer} style={{ height: barHeight }}>
110+
<div className={styles.progressbar}>
111+
<div className={styles.limitLine} style={{ left: `${limitPercentOfMax || 0}%` }} />
129112
<div
130-
className={styles.indicator}
131-
style={{ width: `${percentOfMaxRange || 0.01}%` }}
132-
>
133-
<div className={styles.gradient} />
113+
className={styles.limitBar}
114+
style={{
115+
right: `${limitPercentOfMax ? 100 - limitPercentOfMax : 100}%`,
116+
}}
117+
></div>
118+
119+
<div className={styles.ltvContainer}>
120+
<div
121+
className={styles.indicator}
122+
style={{ width: `${percentOfMaxRange || 0.01}%` }}
123+
>
124+
<div className={styles.gradient} />
125+
</div>
126+
{showPercentageText ? (
127+
<span className={classNames('overline', styles.percentage)}>
128+
{max !== 0 && (
129+
<AnimatedNumber
130+
amount={percentOfMaxRound}
131+
suffix='%'
132+
maxDecimals={roundPercentage ? 0 : undefined}
133+
minDecimals={roundPercentage ? 0 : undefined}
134+
abbreviated={false}
135+
/>
136+
)}
137+
</span>
138+
) : null}
134139
</div>
135-
{showPercentageText ? (
136-
<span className={classNames('overline', styles.percentage)}>
137-
{max !== 0 && (
138-
<AnimatedNumber
139-
amount={percentOfMaxRound}
140-
suffix='%'
141-
maxDecimals={roundPercentage ? 0 : undefined}
142-
minDecimals={roundPercentage ? 0 : undefined}
143-
abbreviated={false}
144-
/>
145-
)}
146-
</span>
147-
) : null}
148140
</div>
149141
</div>
150-
</div>
151-
</Tippy>
142+
}
143+
/>
152144
{!hideValues && (
153145
<div className={`overline ${styles.values} xxxsCaps`}>
154146
<DisplayCurrency

src/components/common/Containers/CommonContainer.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useQueryClient } from '@tanstack/react-query'
1010
import { MARS_SYMBOL, USDC_SYMBOL } from 'constants/appConstants'
1111
import {
1212
useBlockHeight,
13-
useMarketDeposits,
13+
useDepositAndDebt,
1414
useMarsOracle,
1515
useRedBank,
1616
useUserBalance,
@@ -49,7 +49,6 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
4949
const exchangeRatesState = useStore((s) => s.exchangeRatesState)
5050
const isNetworkLoaded = useStore((s) => s.isNetworkLoaded)
5151
const rpc = useStore((s) => s.chainInfo?.rpc)
52-
const marketAssetLiquidity = useStore((s) => s.marketAssetLiquidity)
5352
const marketDeposits = useStore((s) => s.marketDeposits)
5453
const marketInfo = useStore((s) => s.marketInfo)
5554
const marketIncentiveInfo = useStore((s) => s.marketIncentiveInfo)
@@ -131,7 +130,6 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
131130
userBalancesState,
132131
exchangeRates,
133132
marketInfo,
134-
marketAssetLiquidity,
135133
marketIncentiveInfo,
136134
userDebts,
137135
userDeposits,
@@ -157,7 +155,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => {
157155
useMarsOracle()
158156
useSpotPrice(MARS_SYMBOL)
159157
useSpotPrice(USDC_SYMBOL)
160-
useMarketDeposits()
158+
useDepositAndDebt()
161159
useRedBank()
162160

163161
return <>{isNetworkLoaded && children}</>

src/components/common/CosmosWalletConnectProvider/CosmosWalletConnectProvider.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChainInfoID, WalletID, WalletManagerProvider } from '@marsprotocol/wallet-connector'
1+
import { WalletID, WalletManagerProvider } from '@marsprotocol/wallet-connector'
22
import { CircularProgress, SVG } from 'components/common'
33
import { useEffect, useState } from 'react'
44

@@ -8,10 +8,12 @@ type Props = {
88
children?: React.ReactNode
99
}
1010

11-
const defaultChain = ChainInfoID.OsmosisTestnet
12-
1311
export const CosmosWalletConnectProvider = ({ children }: Props) => {
14-
const [chainInfoOverrides, setChainInfoOverrides] = useState<{ rpc: string; rest: string }>()
12+
const [chainInfoOverrides, setChainInfoOverrides] = useState<{
13+
rpc: string
14+
rest: string
15+
chainID: string
16+
}>()
1517
const [enabledWallets, setEnabledWallets] = useState<WalletID[]>([])
1618

1719
useEffect(() => {
@@ -29,6 +31,7 @@ export const CosmosWalletConnectProvider = ({ children }: Props) => {
2931
setChainInfoOverrides({
3032
rpc: networkConfig.rpcUrl,
3133
rest: networkConfig.restUrl,
34+
chainID: networkConfig.name,
3235
})
3336
setEnabledWallets(networkConfig.wallets)
3437
}
@@ -42,7 +45,7 @@ export const CosmosWalletConnectProvider = ({ children }: Props) => {
4245
<WalletManagerProvider
4346
chainInfoOverrides={chainInfoOverrides}
4447
closeIcon={<SVG.Close />}
45-
defaultChainId={defaultChain}
48+
defaultChainId={chainInfoOverrides.chainID}
4649
enabledWallets={enabledWallets}
4750
persistent
4851
renderLoader={() => (

src/components/common/DisplayCurrency/DisplayCurrency.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ export const DisplayCurrency = ({
1717
isApproximation,
1818
className,
1919
}: Props) => {
20-
const displayCurrency = useStore((s) => s.displayCurrency)
20+
const networkConfig = useStore((s) => s.networkConfig)
2121
const convertToDisplayCurrency = useStore((s) => s.convertToDisplayCurrency)
22-
2322
const amount = convertToDisplayCurrency(coin)
23+
const displayCurrency = networkConfig?.displayCurrency
24+
25+
if (!displayCurrency) return null
2426

2527
return (
2628
<div className={className}>

src/components/common/Header/ConnectedButton.module.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
top: rem-calc(38);
4848
@include padding(6, 6, 5.5);
4949
@include layoutPopover;
50-
width: rem-calc(420);
50+
width: rem-calc(380);
5151
max-width: calc(100vw - 24px);
52-
right: 0;
52+
right: -25%;
5353
z-index: 100;
5454
}
5555

@@ -191,6 +191,8 @@
191191
@media only screen and (min-width: $bpMediumLow) {
192192
.details {
193193
transform: none;
194+
width: rem-calc(420);
195+
right: 0;
194196
}
195197

196198
.detailsBalance {

src/components/common/Header/ConnectedButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const ConnectedButton = () => {
4646
const viewOnFinder = useCallback(() => {
4747
const explorerUrl = chainInfo ? chainInfo.explorer : ''
4848

49-
window.open(`${explorerUrl}account/${userWalletAddress}`, '_blank')
49+
window.open(`${explorerUrl}/account/${userWalletAddress}`, '_blank')
5050
}, [chainInfo, userWalletAddress])
5151

5252
const onClickAway = useCallback(() => {
@@ -103,7 +103,7 @@ export const ConnectedButton = () => {
103103
className='s faded'
104104
coin={{
105105
amount: baseCurrencyBalance.toString(),
106-
denom: baseCurrency.symbol,
106+
denom: baseCurrency.denom,
107107
}}
108108
/>
109109
</div>

0 commit comments

Comments
 (0)