Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production => master #465

Merged
merged 39 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1685162
Merge pull request #317 from galacticcouncil/master
jak-pan Feb 9, 2023
9a7e7cb
Merge pull request #319 from galacticcouncil/master
jak-pan Feb 9, 2023
6d85e8c
Merge pull request #322 from galacticcouncil/master
jak-pan Feb 9, 2023
9bb3352
Merge pull request #334 from galacticcouncil/master
jak-pan Feb 16, 2023
3e46fc8
Merge pull request #348 from galacticcouncil/master
jak-pan Mar 17, 2023
31d2e5e
Merge pull request #411 from galacticcouncil/rococo
nohaapav Apr 24, 2023
7852776
Merge pull request #414 from galacticcouncil/rococo
nohaapav Apr 24, 2023
de3edc7
Merge pull request #416 from galacticcouncil/rococo
jak-pan Apr 25, 2023
3b6f7f6
Merge pull request #426 from galacticcouncil/master
obsivac-cleevio Jun 2, 2023
beef11f
Merge pull request #429 from galacticcouncil/master
vkulinich-cl Jun 7, 2023
166aa05
Merge pull request #430 from galacticcouncil/rococo
nohaapav Jun 14, 2023
b0446b3
Merge pull request #432 from galacticcouncil/master
nohaapav Jun 16, 2023
ea6fd1c
Merge pull request #434 from galacticcouncil/master
nohaapav Jun 16, 2023
1b27403
Merge pull request #435 from galacticcouncil/rococo
nohaapav Jun 16, 2023
fa9b224
Merge pull request #437 from galacticcouncil/master
vkulinich-cl Jun 22, 2023
390a65d
Merge pull request #438 from galacticcouncil/rococo
vkulinich-cl Jun 22, 2023
f5a2817
Merge pull request #444 from galacticcouncil/master
vkulinich-cl Aug 21, 2023
0f894fb
Merge pull request #446 from galacticcouncil/rococo
vkulinich-cl Aug 24, 2023
4e0d450
Merge branch 'master' into rococo
mrq1911 Oct 16, 2023
9f064e5
Merge branch 'rococo' into production
mrq1911 Oct 16, 2023
e882daf
Merge pull request #449 from galacticcouncil/master
vkulinich-cl Nov 20, 2023
e52c882
Merge pull request #450 from galacticcouncil/rococo
vkulinich-cl Nov 20, 2023
b0738ba
Merge pull request #452 from galacticcouncil/master
vkulinich-cl Jan 15, 2024
4cc5355
Merge pull request #453 from galacticcouncil/rococo
vkulinich-cl Jan 15, 2024
5cfe3b8
Merge remote-tracking branch 'origin/master' into rococo
mrq1911 Jan 18, 2024
5d06eb4
Merge branch 'rococo' into production
mrq1911 Jan 18, 2024
49b8c0d
Merge pull request #456 from galacticcouncil/master
vkulinich-cl Jan 25, 2024
447d832
Merge pull request #457 from galacticcouncil/rococo
vkulinich-cl Jan 25, 2024
cfdcc52
Merge pull request #459 from galacticcouncil/master
vkulinich-cl Jan 26, 2024
50472cc
Merge pull request #460 from galacticcouncil/rococo
vkulinich-cl Jan 26, 2024
836bd22
FIx textation
vkulinich-cl Jan 26, 2024
4611830
Merge pull request #462 from galacticcouncil/master
nohaapav Feb 13, 2024
4062659
Fix lint
vkulinich-cl Feb 13, 2024
1644a2d
Merge pull request #463 from galacticcouncil/fix-lint
vkulinich-cl Feb 13, 2024
9e0b8f2
Fix lint frozen
vkulinich-cl Feb 13, 2024
839b26e
wip
vkulinich-cl Feb 13, 2024
b701994
Fix lint warning
vkulinich-cl Feb 13, 2024
9a5b00d
Format code
vkulinich-cl Feb 13, 2024
810f6c7
Merge pull request #464 from galacticcouncil/fix-lint
vkulinich-cl Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/api/accountBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { useQuery } from "@tanstack/react-query"
import { QUERY_KEYS } from "utils/queryKeys"
import { ApiPromise } from "@polkadot/api"
import { Maybe, undefinedNoop } from "utils/helpers"
import { u32 } from "@polkadot/types"
import { u32, u128 } from "@polkadot/types"
import { PalletBalancesAccountData } from "@polkadot/types/lookup"
import { BN } from "@polkadot/util"
interface PalletBalancesAccountDataCustom extends PalletBalancesAccountData {
frozen: u128
}

