mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
polygon aave v2 pos
This commit is contained in:
parent
d46a9449cf
commit
08cc23090a
168
abis/read/aaveV2.json
Normal file
168
abis/read/aaveV2.json
Normal file
|
@ -0,0 +1,168 @@
|
|||
[{
|
||||
"inputs": [{
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
}, {
|
||||
"internalType": "address[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
}],
|
||||
"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"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}]
|
5
assets/icons/back.svg
Normal file
5
assets/icons/back.svg
Normal file
|
@ -0,0 +1,5 @@
|
|||
<svg viewBox="0 0 18 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M17.6567 6.65653C17.6567 6.10453 17.2087 5.65653 16.6567 5.65653L3.58643 5.65653L7.44971 1.79325C7.84071 1.40225 7.84071 0.769188 7.44971 0.379188L7.36377 0.29325C6.97277 -0.09775 6.33971 -0.09775 5.94971 0.29325L0.293457 5.9495C-0.0975437 6.3405 -0.0975437 6.97356 0.293457 7.36356L5.94971 13.0198C6.34071 13.4108 6.97377 13.4108 7.36377 13.0198L7.44971 12.9339C7.84071 12.5429 7.84071 11.9098 7.44971 11.5198L3.58643 7.65653L16.6567 7.65653C17.2087 7.65653 17.6567 7.20853 17.6567 6.65653Z"
|
||||
fill="currentColor" />
|
||||
</svg>
|
After Width: | Height: | Size: 624 B |
13
assets/icons/colored/aave.svg
Normal file
13
assets/icons/colored/aave.svg
Normal file
|
@ -0,0 +1,13 @@
|
|||
<svg viewBox="0 0 22 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M12.208 27.7797V28.6067C12.2013 28.7109 12.1792 29.1731 11.8053 29.5243C11.4469 29.8393 11.0354 29.8143 10.9491 29.8098H10.9469C10.7965 29.7917 10.3142 29.7056 10.0354 29.3068C9.87356 29.0402 9.78773 28.7326 9.78761 28.4186C9.78413 28.3446 9.78561 28.2704 9.79204 28.1966C9.80189 28.112 9.79891 28.0264 9.78319 27.9428C9.73379 27.6948 9.61548 27.4666 9.44248 27.2858C9.21249 27.0488 8.90534 26.9068 8.57965 26.887C8.04425 26.8689 7.52212 27.2586 7.29204 27.8567V29.982C7.25515 30.2839 7.11395 30.5622 6.89399 30.7667C6.67404 30.9712 6.38987 31.0883 6.09292 31.0968C5.806 31.101 5.52644 31.0037 5.3015 30.8212C5.07657 30.6387 4.92005 30.3823 4.85841 30.0953V27.8431C4.80138 27.5562 4.6516 27.2972 4.43323 27.1081C4.21487 26.919 3.94067 26.8108 3.65487 26.8009C3.35692 26.7959 3.06676 26.8985 2.83534 27.0907C2.60392 27.283 2.44603 27.5526 2.38938 27.8522V31.9985C2.32858 32.2834 2.17413 32.5383 1.95184 32.7206C1.72955 32.9029 1.4529 33.0015 1.16814 33C0.902255 32.9926 0.64561 32.8985 0.435525 32.7314C0.225441 32.5643 0.0728708 32.333 0 32.071V10.2156C0.079646 9.30023 0.469027 5.94692 3.20354 3.19177C6.46018 -0.0935678 10.5619 -0.0210636 11.2788 0.00612536C15.3186 0.146602 17.9115 2.53017 18.5885 3.19177C21.4735 6.02396 21.9115 9.48602 22 10.3923L21.9845 21.2L21.969 32.0076C21.9081 32.2738 21.7658 32.5131 21.5629 32.6908C21.3599 32.8685 21.107 32.9752 20.8407 32.9954C20.2168 33.0226 19.6283 32.5061 19.5619 31.7901V27.8159C19.5011 27.5219 19.3416 27.259 19.1113 27.0728C18.881 26.8866 18.5943 26.7888 18.3009 26.7964C17.9905 26.8118 17.6969 26.9454 17.4776 27.1708C17.2583 27.3963 17.129 27.6974 17.115 28.0153V29.8597C17.1055 30.16 16.9929 30.4473 16.7971 30.671C16.6013 30.8948 16.3347 31.0407 16.0442 31.0832C15.7389 31.1195 15.4311 31.04 15.1792 30.8596C14.9272 30.6792 14.7485 30.4105 14.677 30.1044V28.0244C14.6598 27.7328 14.5475 27.4555 14.3582 27.2369C14.1689 27.0184 13.9134 26.8712 13.6327 26.819C13.3216 26.7725 13.0046 26.8447 12.7419 27.0218C12.4793 27.1989 12.2893 27.4686 12.208 27.7797ZM8.95133 10.5283C8.95133 10.8443 8.89055 11.1572 8.77248 11.4491C8.6544 11.741 8.48133 12.0063 8.26316 12.2297C8.04498 12.4532 7.78597 12.6304 7.50091 12.7513C7.21585 12.8723 6.91032 12.9345 6.60177 12.9345C6.29322 12.9345 5.98769 12.8723 5.70263 12.7513C5.41757 12.6304 5.15856 12.4532 4.94038 12.2297C4.72221 12.0063 4.54914 11.741 4.43106 11.4491C4.31299 11.1572 4.25221 10.8443 4.25221 10.5283C4.25221 9.8901 4.49975 9.27807 4.94038 8.82681C5.38101 8.37556 5.97863 8.12204 6.60177 8.12204C7.22491 8.12204 7.82253 8.37556 8.26316 8.82681C8.70379 9.27807 8.95133 9.8901 8.95133 10.5283ZM14.7301 12.9345C15.3532 12.9345 15.9508 12.681 16.3915 12.2297C16.8321 11.7785 17.0796 11.1664 17.0796 10.5283C17.0796 9.8901 16.8321 9.27807 16.3915 8.82681C15.9508 8.37556 15.3532 8.12204 14.7301 8.12204C14.1069 8.12204 13.5093 8.37556 13.0687 8.82681C12.6281 9.27807 12.3805 9.8901 12.3805 10.5283C12.3805 11.1664 12.6281 11.7785 13.0687 12.2297C13.5093 12.681 14.1069 12.9345 14.7301 12.9345ZM12.8451 14.8876C12.8451 14.8876 12.6106 15.9434 11.4823 16.0794C9.5177 16.3195 9.28761 14.8876 9.28761 14.8876C9.28761 14.8876 9.17257 14.1082 10.031 14.3665C10.8894 14.6247 12.1239 14.3665 12.1239 14.3665C12.1239 14.3665 13.0221 14.1444 12.8451 14.8876Z"
|
||||
fill="url(#paint0_linear)" />
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear" x1="-1.19248" y1="30.5167" x2="22.2457" y2="9.80174"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.229" stop-color="#8ADAE2" />
|
||||
<stop offset="0.72" stop-color="#9EADCE" />
|
||||
<stop offset="1" stop-color="#C499C9" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
|
@ -2,7 +2,7 @@
|
|||
<div
|
||||
class="h-[68px] px-8 py-5 border border-b-[#E7E8F1] flex items-center justify-between"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<nuxt-link to="/" class="flex items-center">
|
||||
<svg
|
||||
width="28"
|
||||
height="28"
|
||||
|
@ -17,7 +17,7 @@
|
|||
</svg>
|
||||
|
||||
<span class="ml-2 font-extrabold text-lg">ASSEMBLY</span>
|
||||
</div>
|
||||
</nuxt-link>
|
||||
|
||||
<div class="flex items-center space-x-2.5">
|
||||
<button
|
||||
|
|
|
@ -99,22 +99,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, defineComponent, ref } from '@nuxtjs/composition-api'
|
||||
import MainnetSVG from '~/assets/icons/mainnet.svg?inline'
|
||||
import PolygonSVG from '~/assets/icons/polygon.svg?inline'
|
||||
|
||||
const networks = [
|
||||
{ id: 'mainnet', name: 'Mainnet', icon: MainnetSVG },
|
||||
{ id: 'polygon', name: 'Polygon', icon: PolygonSVG }
|
||||
]
|
||||
import { defineComponent, ref } from '@nuxtjs/composition-api'
|
||||
import { useNetwork } from '~/composables/useNetwork'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const show = ref(false)
|
||||
|
||||
const activeNetworkId = ref('mainnet');
|
||||
|
||||
const activeNetwork = computed(() => networks.find(n => n.id === activeNetworkId.value) || networks[0])
|
||||
const { networks, activeNetworkId, activeNetwork } = useNetwork()
|
||||
|
||||
const setActiveNetwork = networkId => {
|
||||
activeNetworkId.value = networkId;
|
||||
|
|
324
composables/useAaveV2Position.ts
Normal file
324
composables/useAaveV2Position.ts
Normal file
|
@ -0,0 +1,324 @@
|
|||
import { AbiItem } from "web3-utils";
|
||||
|
||||
import aaveV2ABI from "~/abis/read/aaveV2.json";
|
||||
import { computed, ref, watch } from "@nuxtjs/composition-api";
|
||||
import { useDSA } from "./useDSA";
|
||||
import { useWeb3 } from "./useWeb3";
|
||||
import BigNumber from "bignumber.js";
|
||||
import atokensV2 from "~/constant/atokensV2";
|
||||
import tokens from "~/constant/tokens";
|
||||
import { Network } from "./useNetwork";
|
||||
import { useBigNumber } from "./useBigNumber";
|
||||
const { times, isZero, div, max } = useBigNumber();
|
||||
|
||||
const position = ref<any>({
|
||||
totalSupplyInEth: new BigNumber(0),
|
||||
totalBorrowInEth: new BigNumber(0),
|
||||
totalBorrowStableInEth: new BigNumber(0),
|
||||
totalBorrowVariableInEth: new BigNumber(0),
|
||||
maxBorrowLimitInEth: new BigNumber(0),
|
||||
maxBorrowLiquidityLimitInEth: new BigNumber(0),
|
||||
ethPriceInUsd: "0"
|
||||
});
|
||||
const totalSupply = computed(() =>
|
||||
position.value
|
||||
? times(
|
||||
position.value.totalSupplyInEth,
|
||||
position.value.ethPriceInUsd
|
||||
).toFixed()
|
||||
: 0
|
||||
);
|
||||
|
||||
const totalBorrow = computed(() =>
|
||||
position.value
|
||||
? times(
|
||||
position.value.totalBorrowInEth,
|
||||
position.value.ethPriceInUsd
|
||||
).toFixed()
|
||||
: 0
|
||||
);
|
||||
|
||||
const status = computed(() => {
|
||||
if (!position.value) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
if (
|
||||
isZero(position.value.totalSupplyInEth) &&
|
||||
!isZero(position.value.totalBorrowInEth)
|
||||
)
|
||||
return "1.1";
|
||||
if (isZero(position.value.totalSupplyInEth)) return "0";
|
||||
|
||||
return max(
|
||||
div(position.value.totalBorrowInEth, position.value.totalSupplyInEth),
|
||||
"0"
|
||||
).toFixed();
|
||||
});
|
||||
|
||||
export function useAaveV2Position() {
|
||||
const { web3, chainId, networkName } = useWeb3();
|
||||
const { activeAccount } = useDSA();
|
||||
|
||||
const resolver =
|
||||
chainId.value === 1
|
||||
? "0xFb3a1D56eD56F046721B9aCa749895100754578b"
|
||||
: "0xD6E0803d0eB34af8Ea135835512D7E77960b28F1";
|
||||
|
||||
const fetchPosition = async () => {
|
||||
if (!web3.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeAccount.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const aaveResolverInstance = new web3.value.eth.Contract(
|
||||
aaveV2ABI as AbiItem[],
|
||||
resolver
|
||||
);
|
||||
|
||||
const aaveTokensArr = atokensV2[networkName.value].allTokens.map(
|
||||
a => tokens[networkName.value].getTokenByKey(a.root).address
|
||||
);
|
||||
|
||||
const aaveRawData = await aaveResolverInstance.methods
|
||||
.getPosition(activeAccount.value.address, aaveTokensArr)
|
||||
.call();
|
||||
|
||||
const newPos = calculateAavePosition(aaveRawData, networkName.value);
|
||||
|
||||
return newPos;
|
||||
};
|
||||
|
||||
watch(
|
||||
web3,
|
||||
async val => {
|
||||
if (val) {
|
||||
position.value = await fetchPosition();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
activeAccount,
|
||||
async val => {
|
||||
if (val) {
|
||||
position.value = await fetchPosition();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
return {
|
||||
position,
|
||||
fetchPosition,
|
||||
totalSupply,
|
||||
totalBorrow,
|
||||
status
|
||||
};
|
||||
}
|
||||
|
||||
function calculateAavePosition(res: any[], network: Network = Network.Mainnet) {
|
||||
try {
|
||||
const newPos = {
|
||||
totalSupplyInEth: new BigNumber(0),
|
||||
totalBorrowInEth: new BigNumber(0),
|
||||
totalBorrowStableInEth: new BigNumber(0),
|
||||
totalBorrowVariableInEth: new BigNumber(0),
|
||||
maxBorrowLimitInEth: new BigNumber(0),
|
||||
maxBorrowLiquidityLimitInEth: new BigNumber(0)
|
||||
// tokens: {},
|
||||
};
|
||||
const dataPos = [];
|
||||
atokensV2[network].allTokens.forEach((atoken, i) => {
|
||||
const key = atoken.address;
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
const [
|
||||
priceInEthInWei,
|
||||
priceInUsdInWei,
|
||||
supplyBalanceInWei,
|
||||
borrowStableBalanceInWei,
|
||||
borrowVariableBalanceInWei,
|
||||
supplyRatePerBlock,
|
||||
borrowStableRatePerBlock,
|
||||
userStableBorrowRatePerBlock,
|
||||
borrowVariableRatePerBlock,
|
||||
isCollateralEnabled,
|
||||
AaveTokenData
|
||||
] = res[0][i];
|
||||
|
||||
const [
|
||||
ltv,
|
||||
threshold,
|
||||
reserveFactor,
|
||||
usageAsCollEnabled,
|
||||
borrowEnabled,
|
||||
stableBorrowEnabled,
|
||||
isActive,
|
||||
isFrozen,
|
||||
totalSupply,
|
||||
availableLiquidity,
|
||||
totalStableDebt,
|
||||
totalVariableDebt,
|
||||
collateralEmission,
|
||||
debtEmission
|
||||
] = AaveTokenData;
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
const decimals = tokens[network].getTokenByKey(atoken.root).decimals;
|
||||
const root = atoken.root;
|
||||
const factor = new BigNumber(ltv).dividedBy(1e4);
|
||||
const priceInEth = new BigNumber(priceInEthInWei).dividedBy(1e18);
|
||||
const priceInUsd = new BigNumber(priceInUsdInWei)
|
||||
.dividedBy(1e18)
|
||||
.toFixed();
|
||||
const supply = new BigNumber(supplyBalanceInWei).dividedBy(
|
||||
10 ** decimals
|
||||
);
|
||||
const borrowStable = new BigNumber(borrowStableBalanceInWei).dividedBy(
|
||||
10 ** decimals
|
||||
);
|
||||
const borrowVariable = new BigNumber(
|
||||
borrowVariableBalanceInWei
|
||||
).dividedBy(10 ** decimals);
|
||||
const supplyRate = new BigNumber(supplyRatePerBlock)
|
||||
.dividedBy(1e27)
|
||||
.toFixed();
|
||||
const supplyYield = supplyRate;
|
||||
const borrowStableRate = new BigNumber(borrowStableRatePerBlock)
|
||||
.dividedBy(1e27)
|
||||
.toFixed();
|
||||
const userBorrowStableRate = new BigNumber(userStableBorrowRatePerBlock)
|
||||
.dividedBy(1e27)
|
||||
.toFixed();
|
||||
const borrowVariableRate = new BigNumber(borrowVariableRatePerBlock)
|
||||
.dividedBy(1e27)
|
||||
.toFixed();
|
||||
const borrowStableYield = borrowStableRate;
|
||||
const borrowVariableYield = borrowVariableRate;
|
||||
const liquidity = new BigNumber(availableLiquidity)
|
||||
.dividedBy(10 ** decimals)
|
||||
.multipliedBy(0.9999)
|
||||
.toFixed();
|
||||
const totalSupplied = new BigNumber(totalSupply)
|
||||
.dividedBy(10 ** decimals)
|
||||
.multipliedBy(priceInUsd);
|
||||
const totalDebt = new BigNumber(totalVariableDebt)
|
||||
.dividedBy(10 ** decimals)
|
||||
.multipliedBy(priceInUsd);
|
||||
const supplyRewardRate = new BigNumber(collateralEmission)
|
||||
.multipliedBy(31536000)
|
||||
.dividedBy(1e18)
|
||||
.dividedBy(totalSupplied)
|
||||
.toFixed();
|
||||
const borrowRewardRate = new BigNumber(debtEmission)
|
||||
.multipliedBy(31536000)
|
||||
.dividedBy(1e18)
|
||||
.dividedBy(totalDebt)
|
||||
.toFixed();
|
||||
|
||||
newPos.totalSupplyInEth = newPos.totalSupplyInEth.plus(
|
||||
supply.multipliedBy(priceInEth)
|
||||
);
|
||||
newPos.maxBorrowLimitInEth = newPos.maxBorrowLimitInEth.plus(
|
||||
supply.multipliedBy(priceInEth).multipliedBy(factor)
|
||||
);
|
||||
newPos.maxBorrowLiquidityLimitInEth = newPos.maxBorrowLiquidityLimitInEth.plus(
|
||||
supply
|
||||
.multipliedBy(priceInEth)
|
||||
.multipliedBy((threshold / 10000).toString())
|
||||
);
|
||||
newPos.totalBorrowInEth = newPos.totalBorrowInEth.plus(
|
||||
borrowStable.plus(borrowVariable).multipliedBy(priceInEth)
|
||||
);
|
||||
newPos.totalBorrowStableInEth = newPos.totalBorrowStableInEth.plus(
|
||||
borrowStable.multipliedBy(priceInEth)
|
||||
);
|
||||
newPos.totalBorrowVariableInEth = newPos.totalBorrowVariableInEth.plus(
|
||||
borrowVariable.multipliedBy(priceInEth)
|
||||
);
|
||||
|
||||
dataPos.push({
|
||||
key: root,
|
||||
aTokenAddr: key,
|
||||
aTokenBal: supplyBalanceInWei,
|
||||
aTokenKey: atoken.key,
|
||||
aDecimals: atoken.decimals.toString(),
|
||||
priceInEth: priceInEth.toFixed(),
|
||||
priceInUsd,
|
||||
supply: supply.toFixed(),
|
||||
borrowStable: borrowStable.toFixed(),
|
||||
borrow: borrowVariable.toFixed(), // TODO: change later
|
||||
supplyRate,
|
||||
supplyYield,
|
||||
borrowStableRate,
|
||||
userBorrowStableRate,
|
||||
borrowStableYield,
|
||||
borrowRate: borrowVariableRate, // TODO: change later
|
||||
borrowYield: borrowVariableYield, // TODO: change later
|
||||
factor: factor.toFixed(),
|
||||
liquidation: (threshold / 10000).toString(),
|
||||
isEnabledAsCollateral: isCollateralEnabled,
|
||||
borrowEnabled,
|
||||
stableBorrowEnabled,
|
||||
availableLiquidity: liquidity,
|
||||
supplyRewardRate,
|
||||
borrowRewardRate
|
||||
});
|
||||
});
|
||||
|
||||
const totalSupplyInEthIsZero = newPos.totalSupplyInEth.isZero();
|
||||
const status = totalSupplyInEthIsZero
|
||||
? 0
|
||||
: newPos.totalBorrowInEth.dividedBy(newPos.totalSupplyInEth).toFixed();
|
||||
const liquidation = totalSupplyInEthIsZero
|
||||
? 0
|
||||
: newPos.maxBorrowLimitInEth.dividedBy(newPos.totalSupplyInEth).toFixed();
|
||||
const maxLiquidation = totalSupplyInEthIsZero
|
||||
? 0
|
||||
: newPos.maxBorrowLiquidityLimitInEth
|
||||
.dividedBy(newPos.totalSupplyInEth)
|
||||
.toFixed();
|
||||
const ethPrice = new BigNumber(res[1].ethPriceInUsd)
|
||||
.dividedBy(1e8)
|
||||
.toFixed();
|
||||
const pendingRewards = new BigNumber(res[1].pendingRewards)
|
||||
.dividedBy(1e18)
|
||||
.toFixed();
|
||||
|
||||
// @ts-ignore
|
||||
newPos.totalSupplyInEth = newPos.totalSupplyInEth.toFixed();
|
||||
// @ts-ignore
|
||||
newPos.totalBorrowInEth = newPos.totalBorrowInEth.toFixed();
|
||||
// @ts-ignore
|
||||
newPos.maxBorrowLimitInEth = newPos.maxBorrowLimitInEth.toFixed();
|
||||
// @ts-ignore
|
||||
newPos.totalBorrowStableInEth = newPos.totalBorrowStableInEth.toFixed();
|
||||
// @ts-ignore
|
||||
newPos.maxBorrowLiquidityLimitInEth = newPos.maxBorrowLiquidityLimitInEth.toFixed();
|
||||
// @ts-ignore
|
||||
newPos.totalBorrowVariableInEth = newPos.totalBorrowVariableInEth.toFixed();
|
||||
|
||||
// @ts-ignore
|
||||
newPos.status = status;
|
||||
// @ts-ignore
|
||||
newPos.liquidation = liquidation;
|
||||
// @ts-ignore
|
||||
newPos.maxLiquidation = maxLiquidation;
|
||||
// @ts-ignore
|
||||
newPos.ethPriceInUsd = ethPrice;
|
||||
// @ts-ignore
|
||||
newPos.pendingRewards = pendingRewards;
|
||||
// @ts-ignore
|
||||
newPos.data = dataPos;
|
||||
|
||||
return newPos;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
229
composables/useBigNumber.ts
Normal file
229
composables/useBigNumber.ts
Normal file
|
@ -0,0 +1,229 @@
|
|||
import BigNumber from "bignumber.js";
|
||||
|
||||
export function useBigNumber() {
|
||||
/**
|
||||
* Returns value as BigNumber if it exists and can be parsed by BigNumber,
|
||||
* otherwise returns BigNumber('0')
|
||||
* @param {*} value
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function ensureValue(value: BigNumber.Value) {
|
||||
if (!value) return new BigNumber("0");
|
||||
if (new BigNumber(value).isNaN()) return new BigNumber("0");
|
||||
|
||||
return new BigNumber(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures value before convert to BigNumber
|
||||
* @param {*} value
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function toBN(value: BigNumber.Value) {
|
||||
return ensureValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* coerce value to boolean(uses same rules as js)
|
||||
* @param {*} val
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isZero(val: BigNumber.Value) {
|
||||
return toBN(val).isZero();
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiply value and multiplier
|
||||
* @param {*} value
|
||||
* @param {*} multiplier
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function times(value: BigNumber.Value, multiplier: BigNumber.Value) {
|
||||
return toBN(value).times(toBN(multiplier));
|
||||
}
|
||||
|
||||
/**
|
||||
* Divides value and divisor. Protected from NaN if no divisor
|
||||
* @param {*} value
|
||||
* @param {*} divisor
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function div(value: BigNumber.Value, divisor: BigNumber.Value) {
|
||||
if (isZero(divisor) || isZero(value)) return toBN("0");
|
||||
return toBN(value).div(toBN(divisor));
|
||||
}
|
||||
|
||||
/**
|
||||
* subtraction values
|
||||
* @param {*} value
|
||||
* @param {*} subtractor
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function minus(value: BigNumber.Value, subtractor: BigNumber.Value) {
|
||||
return toBN(value).minus(toBN(subtractor));
|
||||
}
|
||||
|
||||
/**
|
||||
* sum value
|
||||
* @param {*} value
|
||||
* @param {*} adder
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function plus(value: BigNumber.Value, adder: BigNumber.Value) {
|
||||
return toBN(value).plus(toBN(adder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Exponent value to power
|
||||
* @param {*} value
|
||||
* @param {*} exponent
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function pow(value: BigNumber.Value, exponent: BigNumber.Value) {
|
||||
return toBN(value).pow(toBN(exponent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Max from ...arguments
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function max(...args) {
|
||||
return BigNumber.max(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Min from ...arguments
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function min(...args: BigNumber.Value[]) {
|
||||
return BigNumber.min(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater then (>)
|
||||
* @param {*} value
|
||||
* @param {*} compareWith
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function gt(value: BigNumber.Value, compareWith: BigNumber.Value) {
|
||||
return toBN(value).gt(toBN(compareWith));
|
||||
}
|
||||
|
||||
/**
|
||||
* Equal (===)
|
||||
* @param {*} value
|
||||
* @param {*} compareWith
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function eq(value: BigNumber.Value, compareWith: BigNumber.Value) {
|
||||
return toBN(value).eq(toBN(compareWith));
|
||||
}
|
||||
|
||||
/**
|
||||
* Less then (<)
|
||||
* @param {*} value
|
||||
* @param {*} compareWith
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function lt(value: BigNumber.Value, compareWith: BigNumber.Value) {
|
||||
return toBN(value).lt(toBN(compareWith));
|
||||
}
|
||||
|
||||
/**
|
||||
* Less then or equal (<=)
|
||||
* @param {*} value
|
||||
* @param {*} compareWith
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function lte(value: BigNumber.Value, compareWith: BigNumber.Value) {
|
||||
return toBN(value).lte(toBN(compareWith));
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater then or equal (>=)
|
||||
* @param {*} value
|
||||
* @param {*} compareWith
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function gte(value: BigNumber.Value, compareWith: BigNumber.Value) {
|
||||
return toBN(value).gte(toBN(compareWith));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if value is BigNumber instance
|
||||
* @param {*} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isBigNumber(value: BigNumber.Value) {
|
||||
return BigNumber.isBigNumber(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isNegative(value: BigNumber.Value) {
|
||||
return toBN(value).isNegative();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isPositive(value: BigNumber.Value) {
|
||||
return toBN(value).isPositive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return absolute value
|
||||
* @param {*} value
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function abs(value: BigNumber.Value) {
|
||||
return toBN(value).abs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns value multiplied by -1
|
||||
* @param {*} value
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function negated(value: BigNumber.Value) {
|
||||
return toBN(value).negated();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds to INT like Math.floor
|
||||
* @param {*} value
|
||||
* @returns BigNumber
|
||||
*/
|
||||
function intRoundFloor(value: BigNumber.Value) {
|
||||
return toBN(value).dp(0, 3);
|
||||
}
|
||||
|
||||
return {
|
||||
isZero,
|
||||
toBN,
|
||||
ensureValue,
|
||||
times,
|
||||
plus,
|
||||
pow,
|
||||
minus,
|
||||
div,
|
||||
max,
|
||||
min,
|
||||
eq,
|
||||
gt,
|
||||
lt,
|
||||
lte,
|
||||
gte,
|
||||
isBigNumber,
|
||||
isNegative,
|
||||
isPositive,
|
||||
abs,
|
||||
negated,
|
||||
intRoundFloor
|
||||
};
|
||||
}
|
|
@ -60,5 +60,7 @@ export function useDSA() {
|
|||
createAccount,
|
||||
creatingAccount,
|
||||
setAccount,
|
||||
web3,
|
||||
chainId
|
||||
};
|
||||
}
|
||||
|
|
152
composables/useFormatting.ts
Normal file
152
composables/useFormatting.ts
Normal file
|
@ -0,0 +1,152 @@
|
|||
import { useBigNumber } from "./useBigNumber";
|
||||
|
||||
const {
|
||||
toBN,
|
||||
isZero,
|
||||
times,
|
||||
pow,
|
||||
div,
|
||||
min,
|
||||
gt,
|
||||
lt,
|
||||
abs,
|
||||
intRoundFloor
|
||||
} = useBigNumber();
|
||||
|
||||
const locale = "en-US";
|
||||
|
||||
export function useFormatting() {
|
||||
function getFractionDigits(value: any) {
|
||||
const absoluteValue = abs(value);
|
||||
|
||||
if (isZero(absoluteValue)) {
|
||||
return 2;
|
||||
} else if (lt(absoluteValue, 0.01)) {
|
||||
return 6;
|
||||
} else if (lt(absoluteValue, 1)) {
|
||||
return 4;
|
||||
} else if (lt(absoluteValue, 10000)) {
|
||||
return 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function formatPercent(value: any, fractionDigits = 2) {
|
||||
if (isZero(value)) return "0%";
|
||||
if (gt(value, 1)) return ">100%";
|
||||
|
||||
const formatter = new Intl.NumberFormat(locale, {
|
||||
style: "percent",
|
||||
minimumFractionDigits: fractionDigits,
|
||||
maximumFractionDigits: fractionDigits
|
||||
});
|
||||
|
||||
return formatter.format(value);
|
||||
}
|
||||
|
||||
function formatNumber(value: any, power = getFractionDigits(value)) {
|
||||
let MUL_DIV = toBN("100");
|
||||
if (power || isZero(power)) {
|
||||
MUL_DIV = pow("10", power);
|
||||
} else {
|
||||
if (lt(value, "0.01")) MUL_DIV = pow("10", "6");
|
||||
if (lt(value, "1")) MUL_DIV = pow("10", "4");
|
||||
}
|
||||
|
||||
return div(intRoundFloor(times(value, MUL_DIV)), MUL_DIV).toFixed();
|
||||
}
|
||||
|
||||
function formatUsd(value: any, fractionDigits = getFractionDigits(value)) {
|
||||
const formatter = new Intl.NumberFormat(locale, {
|
||||
style: "currency",
|
||||
currency: "USD",
|
||||
minimumFractionDigits: fractionDigits,
|
||||
maximumFractionDigits: fractionDigits
|
||||
});
|
||||
|
||||
return formatter.format(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats `value` to USD and adds a `>` char if `value` is greater then `max`.
|
||||
*
|
||||
* @param {string} value Value in USD.
|
||||
* @param {string} max Max value in USD.
|
||||
*/
|
||||
function formatUsdMax(value: any, max: any) {
|
||||
const formatted = formatUsd(min(value, max).toFixed());
|
||||
|
||||
if (gt(value, max)) {
|
||||
return `>${formatted}`;
|
||||
}
|
||||
|
||||
return formatted;
|
||||
}
|
||||
|
||||
function formatDecimal(
|
||||
value: any,
|
||||
fractionDigits = getFractionDigits(value)
|
||||
) {
|
||||
let formatter;
|
||||
if (lt(value, "0.000001") && gt(value, "0")) {
|
||||
formatter = new Intl.NumberFormat(locale, {
|
||||
style: "decimal",
|
||||
notation: "scientific",
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
} else {
|
||||
formatter = new Intl.NumberFormat(locale, {
|
||||
style: "decimal",
|
||||
minimumFractionDigits: fractionDigits,
|
||||
maximumFractionDigits: fractionDigits
|
||||
});
|
||||
}
|
||||
|
||||
return formatter.format(value);
|
||||
}
|
||||
|
||||
function shortenHash(hash: any) {
|
||||
if (!hash) return;
|
||||
|
||||
if (hash.length < 12) return hash;
|
||||
|
||||
const beginningChars = hash.startsWith("0x") ? 6 : 4;
|
||||
|
||||
const shortened = hash.substr(0, beginningChars) + "…" + hash.substr(-4);
|
||||
|
||||
return shortened;
|
||||
}
|
||||
|
||||
function toLocaleString(value: any) {
|
||||
return value.toLocaleString(locale);
|
||||
}
|
||||
|
||||
function formatMillisecondsShort(milliseconds: any) {
|
||||
if (!milliseconds) return "";
|
||||
const ms = Number(milliseconds) || 0;
|
||||
|
||||
const timeInSeconds = ms / 1000;
|
||||
const hours = Math.floor((timeInSeconds % (3600 * 24)) / 3600);
|
||||
const minutes = Math.floor((timeInSeconds % 3600) / 60);
|
||||
const seconds = Math.floor(timeInSeconds - hours * 3600 - minutes * 60);
|
||||
|
||||
const mDisplay = String(minutes).padStart(2, "0");
|
||||
const sDisplay = String(seconds).padStart(2, "0");
|
||||
|
||||
return `${mDisplay}:${sDisplay}`;
|
||||
}
|
||||
|
||||
return {
|
||||
getFractionDigits,
|
||||
formatUsd,
|
||||
formatNumber,
|
||||
formatUsdMax,
|
||||
formatPercent,
|
||||
formatDecimal,
|
||||
shortenHash,
|
||||
toLocaleString,
|
||||
formatMillisecondsShort
|
||||
};
|
||||
}
|
31
composables/useNetwork.ts
Normal file
31
composables/useNetwork.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { computed, readonly, ref, watch } from "@nuxtjs/composition-api";
|
||||
|
||||
//@ts-ignore
|
||||
import MainnetSVG from "~/assets/icons/mainnet.svg?inline";
|
||||
//@ts-ignore
|
||||
import PolygonSVG from "~/assets/icons/polygon.svg?inline";
|
||||
|
||||
export enum Network {
|
||||
Mainnet = "mainnet",
|
||||
Polygon = "polygon"
|
||||
}
|
||||
|
||||
const networks = [
|
||||
{ id: "mainnet", chainId: 1, name: "Mainnet", icon: MainnetSVG },
|
||||
{ id: "polygon", chainId: 136, name: "Polygon", icon: PolygonSVG }
|
||||
];
|
||||
|
||||
console.log(Network.Polygon)
|
||||
|
||||
const activeNetworkId = ref<Network>(Network.Polygon);
|
||||
const activeNetwork = computed(
|
||||
() => networks.find(n => n.id === activeNetworkId.value) || networks[0]
|
||||
);
|
||||
|
||||
export function useNetwork() {
|
||||
return {
|
||||
networks,
|
||||
activeNetworkId,
|
||||
activeNetwork
|
||||
};
|
||||
}
|
|
@ -1,14 +1,32 @@
|
|||
import { onMounted, ref } from "@nuxtjs/composition-api";
|
||||
import { computed, onMounted, ref } from "@nuxtjs/composition-api";
|
||||
import Web3 from "web3";
|
||||
import Web3Modal from "web3modal";
|
||||
import { Network } from "./useNetwork";
|
||||
|
||||
let web3Modal: Web3Modal;
|
||||
let web3Provider: any;
|
||||
|
||||
let providerOptions = {};
|
||||
|
||||
const chains = [
|
||||
{
|
||||
name: "mainnet" as Network,
|
||||
chainId: 1,
|
||||
displayName: "Mainnet"
|
||||
},
|
||||
{
|
||||
name: "polygon" as Network,
|
||||
chainId: 137,
|
||||
node: "https://rpc-mainnet.matic.network",
|
||||
displayName: "Polygon"
|
||||
}
|
||||
];
|
||||
|
||||
const active = ref(false);
|
||||
const chainId = ref<number>();
|
||||
const networkName = computed<Network>(
|
||||
() => chains.find(c => c.chainId === chainId.value)?.name || Network.Mainnet
|
||||
);
|
||||
const account = ref<string>();
|
||||
const web3 = ref<Web3>();
|
||||
|
||||
|
@ -71,6 +89,7 @@ export function useWeb3() {
|
|||
web3,
|
||||
active,
|
||||
activate,
|
||||
deactivate
|
||||
deactivate,
|
||||
networkName
|
||||
};
|
||||
}
|
||||
|
|
12
constant/abi/makerProxyRegistry.json
Normal file
12
constant/abi/makerProxyRegistry.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [{ "name": "", "type": "address" }],
|
||||
"name": "proxies",
|
||||
"outputs": [{ "name": "", "type": "address" }],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
|
66
constant/abi/read/aave.json
Normal file
66
constant/abi/read/aave.json
Normal file
|
@ -0,0 +1,66 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "user", "type": "address" },
|
||||
{ "internalType": "address[]", "name": "tokens", "type": "address[]" }
|
||||
],
|
||||
"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": "borrowBalance", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "borrowFee", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "supplyRate", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "borrowRate", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "borrowModal", "type": "uint256" },
|
||||
{ "internalType": "bool", "name": "isCollateral", "type": "bool" },
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "uint256", "name": "ltv", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "threshold", "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": "uint256", "name": "availableLiquidity", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct AaveHelpers.AaveTokenData",
|
||||
"name": "aaveTokenData",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AaveHelpers.AaveUserTokenData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "uint256", "name": "totalSupplyETH", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "totalCollateralETH", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "totalBorrowsETH", "type": "uint256" },
|
||||
{ "internalType": "uint256", "name": "totalFeesETH", "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": "struct AaveHelpers.AaveUserData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
168
constant/abi/read/aaveV2.json
Normal file
168
constant/abi/read/aaveV2.json
Normal file
|
@ -0,0 +1,168 @@
|
|||
[{
|
||||
"inputs": [{
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
}, {
|
||||
"internalType": "address[]",
|
||||
"name": "tokens",
|
||||
"type": "address[]"
|
||||
}],
|
||||
"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"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}]
|
520
constant/abi/read/accounts.json
Normal file
520
constant/abi/read/accounts.json
Normal file
|
@ -0,0 +1,520 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_index",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "gnosisFactory",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "connectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint64",
|
||||
"name": "id",
|
||||
"type": "uint64"
|
||||
}
|
||||
],
|
||||
"name": "getAccount",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAccountAuthorities",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAccountAuthoritiesTypes",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "authType",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AuthType[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAccountDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "ID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "version",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "authorities",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AccountData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "id",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getAccountIdDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "ID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "version",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "authorities",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AccountData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "accounts",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAccountVersions",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAuthorityAccounts",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAuthorityDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "uint64[]",
|
||||
"name": "IDs",
|
||||
"type": "uint64[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "accounts",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "versions",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AuthorityData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "authority",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getAuthorityIDs",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint64[]",
|
||||
"name": "",
|
||||
"type": "uint64[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "authorities",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAuthorityTypes",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "authType",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct AccountResolver.AuthType[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_addr",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getContractCode",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "o_code",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEnabledConnectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getEnabledConnectorsData",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "connector",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "connectorID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"internalType": "struct ConnectorsResolver.ConnectorsData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getID",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "id",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "id",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getIDAuthorities",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getStaticConnectors",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getStaticConnectorsData",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "connector",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "connectorID",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"internalType": "struct ConnectorsResolver.ConnectorsData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "index",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isShield",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "shield",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "list",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "version",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
109
constant/abi/read/balance.json
Normal file
109
constant/abi/read/balance.json
Normal file
|
@ -0,0 +1,109 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "tknAddress",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAllowances",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "tknAddress",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getBalances",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "tknAddress",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getTokenDetails",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "isToken",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "decimals",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Resolver.TokenData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
250
constant/abi/read/compound.json
Normal file
250
constant/abi/read/compound.json
Normal file
|
@ -0,0 +1,250 @@
|
|||
[{
|
||||
"inputs": [],
|
||||
"name": "getCETHAddress",
|
||||
"outputs": [{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "getCompReadAddress",
|
||||
"outputs": [{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "getCompToken",
|
||||
"outputs": [{
|
||||
"internalType": "contract TokenInterface",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}, {
|
||||
"internalType": "address[]",
|
||||
"name": "cAddress",
|
||||
"type": "address[]"
|
||||
}],
|
||||
"name": "getCompoundData",
|
||||
"outputs": [{
|
||||
"components": [{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInEth",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInUsd",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "exchangeRateStored",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "balanceOfUser",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "borrowBalanceStoredUser",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "totalBorrows",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "totalSupplied",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "borrowCap",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "supplyRatePerBlock",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRatePerBlock",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "collateralFactor",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "compSpeed",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "bool",
|
||||
"name": "isComped",
|
||||
"type": "bool"
|
||||
}, {
|
||||
"internalType": "bool",
|
||||
"name": "isBorrowPaused",
|
||||
"type": "bool"
|
||||
}],
|
||||
"internalType": "struct Helpers.CompData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "getComptroller",
|
||||
"outputs": [{
|
||||
"internalType": "contract ComptrollerLensInterface",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "getOracleAddress",
|
||||
"outputs": [{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}, {
|
||||
"internalType": "address[]",
|
||||
"name": "cAddress",
|
||||
"type": "address[]"
|
||||
}],
|
||||
"name": "getPosition",
|
||||
"outputs": [{
|
||||
"components": [{
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInEth",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "tokenPriceInUsd",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "exchangeRateStored",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "balanceOfUser",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "borrowBalanceStoredUser",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "totalBorrows",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "totalSupplied",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "borrowCap",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "supplyRatePerBlock",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "borrowRatePerBlock",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "collateralFactor",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "compSpeed",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "bool",
|
||||
"name": "isComped",
|
||||
"type": "bool"
|
||||
}, {
|
||||
"internalType": "bool",
|
||||
"name": "isBorrowPaused",
|
||||
"type": "bool"
|
||||
}],
|
||||
"internalType": "struct Helpers.CompData[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}, {
|
||||
"components": [{
|
||||
"internalType": "uint256",
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "votes",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "address",
|
||||
"name": "delegate",
|
||||
"type": "address"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "allocated",
|
||||
"type": "uint256"
|
||||
}],
|
||||
"internalType": "struct CompReadInterface.CompBalanceMetadataExt",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [{
|
||||
"internalType": "contract CTokenInterface",
|
||||
"name": "cToken",
|
||||
"type": "address"
|
||||
}],
|
||||
"name": "getPriceInEth",
|
||||
"outputs": [{
|
||||
"internalType": "uint256",
|
||||
"name": "priceInETH",
|
||||
"type": "uint256"
|
||||
}, {
|
||||
"internalType": "uint256",
|
||||
"name": "priceInUSD",
|
||||
"type": "uint256"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}, {
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}]
|
1
constant/abi/read/maker.json
Normal file
1
constant/abi/read/maker.json
Normal file
|
@ -0,0 +1 @@
|
|||
[{"inputs":[{"internalType":"string[]","name":"name","type":"string[]"}],"name":"getColInfo","outputs":[{"components":[{"internalType":"uint256","name":"borrowRate","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"liquidationRatio","type":"uint256"},{"internalType":"uint256","name":"vaultDebtCelling","type":"uint256"},{"internalType":"uint256","name":"vaultDebtFloor","type":"uint256"},{"internalType":"uint256","name":"vaultTotalDebt","type":"uint256"},{"internalType":"uint256","name":"totalDebtCelling","type":"uint256"},{"internalType":"uint256","name":"TotalDebt","type":"uint256"}],"internalType":"struct Helpers.ColInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getDaiPosition","outputs":[{"internalType":"uint256","name":"amt","type":"uint256"},{"internalType":"uint256","name":"dsr","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDsrRate","outputs":[{"internalType":"uint256","name":"dsr","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMcdAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getVaultById","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"colType","type":"string"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"art","type":"uint256"},{"internalType":"uint256","name":"debt","type":"uint256"},{"internalType":"uint256","name":"liquidatedCol","type":"uint256"},{"internalType":"uint256","name":"borrowRate","type":"uint256"},{"internalType":"uint256","name":"colPrice","type":"uint256"},{"internalType":"uint256","name":"liquidationRatio","type":"uint256"},{"internalType":"address","name":"vaultAddress","type":"address"}],"internalType":"struct Helpers.VaultData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getVaults","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"colType","type":"string"},{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"art","type":"uint256"},{"internalType":"uint256","name":"debt","type":"uint256"},{"internalType":"uint256","name":"liquidatedCol","type":"uint256"},{"internalType":"uint256","name":"borrowRate","type":"uint256"},{"internalType":"uint256","name":"colPrice","type":"uint256"},{"internalType":"uint256","name":"liquidationRatio","type":"uint256"},{"internalType":"address","name":"vaultAddress","type":"address"}],"internalType":"struct Helpers.VaultData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
|
71
constant/abi/read/unipool.json
Normal file
71
constant/abi/read/unipool.json
Normal file
|
@ -0,0 +1,71 @@
|
|||
[
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "lpTknAddress",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getUnipairInfo",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "",
|
||||
"type": "uint256[]"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token0",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token1",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserve0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserve1",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "totalSupply",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"internalType": "struct Resolver.UnipairInfo[]",
|
||||
"name": "",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
23
constant/abis.ts
Normal file
23
constant/abis.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import aaveABI from "./abi/read/aave.json";
|
||||
import aaveV2ABI from "./abi/read/aaveV2.json";
|
||||
import accountsABI from "./abi/read/accounts.json";
|
||||
import balanceABI from "./abi/read/balance.json";
|
||||
import compoundABI from "./abi/read/compound.json";
|
||||
import makerABI from "./abi/read/maker.json";
|
||||
import makerProxyRegistryABI from "./abi/makerProxyRegistry.json";
|
||||
import unipoolABI from "./abi/read/unipool.json";
|
||||
|
||||
const abis = {
|
||||
makerProxyRegistry: makerProxyRegistryABI,
|
||||
resolver: {
|
||||
aave: aaveABI,
|
||||
aave_v2: aaveV2ABI,
|
||||
accounts: accountsABI,
|
||||
balance: balanceABI,
|
||||
compound: compoundABI,
|
||||
maker: makerABI,
|
||||
unipool: unipoolABI,
|
||||
},
|
||||
};
|
||||
|
||||
export default abis;
|
32
constant/addresses.ts
Normal file
32
constant/addresses.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
const addresses = {
|
||||
mainnet: {
|
||||
makerProxyRegistry: "0x4678f0a6958e4D2Bc4F1BAF7Bc52E8F3564f3fE4",
|
||||
resolver: {
|
||||
aave: "0xA6Dc31dC10f8071c02099B05B76Ba15dfcD2B04c",
|
||||
aave_v2: "0xFb3a1D56eD56F046721B9aCa749895100754578b",
|
||||
accounts: "0x621AD080ad3B839e7b19e040C77F05213AB71524",
|
||||
balance: "0xea426ed5d09d22e46e5d93176c6c7531638f15c1",
|
||||
compound: "0xcCAa4b1b3931749b8b6EF19C6b0B2c496703321b",
|
||||
maker: "0x84addce4fac0b6ee4b0cd132120d6d4b700e35c0",
|
||||
unipool: "0x22bddA39D14eD0aafeee36B6e784602fdDE64723",
|
||||
},
|
||||
},
|
||||
|
||||
polygon: {
|
||||
core: {
|
||||
instaIndex: "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad",
|
||||
instaConnectorsV2: "0x2A00684bFAb9717C21271E0751BCcb7d2D763c88",
|
||||
},
|
||||
resolver: {
|
||||
aave_v2: "0xD6E0803d0eB34af8Ea135835512D7E77960b28F1",
|
||||
accounts: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
|
||||
balance: "0x04F8a41be023f839E709eeEaA0725FD766139A4d",
|
||||
merkleResolver: {
|
||||
aave_v2: "0x2a26228e607ffD2aB2bD3aA49cBae0eDC6469Bf8",
|
||||
},
|
||||
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default addresses;
|
54
constant/atokens.ts
Normal file
54
constant/atokens.ts
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { createTokenUtils } from "../utils/create-token-utils";
|
||||
|
||||
// prettier-ignore
|
||||
export default {
|
||||
mainnet : createTokenUtils([
|
||||
{ key: "aeth", "type": "atoken", "symbol": "AETH", "name": "Aave ETH", "address": "0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04", "decimals": 18, "factor": 0.75, "root": "eth" },
|
||||
{ key: "adai", "type": "atoken", "symbol": "ADAI", "name": "Aave DAI", "address": "0xfC1E690f61EFd961294b3e1Ce3313fBD8aa4f85d", "decimals": 18, "factor": 0.75, "root": "dai" },
|
||||
{ key: "ausdc", "type": "atoken", "symbol": "AUSDC", "name": "Aave USDC", "address": "0x9bA00D6856a4eDF4665BcA2C2309936572473B7E", "decimals": 6, "factor": 0.75, "root": "usdc" },
|
||||
{ key: "ausdt", "type": "atoken", "symbol": "AUSDT", "name": "Aave USDT", "address": "0x71fc860F7D3A592A4a98740e39dB31d25db65ae8", "decimals": 6, "factor": 0, "root": "usdt" },
|
||||
{ key: "asusd", "type": "atoken", "symbol": "ASUSD", "name": "Aave SUSD", "address": "0x625aE63000f46200499120B906716420bd059240", "decimals": 18, "factor": 0, "root": "susd" },
|
||||
{ key: "atusd", "type": "atoken", "symbol": "ATUSD", "name": "Aave TUSD", "address": "0x4DA9b813057D04BAef4e5800E36083717b4a0341", "decimals": 18, "factor": 0.75, "root": "tusd" },
|
||||
{ key: "abusd", "type": "atoken", "symbol": "ABUSD", "name": "Aave BUSD", "address": "0x6Ee0f7BB50a54AB5253dA0667B0Dc2ee526C30a8", "decimals": 18, "factor": 0, "root": "busd" },
|
||||
{ key: "abat", "type": "atoken", "symbol": "ABAT", "name": "Aave BAT", "address": "0xE1BA0FB44CCb0D11b80F92f4f8Ed94CA3fF51D00", "decimals": 18, "factor": 0.6, "root": "bat" },
|
||||
{ key: "aknc", "type": "atoken", "symbol": "AKNC", "name": "Aave KNC", "address": "0x9D91BE44C06d373a8a226E1f3b146956083803eB", "decimals": 18, "factor": 0.6, "root": "knc" },
|
||||
{ key: "alend", "type": "atoken", "symbol": "ALEND", "name": "Aave LEND", "address": "0x7D2D3688Df45Ce7C552E19c27e007673da9204B8", "decimals": 18, "factor": 0.4, "root": "lend" },
|
||||
{ key: "aaave", "type": "atoken", "symbol": "AAAVE", "name": "Aave AAVE", "address": "0xba3D9687Cf50fE253cd2e1cFeEdE1d6787344Ed5", "decimals": 18, "factor": 0.5, "root": "aave" },
|
||||
{ key: "auni", "type": "atoken", "symbol": "AUNI", "name": "Aave UNI", "address": "0xB124541127A0A657f056D9Dd06188c4F1b0e5aab", "decimals": 18, "factor": 0.4, "root": "uni" },
|
||||
{ key: "alink", "type": "atoken", "symbol": "ALINK", "name": "Aave LINK", "address": "0xA64BD6C70Cb9051F6A9ba1F163Fdc07E0DfB5F84", "decimals": 18, "factor": 0.65, "root": "link" },
|
||||
{ key: "amana", "type": "atoken", "symbol": "AMANA", "name": "Aave MANA", "address": "0x6FCE4A401B6B80ACe52baAefE4421Bd188e76F6f", "decimals": 18, "factor": 0.6, "root": "mana" },
|
||||
{ key: "amkr", "type": "atoken", "symbol": "AMKR", "name": "Aave MKR", "address": "0x7deB5e830be29F91E298ba5FF1356BB7f8146998", "decimals": 18, "factor": 0.35, "root": "mkr" },
|
||||
{ key: "aren", "type": "atoken", "symbol": "AREN", "name": "Aave REN", "address": "0x69948cc03f478b95283f7dbf1ce764d0fc7ec54c", "decimals": 18, "factor": 0.5, "root": "ren" },
|
||||
{ key: "asnx", "type": "atoken", "symbol": "ASNX", "name": "Aave SNX", "address": "0x328C4c80BC7aCa0834Db37e6600A6c49E12Da4DE", "decimals": 18, "factor": 0, "root": "snx" },
|
||||
{ key: "awbtc", "type": "atoken", "symbol": "AWBTC", "name": "Aave WBTC", "address": "0xFC4B8ED459e00e5400be803A9BB3954234FD50e3", "decimals": 8, "factor": 0.6, "root": "wbtc" },
|
||||
{ key: "ayfi", "type": "atoken", "symbol": "AYFI", "name": "Aave YFI", "address": "0x12e51E77DAAA58aA0E9247db7510Ea4B46F9bEAd", "decimals": 18, "factor": 0.4, "root": "yfi" },
|
||||
{ key: "azrx", "type": "atoken", "symbol": "AZRX", "name": "Aave ZRX", "address": "0x6Fb0855c404E09c47C3fBCA25f08d4E41f9F062f", "decimals": 18, "factor": 0.6, "root": "zrx" },
|
||||
{ key: "arep", "type": "atoken", "symbol": "AREP", "name": "Aave REP", "address": "0x71010A9D003445aC60C4e6A7017c1E89A477B438", "decimals": 18, "factor": 0.35, "root": "rep" },
|
||||
{ key: "aenj", "type": "atoken", "symbol": "AENJ", "name": "Aave ENJ", "address": "0x712db54daa836b53ef1ecbb9c6ba3b9efb073f40", "decimals": 18, "factor": 0.55, "root": "enj" }
|
||||
]),
|
||||
|
||||
polygon : createTokenUtils([
|
||||
{ key: "aeth", "type": "atoken", "symbol": "AETH", "name": "Aave ETH", "address": "0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04", "decimals": 18, "factor": 0.75, "root": "eth" },
|
||||
{ key: "adai", "type": "atoken", "symbol": "ADAI", "name": "Aave DAI", "address": "0xfC1E690f61EFd961294b3e1Ce3313fBD8aa4f85d", "decimals": 18, "factor": 0.75, "root": "dai" },
|
||||
{ key: "ausdc", "type": "atoken", "symbol": "AUSDC", "name": "Aave USDC", "address": "0x9bA00D6856a4eDF4665BcA2C2309936572473B7E", "decimals": 6, "factor": 0.75, "root": "usdc" },
|
||||
{ key: "ausdt", "type": "atoken", "symbol": "AUSDT", "name": "Aave USDT", "address": "0x71fc860F7D3A592A4a98740e39dB31d25db65ae8", "decimals": 6, "factor": 0, "root": "usdt" },
|
||||
{ key: "asusd", "type": "atoken", "symbol": "ASUSD", "name": "Aave SUSD", "address": "0x625aE63000f46200499120B906716420bd059240", "decimals": 18, "factor": 0, "root": "susd" },
|
||||
{ key: "atusd", "type": "atoken", "symbol": "ATUSD", "name": "Aave TUSD", "address": "0x4DA9b813057D04BAef4e5800E36083717b4a0341", "decimals": 18, "factor": 0.75, "root": "tusd" },
|
||||
{ key: "abusd", "type": "atoken", "symbol": "ABUSD", "name": "Aave BUSD", "address": "0x6Ee0f7BB50a54AB5253dA0667B0Dc2ee526C30a8", "decimals": 18, "factor": 0, "root": "busd" },
|
||||
{ key: "abat", "type": "atoken", "symbol": "ABAT", "name": "Aave BAT", "address": "0xE1BA0FB44CCb0D11b80F92f4f8Ed94CA3fF51D00", "decimals": 18, "factor": 0.6, "root": "bat" },
|
||||
{ key: "aknc", "type": "atoken", "symbol": "AKNC", "name": "Aave KNC", "address": "0x9D91BE44C06d373a8a226E1f3b146956083803eB", "decimals": 18, "factor": 0.6, "root": "knc" },
|
||||
{ key: "alend", "type": "atoken", "symbol": "ALEND", "name": "Aave LEND", "address": "0x7D2D3688Df45Ce7C552E19c27e007673da9204B8", "decimals": 18, "factor": 0.4, "root": "lend" },
|
||||
{ key: "aaave", "type": "atoken", "symbol": "AAAVE", "name": "Aave AAVE", "address": "0xba3D9687Cf50fE253cd2e1cFeEdE1d6787344Ed5", "decimals": 18, "factor": 0.5, "root": "aave" },
|
||||
{ key: "auni", "type": "atoken", "symbol": "AUNI", "name": "Aave UNI", "address": "0xB124541127A0A657f056D9Dd06188c4F1b0e5aab", "decimals": 18, "factor": 0.4, "root": "uni" },
|
||||
{ key: "alink", "type": "atoken", "symbol": "ALINK", "name": "Aave LINK", "address": "0xA64BD6C70Cb9051F6A9ba1F163Fdc07E0DfB5F84", "decimals": 18, "factor": 0.65, "root": "link" },
|
||||
{ key: "amana", "type": "atoken", "symbol": "AMANA", "name": "Aave MANA", "address": "0x6FCE4A401B6B80ACe52baAefE4421Bd188e76F6f", "decimals": 18, "factor": 0.6, "root": "mana" },
|
||||
{ key: "amkr", "type": "atoken", "symbol": "AMKR", "name": "Aave MKR", "address": "0x7deB5e830be29F91E298ba5FF1356BB7f8146998", "decimals": 18, "factor": 0.35, "root": "mkr" },
|
||||
{ key: "aren", "type": "atoken", "symbol": "AREN", "name": "Aave REN", "address": "0x69948cc03f478b95283f7dbf1ce764d0fc7ec54c", "decimals": 18, "factor": 0.5, "root": "ren" },
|
||||
{ key: "asnx", "type": "atoken", "symbol": "ASNX", "name": "Aave SNX", "address": "0x328C4c80BC7aCa0834Db37e6600A6c49E12Da4DE", "decimals": 18, "factor": 0, "root": "snx" },
|
||||
{ key: "awbtc", "type": "atoken", "symbol": "AWBTC", "name": "Aave WBTC", "address": "0xFC4B8ED459e00e5400be803A9BB3954234FD50e3", "decimals": 8, "factor": 0.6, "root": "wbtc" },
|
||||
{ key: "ayfi", "type": "atoken", "symbol": "AYFI", "name": "Aave YFI", "address": "0x12e51E77DAAA58aA0E9247db7510Ea4B46F9bEAd", "decimals": 18, "factor": 0.4, "root": "yfi" },
|
||||
{ key: "azrx", "type": "atoken", "symbol": "AZRX", "name": "Aave ZRX", "address": "0x6Fb0855c404E09c47C3fBCA25f08d4E41f9F062f", "decimals": 18, "factor": 0.6, "root": "zrx" },
|
||||
{ key: "arep", "type": "atoken", "symbol": "AREP", "name": "Aave REP", "address": "0x71010A9D003445aC60C4e6A7017c1E89A477B438", "decimals": 18, "factor": 0.35, "root": "rep" },
|
||||
{ key: "aenj", "type": "atoken", "symbol": "AENJ", "name": "Aave ENJ", "address": "0x712db54daa836b53ef1ecbb9c6ba3b9efb073f40", "decimals": 18, "factor": 0.55, "root": "enj" }
|
||||
])
|
||||
}
|
42
constant/atokensV2.ts
Normal file
42
constant/atokensV2.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { createTokenUtils } from "../utils/create-token-utils";
|
||||
|
||||
// prettier-ignore
|
||||
export default {
|
||||
mainnet : createTokenUtils([
|
||||
{ key: "aeth", "type": "atoken", "symbol": "AETH", "name": "Aave ETH", "address": "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e", "decimals": 18, "factor": 0.8, "root": "eth" },
|
||||
{ key: "adai", "type": "atoken", "symbol": "ADAI", "name": "Aave DAI", "address": "0x028171bCA77440897B824Ca71D1c56caC55b68A3", "decimals": 18, "factor": 0.75, "root": "dai" },
|
||||
{ key: "ausdc", "type": "atoken", "symbol": "AUSDC", "name": "Aave USDC", "address": "0xBcca60bB61934080951369a648Fb03DF4F96263C", "decimals": 6, "factor": 0.8, "root": "usdc" },
|
||||
{ key: "ausdt", "type": "atoken", "symbol": "AUSDT", "name": "Aave USDT", "address": "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811", "decimals": 6, "factor": 0, "root": "usdt" },
|
||||
{ key: "asusd", "type": "atoken", "symbol": "ASUSD", "name": "Aave SUSD", "address": "0x6C5024Cd4F8A59110119C56f8933403A539555EB", "decimals": 18, "factor": 0, "root": "susd" },
|
||||
{ key: "atusd", "type": "atoken", "symbol": "ATUSD", "name": "Aave TUSD", "address": "0x101cc05f4A51C0319f570d5E146a8C625198e636", "decimals": 18, "factor": 0.75, "root": "tusd" },
|
||||
{ key: "arai", "type": "atoken", "symbol": "ARAI", "name": "Aave RAI", "address": "0xe0065ea37791d336D78fcA0e870D04f700395B8d", "decimals": 18, "factor": 0, "root": "rai" },
|
||||
{ key: "abusd", "type": "atoken", "symbol": "ABUSD", "name": "Aave BUSD", "address": "0xA361718326c15715591c299427c62086F69923D9", "decimals": 18, "factor": 0, "root": "busd" },
|
||||
{ key: "abat", "type": "atoken", "symbol": "ABAT", "name": "Aave BAT", "address": "0x05Ec93c0365baAeAbF7AefFb0972ea7ECdD39CF1", "decimals": 18, "factor": 0.7, "root": "bat" },
|
||||
{ key: "aknc", "type": "atoken", "symbol": "AKNC", "name": "Aave KNC", "address": "0x39C6b3e42d6A679d7D776778Fe880BC9487C2EDA", "decimals": 18, "factor": 0.6, "root": "knc" },
|
||||
{ key: "alink", "type": "atoken", "symbol": "ALINK", "name": "Aave LINK", "address": "0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0", "decimals": 18, "factor": 0.7, "root": "link" },
|
||||
{ key: "amana", "type": "atoken", "symbol": "AMANA", "name": "Aave MANA", "address": "0xa685a61171bb30d4072B338c80Cb7b2c865c873E", "decimals": 18, "factor": 0.6, "root": "mana" },
|
||||
{ key: "amkr", "type": "atoken", "symbol": "AMKR", "name": "Aave MKR", "address": "0xc713e5E149D5D0715DcD1c156a020976e7E56B88", "decimals": 18, "factor": 0.6, "root": "mkr" },
|
||||
{ key: "aren", "type": "atoken", "symbol": "AREN", "name": "Aave REN", "address": "0xCC12AbE4ff81c9378D670De1b57F8e0Dd228D77a", "decimals": 18, "factor": 0.55, "root": "ren" },
|
||||
{ key: "asnx", "type": "atoken", "symbol": "ASNX", "name": "Aave SNX", "address": "0x35f6B052C598d933D69A4EEC4D04c73A191fE6c2", "decimals": 18, "factor": 0.15, "root": "snx" },
|
||||
{ key: "awbtc", "type": "atoken", "symbol": "AWBTC", "name": "Aave WBTC", "address": "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656", "decimals": 8, "factor": 0.7, "root": "wbtc" },
|
||||
{ key: "ayfi", "type": "atoken", "symbol": "AYFI", "name": "Aave YFI", "address": "0x5165d24277cD063F5ac44Efd447B27025e888f37", "decimals": 18, "factor": 0.4, "root": "yfi" },
|
||||
{ key: "azrx", "type": "atoken", "symbol": "AZRX", "name": "Aave ZRX", "address": "0xDf7FF54aAcAcbFf42dfe29DD6144A69b629f8C9e", "decimals": 18, "factor": 0.6, "root": "zrx" },
|
||||
{ key: "aenj", "type": "atoken", "symbol": "AENJ", "name": "Aave ENJ", "address": "0xaC6Df26a590F08dcC95D5a4705ae8abbc88509Ef", "decimals": 18, "factor": 0.55, "root": "enj" },
|
||||
{ key: "auni", "type": "atoken", "symbol": "AUNI", "name": "Aave UNI", "address": "0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1", "decimals": 18, "factor": 0.6, "root": "uni" },
|
||||
{ key: "aaave", "type": "atoken", "symbol": "AAAVE", "name": "Aave AAVE", "address": "0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B", "decimals": 18, "factor": 0.5, "root": "aave" },
|
||||
{ key: "agusd", "type": "atoken", "symbol": "AGUSD", "name": "Aave GUSD", "address": "0xD37EE7e4f452C6638c96536e68090De8cBcdb583", "decimals": 2, "factor": 0, "root": "gusd" },
|
||||
{ key: "abal", "type": "atoken", "symbol": "ABAL", "name": "Aave BAL", "address": "0x272F97b7a56a387aE942350bBC7Df5700f8a4576", "decimals": 18, "factor": 0.55, "root": "bal" },
|
||||
{ key: "acrv", "type": "atoken", "symbol": "ACRV", "name": "Aave CRV", "address": "0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1", "decimals": 18, "factor": 0.40, "root": "crv" },
|
||||
{ key: "axsushi", "type": "atoken", "symbol": "AXSUSHI", "name": "Aave xSUSHI", "address": "0xF256CC7847E919FAc9B808cC216cAc87CCF2f47a", "decimals": 18, "factor": 0.45, "root": "xsushi" }
|
||||
]),
|
||||
|
||||
polygon : createTokenUtils([
|
||||
{ key: "aeth", "type": "atoken", "symbol": "AETH", "name": "Aave ETH", "address": "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390", "decimals": 18, "factor": 0.8, "root": "eth" },
|
||||
{ key: "adai", "type": "atoken", "symbol": "ADAI", "name": "Aave DAI", "address": "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", "decimals": 18, "factor": 0.75, "root": "dai" },
|
||||
{ key: "ausdc", "type": "atoken", "symbol": "AUSDC", "name": "Aave USDC", "address": "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", "decimals": 6, "factor": 0.8, "root": "usdc" },
|
||||
{ key: "ausdt", "type": "atoken", "symbol": "AUSDT", "name": "Aave USDT", "address": "0x60D55F02A771d515e077c9C2403a1ef324885CeC", "decimals": 6, "factor": 0, "root": "usdt" },
|
||||
{ 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" },
|
||||
])
|
||||
}
|
37
constant/ctokens.ts
Normal file
37
constant/ctokens.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { createTokenUtils } from '../utils/create-token-utils'
|
||||
|
||||
// prettier-ignore
|
||||
const mainnetTokens = [
|
||||
{ key: "ceth", type: 'ctoken', symbol: 'CETH', name: 'Compound ETH', address: '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5', decimals: 8, factor: 0.75, root: 'eth', id: 'ETH-A' },
|
||||
{ key: "cdai", type: 'ctoken', symbol: 'CDAI', name: 'Compound DAI', address: '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', decimals: 8, factor: 0.75, root: 'dai', id: 'DAI-A' },
|
||||
{ key: "cusdc", type: 'ctoken', symbol: 'CUSDC', name: 'Compound USDC', address: '0x39aa39c021dfbae8fac545936693ac917d5e7563', decimals: 8, factor: 0.75, root: 'usdc', id: 'USDC-A' },
|
||||
{ key: "cusdt", type: 'ctoken', symbol: 'CUSDT', name: 'Compound USDT', address: '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', decimals: 8, factor: 0, root: 'usdt', id: 'USDT-A' },
|
||||
{ key: "czrx", type: 'ctoken', symbol: 'CZRX', name: 'Compound ZRX', address: '0xb3319f5d18bc0d84dd1b4825dcde5d5f7266d407', decimals: 8, factor: 0.6, root: 'zrx', id: 'ZRX-A' },
|
||||
{ key: "crep", type: 'ctoken', symbol: 'CREP', name: 'Compound REP', address: '0x158079ee67fce2f58472a96584a73c7ab9ac95c1', decimals: 8, factor: 0.4, root: 'rep', id: 'REP-A' },
|
||||
{ key: "cbat", type: 'ctoken', symbol: 'CBAT', name: 'Compound BAT', address: '0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e', decimals: 8, factor: 0.6, root: 'bat', id: 'BAT-A' },
|
||||
{ key: "cuni", type: 'ctoken', symbol: 'CUNI', name: 'Compound UNI', address: '0x35A18000230DA775CAc24873d00Ff85BccdeD550', decimals: 8, factor: 0.6, root: 'uni', id: 'UNI-A' },
|
||||
{ key: "cwbtc", type: 'ctoken', symbol: 'CWBTC', name: 'Compound WBTC', address: '0xc11b1268c1a384e55c48c2391d8d480264a3a7f4', decimals: 8, factor: 0.6, root: 'wbtc', id: 'WBTC-A' },
|
||||
{ key: "cwbtc", type: 'ctoken', symbol: 'CWBTC', name: 'Compound WBTC', address: '0xccF4429DB6322D5C611ee964527D42E5d685DD6a', decimals: 8, factor: 0.6, root: 'wbtc', id: 'WBTC-B' },
|
||||
{ key: "ccomp", type: 'ctoken', symbol: 'CCOMP', name: 'Compound COMP', address: '0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4', decimals: 8, factor: 0.6, root: 'comp', id: 'COMP-A' },
|
||||
{ key: "ctusd", type: 'ctoken', symbol: 'CTUSD', name: 'Compound TUSD', address: '0x12392F67bdf24faE0AF363c24aC620a2f67DAd86', decimals: 8, factor: 0, root: 'tusd', id: 'TUSD-A' },
|
||||
{ key: "clink", type: 'ctoken', symbol: 'CLINK', name: 'Compound LINK', address: '0xFAce851a4921ce59e912d19329929CE6da6EB0c7', decimals: 8, factor: 0, root: 'link', id: 'LINK-A' },
|
||||
]
|
||||
|
||||
const maticTokens = [
|
||||
{ key: "ceth", type: 'ctoken', symbol: 'CETH', name: 'Compound ETH', address: '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5', decimals: 8, factor: 0.75, root: 'eth', id: 'ETH-A' },
|
||||
{ key: "cdai", type: 'ctoken', symbol: 'CDAI', name: 'Compound DAI', address: '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', decimals: 8, factor: 0.75, root: 'dai', id: 'DAI-A' },
|
||||
{ key: "cusdc", type: 'ctoken', symbol: 'CUSDC', name: 'Compound USDC', address: '0x39aa39c021dfbae8fac545936693ac917d5e7563', decimals: 8, factor: 0.75, root: 'usdc', id: 'USDC-A' },
|
||||
{ key: "cusdt", type: 'ctoken', symbol: 'CUSDT', name: 'Compound USDT', address: '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', decimals: 8, factor: 0, root: 'usdt', id: 'USDT-A' },
|
||||
{ key: "czrx", type: 'ctoken', symbol: 'CZRX', name: 'Compound ZRX', address: '0xb3319f5d18bc0d84dd1b4825dcde5d5f7266d407', decimals: 8, factor: 0.6, root: 'zrx', id: 'ZRX-A' },
|
||||
{ key: "crep", type: 'ctoken', symbol: 'CREP', name: 'Compound REP', address: '0x158079ee67fce2f58472a96584a73c7ab9ac95c1', decimals: 8, factor: 0.4, root: 'rep', id: 'REP-A' },
|
||||
{ key: "cbat", type: 'ctoken', symbol: 'CBAT', name: 'Compound BAT', address: '0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e', decimals: 8, factor: 0.6, root: 'bat', id: 'BAT-A' },
|
||||
{ key: "cuni", type: 'ctoken', symbol: 'CUNI', name: 'Compound UNI', address: '0x35A18000230DA775CAc24873d00Ff85BccdeD550', decimals: 8, factor: 0.6, root: 'uni', id: 'UNI-A' },
|
||||
{ key: "cwbtc", type: 'ctoken', symbol: 'CWBTC', name: 'Compound WBTC', address: '0xc11b1268c1a384e55c48c2391d8d480264a3a7f4', decimals: 8, factor: 0.6, root: 'wbtc', id: 'WBTC-A' },
|
||||
{ key: "cwbtc", type: 'ctoken', symbol: 'CWBTC', name: 'Compound WBTC', address: '0xccF4429DB6322D5C611ee964527D42E5d685DD6a', decimals: 8, factor: 0.6, root: 'wbtc', id: 'WBTC-B' },
|
||||
{ key: "ccomp", type: 'ctoken', symbol: 'CCOMP', name: 'Compound COMP', address: '0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4', decimals: 8, factor: 0.6, root: 'comp', id: 'COMP-A' },
|
||||
]
|
||||
|
||||
export default {
|
||||
mainnet : createTokenUtils(mainnetTokens),
|
||||
polygon : createTokenUtils(maticTokens),
|
||||
}
|
2
constant/errorMessages.ts
Normal file
2
constant/errorMessages.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export const FORK_EXPIRED = 'fork expired'
|
||||
export const COULD_NOT_FIND_A_FORK_ID = 'could not find a forkId'
|
62
constant/tokens.ts
Normal file
62
constant/tokens.ts
Normal file
|
@ -0,0 +1,62 @@
|
|||
import { createTokenUtils } from "../utils/create-token-utils";
|
||||
|
||||
// prettier-ignore
|
||||
export default {
|
||||
mainnet : createTokenUtils([
|
||||
{ key: 'eth', type: 'token', symbol: 'ETH', name: 'Ethereum', address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', decimals: 18, isStableCoin: false},
|
||||
{ key: 'weth', type: 'token', symbol: 'WETH', name: 'Wrapped Ethereum', address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', decimals: 18, isStableCoin: false},
|
||||
{ key: 'inst', type: 'token', symbol: 'INST', name: 'Instadapp Token', address: '0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb', decimals: 18, isStableCoin: false},
|
||||
{ key: 'dai', type: 'token', symbol: 'DAI', name: 'DAI Stable', address: '0x6B175474E89094C44Da98b954EedeAC495271d0F', decimals: 18, isStableCoin: true},
|
||||
{ key: 'usdc', type: 'token', symbol: 'USDC', name: 'USD Coin', address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', decimals: 6, isStableCoin: true},
|
||||
{ key: 'usdt', type: 'token', symbol: 'USDT', name: 'Tether USD Coin', address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', decimals: 6, isStableCoin: true},
|
||||
{ key: 'mkr', type: 'token', symbol: 'MKR', name: 'MakerDAO', address: '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', decimals: 18, isStableCoin: false},
|
||||
{ key: 'comp', type: 'token', symbol: 'COMP', name: 'Compound', address: '0xc00e94Cb662C3520282E6f5717214004A7f26888', decimals: 18, isStableCoin: false},
|
||||
{ key: 'rai', type: 'token', symbol: 'RAI', name: 'Rai Reflex Index', address: '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', decimals: 18, isStableCoin: false},
|
||||
{ key: 'zrx', type: 'token', symbol: 'ZRX', name: '0x Protocol', address: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', decimals: 18, isStableCoin: false},
|
||||
{ key: 'rep', type: 'token', symbol: 'REP', name: 'Augur', address: '0x1985365e9f78359a9B6AD760e32412f4a445E862', decimals: 18, isStableCoin: false},
|
||||
{ key: 'tusd', type: 'token', symbol: 'TUSD', name: 'TrueUSD', address: '0x0000000000085d4780B73119b644AE5ecd22b376', decimals: 18, isStableCoin: true},
|
||||
{ key: 'pax', type: 'token', symbol: 'PAX', name: 'Paxos Standard Coin', address: '0x8E870D67F660D95d5be530380D0eC0bd388289E1', decimals: 18, isStableCoin: true},
|
||||
{ key: 'bat', type: 'token', symbol: 'BAT', name: 'Basic Attention', address: '0x0D8775F648430679A709E98d2b0Cb6250d2887EF', decimals: 18, isStableCoin: false},
|
||||
{ key: 'knc', type: 'token', symbol: 'KNC', name: 'Kyber Network', address: '0xdd974D5C2e2928deA5F71b9825b8b646686BD200', decimals: 18, isStableCoin: false},
|
||||
{ key: 'wbtc', type: 'token', symbol: 'WBTC', name: 'Wrapped BTC', address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', decimals: 8, isStableCoin: false},
|
||||
{ key: 'susd', type: 'token', symbol: 'SUSD', name: 'Synthetix USD', address: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51', decimals: 18, isStableCoin: false},
|
||||
{ key: 'sbtc', type: 'token', symbol: 'SBTC', name: 'Synthetix BTC', address: '0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6', decimals: 18, isStableCoin: false},
|
||||
{ key: 'ren', type: 'token', symbol: 'REN', name: 'Republic Token', address: '0x408e41876cCCDC0F92210600ef50372656052a38', decimals: 18, isStableCoin: false},
|
||||
{ key: 'renbtc', type: 'token', symbol: 'renBTC', name: 'Ren BTC', address: '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D', decimals: 8, isStableCoin: false},
|
||||
{ key: 'busd', type: 'token', symbol: 'BUSD', name: 'Binance USD', address: '0x4Fabb145d64652a948d72533023f6E7A623C7C53', decimals: 18, isStableCoin: true},
|
||||
{ key: 'lend', type: 'token', symbol: 'LEND', name: 'ETH LEND', address: '0x80fB784B7eD66730e8b1DBd9820aFD29931aab03', decimals: 18, isStableCoin: false},
|
||||
{ key: 'aave', type: 'token', symbol: 'AAVE', name: 'Aave Token', address: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', decimals: 18, isStableCoin: false},
|
||||
{ key: 'link', type: 'token', symbol: 'LINK', name: 'ChainLink Token', address: '0x514910771AF9Ca656af840dff83E8264EcF986CA', decimals: 18, isStableCoin: false},
|
||||
{ key: 'mana', type: 'token', symbol: 'MANA', name: 'Decentraland', address: '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', decimals: 18, isStableCoin: false},
|
||||
{ key: 'snx', type: 'token', symbol: 'SNX', name: 'Synthetix Network Token', address: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', decimals: 18, isStableCoin: false},
|
||||
{ key: 'uni', type: 'token', symbol: 'UNI', name: 'Uniswap Token', address: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', decimals: 18, isStableCoin: false},
|
||||
{ key: 'yfi', type: 'token', symbol: 'YFI', name: 'YEARN', address: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', decimals: 18, isStableCoin: false},
|
||||
// { key: 'chi', type: 'token', symbol: 'CHI', name: 'CHI Gas Token', address: '0x0000000000004946c0e9F43F4Dee607b0eF1fA1c', decimals: 0, isStableCoin: false},
|
||||
{ key: 'lrc', type: 'token', symbol: 'LRC', name: 'Loopring Coin V2', address: '0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD', decimals: 18, isStableCoin: false},
|
||||
{ key: 'enj', type: 'token', symbol: 'ENJ', name: 'Enjin Coin', address: '0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c', decimals: 18, isStableCoin: false},
|
||||
{ key: 'bal', type: 'token', symbol: 'BAL', name: 'Balancer', address: '0xba100000625a3754423978a60c9317c58a424e3D', decimals: 18, isStableCoin: false},
|
||||
{ key: 'gusd', type: 'token', symbol: 'GUSD', name: 'Gemini Dollar', address: '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', decimals: 2, isStableCoin: true, },
|
||||
{ key: 'dpi', type: 'token', symbol: 'DPI', name: 'DefiPulse Index', address: '0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b', decimals: 18, isStableCoin: false, },
|
||||
{ key: '1inch', type: 'token', symbol: '1INCH', name: '1INCH Token', address: '0x111111111117dC0aa78b770fA6A738034120C302', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'sushi', type: 'token', symbol: 'SUSHI', name: 'Sushiswap Token', address: '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'xsushi', type: 'token', symbol: 'xSUSHI', name: 'Sushibar', address: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'crv', type: 'token', symbol: 'CRV', name: 'Curve DAO Token', address: '0xD533a949740bb3306d119CC777fa900bA034cd52', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'eth2xfli', type: 'token', symbol: 'ETH2x-FLI', name: 'ETH 2x Flexible Leverage Index', address: '0xAa6E8127831c9DE45ae56bB1b0d4D4Da6e5665BD', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'btc2xfli', type: 'token', symbol: 'BTC2x-FLI', name: 'BTC 2x Flexible Leverage Index', address: '0x0B498ff89709d3838a063f1dFA463091F9801c2b', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'stkaave', type: 'token', symbol: 'stkAAVE', name: 'Staked Aave', address: '0x4da27a545c0c5B758a6BA100e3a049001de870f5', decimals: 18, isStableCoin: false, },
|
||||
{ key: 'matic', type: 'token', symbol: 'MATIC', name: 'Matic Token', address: '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', decimals: 18, isStableCoin: false, }
|
||||
]),
|
||||
|
||||
polygon: createTokenUtils([
|
||||
{ key: 'matic', type: 'token', symbol: 'MATIC', name: 'MATIC', address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', decimals: 18, isStableCoin: false},
|
||||
{ key: 'inst', type: 'token', symbol: 'INST', name: 'Instadapp Token', address: '0xf50D05A1402d0adAfA880D36050736f9f6ee7dee', decimals: 18, isStableCoin: false},
|
||||
{ key: 'eth', type: 'token', symbol: 'ETH', name: 'Ethereum', address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', decimals: 18, isStableCoin: false},
|
||||
{ key: 'dai', type: 'token', symbol: 'DAI', name: 'DAI Stable', address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', decimals: 18, isStableCoin: true},
|
||||
{ key: 'usdc', type: 'token', symbol: 'USDC', name: 'USD Coin', address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', decimals: 6, isStableCoin: true},
|
||||
{ key: 'usdt', type: 'token', symbol: 'USDT', name: 'Tether USD Coin', address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', decimals: 6, isStableCoin: true},
|
||||
{ key: 'wmatic', type: 'token', symbol: 'WMATIC', name: 'Wrapped MATIC', address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', decimals: 18, isStableCoin: false},
|
||||
{ key: 'wbtc', type: 'token', symbol: 'WBTC', name: 'Wrapped BTC', address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6', decimals: 8, isStableCoin: false},
|
||||
{ key: 'aave', type: 'token', symbol: 'AAVE', name: 'Aave Token', address: '0xD6DF932A45C0f255f85145f286eA0b292B21C90B', decimals: 18, isStableCoin: false },
|
||||
])
|
||||
|
||||
}
|
41
constant/tokens/vaults.ts
Normal file
41
constant/tokens/vaults.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
// prettier-ignore
|
||||
const vaults = [
|
||||
{ type: 'ETH-A', token: 'ETH', key: 'eth', ratio: 0.6666666666666666, joinAddr: '0x2F0b23f53734252Bda2277357e97e1517d6B042A', addr: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', stabiltyRate: 0, price: 0, typeBytes: '0x4554482d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'ETH-B', token: 'ETH', key: 'eth', ratio: 0.76923076923, joinAddr: '0x08638eF1A205bE6762A8b935F5da9b700Cf7322c', addr: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', stabiltyRate: 0, price: 0, typeBytes: '0x4554482d42000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'ETH-C', token: 'ETH', key: 'eth', ratio: 0.571428571, joinAddr: '0xF04a5cC80B1E94C69B48f5ee68a08CD2F09A7c3E', addr: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', stabiltyRate: 0, price: 0, typeBytes: '0x4554482d43000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'BAT-A', token: 'BAT', key: 'bat', ratio: 0.6666666666666666, joinAddr: '0x3D0B1912B66114d4096F48A8CEe3A56C231772cA', addr: '0x0d8775f648430679a709e98d2b0cb6250d2887ef', stabiltyRate: 0, price: 0, typeBytes: '0x4241542d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'USDC-A', token: 'USDC', key: 'usdc', ratio: 0.9090909090909091, joinAddr: '0xa191e578a6736167326d05c119ce0c90849e84b7', addr: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', stabiltyRate: 0, price: 0, typeBytes: '0x555344432d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'WBTC-A', token: 'WBTC', key: 'wbtc', ratio: 0.6666666666666666, joinAddr: '0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5', addr: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', stabiltyRate: 0, price: 0, typeBytes: '0x574254432d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'USDC-B', token: 'USDC', key: 'usdc', ratio: 0.8333333333333334, joinAddr: '0x2600004fd1585f7270756DDc88aD9cfA10dD0428', addr: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', stabiltyRate: 0, price: 0, typeBytes: '0x555344432d420000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'ZRX-A', token: 'ZRX', key: 'zrx', ratio: 0.5714285714285714, joinAddr: '0xc7e8Cd72BDEe38865b4F5615956eF47ce1a7e5D0', addr: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', stabiltyRate: 0, price: 0, typeBytes: '0x5a52582d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'KNC-A', token: 'KNC', key: 'knc', ratio: 0.5714285714285714, joinAddr: '0x475F1a89C1ED844A08E8f6C50A00228b5E59E4A9', addr: '0xdd974D5C2e2928deA5F71b9825b8b646686BD200', stabiltyRate: 0, price: 0, typeBytes: '0x4b4e432d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'MANA-A', token: 'MANA', key: 'mana', ratio: 0.5714285714285714, joinAddr: '0xA6EA3b9C04b8a38Ff5e224E7c3D6937ca44C0ef9', addr: '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', stabiltyRate: 0, price: 0, typeBytes: '0x4d414e412d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'USDT-A', token: 'USDT', key: 'usdt', ratio: 0.6666666666666666, joinAddr: '0x0Ac6A1D74E84C2dF9063bDDc31699FF2a2BB22A2', addr: '0xdAC17F958D2ee523a2206206994597C13D831ec7', stabiltyRate: 0, price: 0, typeBytes: '0x555344542d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'PAXUSD-A', token: 'PAX', key: 'pax', ratio: 0.8333333333333334, joinAddr: '0x7e62B7E279DFC78DEB656E34D6a435cC08a44666', addr: '0x8E870D67F660D95d5be530380D0eC0bd388289E1', stabiltyRate: 0, price: 0, typeBytes: '0x5041585553442d41000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'TUSD-A', token: 'TUSD', key: 'tusd', ratio: 0.8333333333333334, joinAddr: '0x4454aF7C8bb9463203b66C816220D41ED7837f44', addr: '0x0000000000085d4780B73119b644AE5ecd22b376', stabiltyRate: 0, price: 0, typeBytes: '0x545553442d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'COMP-A', token: 'COMP', key: 'comp', ratio: 0.5714285714285714, joinAddr: '0xBEa7cDfB4b49EC154Ae1c0D731E4DC773A3265aA', addr: '0xc00e94Cb662C3520282E6f5717214004A7f26888', stabiltyRate: 0, price: 0, typeBytes: '0x434f4d502d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'LINK-A', token: 'LINK', key: 'link', ratio: 0.5714285714285714, joinAddr: '0xdFccAf8fDbD2F4805C174f856a317765B49E4a50', addr: '0x514910771AF9Ca656af840dff83E8264EcF986CA', stabiltyRate: 0, price: 0, typeBytes: '0x4c494e4b2d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'LRC-A', token: 'LRC', key: 'lrc', ratio: 0.5714285714285714, joinAddr: '0x6C186404A7A238D3d6027C0299D1822c1cf5d8f1', addr: '0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD', stabiltyRate: 0, price: 0, typeBytes: '0x4c52432d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'YFI-A', token: 'YFI', key: 'yfi', ratio: 0.5714285714285714, joinAddr: '0x3ff33d9162aD47660083D7DC4bC02Fb231c81677', addr: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', stabiltyRate: 0, price: 0, typeBytes: '0x5946492d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'BAL-A', token: 'BAL', key: 'bal', ratio: 0.5714285714285714, joinAddr: '0x4a03Aa7fb3973d8f0221B466EefB53D0aC195f55', addr: '0xba100000625a3754423978a60c9317c58a424e3D', stabiltyRate: 0, price: 0, typeBytes: '0x42414c2d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'GUSD-A', token: 'GUSD', key: 'gusd', ratio: 0.9090909090909091, joinAddr: '0xe29A14bcDeA40d83675aa43B72dF07f649738C8b', addr: '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', stabiltyRate: 0, price: 0, typeBytes: '0x475553442d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'UNI-A', token: 'UNI', key: 'uni', ratio: 0.5714285714285714, joinAddr: '0x3BC3A58b4FC1CbE7e98bB4aB7c99535e8bA9b8F1', addr: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', stabiltyRate: 0, price: 0, typeBytes: '0x554e492d41000000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'RENBTC-A', token: 'RENBTC', key: 'renbtc', ratio: 0.5714285714285714, joinAddr: '0xFD5608515A47C37afbA68960c1916b79af9491D0', addr: '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D', stabiltyRate: 0, price: 0, typeBytes: '0x52454e4254432d41000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'AAVE-A', token: 'AAVE', key: 'aave', ratio: 0.5714285714285714, joinAddr: '0x24e459F61cEAa7b1cE70Dbaea938940A7c5aD46e', addr: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', stabiltyRate: 0, price: 0, typeBytes: '0x414156452d410000000000000000000000000000000000000000000000000000', disabled: false, vaultTokenType: 'token' },
|
||||
{ type: 'UNIV2DAIETH-A', token: 'UNI-V2-DAI/ETH', key: 'unidaieth', ratio: 0.8, joinAddr: '0x2502F65D77cA13f183850b5f9272270454094A08', addr: '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11', stabiltyRate: 0, price: 0, typeBytes: '0x554e4956324441494554482d4100000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2WBTCETH-A', token: 'UNI-V2-WBTC/ETH', key: 'uniwbtceth', ratio: 0.6666666666666666, joinAddr: '0xDc26C9b7a8fe4F5dF648E314eC3E6Dc3694e6Dd2', addr: '0xBb2b8038a1640196FbE3e38816F3e67Cba72D940', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632574254434554482d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2USDCETH-A', token: 'UNI-V2-USDC/ETH', key: 'uniusdceth', ratio: 0.8, joinAddr: '0x03Ae53B33FeeAc1222C3f372f32D37Ba95f0F099', addr: '0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632555344434554482d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2DAIUSDC-A', token: 'UNI-V2-USDC/DAI', key: 'unidaiusdc', ratio: 0.900900901, joinAddr: '0xA81598667AC561986b70ae11bBE2dd5348ed4327', addr: '0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632444149555344432d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2ETHUSDT-A', token: 'UNI-V2-USDT/ETH', key: 'uniethusdt', ratio: 0.714285714, joinAddr: '0x4aAD139a88D2dd5e7410b408593208523a3a891d', addr: '0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632455448555344542d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2LINKETH-A', token: 'UNI-V2-LINK/ETH', key: 'unilinketh', ratio: 0.606060606, joinAddr: '0xDae88bDe1FB38cF39B6A02b595930A3449e593A6', addr: '0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974', stabiltyRate: 0, price: 0, typeBytes: '0x554e4956324c494e4b4554482d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2UNIETH-A', token: 'UNI-V2-UNI/ETH', key: 'uniunieth', ratio: 0.606060606, joinAddr: '0xf11a98339FE1CdE648e8D1463310CE3ccC3d7cC1', addr: '0xd3d2E2692501A5c9Ca623199D38826e513033a17', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632554e494554482d4100000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2WBTCDAI-A', token: 'UNI-V2-WBTC/DAI', key: 'uniwbtcdai', ratio: 0.8, joinAddr: '0xD40798267795Cbf3aeEA8E9F8DCbdBA9b5281fcC', addr: '0x231B7589426Ffe1b75405526fC32aC09D44364c4', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632574254434441492d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2AAVEETH-A', token: 'UNI-V2-AAVE/ETH', key: 'uniaaveeth', ratio: 0.606060606, joinAddr: '0x42AFd448Df7d96291551f1eFE1A590101afB1DfF', addr: '0xDFC14d2Af169B0D36C4EFF567Ada9b2E0CAE044f', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632414156454554482d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
{ type: 'UNIV2DAIUSDT-A', token: 'UNI-V2-DAI/USDT', key: 'unidaiusdt', ratio: 0.8, joinAddr: '0xAf034D882169328CAf43b823a4083dABC7EEE0F4', addr: '0xB20bd5D04BE54f870D5C0d3cA85d82b34B836405', stabiltyRate: 0, price: 0, typeBytes: '0x554e495632444149555344542d41000000000000000000000000000000000000', disabled: false, vaultTokenType: 'uniLPT' },
|
||||
]
|
||||
|
||||
export default {
|
||||
allVaults: vaults,
|
||||
types: vaults.map((vault) => vault.type),
|
||||
getVaultByType: (type) => vaults.find((vault) => vault.type === type),
|
||||
};
|
429
constant/uniPoolTokens.ts
Normal file
429
constant/uniPoolTokens.ts
Normal file
|
@ -0,0 +1,429 @@
|
|||
import { createTokenUtils } from "../utils/create-token-utils";
|
||||
|
||||
export default {
|
||||
mainnet: createTokenUtils([
|
||||
{
|
||||
key: "unidaieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-ETH",
|
||||
name: "Uniswap DAI/ETH Pool",
|
||||
address: "0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniusdceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDC-ETH",
|
||||
name: "Uniswap USDC/ETH Pool",
|
||||
address: "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniwbtceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-WBTC-ETH",
|
||||
name: "Uniswap WBTC/ETH Pool",
|
||||
address: "0xBb2b8038a1640196FbE3e38816F3e67Cba72D940",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["wbtc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniethusdt",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDT-ETH",
|
||||
name: "Uniswap USDT/ETH Pool",
|
||||
address: "0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdt", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniwbtcdai",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-WBTC",
|
||||
name: "Uniswap DAI/WBTC Pool",
|
||||
address: "0x231B7589426Ffe1b75405526fC32aC09D44364c4",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "wbtc"],
|
||||
},
|
||||
{
|
||||
key: "uniyfidai",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-YFI",
|
||||
name: "Uniswap DAI/YFI Pool",
|
||||
address: "0x3CD132ac73A4043Bb4f1674369E70BE6f88EdD73",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "yfi"],
|
||||
},
|
||||
{
|
||||
key: "uniunieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-UNI-ETH",
|
||||
name: "Uniswap UNI/ETH Pool",
|
||||
address: "0xd3d2E2692501A5c9Ca623199D38826e513033a17",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["uni", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unilinketh",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-LINK-ETH",
|
||||
name: "Uniswap LINK/ETH Pool",
|
||||
address: "0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["link", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniusdcusdt",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDC-USDT",
|
||||
name: "Uniswap USDC/USDT Pool",
|
||||
address: "0x3041CbD36888bECc7bbCBc0045E3B1f144466f5f",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdc", "usdt"],
|
||||
},
|
||||
{
|
||||
key: "unidaiusdc",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDC-DAI",
|
||||
name: "Uniswap USDC/DAI Pool",
|
||||
address: "0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdc", "dai"],
|
||||
},
|
||||
{
|
||||
key: "unidaiusdt",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-USDT",
|
||||
name: "Uniswap DAI/USDT Pool",
|
||||
address: "0xB20bd5D04BE54f870D5C0d3cA85d82b34B836405",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "usdt"],
|
||||
},
|
||||
{
|
||||
key: "uniwbtcusdc",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-WBTC-USDC",
|
||||
name: "Uniswap WBTC/USDC Pool",
|
||||
address: "0x004375Dff511095CC5A197A54140a24eFEF3A416",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["wbtc", "usdc"],
|
||||
},
|
||||
{
|
||||
key: "uniaaveeth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-AAVE-ETH",
|
||||
name: "Uniswap AAVE/ETH Pool",
|
||||
address: "0xDFC14d2Af169B0D36C4EFF567Ada9b2E0CAE044f",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["aave", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unisnxeth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-SNX-ETH",
|
||||
name: "Uniswap SNX/ETH Pool",
|
||||
address: "0x43AE24960e5534731Fc831386c07755A2dc33D47",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["snx", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unidpieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DPI-ETH",
|
||||
name: "Uniswap DPI/ETH Pool",
|
||||
address: "0x4d5ef58aAc27d99935E5b6B4A6778ff292059991",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dpi", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniyfieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-YFI-ETH",
|
||||
name: "Uniswap YFI/ETH Pool",
|
||||
address: "0x2fDbAdf3C4D5A8666Bc06645B8358ab803996E28",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["yfi", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniethrenbtc",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-renBTC-ETH",
|
||||
name: "Uniswap renBTC/ETH Pool",
|
||||
address: "0x81FbEf4704776cc5bBa0A5dF3a90056d2C6900B3",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["renbtc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unimkreth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-MKR-ETH",
|
||||
name: "Uniswap MKR/ETH Pool",
|
||||
address: "0xC2aDdA861F89bBB333c90c492cB837741916A225",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["mkr", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unicompeth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-COMP-ETH",
|
||||
name: "Uniswap COMP/ETH Pool",
|
||||
address: "0xCFfDdeD873554F362Ac02f8Fb1f02E5ada10516f",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["comp", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unilrceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-LRC-ETH",
|
||||
name: "Uniswap LRC/ETH Pool",
|
||||
address: "0x8878Df9E1A7c87dcBf6d3999D997f262C05D8C70",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["lrc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unieth2xflieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-ETH2x-FLI-ETH",
|
||||
name: "Uniswap ETH2x-FLI/ETH Pool",
|
||||
address: "0xF91c12DAe1313d0bE5d7A27aa559B1171cC1EaC5",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["eth2xfli", "eth"],
|
||||
},
|
||||
]),
|
||||
|
||||
polygon: createTokenUtils([
|
||||
{
|
||||
key: "unidaieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-ETH",
|
||||
name: "Uniswap DAI/ETH Pool",
|
||||
address: "0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniusdceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDC-ETH",
|
||||
name: "Uniswap USDC/ETH Pool",
|
||||
address: "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniwbtceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-WBTC-ETH",
|
||||
name: "Uniswap WBTC/ETH Pool",
|
||||
address: "0xBb2b8038a1640196FbE3e38816F3e67Cba72D940",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["wbtc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniusdteth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDT-ETH",
|
||||
name: "Uniswap USDT/ETH Pool",
|
||||
address: "0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdt", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unidaiwbtc",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-WBTC",
|
||||
name: "Uniswap DAI/WBTC Pool",
|
||||
address: "0x231B7589426Ffe1b75405526fC32aC09D44364c4",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "wbtc"],
|
||||
},
|
||||
{
|
||||
key: "unidaiyfi",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-YFI",
|
||||
name: "Uniswap DAI/YFI Pool",
|
||||
address: "0x3CD132ac73A4043Bb4f1674369E70BE6f88EdD73",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "yfi"],
|
||||
},
|
||||
{
|
||||
key: "uniunieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-UNI-ETH",
|
||||
name: "Uniswap UNI/ETH Pool",
|
||||
address: "0xd3d2E2692501A5c9Ca623199D38826e513033a17",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["uni", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unilinketh",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-LINK-ETH",
|
||||
name: "Uniswap LINK/ETH Pool",
|
||||
address: "0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["link", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniusdcusdt",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDC-USDT",
|
||||
name: "Uniswap USDC/USDT Pool",
|
||||
address: "0x3041CbD36888bECc7bbCBc0045E3B1f144466f5f",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdc", "usdt"],
|
||||
},
|
||||
{
|
||||
key: "uniusdcdai",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-USDC-DAI",
|
||||
name: "Uniswap USDC/DAI Pool",
|
||||
address: "0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["usdc", "dai"],
|
||||
},
|
||||
{
|
||||
key: "unidaiusdt",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DAI-USDT",
|
||||
name: "Uniswap DAI/USDT Pool",
|
||||
address: "0xB20bd5D04BE54f870D5C0d3cA85d82b34B836405",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dai", "usdt"],
|
||||
},
|
||||
{
|
||||
key: "uniwbtcusdc",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-WBTC-USDC",
|
||||
name: "Uniswap WBTC/USDC Pool",
|
||||
address: "0x004375Dff511095CC5A197A54140a24eFEF3A416",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["wbtc", "usdc"],
|
||||
},
|
||||
{
|
||||
key: "uniaaveeth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-AAVE-ETH",
|
||||
name: "Uniswap AAVE/ETH Pool",
|
||||
address: "0xDFC14d2Af169B0D36C4EFF567Ada9b2E0CAE044f",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["aave", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unisnxeth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-SNX-ETH",
|
||||
name: "Uniswap SNX/ETH Pool",
|
||||
address: "0x43AE24960e5534731Fc831386c07755A2dc33D47",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["snx", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unidpieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-DPI-ETH",
|
||||
name: "Uniswap DPI/ETH Pool",
|
||||
address: "0x4d5ef58aAc27d99935E5b6B4A6778ff292059991",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["dpi", "eth"],
|
||||
},
|
||||
{
|
||||
key: "uniyfieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-YFI-ETH",
|
||||
name: "Uniswap YFI/ETH Pool",
|
||||
address: "0x2fDbAdf3C4D5A8666Bc06645B8358ab803996E28",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["yfi", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unirenbtceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-renBTC-ETH",
|
||||
name: "Uniswap renBTC/ETH Pool",
|
||||
address: "0x81FbEf4704776cc5bBa0A5dF3a90056d2C6900B3",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["renbtc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unimkreth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-MKR-ETH",
|
||||
name: "Uniswap MKR/ETH Pool",
|
||||
address: "0xC2aDdA861F89bBB333c90c492cB837741916A225",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["mkr", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unicompeth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-COMP-ETH",
|
||||
name: "Uniswap COMP/ETH Pool",
|
||||
address: "0xCFfDdeD873554F362Ac02f8Fb1f02E5ada10516f",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["comp", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unilrceth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-LRC-ETH",
|
||||
name: "Uniswap LRC/ETH Pool",
|
||||
address: "0x8878Df9E1A7c87dcBf6d3999D997f262C05D8C70",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["lrc", "eth"],
|
||||
},
|
||||
{
|
||||
key: "unieth2xflieth",
|
||||
type: "uniLPT",
|
||||
symbol: "UNI-V2-ETH2x-FLI-ETH",
|
||||
name: "Uniswap ETH2x-FLI/ETH Pool",
|
||||
address: "0xF91c12DAe1313d0bE5d7A27aa559B1171cC1EaC5",
|
||||
decimals: 18,
|
||||
isStableCoin: false,
|
||||
tokens: ["eth2xfli", "eth"],
|
||||
},
|
||||
]),
|
||||
};
|
|
@ -1,36 +1,8 @@
|
|||
<template>
|
||||
<div class="min-h-screen font-sans antialiased text-primary-black">
|
||||
<Navbar />
|
||||
<div class="max-w-6xl mx-auto py-8">
|
||||
<div class="space-x-4">
|
||||
<button
|
||||
class="font-semibold text-primary-gray hover:text-primary-blue-dark h-[44px] w-[216px] rounded-[6px] p-5 inline-flex items-center justify-center shadow-lg"
|
||||
>
|
||||
<MakerDAOIcon class="mr-2 w-8 h-8" />
|
||||
|
||||
Maker
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="font-semibold text-white h-[44px] w-[216px] rounded-[6px] p-5 inline-flex items-center justify-center shadow bg-primary-blue-dark hover:bg-primary-blue-hover "
|
||||
>
|
||||
<CompoundIcon class="mr-2 w-8 h-8" />
|
||||
|
||||
Compound
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="font-semibold text-primary-gray hover:text-primary-blue-dark h-[44px] w-[216px] rounded-[6px] p-5 inline-flex items-center justify-center shadow-lg"
|
||||
>
|
||||
<AaveIcon class="mr-2 w-8 h-8" />
|
||||
|
||||
Aave
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="border border-b-[#E7E8F1] w-full my-6"></div>
|
||||
|
||||
<div class="py-4">
|
||||
<div class="max-w-6xl mx-auto py-12">
|
||||
<div>
|
||||
<Nuxt />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"@tailwindcss/forms": "^0.3.3",
|
||||
"@vueuse/core": "^5.1.4",
|
||||
"@walletconnect/web3-provider": "^1.4.1",
|
||||
"bignumber.js": "^9.0.1",
|
||||
"core-js": "^3.15.1",
|
||||
"dsa-connect": "^0.4.2",
|
||||
"nuxt": "^2.15.7",
|
||||
|
|
|
@ -1,16 +1,85 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1 class="font-semibold text-2xl">MakerDAO</h1>
|
||||
<div>
|
||||
<h1 class="font-semibold text-2xl text-center">Assembly Apps</h1>
|
||||
|
||||
<!-- Overview -->
|
||||
<div class="mt-10 grid w-full grid-cols-1 gap-4 sm:grid-cols-3 xl:gap-6">
|
||||
<nuxt-link
|
||||
v-for="app in apps"
|
||||
:key="app.id"
|
||||
:to="app.url"
|
||||
class="relative flex flex-col items-center px-4 py-12 text-center rounded-[6px] cursor-pointer bg-white hover:bg-gray-50 shadow"
|
||||
>
|
||||
<div
|
||||
style="background: radial-gradient(42.15% 42.15% at 48.94% 48.94%, #D6DAE0 75.67%, #F0F3F9 100%), #C4C4C4;"
|
||||
class="w-20 h-20 rounded-full flex items-center justify-center"
|
||||
>
|
||||
<div
|
||||
style="background: linear-gradient(0deg, #FFFFFF, #FFFFFF), #C4C4C4"
|
||||
class="w-16 h-16 rounded-full flex items-center justify-center"
|
||||
>
|
||||
<component :is="app.icon" class="w-8 h-8" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Positions -->
|
||||
|
||||
</div>
|
||||
<h2 class="mt-4 font-semibold text-19">{{ app.name }}</h2>
|
||||
<p class="mt-2 text-14 font-regular text-grey-dark opacity-90">
|
||||
{{ app.description }}
|
||||
</p>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from '@nuxtjs/composition-api'
|
||||
import { computed, defineComponent } from "@nuxtjs/composition-api";
|
||||
import { useNetwork } from "~/composables/useNetwork";
|
||||
//@ts-ignore
|
||||
import AaveIcon from "~/assets/icons/colored/aave.svg?inline";
|
||||
|
||||
export default defineComponent({})
|
||||
const appsPerNetwork = {
|
||||
mainnet: [
|
||||
{
|
||||
id: "aave-v2",
|
||||
icon: AaveIcon,
|
||||
name: "Aave v2",
|
||||
url: "/mainnet/aave-v2",
|
||||
description: "Lend and borrow straight from your Gnosis Safe"
|
||||
}
|
||||
],
|
||||
polygon: [
|
||||
{
|
||||
id: "aave-v2",
|
||||
icon: AaveIcon,
|
||||
name: "Aave v2",
|
||||
url: "/polygon/aave-v2",
|
||||
description: "Lend and borrow straight from your Gnosis Safe"
|
||||
},
|
||||
{
|
||||
id: "aave-v3",
|
||||
icon: AaveIcon,
|
||||
name: "Aave v3",
|
||||
url: "/polygon/aave-v2",
|
||||
description: "Lend and borrow straight from your Gnosis Safe"
|
||||
},
|
||||
{
|
||||
id: "aave-v4",
|
||||
icon: AaveIcon,
|
||||
name: "Aave v4",
|
||||
url: "/polygon/aave-v2",
|
||||
description: "Lend and borrow straight from your Gnosis Safe"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const { activeNetworkId } = useNetwork();
|
||||
|
||||
const apps = computed(() => appsPerNetwork[activeNetworkId.value]);
|
||||
|
||||
return {
|
||||
apps
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
3
pages/mainnet/aave-v2.vue
Normal file
3
pages/mainnet/aave-v2.vue
Normal file
|
@ -0,0 +1,3 @@
|
|||
<template>
|
||||
<div>aave v2</div>
|
||||
</template>
|
133
pages/polygon/aave-v2.vue
Normal file
133
pages/polygon/aave-v2.vue
Normal file
|
@ -0,0 +1,133 @@
|
|||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<nuxt-link
|
||||
to="/"
|
||||
class="text-[#C0C5D7] text-lg font-semibold flex items-center"
|
||||
>
|
||||
<BackIcon class="w-4 h-4 mr-3" />
|
||||
Apps
|
||||
</nuxt-link>
|
||||
</div>
|
||||
|
||||
<div class="mt-10">
|
||||
<h1 class="text-primary-black text-2xl font-semibold">Aave v2</h1>
|
||||
</div>
|
||||
|
||||
<div class="mt-10" v-if="position">
|
||||
<h2 class="text-primary-gray text-lg font-semibold">Overview</h2>
|
||||
|
||||
<div
|
||||
class="mt-6 grid w-full grid-cols-1 gap-4 sm:grid-cols-3 xl:gap-[18px]"
|
||||
>
|
||||
<div class="shadow rounded-lg py-8 px-6 flex">
|
||||
<div class="flex-1">
|
||||
<h3 class="text-2xl text-primary-black font-medium">
|
||||
{{ formatUsd(totalSupply) }}
|
||||
</h3>
|
||||
<p class="mt-4 text-primary-gray font-medium">Lend</p>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<svg
|
||||
width="27"
|
||||
height="29"
|
||||
viewBox="0 0 27 29"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1.34917 12C0.603705 12 -7.62939e-06 12.6037 -7.62939e-06 13.3492V26.8498C-7.62939e-06 27.5953 0.603705 28.199 1.34917 28.199H25.6496C26.395 28.199 27 27.5953 27 26.8498V13.3492C27 12.6037 26.395 12 25.6496 12H1.34917ZM3.93109 14.6996H23.0676C23.1684 14.9836 23.3312 15.2415 23.5442 15.4545C23.7573 15.6675 24.0152 15.8304 24.2991 15.9311V24.2679C24.0154 24.3688 23.7578 24.5317 23.5449 24.7447C23.3321 24.9577 23.1695 25.2156 23.0689 25.4994H3.93109C3.83052 25.2153 3.66775 24.9574 3.45469 24.7443C3.24163 24.5312 2.98365 24.3685 2.69961 24.2679V15.9311C2.98365 15.8305 3.24163 15.6678 3.45469 15.4547C3.66775 15.2416 3.83052 14.9837 3.93109 14.6996ZM13.4994 16.0501C12.4252 16.0501 11.3951 16.4768 10.6355 17.2363C9.876 17.9958 9.4493 19.026 9.4493 20.1001C9.4493 21.1743 9.876 22.2044 10.6355 22.964C11.3951 23.7235 12.4252 24.1502 13.4994 24.1502C14.5735 24.1502 15.6037 23.7235 16.3632 22.964C17.1227 22.2044 17.5494 21.1743 17.5494 20.1001C17.5494 19.026 17.1227 17.9958 16.3632 17.2363C15.6037 16.4768 14.5735 16.0501 13.4994 16.0501ZM6.74968 18.7497C6.39185 18.7497 6.04868 18.8918 5.79566 19.1448C5.54264 19.3979 5.4005 19.741 5.4005 20.0989C5.4005 20.4567 5.54264 20.7999 5.79566 21.0529C6.04868 21.3059 6.39185 21.448 6.74968 21.448C7.1075 21.448 7.45067 21.3059 7.70369 21.0529C7.95671 20.7999 8.09886 20.4567 8.09886 20.0989C8.09886 19.741 7.95671 19.3979 7.70369 19.1448C7.45067 18.8918 7.1075 18.7497 6.74968 18.7497ZM20.2491 18.7497C19.8911 18.7497 19.5477 18.8919 19.2946 19.145C19.0415 19.3982 18.8992 19.7415 18.8992 20.0995C18.8992 20.4575 19.0415 20.8008 19.2946 21.054C19.5477 21.3071 19.8911 21.4493 20.2491 21.4493C20.607 21.4493 20.9504 21.3071 21.2035 21.054C21.4566 20.8008 21.5989 20.4575 21.5989 20.0995C21.5989 19.7415 21.4566 19.3982 21.2035 19.145C20.9504 18.8919 20.607 18.7497 20.2491 18.7497Z"
|
||||
fill="#209B9F"
|
||||
/>
|
||||
<path
|
||||
d="M9.26922 5.85639L12.8282 9.41665C12.9101 9.50186 13.0083 9.56957 13.1171 9.61569C13.2259 9.66181 13.3429 9.68538 13.461 9.68497C13.5793 9.68521 13.6963 9.66144 13.8051 9.61511C13.9139 9.56877 14.0121 9.50082 14.0939 9.41538L17.6529 5.85639C17.7382 5.77424 17.8061 5.67566 17.8524 5.5666C17.8986 5.45754 17.9224 5.34024 17.9221 5.22176C17.9219 5.10329 17.8977 4.98609 17.851 4.87721C17.8043 4.76833 17.736 4.67003 17.6503 4.58821C17.4829 4.42155 17.2575 4.32628 17.0213 4.32243C16.7834 4.32597 16.5564 4.42224 16.3885 4.59075L14.3634 6.61578V1.90125C14.3651 1.78233 14.343 1.66428 14.2982 1.55409C14.2534 1.44391 14.187 1.34383 14.1029 1.25979C14.0187 1.17575 13.9185 1.10946 13.8083 1.06486C13.698 1.02025 13.58 0.998235 13.461 1.00011C13.3422 0.998406 13.2243 1.02055 13.1142 1.06523C13.0041 1.10992 12.9041 1.17623 12.82 1.26025C12.736 1.34427 12.6697 1.44429 12.625 1.55439C12.5803 1.66449 12.5582 1.78244 12.5599 1.90125V6.61704L10.5349 4.59201C10.3672 4.42305 10.1401 4.3263 9.90204 4.32243C9.66419 4.32597 9.43713 4.42224 9.26922 4.59075C9.18408 4.67269 9.11636 4.77098 9.0701 4.87971C9.02384 4.98845 9 5.1054 9 5.22357C9 5.34173 9.02384 5.45869 9.0701 5.56742C9.11636 5.67616 9.18408 5.77444 9.26922 5.85639Z"
|
||||
fill="#209B9F"
|
||||
stroke="#209B9F"
|
||||
stroke-width="0.3"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shadow rounded-lg py-8 px-6 flex">
|
||||
<div class="flex-1">
|
||||
<h3 class="text-2xl text-primary-black font-medium">
|
||||
{{ formatUsd(totalBorrow) }}
|
||||
</h3>
|
||||
<p class="mt-4 text-primary-gray font-medium">Borrowed</p>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<svg width="27" height="28" viewBox="0 0 27 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1.34511 11C0.601893 11 0 11.6019 0 12.3451V25.8051C0 26.5483 0.601893 27.1502 1.34511 27.1502H25.5722C26.3155 27.1502 26.9186 26.5483 26.9186 25.8051V12.3451C26.9186 11.6019 26.3155 11 25.5722 11H1.34511ZM3.91924 13.6915H22.9981C23.0985 13.9746 23.2609 14.2317 23.4733 14.4441C23.6857 14.6565 23.9428 14.8188 24.2259 14.9192V23.2309C23.943 23.3315 23.6861 23.4939 23.474 23.7063C23.2618 23.9187 23.0997 24.1757 22.9994 24.4587H3.91924C3.81898 24.1755 3.6567 23.9183 3.44428 23.7059C3.23186 23.4935 2.97466 23.3312 2.69148 23.2309V14.9192C2.97466 14.819 3.23186 14.6567 3.44428 14.4443C3.6567 14.2319 3.81898 13.9747 3.91924 13.6915ZM13.4587 15.0379C12.3878 15.0379 11.3607 15.4633 10.6035 16.2205C9.84624 16.9778 9.42082 18.0048 9.42082 19.0757C9.42082 20.1466 9.84624 21.1737 10.6035 21.9309C11.3607 22.6882 12.3878 23.1136 13.4587 23.1136C14.5296 23.1136 15.5566 22.6882 16.3139 21.9309C17.0711 21.1737 17.4965 20.1466 17.4965 19.0757C17.4965 18.0048 17.0711 16.9778 16.3139 16.2205C15.5566 15.4633 14.5296 15.0379 13.4587 15.0379ZM6.72934 17.7293C6.37259 17.7293 6.03046 17.8711 5.7782 18.1233C5.52594 18.3756 5.38423 18.7177 5.38423 19.0744C5.38423 19.4312 5.52594 19.7733 5.7782 20.0256C6.03046 20.2778 6.37259 20.4196 6.72934 20.4196C7.08608 20.4196 7.42822 20.2778 7.68048 20.0256C7.93273 19.7733 8.07445 19.4312 8.07445 19.0744C8.07445 18.7177 7.93273 18.3756 7.68048 18.1233C7.42822 17.8711 7.08608 17.7293 6.72934 17.7293ZM20.188 17.7293C19.8311 17.7293 19.4888 17.8711 19.2364 18.1235C18.9841 18.3759 18.8423 18.7182 18.8423 19.0751C18.8423 19.432 18.9841 19.7743 19.2364 20.0267C19.4888 20.279 19.8311 20.4208 20.188 20.4208C20.5449 20.4208 20.8872 20.279 21.1396 20.0267C21.392 19.7743 21.5338 19.432 21.5338 19.0751C21.5338 18.7182 21.392 18.3759 21.1396 18.1235C20.8872 17.8711 20.5449 17.7293 20.188 17.7293Z" fill="#CA8700"/>
|
||||
<path d="M17.5573 3.7854H10.6173C10.0946 3.7854 9.6709 4.20911 9.6709 4.73177C9.6709 5.25444 10.0946 5.67815 10.6173 5.67815H17.5573C18.08 5.67815 18.5037 5.25444 18.5037 4.73177C18.5037 4.20911 18.08 3.7854 17.5573 3.7854Z" fill="#CA8700"/>
|
||||
<path d="M17.5573 0H10.6173C10.0946 0 9.6709 0.423705 9.6709 0.946372C9.6709 1.46904 10.0946 1.89274 10.6173 1.89274H17.5573C18.08 1.89274 18.5037 1.46904 18.5037 0.946372C18.5037 0.423705 18.08 0 17.5573 0Z" fill="#CA8700"/>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shadow rounded-lg py-8 px-6 flex">
|
||||
<div class="flex-1">
|
||||
<h3 class="text-2xl text-primary-black font-medium">
|
||||
{{ formatPercent(status) }} -
|
||||
{{ formatPercent(position.maxLiquidation)}}
|
||||
</h3>
|
||||
<p class="mt-4 text-primary-gray font-medium">D/C (%)</p>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<svg
|
||||
width="27"
|
||||
height="29"
|
||||
viewBox="0 0 27 29"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1.34917 12C0.603705 12 -7.62939e-06 12.6037 -7.62939e-06 13.3492V26.8498C-7.62939e-06 27.5953 0.603705 28.199 1.34917 28.199H25.6496C26.395 28.199 27 27.5953 27 26.8498V13.3492C27 12.6037 26.395 12 25.6496 12H1.34917ZM3.93109 14.6996H23.0676C23.1684 14.9836 23.3312 15.2415 23.5442 15.4545C23.7573 15.6675 24.0152 15.8304 24.2991 15.9311V24.2679C24.0154 24.3688 23.7578 24.5317 23.5449 24.7447C23.3321 24.9577 23.1695 25.2156 23.0689 25.4994H3.93109C3.83052 25.2153 3.66775 24.9574 3.45469 24.7443C3.24163 24.5312 2.98365 24.3685 2.69961 24.2679V15.9311C2.98365 15.8305 3.24163 15.6678 3.45469 15.4547C3.66775 15.2416 3.83052 14.9837 3.93109 14.6996ZM13.4994 16.0501C12.4252 16.0501 11.3951 16.4768 10.6355 17.2363C9.876 17.9958 9.4493 19.026 9.4493 20.1001C9.4493 21.1743 9.876 22.2044 10.6355 22.964C11.3951 23.7235 12.4252 24.1502 13.4994 24.1502C14.5735 24.1502 15.6037 23.7235 16.3632 22.964C17.1227 22.2044 17.5494 21.1743 17.5494 20.1001C17.5494 19.026 17.1227 17.9958 16.3632 17.2363C15.6037 16.4768 14.5735 16.0501 13.4994 16.0501ZM6.74968 18.7497C6.39185 18.7497 6.04868 18.8918 5.79566 19.1448C5.54264 19.3979 5.4005 19.741 5.4005 20.0989C5.4005 20.4567 5.54264 20.7999 5.79566 21.0529C6.04868 21.3059 6.39185 21.448 6.74968 21.448C7.1075 21.448 7.45067 21.3059 7.70369 21.0529C7.95671 20.7999 8.09886 20.4567 8.09886 20.0989C8.09886 19.741 7.95671 19.3979 7.70369 19.1448C7.45067 18.8918 7.1075 18.7497 6.74968 18.7497ZM20.2491 18.7497C19.8911 18.7497 19.5477 18.8919 19.2946 19.145C19.0415 19.3982 18.8992 19.7415 18.8992 20.0995C18.8992 20.4575 19.0415 20.8008 19.2946 21.054C19.5477 21.3071 19.8911 21.4493 20.2491 21.4493C20.607 21.4493 20.9504 21.3071 21.2035 21.054C21.4566 20.8008 21.5989 20.4575 21.5989 20.0995C21.5989 19.7415 21.4566 19.3982 21.2035 19.145C20.9504 18.8919 20.607 18.7497 20.2491 18.7497Z"
|
||||
fill="#209B9F"
|
||||
/>
|
||||
<path
|
||||
d="M9.26922 5.85639L12.8282 9.41665C12.9101 9.50186 13.0083 9.56957 13.1171 9.61569C13.2259 9.66181 13.3429 9.68538 13.461 9.68497C13.5793 9.68521 13.6963 9.66144 13.8051 9.61511C13.9139 9.56877 14.0121 9.50082 14.0939 9.41538L17.6529 5.85639C17.7382 5.77424 17.8061 5.67566 17.8524 5.5666C17.8986 5.45754 17.9224 5.34024 17.9221 5.22176C17.9219 5.10329 17.8977 4.98609 17.851 4.87721C17.8043 4.76833 17.736 4.67003 17.6503 4.58821C17.4829 4.42155 17.2575 4.32628 17.0213 4.32243C16.7834 4.32597 16.5564 4.42224 16.3885 4.59075L14.3634 6.61578V1.90125C14.3651 1.78233 14.343 1.66428 14.2982 1.55409C14.2534 1.44391 14.187 1.34383 14.1029 1.25979C14.0187 1.17575 13.9185 1.10946 13.8083 1.06486C13.698 1.02025 13.58 0.998235 13.461 1.00011C13.3422 0.998406 13.2243 1.02055 13.1142 1.06523C13.0041 1.10992 12.9041 1.17623 12.82 1.26025C12.736 1.34427 12.6697 1.44429 12.625 1.55439C12.5803 1.66449 12.5582 1.78244 12.5599 1.90125V6.61704L10.5349 4.59201C10.3672 4.42305 10.1401 4.3263 9.90204 4.32243C9.66419 4.32597 9.43713 4.42224 9.26922 4.59075C9.18408 4.67269 9.11636 4.77098 9.0701 4.87971C9.02384 4.98845 9 5.1054 9 5.22357C9 5.34173 9.02384 5.45869 9.0701 5.56742C9.11636 5.67616 9.18408 5.77444 9.26922 5.85639Z"
|
||||
fill="#209B9F"
|
||||
stroke="#209B9F"
|
||||
stroke-width="0.3"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-[60px]">
|
||||
<h2 class="text-primary-gray text-lg font-semibold">Your Positions</h2>
|
||||
|
||||
<pre>{{ position }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from "@nuxtjs/composition-api";
|
||||
// @ts-ignore
|
||||
import BackIcon from "~/assets/icons/back.svg?inline";
|
||||
import { useAaveV2Position } from "~/composables/useAaveV2Position";
|
||||
import { useFormatting } from "~/composables/useFormatting";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
BackIcon
|
||||
},
|
||||
setup() {
|
||||
const { position, totalSupply, totalBorrow, status } = useAaveV2Position();
|
||||
const { formatUsd, formatPercent } = useFormatting();
|
||||
return {
|
||||
position,
|
||||
totalSupply,
|
||||
totalBorrow,
|
||||
status,
|
||||
formatUsd,
|
||||
formatPercent,
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -11,9 +11,10 @@
|
|||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"strict": false,
|
||||
"noEmit": true,
|
||||
"experimentalDecorators": true,
|
||||
"resolveJsonModule": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": [
|
||||
|
|
15
utils/create-token-utils.ts
Normal file
15
utils/create-token-utils.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export function createTokenUtils(tokens) {
|
||||
const getTokenByAddress = address =>
|
||||
tokens.find(token => token.address === address);
|
||||
const getTokenByKey = key => tokens.find(token => token.key === key);
|
||||
const tokenKeys = tokens.map(token => token.key);
|
||||
const rootTokens = tokens.map(token => token.root);
|
||||
|
||||
return {
|
||||
allTokens: tokens,
|
||||
tokenKeys,
|
||||
getTokenByAddress,
|
||||
getTokenByKey,
|
||||
rootTokens
|
||||
};
|
||||
}
|
16
utils/web3.ts
Normal file
16
utils/web3.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import Web3 from "web3";
|
||||
|
||||
const mainnetInfura = "https://mainnet.infura.io/v3/";
|
||||
const polygonInfura = "https://polygon-mainnet.infura.io/v3/";
|
||||
|
||||
export const polygonWeb3 = new Web3(
|
||||
new Web3.providers.HttpProvider(
|
||||
polygonInfura + "5c8b888909a544e2ba6917322f0cca68"
|
||||
)
|
||||
);
|
||||
|
||||
export const mainnetWeb3 = new Web3(
|
||||
new Web3.providers.HttpProvider(
|
||||
mainnetInfura + "5c8b888909a544e2ba6917322f0cca68"
|
||||
)
|
||||
);
|
|
@ -2901,7 +2901,7 @@ big.js@^5.2.2:
|
|||
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
|
||||
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==
|
||||
|
||||
bignumber.js@^9.0.0:
|
||||
bignumber.js@^9.0.0, bignumber.js@^9.0.1:
|
||||
version "9.0.1"
|
||||
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5"
|
||||
integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==
|
||||
|
|
Loading…
Reference in New Issue
Block a user