Skip to content

Commit 51b70d4

Browse files
authored
Merge pull request #52 from mars-protocol/v1.7.4
v1.7.4
2 parents 2a24ac5 + 07d5ce1 commit 51b70d4

File tree

16 files changed

+112
-13
lines changed

16 files changed

+112
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mars",
33
"homepage": "./",
4-
"version": "1.7.3",
4+
"version": "1.7.4",
55
"private": false,
66
"license": "SEE LICENSE IN LICENSE FILE",
77
"scripts": {

src/components/common/TxModal/Action.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ export const Action = ({
310310

311311
if (!currentAsset) return <></>
312312

313-
const amountUntilDepositCap = currentAsset.depositCap - Number(currentAsset.depositLiquidity)
313+
const amountUntilDepositCap =
314+
Number(currentAsset.depositCap.amount) - Number(currentAsset.depositCap.used)
314315

315316
const onValueEntered = (microValue: number) => {
316317
if (microValue >= maxUsableAmount) microValue = maxUsableAmount

src/components/redbank/DepositColumns/useDepositColumns.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BigNumber from 'bignumber.js'
33
import classNames from 'classnames'
44
import { AnimatedNumber, Apr, Button, CellAmount, SVG, TextTooltip } from 'components/common'
55
import { convertPercentage } from 'functions'
6-
import { formatValue } from 'libs/parse'
6+
import { demagnify, formatValue } from 'libs/parse'
77
import Image from 'next/image'
88
import { useMemo } from 'react'
99
import { isMobile, isTablet } from 'react-device-detect'
@@ -127,8 +127,12 @@ export const useDepositColumns = () => {
127127
/>
128128
),
129129
cell: ({ row }) => {
130-
const depositLiquidity = Number(row.original.depositLiquidity)
131-
const percent = convertPercentage((depositLiquidity / row.original.depositCap) * 100)
130+
const depositCap = new BigNumber(row.original.depositCap?.amount ?? 0)
131+
const depositCapUsed = new BigNumber(row.original.depositCap?.used ?? 0)
132+
const percent = depositCap.isZero()
133+
? 0
134+
: convertPercentage(depositCapUsed.dividedBy(depositCap).toNumber() * 100)
135+
132136
const percentClasses = classNames(
133137
's',
134138
'number',
@@ -139,7 +143,7 @@ export const useDepositColumns = () => {
139143
<>
140144
<p className='number'>
141145
{formatValue(
142-
row.original.depositCap / 10 ** row.original.decimals,
146+
demagnify(depositCap.toNumber(), row.original.decimals),
143147
2,
144148
2,
145149
true,

src/components/redbank/RedbankColumns.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
background-image: $colorGradientOSMO;
1212
}
1313

14+
&.akt {
15+
background-image: $colorGradientAKT;
16+
}
17+
1418
&.atom {
1519
background-image: $colorGradientATOM;
1620
}
@@ -19,6 +23,10 @@
1923
background-image: $colorGradientAXL;
2024
}
2125

26+
&.dydx {
27+
background-image: $colorGradientDYDX;
28+
}
29+
2230
&.inj {
2331
background-image: $colorGradientINJ;
2432
}

src/components/redbank/RedbankNotConnected/RedbankNotConnected.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const RedbankNotConnected = () => {
4040
isCollateral: true,
4141
borrowBalanceBaseCurrency: 0,
4242
depositBalanceBaseCurrency: 0,
43-
depositCap: 0,
43+
depositCap: { amount: '0', used: '0' },
4444
depositLiquidity: 0,
4545
borrowEnabled: true,
4646
depositEnabled: true,

src/configs/devnet.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import akt from 'images/akt.svg'
12
import atom from 'images/atom.svg'
23
import axl from 'images/axl.svg'
34
import axlusdc from 'images/axlusdc.svg'
45
import axlwbtc from 'images/axlwbtc.svg'
56
import axlweth from 'images/axlweth.svg'
7+
import dydx from 'images/dydx.svg'
68
import inj from 'images/inj.svg'
79
import mars from 'images/mars.svg'
810
import osmo from 'images/osmo.svg'
@@ -133,6 +135,26 @@ const ASSETS: NetworkAssets = {
133135
logo: stosmo,
134136
decimals: 6,
135137
},
138+
akt: {
139+
symbol: 'AKT',
140+
id: 'AKT',
141+
name: 'Akash',
142+
denom: 'ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4',
143+
logo: akt,
144+
color: colors.akt,
145+
decimals: 6,
146+
priceFeedId: '4ea5bb4d2f5900cc2e97ba534240950740b4d3b89fe712a94a7304fd2fd92702',
147+
},
148+
dydx: {
149+
symbol: 'DYDX',
150+
id: 'DYDX',
151+
name: 'DyDx',
152+
denom: 'ibc/831F0B1BBB1D08A2B75311892876D71565478C532967545476DF4C2D7492E48C',
153+
logo: dydx,
154+
color: colors.dydx,
155+
decimals: 18,
156+
priceFeedId: '6489800bb8974169adfe35937bf6736507097d13c190d760c557108c7e93a81b',
157+
},
136158
}
137159

138160
const OTHER_ASSETS: { [denom: string]: OtherAsset } = {
@@ -179,10 +201,12 @@ export const NETWORK_CONFIG: NetworkConfig = {
179201
whitelist: [
180202
ASSETS.osmo,
181203
ASSETS.atom,
204+
ASSETS.akt,
182205
ASSETS.axl,
183206
ASSETS.axlusdc,
184207
ASSETS.axlwbtc,
185208
ASSETS.axlweth,
209+
ASSETS.dydx,
186210
ASSETS.inj,
187211
ASSETS.statom,
188212
ASSETS.usdc,
@@ -198,9 +222,11 @@ export const NETWORK_CONFIG: NetworkConfig = {
198222
ASSETS.axlusdc,
199223
ASSETS.osmo,
200224
ASSETS.atom,
225+
ASSETS.akt,
201226
ASSETS.axl,
202227
ASSETS.axlweth,
203228
ASSETS.axlwbtc,
229+
ASSETS.dydx,
204230
ASSETS.statom,
205231
ASSETS.stosmo,
206232
ASSETS.tia,

src/configs/osmosis-1.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import akt from 'images/akt.svg'
12
import atom from 'images/atom.svg'
23
import axl from 'images/axl.svg'
34
import axlusdc from 'images/axlusdc.svg'
45
import axlwbtc from 'images/axlwbtc.svg'
56
import axlweth from 'images/axlweth.svg'
7+
import dydx from 'images/dydx.svg'
68
import inj from 'images/inj.svg'
79
import mars from 'images/mars.svg'
810
import osmo from 'images/osmo.svg'
@@ -133,6 +135,26 @@ const ASSETS: NetworkAssets = {
133135
logo: stosmo,
134136
decimals: 6,
135137
},
138+
akt: {
139+
symbol: 'AKT',
140+
id: 'AKT',
141+
name: 'Akash',
142+
denom: 'ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4',
143+
logo: akt,
144+
color: colors.akt,
145+
decimals: 6,
146+
priceFeedId: '4ea5bb4d2f5900cc2e97ba534240950740b4d3b89fe712a94a7304fd2fd92702',
147+
},
148+
dydx: {
149+
symbol: 'DYDX',
150+
id: 'DYDX',
151+
name: 'DyDx',
152+
denom: 'ibc/831F0B1BBB1D08A2B75311892876D71565478C532967545476DF4C2D7492E48C',
153+
logo: dydx,
154+
color: colors.dydx,
155+
decimals: 18,
156+
priceFeedId: '6489800bb8974169adfe35937bf6736507097d13c190d760c557108c7e93a81b',
157+
},
136158
}
137159

138160
const OTHER_ASSETS: { [denom: string]: OtherAsset } = {
@@ -181,10 +203,12 @@ export const NETWORK_CONFIG: NetworkConfig = {
181203
whitelist: [
182204
ASSETS.osmo,
183205
ASSETS.atom,
206+
ASSETS.akt,
184207
ASSETS.axl,
185208
ASSETS.axlusdc,
186209
ASSETS.axlwbtc,
187210
ASSETS.axlweth,
211+
ASSETS.dydx,
188212
ASSETS.inj,
189213
ASSETS.statom,
190214
ASSETS.usdc,
@@ -200,9 +224,11 @@ export const NETWORK_CONFIG: NetworkConfig = {
200224
ASSETS.axlusdc,
201225
ASSETS.osmo,
202226
ASSETS.atom,
227+
ASSETS.akt,
203228
ASSETS.axl,
204229
ASSETS.axlweth,
205230
ASSETS.axlwbtc,
231+
ASSETS.dydx,
206232
ASSETS.statom,
207233
ASSETS.stosmo,
208234
ASSETS.tia,

src/hooks/queries/useAssetParams.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ import { QUERY_KEYS } from 'types/enums/queryKeys'
66
export const useAssetParams = () => {
77
const paramsContract = useStore((s) => s.networkConfig.contracts.params)
88
const paramsClient = useStore((s) => s.paramsClient)
9-
9+
const whitelistedAssets = useStore((s) => s.networkConfig.assets.whitelist)
1010
return useQuery(
1111
[QUERY_KEYS.ASSET_PARAMS],
1212
async () => {
1313
if (!paramsClient) return []
1414

1515
const params = await iterateContractQuery(paramsClient.allAssetParams)
16+
const capQueries = whitelistedAssets.map(
17+
async (assetParams) => await paramsClient.totalDeposit({ denom: assetParams.denom }),
18+
)
19+
const assetCaps = await Promise.all(capQueries)
20+
assetCaps.forEach((assetCap) => {
21+
const assetParams = params.find((param) => param.denom === assetCap.denom)
22+
if (!assetParams) return
23+
assetParams.cap = { amount: assetCap.cap, used: assetCap.amount }
24+
})
1625
useStore.setState({ assetParams: params })
1726
return params
1827
},

src/hooks/queries/useDepositAndDebt.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ export interface DepositAndDebtData {
99
mdwasmkey: {
1010
OSMODeposits: string
1111
OSMODebt: string
12+
AKTDeposits: string
13+
AKTDebt: string
1214
ATOMDeposits: string
1315
ATOMDebt: string
1416
ASTRODeposits: string
1517
ASTRODebt: string
1618
AXLDeposits: string
1719
AXLDebt: string
20+
DYDXDeposits: string
21+
DYDXDebt: string
1822
INJDeposits: string
1923
INJDebt: string
2024
axlUSDCDeposits: string

src/mocks/redBankAssets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const redBankAssets: RedBankAsset[] = [
99
denom: 'ATOM',
1010
depositBalance: '0',
1111
depositBalanceBaseCurrency: 0,
12-
depositCap: 1_000_000,
12+
depositCap: { amount: '1000000', used: '5000' },
1313
depositLiquidity: 5_000,
1414
isCollateral: true,
1515
logo: '',
@@ -31,7 +31,7 @@ export const redBankAssets: RedBankAsset[] = [
3131
denom: 'OSMO',
3232
depositBalance: '0',
3333
depositBalanceBaseCurrency: 0,
34-
depositCap: 1_000_000,
34+
depositCap: { amount: '1000000', used: '5000' },
3535
depositLiquidity: 5_000,
3636
isCollateral: true,
3737
logo: '',

0 commit comments

Comments
 (0)