diff --git a/abis/read/aaveV2.json b/abis/read/aaveV2.json index 48b0b08..09c703c 100644 --- a/abis/read/aaveV2.json +++ b/abis/read/aaveV2.json @@ -1,168 +1,196 @@ -[{ - "inputs": [{ - "internalType": "address", - "name": "user", - "type": "address" - }, { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }], +[ + { + "type": "function", + "stateMutability": "view", + "outputs": [ + { + "type": "tuple[]", + "name": "", + "internalType": "struct AaveHelpers.AaveUserTokenData[]", + "components": [ + { + "type": "uint256", + "name": "tokenPriceInEth", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "tokenPriceInUsd", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "supplyBalance", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "stableBorrowBalance", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "variableBorrowBalance", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "supplyRate", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "stableBorrowRate", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "userStableBorrowRate", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "variableBorrowRate", + "internalType": "uint256" + }, + { "type": "bool", "name": "isCollateral", "internalType": "bool" }, + { + "type": "tuple", + "name": "aaveTokenData", + "internalType": "struct AaveHelpers.AaveTokenData", + "components": [ + { "type": "uint256", "name": "ltv", "internalType": "uint256" }, + { + "type": "uint256", + "name": "threshold", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "reserveFactor", + "internalType": "uint256" + }, + { + "type": "bool", + "name": "usageAsCollEnabled", + "internalType": "bool" + }, + { + "type": "bool", + "name": "borrowEnabled", + "internalType": "bool" + }, + { + "type": "bool", + "name": "stableBorrowEnabled", + "internalType": "bool" + }, + { "type": "bool", "name": "isActive", "internalType": "bool" }, + { "type": "bool", "name": "isFrozen", "internalType": "bool" }, + { + "type": "uint256", + "name": "totalSupply", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "availableLiquidity", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "totalStableDebt", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "totalVariableDebt", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "collateralEmission", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "debtEmission", + "internalType": "uint256" + }, + { + "type": "address", + "name": "aTokenAddress", + "internalType": "address" + }, + { + "type": "address", + "name": "stableDebtTokenAddress", + "internalType": "address" + }, + { + "type": "address", + "name": "variableDebtTokenAddress", + "internalType": "address" + } + ] + } + ] + }, + { + "type": "tuple", + "name": "", + "internalType": "struct AaveHelpers.AaveUserData", + "components": [ + { + "type": "uint256", + "name": "totalCollateralETH", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "totalBorrowsETH", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "availableBorrowsETH", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "currentLiquidationThreshold", + "internalType": "uint256" + }, + { "type": "uint256", "name": "ltv", "internalType": "uint256" }, + { + "type": "uint256", + "name": "healthFactor", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "ethPriceInUsd", + "internalType": "uint256" + }, + { + "type": "uint256", + "name": "pendingRewards", + "internalType": "uint256" + } + ] + } + ], "name": "getPosition", - "outputs": [{ - "components": [{ - "internalType": "uint256", - "name": "tokenPriceInEth", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "tokenPriceInUsd", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "supplyBalance", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "stableBorrowBalance", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "variableBorrowBalance", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "supplyRate", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "userStableBorrowRate", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, { - "internalType": "bool", - "name": "isCollateral", - "type": "bool" - }, { - "components": [{ - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "threshold", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "reserveFactor", - "type": "uint256" - }, { - "internalType": "bool", - "name": "usageAsCollEnabled", - "type": "bool" - }, { - "internalType": "bool", - "name": "borrowEnabled", - "type": "bool" - }, { - "internalType": "bool", - "name": "stableBorrowEnabled", - "type": "bool" - }, { - "internalType": "bool", - "name": "isActive", - "type": "bool" - }, { - "internalType": "bool", - "name": "isFrozen", - "type": "bool" - }, { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "collateralEmission", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "debtEmission", - "type": "uint256" - }], - "internalType": "struct AaveHelpers.AaveTokenData", - "name": "aaveTokenData", - "type": "tuple" - }], - "internalType": "struct AaveHelpers.AaveUserTokenData[]", - "name": "", - "type": "tuple[]" - }, { - "components": [{ - "internalType": "uint256", - "name": "totalCollateralETH", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "totalBorrowsETH", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "availableBorrowsETH", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "currentLiquidationThreshold", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "healthFactor", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "ethPriceInUsd", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "pendingRewards", - "type": "uint256" - }], - "internalType": "struct AaveHelpers.AaveUserData", - "name": "", - "type": "tuple" - }], + "inputs": [ + { "type": "address", "name": "user", "internalType": "address" }, + { "type": "address[]", "name": "tokens", "internalType": "address[]" } + ] + }, + { + "type": "function", "stateMutability": "view", - "type": "function" - }, { - "inputs": [], + "outputs": [{ "type": "string", "name": "", "internalType": "string" }], "name": "name", - "outputs": [{ - "internalType": "string", - "name": "", - "type": "string" - }], - "stateMutability": "view", - "type": "function" - }] \ No newline at end of file + "inputs": [] + } +] \ No newline at end of file diff --git a/assets/icons/avalanche.svg b/assets/icons/avalanche.svg new file mode 100644 index 0000000..02bb5d2 --- /dev/null +++ b/assets/icons/avalanche.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/assets/icons/currencies/aave.svg b/assets/icons/currencies/aave.svg index 55017cd..4f9b21e 100644 --- a/assets/icons/currencies/aave.svg +++ b/assets/icons/currencies/aave.svg @@ -1 +1,18 @@ - \ No newline at end of file + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/icons/currencies/avax.svg b/assets/icons/currencies/avax.svg new file mode 100644 index 0000000..52767e1 --- /dev/null +++ b/assets/icons/currencies/avax.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/icons/currencies/eth.svg b/assets/icons/currencies/eth.svg index ad46b15..14c742c 100644 --- a/assets/icons/currencies/eth.svg +++ b/assets/icons/currencies/eth.svg @@ -1 +1,18 @@ - \ No newline at end of file + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/icons/currencies/gunidaiusdc.svg b/assets/icons/currencies/gunidaiusdc.svg new file mode 100644 index 0000000..efc1090 --- /dev/null +++ b/assets/icons/currencies/gunidaiusdc.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/currencies/usdc.svg b/assets/icons/currencies/usdc.svg index 3a2045e..23e159f 100644 --- a/assets/icons/currencies/usdc.svg +++ b/assets/icons/currencies/usdc.svg @@ -1 +1,12 @@ - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/assets/icons/currencies/wavax.svg b/assets/icons/currencies/wavax.svg new file mode 100644 index 0000000..fc0643f --- /dev/null +++ b/assets/icons/currencies/wavax.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/IconCurrency.vue b/components/IconCurrency.vue index 7687f8b..3306e96 100644 --- a/components/IconCurrency.vue +++ b/components/IconCurrency.vue @@ -3,7 +3,7 @@
@@ -77,6 +77,8 @@ + +
diff --git a/composables/protocols/useAaveV2Position.ts b/composables/protocols/useAaveV2Position.ts index 67d1474..ffffc3c 100644 --- a/composables/protocols/useAaveV2Position.ts +++ b/composables/protocols/useAaveV2Position.ts @@ -13,6 +13,7 @@ import { usePosition } from "~/composables/usePosition"; import { useToken } from "~/composables/useToken"; import { useSorting } from "~/composables/useSorting"; import useEventBus from "../useEventBus"; +import addresses from "~/constant/addresses"; const { times, @@ -70,13 +71,13 @@ export function useAaveV2Position( const { activeNetworkId } = useNetwork(); const { activeAccount } = useDSA(); const { getTokenByKey, allATokensV2 } = useToken(); - const { byMaxSupplyOrBorrowDesc } = useSorting() - const { onEvent } = useEventBus() - - const resolver = computed(() => - chainId.value === 1 - ? "0xFb3a1D56eD56F046721B9aCa749895100754578b" - : "0xD6E0803d0eB34af8Ea135835512D7E77960b28F1" + const { byMaxSupplyOrBorrowDesc } = useSorting(); + const { onEvent } = useEventBus(); + + const resolver = computed( + () => + // @ts-ignore + addresses[activeNetworkId.value]?.resolver?.aave_v2 ); const fetchPosition = async () => { @@ -97,6 +98,8 @@ export function useAaveV2Position( a => tokens[activeNetworkId.value].getTokenByKey(a.root).address ); + console.log(activeAccount.value.address, aaveTokensArr); + const aaveRawData = await aaveResolverInstance.methods .getPosition(activeAccount.value.address, aaveTokensArr) .call(); @@ -393,7 +396,10 @@ function calculateAavePosition(res: any[], network: Network = Network.Mainnet) { totalStableDebt, totalVariableDebt, collateralEmission, - debtEmission + debtEmission, + aTokenAddress, + stableDebtTokenAddress, + variableDebtTokenAddress ] = AaveTokenData; /* eslint-enable no-unused-vars */ @@ -473,6 +479,9 @@ function calculateAavePosition(res: any[], network: Network = Network.Mainnet) { dataPos.push({ key: root, aTokenAddr: key, + aTokenAddress, + stableDebtTokenAddress, + variableDebtTokenAddress, aTokenBal: supplyBalanceInWei, aTokenKey: atoken.key, aDecimals: atoken.decimals.toString(), diff --git a/composables/useBalances.ts b/composables/useBalances.ts index 5cdc927..14f2d8c 100644 --- a/composables/useBalances.ts +++ b/composables/useBalances.ts @@ -23,19 +23,22 @@ const balances = reactive({ user: { mainnet: {}, polygon: {}, - arbitrum: {} + arbitrum: {}, + avalanche: {} }, dsa: { mainnet: {}, polygon: {}, - arbitrum: {} + arbitrum: {}, + avalanche: {} } }); const prices = reactive({ mainnet: {}, polygon: {}, - arbitrum: {} + arbitrum: {}, + avalanche: {} }); export function useBalances() { @@ -55,6 +58,9 @@ export function useBalances() { prices.arbitrum = await $axios.$get( "https://api.instadapp.io/defi/arbitrum/prices" ); + prices.avalanche = await $axios.$get( + "https://api.instadapp.io/defi/avalanche/prices" + ); }); const fetchBalances = async (refresh = false) => { if (!balances.user || refresh) { @@ -71,6 +77,10 @@ export function useBalances() { arbitrum: activeNetworkId.value === Network.Arbitrum ? await getBalances(account.value, Network.Arbitrum, library.value) + : {}, + avalanche: + activeNetworkId.value === Network.Avalanche + ? await getBalances(account.value, Network.Avalanche, library.value) : {} }; } @@ -102,6 +112,10 @@ export function useBalances() { Network.Arbitrum, library.value ) + : {}, + avalanche: + activeNetworkId.value === Network.Avalanche + ? await getBalances(account.value, Network.Avalanche, library.value) : {} }; } diff --git a/composables/useLink.ts b/composables/useLink.ts index b0e4586..5afd154 100644 --- a/composables/useLink.ts +++ b/composables/useLink.ts @@ -8,10 +8,15 @@ export function useLink() { if (activeNetworkId.value === "polygon") { return "https://polygonscan.com/address"; } + if (activeNetworkId.value === "arbitrum") { return "https://arbiscan.io/address"; } + if (activeNetworkId.value === "avalanche") { + return "https://cchain.explorer.avax.network/address"; + } + return "https://etherscan.io/address"; }); @@ -26,5 +31,7 @@ export const getPolygonLink = transactionHash => `https://polygonscan.com/tx/${transactionHash}`; export const getArbitrumLink = transactionHash => `https://arbiscan.io/tx/${transactionHash}`; +export const getAvalancheLink = transactionHash => + `https://cchain.explorer.avax.network/tx/${transactionHash}`; export const getTenderlyLink = simulationId => `https://dashboard.tenderly.co/public/InstaDApp/dsa-simulations/fork-simulation/${simulationId}?hideSidebar=true`; diff --git a/composables/useNetwork.ts b/composables/useNetwork.ts index 98fb9d4..37ff944 100644 --- a/composables/useNetwork.ts +++ b/composables/useNetwork.ts @@ -3,6 +3,7 @@ import { computed, watchEffect, ref, watch } from "@nuxtjs/composition-api"; import MainnetSVG from "~/assets/icons/mainnet.svg?inline"; import PolygonSVG from "~/assets/icons/polygon.svg?inline"; import ArbitrumSVG from "~/assets/icons/arbitrum.svg?inline"; +import AvalancheSVG from "~/assets/icons/avalanche.svg?inline"; import { useModal } from "./useModal"; import { useNotification } from "./useNotification"; @@ -12,13 +13,15 @@ import { useCookies } from "./useCookies"; export enum Network { Mainnet = "mainnet", Polygon = "polygon", - Arbitrum = "arbitrum" + Arbitrum = "arbitrum", + Avalanche = "avalanche" } export const networks = [ { id: "mainnet", chainId: 1, name: "Mainnet", icon: MainnetSVG }, { id: "polygon", chainId: 137, name: "Polygon", icon: PolygonSVG }, - { id: "arbitrum", chainId: 42161, name: "Arbitrum", icon: ArbitrumSVG } + { id: "arbitrum", chainId: 42161, name: "Arbitrum", icon: ArbitrumSVG }, + { id: "avalanche", chainId: 43114, name: "Avalanche", icon: AvalancheSVG }, ]; export const activeNetworkId = ref(); @@ -135,12 +138,52 @@ export function useNetwork() { } } + async function switchToAvalanche() { + if (window.ethereum) { + const chainId = '0xa86a' + + try { + await window.ethereum.request({ + method: 'wallet_switchEthereumChain', + params: [{ chainId }], + }) + } catch (switchError) { + // 4902 error code indicates that the chain has not been added to MetaMask. + if (switchError.code === 4902) { + try { + const chainData = { + chainId, + chainName: 'Avalanche Network', + nativeCurrency: { + name: 'Avalanche', + symbol: 'AVAX', + decimals: 18, + }, + rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'], + blockExplorerUrls: ['https://cchain.explorer.avax.network/'], + } + await window.ethereum.request({ + method: 'wallet_addEthereumChain', + params: [chainData, account.value], + }) + } catch (addError) { + return Promise.reject(addError) + } + } else { + return Promise.reject(switchError) + } + } + } + } + async function switchNetwork() { try { if (activeNetworkId.value === "mainnet") { await switchToMainnet(); } else if (activeNetworkId.value === "arbitrum") { await switchToArbitrum(); + } else if (activeNetworkId.value === "avalanche") { + await switchToAvalanche(); } else { await switchToPolygon(); } diff --git a/composables/useNotification.ts b/composables/useNotification.ts index 483d03e..ab56d55 100644 --- a/composables/useNotification.ts +++ b/composables/useNotification.ts @@ -1,6 +1,7 @@ import { ref } from "@nuxtjs/composition-api"; import { useFormatting } from "@/composables/useFormatting"; import { + getAvalancheLink, getArbitrumLink, getEtherscanLink, getMaticLink, @@ -99,6 +100,8 @@ export function useNotification() { href = getMaticLink(transactionHash); }else if (network === Network.Arbitrum) { href = getArbitrumLink(transactionHash); + }else if (network === Network.Avalanche) { + href = getAvalancheLink(transactionHash); } else { href = getEtherscanLink(transactionHash); } @@ -122,6 +125,8 @@ export function useNotification() { href = getMaticLink(transactionHash); } else if (network === Network.Arbitrum) { href = getArbitrumLink(transactionHash); + } else if (network === Network.Avalanche) { + href = getAvalancheLink(transactionHash); } else { href = getEtherscanLink(transactionHash); } diff --git a/connectors/index.ts b/connectors/index.ts index 977b638..6dffc5b 100644 --- a/connectors/index.ts +++ b/connectors/index.ts @@ -14,16 +14,17 @@ import { SafeAppConnector } from "@gnosis.pm/safe-apps-web3-react/dist/connector setWeb3LibraryCallback(provider => new Web3(provider)); export const injected = new InjectedConnector({ - supportedChainIds: [1, 137, 42161] + supportedChainIds: [1, 137, 42161, 43114] }); export const walletconnect = new WalletConnectConnector({ rpc: { 1: `https://mainnet.infura.io/v3/${process.env.INFURA_ID}`, 137: "https://rpc-mainnet.maticvigil.com", - 42161: "https://arb1.arbitrum.io/rpc" + 42161: "https://arb1.arbitrum.io/rpc", + 43114: "https://api.avax.network/ext/bc/C/rpc" }, - supportedChainIds: [1, 137, 42161] + supportedChainIds: [1, 137, 42161, 43114] }); // mainnet only @@ -42,7 +43,7 @@ let gnosisSafe = null; if (process.client) { gnosisSafe = new SafeAppConnector({ - supportedChainIds: [1, 137, 42161] + supportedChainIds: [1, 137, 42161, 43114] }); } diff --git a/constant/addresses.ts b/constant/addresses.ts index 05bd366..baf73db 100644 --- a/constant/addresses.ts +++ b/constant/addresses.ts @@ -4,7 +4,7 @@ const addresses = { bprotocolBamm: "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598", resolver: { aave: "0xA6Dc31dC10f8071c02099B05B76Ba15dfcD2B04c", - aave_v2: "0xFb3a1D56eD56F046721B9aCa749895100754578b", + aave_v2: "0xF0317C5Bc206F2291dd2f3eE9C4cDB5Bbb25418d", accounts: "0x621AD080ad3B839e7b19e040C77F05213AB71524", balance: "0xea426ed5d09d22e46e5d93176c6c7531638f15c1", compound: "0xcCAa4b1b3931749b8b6EF19C6b0B2c496703321b", @@ -23,7 +23,7 @@ const addresses = { instaConnectorsV2: "0x2A00684bFAb9717C21271E0751BCcb7d2D763c88" }, resolver: { - aave_v2: "0xD6E0803d0eB34af8Ea135835512D7E77960b28F1", + aave_v2: "0x1f5e200493adB54FEB4a7D734E48649143ecE2CA", accounts: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474", balance: "0x04F8a41be023f839E709eeEaA0725FD766139A4d", merkleResolver: { @@ -46,6 +46,17 @@ const addresses = { }, uniswapV3Staker: '0x1f98407aaB862CdDeF78Ed252D6f557aA5b0f00d', }, + avalanche: { + core: { + instaIndex: '0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25', + instaConnectorsV2: '0x127d8cD0E2b2E0366D522DeA53A787bfE9002C14' + }, + resolver: { + aave_v2: '0x43c51C24b49f7cF389D043e93533E5179870Eea3', + accounts: '0x746e318e179CB0A359C1FeE8331A3F9bE309b3CE', + balance: '0xE6F92a3eCAa618FC5D4Bf2a14090787715C115F0', + }, + }, }; export default addresses; diff --git a/constant/atokens.ts b/constant/atokens.ts index 87a738d..4367f74 100644 --- a/constant/atokens.ts +++ b/constant/atokens.ts @@ -35,5 +35,15 @@ export default { { key: "awbtc", "type": "atoken", "symbol": "AWBTC", "name": "Aave WBTC", "address": "0x5c2ed810328349100A66B82b78a1791B101C9D61", "decimals": 8, "factor": 0.7, "root": "wbtc" }, { key: "aaave", "type": "atoken", "symbol": "AAAVE", "name": "Aave AAVE", "address": "0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360", "decimals": 18, "factor": 0.5, "root": "aave" }, { key: "awmatic", "type": "atoken", "symbol": "AWMATIC", "name": "Aave WMATIC", "address": "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", "decimals": 18, "factor": 0.5, "root": "matic" }, + ]), + + avalanche : createTokenUtils([ + { key: "avweth", "type": "atoken", "symbol": "avWETH", "name": "Aave ETH", "address": "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21", "decimals": 18, "factor": 0.8, "root": "eth" }, + { key: "avdai", "type": "atoken", "symbol": "avDAI", "name": "Aave DAI", "address": "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", "decimals": 18, "factor": 0, "root": "dai" }, + { key: "avusdc", "type": "atoken", "symbol": "avUSDC", "name": "Aave USDC", "address": "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", "decimals": 6, "factor": 0.8, "root": "usdc" }, + { key: "avusdt", "type": "atoken", "symbol": "avUSDT", "name": "Aave USDT", "address": "0x532E6537FEA298397212F09A61e03311686f548e", "decimals": 6, "factor": 0, "root": "usdt" }, + { key: "avwbtc", "type": "atoken", "symbol": "avWBTC", "name": "Aave WBTC", "address": "0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D", "decimals": 8, "factor": 0.6, "root": "wbtc" }, + { key: "avaave", "type": "atoken", "symbol": "avAAVE", "name": "Aave AAVE", "address": "0xD45B7c061016102f9FA220502908f2c0f1add1D7", "decimals": 18, "factor": 0, "root": "aave" }, + { key: "avwavax", "type": "atoken", "symbol": "avWAVAX", "name": "Aave WAVAX", "address": "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B", "decimals": 8, "factor": 0, "root": "avax" }, ]) -} \ No newline at end of file +} diff --git a/constant/atokensV2.ts b/constant/atokensV2.ts index fa167b0..7965d8d 100644 --- a/constant/atokensV2.ts +++ b/constant/atokensV2.ts @@ -38,5 +38,15 @@ export default { { key: "awbtc", "type": "atoken", "symbol": "AWBTC", "name": "Aave WBTC", "address": "0x5c2ed810328349100A66B82b78a1791B101C9D61", "decimals": 8, "factor": 0.7, "root": "wbtc" }, { key: "aaave", "type": "atoken", "symbol": "AAAVE", "name": "Aave AAVE", "address": "0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360", "decimals": 18, "factor": 0.5, "root": "aave" }, { key: "awmatic", "type": "atoken", "symbol": "AWMATIC", "name": "Aave WMATIC", "address": "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", "decimals": 8, "factor": 0.7, "root": "matic" }, + ]), + + avalanche: createTokenUtils([ + { key: "avweth", "type": "atoken", "symbol": "avWETH", "name": "Aave ETH", "address": "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21", "decimals": 18, "factor": 0.8, "root": "eth" }, + { key: "avdai", "type": "atoken", "symbol": "avDAI", "name": "Aave DAI", "address": "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", "decimals": 18, "factor": 0, "root": "dai" }, + { key: "avusdc", "type": "atoken", "symbol": "avUSDC", "name": "Aave USDC", "address": "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", "decimals": 6, "factor": 0.8, "root": "usdc" }, + { key: "avusdt", "type": "atoken", "symbol": "avUSDT", "name": "Aave USDT", "address": "0x532E6537FEA298397212F09A61e03311686f548e", "decimals": 6, "factor": 0, "root": "usdt" }, + { key: "avwbtc", "type": "atoken", "symbol": "avWBTC", "name": "Aave WBTC", "address": "0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D", "decimals": 8, "factor": 0.6, "root": "wbtc" }, + { key: "avaave", "type": "atoken", "symbol": "avAAVE", "name": "Aave AAVE", "address": "0xD45B7c061016102f9FA220502908f2c0f1add1D7", "decimals": 18, "factor": 0, "root": "aave" }, + { key: "avwavax", "type": "atoken", "symbol": "avWAVAX", "name": "Aave WAVAX", "address": "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B", "decimals": 8, "factor": 0, "root": "avax" }, ]) } diff --git a/constant/tokens.ts b/constant/tokens.ts index ab98e17..62549d6 100644 --- a/constant/tokens.ts +++ b/constant/tokens.ts @@ -69,5 +69,15 @@ export default { { key: 'link', type: 'token', symbol: 'LINK', name: 'ChainLink Token', address: '0xf97f4df75117a78c1A5a0DBb814Af92458539FB4', decimals: 18, isStableCoin: false }, { key: 'uni', type: 'token', symbol: 'UNI', name: 'Uniswap Token', address: '0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0', decimals: 18, isStableCoin: false }, { key: 'wbtc', type: 'token', symbol: 'WBTC', name: 'Wrapped BTC', address: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', decimals: 8, isStableCoin: false }, + ]), + avalanche: createTokenUtils([ + { key: 'avax', type: 'token', symbol: 'AVAX', name: 'Avalanche', address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', decimals: 18, isStableCoin: false }, + { key: 'wavax', type: 'token', symbol: 'WAVAX', name: 'Wrapped AVAX', address: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', decimals: 18, isStableCoin: false }, + { key: 'eth', type: 'token', symbol: 'ETH', name: 'Ethereum', address: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', decimals: 18, isStableCoin: false }, + { key: 'usdt', type: 'token', symbol: 'USDT', name: 'Tether USD Coin', address: '0xc7198437980c041c805A1EDcbA50c1Ce5db95118', decimals: 6, isStableCoin: true }, + { key: 'aave', type: 'token', symbol: 'AAVE', name: 'Aave Token', address: '0x63a72806098Bd3D9520cC43356dD78afe5D386D9', decimals: 18, isStableCoin: false }, + { key: 'usdc', type: 'token', symbol: 'USDC', name: 'USD Coin', address: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664', decimals: 6, isStableCoin: true }, + { key: 'wbtc', type: 'token', symbol: 'WBTC', name: 'Wrapped BTC', address: '0x50b7545627a5162F82A992c33b87aDc75187B218', decimals: 8, isStableCoin: false }, + { key: 'dai', type: 'token', symbol: 'DAI', name: 'DAI Stable', address: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', decimals: 18, isStableCoin: true }, ]) } diff --git a/layouts/default.vue b/layouts/default.vue index ca09b34..fb395d0 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -145,14 +145,14 @@ export default defineComponent({ return; } - if (route.value.path.includes(['mainnet', 'polygon', "arbitrum"]) && route.value.path.includes(activeNetwork.value.id)) { + if (route.value.path.includes(['mainnet', 'polygon', "arbitrum", "avalanche"]) && route.value.path.includes(activeNetwork.value.id)) { redirect('/') } }, { immediate: true }) watch(chainId, (val) => { if (val) { - if ([1, 137, 42161].includes(val)) { + if ([1, 137, 42161, 43114].includes(val)) { checkForNetworkMismatch() } else { showNetworksMismatchDialog(); diff --git a/package.json b/package.json index be20e8c..e41764a 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "bignumber.js": "^9.0.1", "core-js": "^3.15.1", "css-color-function": "^1.3.3", - "dsa-connect": "^0.5.0", + "dsa-connect": "^0.5.1", "nuxt": "^2.15.7", "qrcode": "^1.4.4", "slugify": "^1.6.0", diff --git a/pages/index.vue b/pages/index.vue index 8cf3120..f40d3ac 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -124,6 +124,15 @@ const appsPerNetwork = { url: "/1inch", description: "DEX Aggregator" } + ], + avalanche: [ + { + id: "aave-v2", + icon: AaveIcon, + name: "Aave v2", + url: "/aave-v2", + description: "Lend and borrow straight from your Gnosis Safe" + } ] }; diff --git a/yarn.lock b/yarn.lock index c9f13f5..e38a994 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6472,10 +6472,10 @@ drbg.js@^1.0.1: create-hash "^1.1.2" create-hmac "^1.1.4" -dsa-connect@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/dsa-connect/-/dsa-connect-0.5.0.tgz#33a1d9ab1095f66724a209d85f335e2e7c89cc5d" - integrity sha512-n3X5oD980CBG/rj2AbgcHFA1jZwEEvnIeY+qB7/3mOsgRqVFplguYZjAPKpP8da9WkCDHKkt8FvfQfYbTuvuOw== +dsa-connect@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/dsa-connect/-/dsa-connect-0.5.1.tgz#a8be7c18ecc0857bf956000bf83e6b5aa57b2ab9" + integrity sha512-DK+kD+rcyQ6Y+01nvaSvR2TJP+guuHNRYeB8FiJvOGzt1LznhNVoKa5bZJ8c2qAxBBdjW36l6crqnE+YmMT1Rw== duplexer3@^0.1.4: version "0.1.4"