Skip to content

Commit

Permalink
feat: gnosis plus more fields (#47)
Browse files Browse the repository at this point in the history
* chore: package update

* feat: gnosis market

* feat: frozen and paused flags
  • Loading branch information
defispartan authored Nov 8, 2023
1 parent 58b1bcc commit 209301d
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 63 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"lint": "next lint"
},
"dependencies": {
"@aave/contract-helpers": "^1.20.0",
"@aave/math-utils": "^1.20.0",
"@bgd-labs/aave-address-book": "^2.4.0",
"@aave/contract-helpers": "^1.21.0",
"@aave/math-utils": "^1.21.0",
"@bgd-labs/aave-address-book": "^2.10.0",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@mui/material": "^5.8.0",
Expand Down
5 changes: 5 additions & 0 deletions pages/api/aave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const chainIdToRPCProvider: Record<number, string> = {
1666600000: "https://api.harmony.one",
1088: "https://andromeda.metis.io/?owner=1088",
8453: "https://base-mainnet.public.blastapi.io",
100: "https://gnosis-mainnet.public.blastapi.io",
};

type configInterface = {
Expand Down Expand Up @@ -71,6 +72,8 @@ export default async function handler(
config.protocol === "v3"
? {
symbol: n.symbol,
frozen: n.isFrozen ? "True" : "False",
paused: n.isPaused ? "True" : "False",
canCollateral: n.usageAsCollateralEnabled ? "True" : "False",
LTV: parseInt(n.baseLTVasCollateral) / 100 + "%",
liqThereshold: parseInt(n.reserveLiquidationThreshold) / 100 + "%",
Expand Down Expand Up @@ -112,6 +115,8 @@ export default async function handler(
}
: {
symbol: n.symbol,
frozen: n.isFrozen ? "True" : "False",
paused: n.isPaused ? "True" : "False",
canCollateral: n.usageAsCollateralEnabled ? "True" : "False",
LTV: parseInt(n.baseLTVasCollateral) / 100 + "%",
liqThereshold: parseInt(n.reserveLiquidationThreshold) / 100 + "%",
Expand Down
12 changes: 8 additions & 4 deletions utils/headers.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
export const headers = {
v2: [
"asset",
"frozen",
"paused",
"can collateral",
"LTV",
"liquidation thereshold",
"liquidation bonus",
"reserve factor",
"can borrow?",
"can borrow",
"optimal utilization",
"variable borrow rate",
"can borrow stable?",
"can borrow stable",
"stable borrow rate",
"share of stable rate",
"",
],
v3: [
"asset",
"frozen",
"paused",
"can collateral",
"LTV",
"liquidation thereshold",
"liquidation bonus",
"reserve factor",
"can borrow?",
"can borrow",
"optimal utilization",
"variable borrow rate",
"can borrow stable?",
"can borrow stable",
"stable borrow rate",
"share of stable rate",
"is isolated",
Expand Down
88 changes: 44 additions & 44 deletions utils/interfaces.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
interface Aavev2 {
symbol: string,
canCollateral: string,
LTV: string,
liqThereshold: string,
liqBonus: string,
reserveFactor: string,
canBorrow: string,
optimalUtilization: string,
varBorrowRate: string,
canBorrowStable: string,
stableBorrowRate: string,
shareOfStableRate: string,
assetLink: string,
symbol: string;
frozen: string;
paused: string;
canCollateral: string;
LTV: string;
liqThereshold: string;
liqBonus: string;
reserveFactor: string;
canBorrow: string;
optimalUtilization: string;
varBorrowRate: string;
canBorrowStable: string;
stableBorrowRate: string;
shareOfStableRate: string;
assetLink: string;
}

interface Aavev3 {
symbol: string,
canCollateral: string,
LTV: string,
liqThereshold: string,
liqBonus: string,
reserveFactor: string,
canBorrow: string,
optimalUtilization: string,
varBorrowRate: string,
canBorrowStable: string,
stableBorrowRate: string,
shareOfStableRate: string,
debtCeiling: string,
supplyCap: string,
borrowCap: string,
eModeLtv: string
eModeLiquidationThereshold: string,
eModeLiquidationBonus: string,
assetLink: string,
symbol: string;
frozen: string;
paused: string;
canCollateral: string;
LTV: string;
liqThereshold: string;
liqBonus: string;
reserveFactor: string;
canBorrow: string;
optimalUtilization: string;
varBorrowRate: string;
canBorrowStable: string;
stableBorrowRate: string;
shareOfStableRate: string;
debtCeiling: string;
supplyCap: string;
borrowCap: string;
eModeLtv: string;
eModeLiquidationThereshold: string;
eModeLiquidationBonus: string;
assetLink: string;
}

interface Benqi {
symbol: string,
collateralFactor: string,
reserveFactor: string,
closeFactor: string,
liquidationIncentive: string,
assetLink?: string
symbol: string;
collateralFactor: string;
reserveFactor: string;
closeFactor: string;
liquidationIncentive: string;
assetLink?: string;
}

export type assetType = (Aavev2 | Aavev3 | Benqi)
export type assetType = Aavev2 | Aavev3 | Benqi;

export type {
Aavev2,
Aavev3,
Benqi
}
export type { Aavev2, Aavev3, Benqi };
8 changes: 8 additions & 0 deletions utils/marketconfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
AaveV2Polygon,
AaveV3Metis,
AaveV3Base,
AaveV3Gnosis,
} from "@bgd-labs/aave-address-book";
import { ChainId } from "@aave/contract-helpers";

Expand Down Expand Up @@ -107,4 +108,11 @@ export const marketConfig = {
UI_POOL_DATA_PROVIDER: AaveV3Base.UI_POOL_DATA_PROVIDER,
marketName: "proto_base_v3",
},
gnosis: {
chainId: 100,
publicJsonRPCUrl: "https://gnosis-mainnet.public.blastapi.io",
LENDING_POOL_ADDRESS_PROVIDER: AaveV3Gnosis.POOL_ADDRESSES_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Gnosis.UI_POOL_DATA_PROVIDER,
marketName: "proto_gnosis_v3",
},
};
4 changes: 4 additions & 0 deletions utils/markets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export const markets = {
name: "base",
config: marketConfig.base,
},
{
name: "gnosis",
config: marketConfig.gnosis,
},
],
benqi: [
{
Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# yarn lockfile v1


"@aave/contract-helpers@^1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@aave/contract-helpers/-/contract-helpers-1.20.0.tgz#4ff6afb540402ff2ffef3b08cbcc80a688b627d1"
integrity sha512-LrHswh/g1fyTpZ4fKHO2jdGjDe/2ligz47xZp/b23IS+b2eXxvTqOtPvDyyAXyYvcmK6Ce3zYYAUk2jaMOGoNg==
"@aave/contract-helpers@^1.21.0":
version "1.21.0"
resolved "https://registry.yarnpkg.com/@aave/contract-helpers/-/contract-helpers-1.21.0.tgz#9081a7aab4bc84818584494c344e99ef3e1dffec"
integrity sha512-vlTZyX5yDHli4u4zXNcI74JRcWToPSL3ARdax80Kauu+9L8SxjWNcbIfPrCvvQ7j0HY8tYDg4O4FYRjwu62N3Q==
dependencies:
isomorphic-unfetch "^3.1.0"

"@aave/math-utils@^1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@aave/math-utils/-/math-utils-1.20.0.tgz#735f38c8150e8a603490d73d2db59864d5515dd6"
integrity sha512-s6o2x1Gx1aqA+w0Hk8KzKsdqBA2A/iT7WGNkIAelfyxLJol2JC3Ap6tzDTlEny2zzLIfl+vpQjdWhabFMgqv4Q==
"@aave/math-utils@^1.21.0":
version "1.21.0"
resolved "https://registry.yarnpkg.com/@aave/math-utils/-/math-utils-1.21.0.tgz#420e36de179c27637be1c544afaf2f7b6c92b4d1"
integrity sha512-phO9BogmnpMPaK0/rl2QxdiTfHLHb+YmTCwvLC3e/IhDyRcc4QKLb/NFaPfC65aRZBjEEsS4QI1crPz3WKHHXA==

"@babel/code-frame@^7.0.0":
version "7.18.6"
Expand Down Expand Up @@ -83,10 +83,10 @@
"@babel/helper-validator-identifier" "^7.18.6"
to-fast-properties "^2.0.0"

"@bgd-labs/aave-address-book@^2.4.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.5.0.tgz#bda008b65b87b21c7a5940861d5ccf0b7285a282"
integrity sha512-YCTJVlWvmnaYUNgrOqhB0UZw+uJ6Y3qguwr5l8ul10auajM1/gzzK1Wt+qkc8Ih7ccuoGcqqUyfQj5DKE31IZA==
"@bgd-labs/aave-address-book@^2.10.0":
version "2.10.0"
resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.10.0.tgz#19873ec0edf9ee1f1a5539162e6092b0a2b2c4b4"
integrity sha512-DVglkDCYUf7etb6mnCziIY2HPgap4X3AnC/1tC0ZqpXFrhO0lQzWBiMeWy20r1x/b81iHMQa02ULaco3LhdeVw==

"@emotion/babel-plugin@^11.10.0":
version "11.10.2"
Expand Down

1 comment on commit 209301d

@vercel
Copy link

@vercel vercel bot commented on 209301d Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.