Skip to content

Commit

Permalink
Merge branch 'master' into 86c0qz6a5
Browse files Browse the repository at this point in the history
  • Loading branch information
vkulinich-cl committed Dec 6, 2024
2 parents 0e72bb1 + 9d36da2 commit 77da24a
Show file tree
Hide file tree
Showing 38 changed files with 248 additions and 239 deletions.
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ VITE_HDX_CAIP_ID=polkadot:afdc188f45c71dacbaa0b62e16a91f72
VITE_STABLECOIN_ASSET_ID=10
VITE_FF_DISPLAY_ASSET_ENABLED=true
VITE_FF_ADD_TOKEN=true
VITE_REFERENDUM_LINK=https://hydradx.subsquare.io/democracy/referendum
VITE_REFERENDUM_DATA_URL=https://hydradx.subsquare.io/api/democracy/referendums
VITE_REFERENDUM_LINK=https://hydration.subsquare.io/democracy/referendum
VITE_REFERENDUM_DATA_URL=https://hydration.subsquare.io/api/democracy/referendums
VITE_EVM_CHAIN_ID=222222
VITE_EVM_NATIVE_ASSET_ID=20
VITE_MIGRATION_TRIGGER_DOMAIN="deploy-preview-1334--testnet-hydra-app.netlify.app"
Expand Down
4 changes: 2 additions & 2 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ VITE_HDX_CAIP_ID=polkadot:afdc188f45c71dacbaa0b62e16a91f72
VITE_STABLECOIN_ASSET_ID=10
VITE_FF_DISPLAY_ASSET_ENABLED=false
VITE_FF_ADD_TOKEN=true
VITE_REFERENDUM_LINK=https://hydradx.subsquare.io/democracy/referendum
VITE_REFERENDUM_DATA_URL=https://hydradx.subsquare.io/api/democracy/referendums
VITE_REFERENDUM_LINK=https://hydration.subsquare.io/democracy/referendum
VITE_REFERENDUM_DATA_URL=https://hydration.subsquare.io/api/democracy/referendums
VITE_EVM_CHAIN_ID=222222
VITE_EVM_NATIVE_ASSET_ID=20
VITE_MIGRATION_TRIGGER_DOMAIN="app.hydradx.io"
Expand Down
4 changes: 2 additions & 2 deletions .env.rococo
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ VITE_HDX_CAIP_ID=polkadot:afdc188f45c71dacbaa0b62e16a91f72
VITE_STABLECOIN_ASSET_ID=10
VITE_FF_DISPLAY_ASSET_ENABLED=false
VITE_FF_ADD_TOKEN=false
VITE_REFERENDUM_LINK=https://hydradx.subsquare.io/democracy/referendum
VITE_REFERENDUM_DATA_URL=https://hydradx.subsquare.io/api/democracy/referendums
VITE_REFERENDUM_LINK=https://hydration.subsquare.io/democracy/referendum
VITE_REFERENDUM_DATA_URL=https://hydration.subsquare.io/api/democracy/referendums
VITE_EVM_CHAIN_ID=
VITE_EVM_NATIVE_ASSET_ID=20
VITE_MIGRATION_TRIGGER_DOMAIN=""
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@emotion/styled": "^11.10.4",
"@ethersproject/address": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@galacticcouncil/apps": "^9.0.2",
"@galacticcouncil/apps": "^9.1.0",
"@galacticcouncil/math-lbp": "^1.0.0",
"@galacticcouncil/math-liquidity-mining": "^1.0.0",
"@galacticcouncil/math-omnipool": "^1.0.0",
Expand All @@ -47,15 +47,15 @@
"@galacticcouncil/math-xyk": "^1.0.0",
"@galacticcouncil/sdk": "^5.0.1",
"@galacticcouncil/ui": "^5.2.3",
"@galacticcouncil/xcm-cfg": "^5.5.1",
"@galacticcouncil/xcm-cfg": "^5.6.0",
"@galacticcouncil/xcm-core": "^5.4.0",
"@galacticcouncil/xcm-sdk": "^7.0.0",
"@hookform/resolvers": "^3.3.4",
"@lit-labs/react": "^1.1.0",
"@polkadot/api": "14.0.1",
"@polkadot/apps-config": "^0.132.1",
"@polkadot/extension-inject": "^0.48.2",
"@polkadot/networks": "^13.2.2",
"@polkadot/networks": "^13.2.3",
"@polkadot/ui-shared": "^3.1.4",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
Expand Down
45 changes: 34 additions & 11 deletions src/api/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,46 @@ export const getAcceptedCurrency = (api: ApiPromise) => async () => {
}