export const useAccountBalances = (id: Maybe<AccountId32 | string>) => {
const api = useApiPromise()
Expand Down Expand Up @@ -65,10 +69,14 @@ const getTokenAccountBalancesList =
const [, assetId] = pairs[idx]

if (assetId.toString() === NATIVE_ASSET_ID) {
let {data} = natives[nativeIdx]
const frozen = data.feeFrozen ? data.feeFrozen.add(
data.miscFrozen,
) : data.frozen
//@ts-ignore
let { data }: { data: PalletBalancesAccountDataCustom } =
natives[nativeIdx]

const frozen = data.feeFrozen
? data.feeFrozen.add(data.miscFrozen)
: data.frozen

values.push({
free: data.free,
reserved: data.reserved,
Expand Down
14 changes: 11 additions & 3 deletions src/api/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ export const getTokenBalance =
(api: ApiPromise, account: AccountId32 | string, id: string | u32) =>
async () => {
if (id.toString() === NATIVE_ASSET_ID) {
const res = await api.query.system.account(account)
const res = (await api.query.system.account(account)) as any
const freeBalance = new BigNumber(res.data.free.toHex())
const miscFrozenBalance = new BigNumber(res.data.miscFrozen ? res.data.miscFrozen.toHex() : res.data.frozen.toHex())
const feeFrozenBalance = new BigNumber(res.data.feeFrozen ? res.data.feeFrozen.toHex() : res.data.frozen.toHex())
const miscFrozenBalance = new BigNumber(
res.data.miscFrozen
? res.data.miscFrozen.toHex()
: res.data.frozen.toHex(),
)
const feeFrozenBalance = new BigNumber(
res.data.feeFrozen
? res.data.feeFrozen.toHex()
: res.data.frozen.toHex(),
)
const reservedBalance = new BigNumber(res.data.reserved.toHex())

const balance = new BigNumber(
Expand Down
2 changes: 1 addition & 1 deletion src/api/farms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const getGlobalFarm = (api: ApiPromise, id: u32) => async () => {
}

export interface FarmIds {
poolId: AccountId32
poolId: AccountId32 | string
globalFarmId: u32
yieldFarmId: u32
}
2 changes: 1 addition & 1 deletion src/i18n/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
"fund.modal.crypto.buy": "Use cross-chain",
"fund.button": "Fund wallet",
"depeg.modal.title": "Important Notice",
"depeg.modal.desx": "Tether have dropped support for native USDT on Kusama - herefore USDT pools are currently not priced at $1",
"depeg.modal.desx": "Tether have dropped support for native USDT on Kusama - thefore USDT pools are currently not priced at $1",
"depeg.modal.desx.crossChain": "Cross chain transfers in Kusama are temporarily suspended, please do not try to send tokens",
"depeg.modal.icon": "More info"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export const MyPositionsList = ({ pool, onClose }: Props) => {
onClose={onClose}
/>
))
}, [depositNftList, pool])
}, [depositNftList, onClose, pool])
return <div sx={{ flex: "column", gap: 8 }}>{positionsList}</div>
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,16 @@ const getNativeBalances = (
const dp = BN_10.pow(decimals)
const free = balance.free.toBigNumber()
const reservedBN = balance.reserved.toBigNumber()
const feeFrozen = balance.feeFrozen ? balance.feeFrozen.toBigNumber() : balance.frozen.toBigNumber()
const miscFrozen = balance.miscFrozen ? balance.miscFrozen.toBigNumber() : balance.frozen.toBigNumber()

const feeFrozen = balance.feeFrozen
? balance.feeFrozen.toBigNumber()
: //@ts-ignore
balance.frozen.toBigNumber()

const miscFrozen = balance.miscFrozen
? balance.miscFrozen.toBigNumber()
: //@ts-ignore
balance.frozen.toBigNumber()

const total = free.plus(reservedBN).div(dp)
const totalUSD = total.times(spotPrice)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/farms/apr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useAPR = (poolId: AccountId32 | string) => {
// all of the APR calculations are using only half of the position -
// this is correct in terms of inputs but for the user,
// they are not depositing only half of the position, they are depositing 2 assets
apr = globalFarm.id.toString() === '5'? BN_0: apr.div(2)
apr = globalFarm.id.toString() === "5" ? BN_0 : apr.div(2)
const minApr = apr.times(loyaltyFactor)

// max distribution of rewards
Expand Down
6 changes: 4 additions & 2 deletions src/utils/farms/positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ export const useTotalInPositions = () => {
({ position: { yieldFarmId, globalFarmId }, poolId }) => ({
yieldFarmId: yieldFarmId,
globalFarmId: globalFarmId,
poolId,
poolId: poolId.toString(),
}),
) ?? [],
)
const shareTokens = usePoolShareTokens(
deposits.data?.deposits?.map(({ deposit }) => deposit.ammPoolId) ?? [],
deposits.data?.deposits?.map(({ deposit }) =>
deposit.ammPoolId.toString(),
) ?? [],
)
const totalIssuances = useTotalIssuances(
shareTokens.map((st) => st.data?.token),
Expand Down
Loading