export const useAcceptedCurrencies = (ids: string[]) => {
const { api, isLoaded } = useRpcProvider()
const { api, isLoaded, tradeRouter } = useRpcProvider()
const { native } = useAssets()

return useQuery(QUERY_KEYS.acceptedCurrencies, getAcceptedCurrency(api), {
enabled: isLoaded && ids.length > 0,
select: (assets) => {
return useQuery(
QUERY_KEYS.acceptedCurrencies(ids),
async () => {
const [pools, acceptedCurrency] = await Promise.all([
tradeRouter.getPools(),
getAcceptedCurrency(api)(),
])

return ids.map((id) => {
const response = assets.find((asset) => asset.id === id)
const currency = acceptedCurrency.find((currency) => currency.id === id)

if (currency) {
return currency
}

if (id === native.id) {
return { id, accepted: true, data: undefined }
}

const hasPoolWithDOT = !!pools.find((pool) => {
return (
pool.tokens.find((token) => token.id === id) &&
pool.tokens.find((token) => token.id === "5")
)
})

return response
? response
: id === native.id
? { id, accepted: true, data: undefined }
: { id, accepted: false, data: undefined }
if (hasPoolWithDOT) {
return { id, accepted: true, data: undefined }
}

return { id, accepted: false, data: undefined }
})
},
})
{
enabled: isLoaded && ids.length > 0,
},
)
}

export const useSetAsFeePayment = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@
"staking.dashboard.rewards.legend.current": "Current rewards",
"staking.dashboard.rewards.legend.future": "Rewards after voting",
"staking.dashboard.rewards.legend.tooltip": "You have to vote max conviction with whole staking position",
"staking.dashboard.graph.axisY": "Paylable Percentage",
"staking.dashboard.graph.axisY": "Payable Percentage",
"staking.dashboard.graph.axisX": "Days",
"staking.dashboard.rewards.button": "Claim",
"staking.dashboard.stats.chart.label": "Staked HDX",
Expand Down
3 changes: 3 additions & 0 deletions src/sections/assets/AssetsModal.utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface useAssetsModalProps {
allAssets?: boolean
confirmRequired?: boolean
defaultSelectedAsssetId?: string
withExternal?: boolean
}

export const useAssetsModal = ({
Expand All @@ -28,6 +29,7 @@ export const useAssetsModal = ({
allAssets,
confirmRequired,
defaultSelectedAsssetId,
withExternal,
}: useAssetsModalProps) => {
const { t } = useTranslation()
const [isOpen, setIsOpen] = useState(false)
Expand Down Expand Up @@ -61,6 +63,7 @@ export const useAssetsModal = ({
allAssets={allAssets}
confirmRequired={confirmRequired}
defaultSelectedAsssetId={defaultSelectedAsssetId}
withExternal={withExternal}
/>
</Modal>
) : null
Expand Down
10 changes: 1 addition & 9 deletions src/sections/lending/components/caps/DebtCeilingStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,7 @@ export const DebtCeilingStatus = ({
Debt ceiling limits the amount possible to borrow against this
asset by protocol users. Debt ceiling is specific to assets in
isolation mode and is denoted in USD.
</span>{" "}
<a
target="_blank"
href="https://docs.aave.com/faq/aave-v3-features#how-does-isolation-mode-affect-my-borrowing-power"
rel="noreferrer"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</a>
</span>
</span>
}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { InfoTooltip } from "components/InfoTooltip/InfoTooltip"
import { Text } from "components/Typography/Text/Text"
import { Link } from "sections/lending/components/primitives/Link"
import { AssetCapData } from "sections/lending/hooks/useAssetCaps"

type BorrowCapMaxedTooltipProps = {
Expand All @@ -16,16 +15,8 @@ export const BorrowCapMaxedTooltip = ({
<InfoTooltip
text={
<Text>
<span>
Protocol borrow cap at 100% for this asset. Further borrowing
unavailable.
</span>{" "}
<Link
href="https://docs.aave.com/developers/whats-new/supply-borrow-caps"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</Link>
Protocol borrow cap at 100% for this asset. Further borrowing
unavailable.
</Text>
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AssetCapData } from "sections/lending/hooks/useAssetCaps"
import { InfoTooltip } from "components/InfoTooltip/InfoTooltip"
import { Link } from "sections/lending/components/primitives/Link"
import { Text } from "components/Typography/Text/Text"

type DebtCeilingMaxedTooltipProps = {
Expand All @@ -16,16 +15,8 @@ export const DebtCeilingMaxedTooltip = ({
<InfoTooltip
text={
<Text>
<span>
Protocol debt ceiling is at 100% for this asset. Futher borrowing
against this asset is unavailable.
</span>{" "}
<Link
href="https://docs.aave.com/faq/aave-v3-features#how-does-isolation-mode-affect-my-borrowing-power"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</Link>
Protocol debt ceiling is at 100% for this asset. Futher borrowing
against this asset is unavailable.
</Text>
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AssetCapData } from "sections/lending/hooks/useAssetCaps"
import { Link } from "sections/lending/components/primitives/Link"
import { InfoTooltip } from "components/InfoTooltip/InfoTooltip"
import { Text } from "components/Typography/Text/Text"

Expand All @@ -16,16 +15,8 @@ export const SupplyCapMaxedTooltip = ({
<InfoTooltip
text={
<Text>
<span>
Protocol supply cap at 100% for this asset. Further supply
unavailable.
</span>{" "}
<Link
href="https://docs.aave.com/developers/whats-new/supply-borrow-caps"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</Link>
Protocol supply cap at 100% for this asset. Further supply
unavailable.
</Text>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,8 @@ export const EmodeModalContent = ({ mode }: EmodeModalContentProps) => {
{user.userEmodeCategoryId === 0 && (
<Alert variant="warning" sx={{ mt: 12 }}>
<Text>
<span>
Enabling E-Mode only allows you to borrow assets belonging to the
selected category. Please visit our{" "}
<a
href="https://docs.aave.com/faq/aave-v3-features#high-efficiency-mode-e-mode"
target="_blank"
rel="noopener noreferrer"
>
FAQ guide
</a>{" "}
to learn more about how it works and the applied restrictions.
</span>
Enabling E-Mode only allows you to borrow assets belonging to the
selected category.
</Text>
</Alert>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AssetCapData } from "sections/lending/hooks/useAssetCaps"
import { Alert } from "components/Alert"
import { Link } from "sections/lending/components/primitives/Link"

type BorrowCapWarningProps = {
borrowCap: AssetCapData
Expand Down Expand Up @@ -29,13 +28,7 @@ export const BorrowCapWarning = ({

return (
<Alert {...rest} variant="warning">
{renderText()}{" "}
<Link
href="https://docs.aave.com/developers/whats-new/supply-borrow-caps"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</Link>
{renderText()}
</Alert>
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AssetCapData } from "sections/lending/hooks/useAssetCaps"
import { Alert } from "components/Alert"
import { Link } from "sections/lending/components/primitives/Link"

type DebtCeilingWarningProps = {
debtCeiling: AssetCapData
Expand Down Expand Up @@ -29,13 +28,7 @@ export const DebtCeilingWarning = ({

return (
<Alert variant={debtCeiling.isMaxed ? "error" : "warning"} {...rest}>
{renderText()}{" "}
<Link
href="https://docs.aave.com/faq/aave-v3-features#how-does-isolation-mode-affect-my-borrowing-power"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</Link>
{renderText()}
</Alert>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export const IsolationModeWarning = ({
In Isolation mode, you cannot supply other assets as collateral. A
global debt ceiling limits the borrowing power of the isolated asset. To
exit isolation mode disable {asset ? asset : ""} as collateral before
borrowing another asset. Read more in our{" "}
<Link href="https://docs.aave.com/faq/aave-v3-features#isolation-mode">
FAQ
</Link>
borrowing another asset.
</Text>
</Alert>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AssetCapData } from "sections/lending/hooks/useAssetCaps"
import { Link } from "sections/lending/components/primitives/Link"
import { Alert } from "components/Alert"

type SupplyCapWarningProps = {
Expand Down Expand Up @@ -33,13 +32,7 @@ export const SupplyCapWarning = ({

return (
<Alert variant={severity} {...rest}>
{renderText()}{" "}
<Link
href="https://docs.aave.com/developers/whats-new/supply-borrow-caps"
css={{ textDecoration: "underline" }}
>
<span>Learn more</span>
</Link>
{renderText()}
</Alert>
)
}
13 changes: 0 additions & 13 deletions src/sections/lending/ui/isolation-mode/IsolationBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,6 @@ const IsolationModeTooltipTemplate = ({ content }: { content: ReactNode }) => {
<Text fs={12} lh={18} sx={{ mb: 6 }}>
{content}
</Text>
<Text fs={12} lh={18}>
<span>
Learn more in our{" "}
<a
target="_blank"
href="https://docs.aave.com/faq/aave-v3-features#isolation-mode"
rel="noreferrer"
css={{ textDecoration: "underline" }}
>
FAQ guide
</a>
</span>
</Text>
</div>
)
}
10 changes: 1 addition & 9 deletions src/sections/lending/ui/reserve-overview/BorrowInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,7 @@ export const BorrowInfo = ({
<InfoTooltip
text={
<Text fs={12}>
{t("lending.tooltip.borrowCap")}{" "}
<a
css={{ textDecoration: "underline" }}
target="_blank"
href="https://docs.aave.com/developers/whats-new/supply-borrow-caps"
rel="noreferrer"
>
{t("lending.learnMore")}
</a>
{t("lending.tooltip.borrowCap")}
</Text>
}
>
Expand Down
9 changes: 1 addition & 8 deletions src/sections/lending/ui/reserve-overview/SupplyInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,7 @@ export const SupplyInfo = ({
{t("lending.supply.isolatedCollateral.title")}
</Text>
<Text fs={13}>
{t("lending.supply.isolatedCollateral.description")}{" "}
<a
target="_blank"
href="https://docs.aave.com/faq/aave-v3-features#isolation-mode"
rel="noreferrer"
>
{t("lending.learnMore")}
</a>
{t("lending.supply.isolatedCollateral.description")}
</Text>
</Alert>
</div>
Expand Down
Loading

0 comments on commit 77da24a

Please sign in to comment.