Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 36 additions & 61 deletions src/abis/future-option-power/Reader.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,42 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pool_",
"type": "address"
}
],
"name": "getAlpInfo",
"outputs": [
{
"components": [
{
"internalType": "string",
"name": "symbol",
"type": "string"
},
{
"internalType": "address",
"name": "symbolAddress",
"type": "address"
},
{
"internalType": "int256",
"name": "volume",
"type": "int256"
}
],
"internalType": "struct DeriLens.AlpInfo[]",
"name": "infos",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -714,67 +750,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pool_",
"type": "address"
},
{
"internalType": "address",
"name": "account_",
"type": "address"
}
],
"name": "getLpInfo",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "lTokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "vault",
"type": "address"
},
{
"internalType": "int256",
"name": "amountB0",
"type": "int256"
},
{
"internalType": "int256",
"name": "liquidity",
"type": "int256"
},
{
"internalType": "int256",
"name": "cumulativePnlPerLiquidity",
"type": "int256"
},
{
"internalType": "uint256",
"name": "vaultLiquidity",
"type": "uint256"
}
],
"internalType": "struct DeriLens.LpInfo",
"name": "info",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down
8 changes: 7 additions & 1 deletion src/components/AcyPool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const AcyPool = props => {
const [alpPriceData, alpPriceDataLoading] = useAlpPriceData(alpData, feesData, params)

const tokens = getTokens(chainId)
console.log("tokens", tokens)

const [isBuying, setIsBuying] = useState(true)
const [swapTokenAddress, setSwapTokenAddress] = useState(tokens[0].address)
Expand Down Expand Up @@ -104,6 +105,11 @@ const AcyPool = props => {
fetcher: fetcher(library, Reader)
});

const { data: alpTokenList, mutate: updateAlpTokenList } = useSWR([chainId, readerAddress, "getAlpInfo", poolAddress], {
fetcher: fetcher(library, Reader)
});


useEffect(() => {
if (active) {
library.on('block', () => {
Expand Down Expand Up @@ -177,7 +183,7 @@ const AcyPool = props => {
alpBalance={alpBalance}
alpBalanceUsd={alpBalanceUsd}
tokens={tokens}
tokenList={tokens}
alpTokenList={alpTokenList}
aum={aum}
/>
<AcyCard style={{ backgroundColor: 'transparent' }}>
Expand Down
15 changes: 12 additions & 3 deletions src/constants/future_option_power.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ const contracts = {

oracleManager: '0x1553497f478820359852335de50182D72dCaCB0b',
pool: '0x709eea8f973ce668ccED36e71A634Fe0C2C45FF7',
poolImplementation: '0x5129cE242232Bb907882f93487F308C324ef0911',
poolImplementation: '0x67C543e7B6D9fb14362A0B7c57efB27f2ae1aB48',
symbolManager: "0x28AE6Ae39C9f5431ec82caC4008d3206d210133b",
symbolManagerImplementation: "0x95a68beB1b1aFE0A7fA0378dD2c74af0516B1E5A",
alp: "0xac582b54A4fE361eb3E1aECc95Dc4B2Ee1161706",
symbolsLens: "0x93603F4a3ae3472E177e9848872D7cE3572C30cE",
reader: "0xC0CA4C86802414DeD474c69fC6fd98fe252878ec",
reader: "0xf78dF44E2A910b6B4B8D49451615D6D793f87586",
router: "0x5D084F651794A37B0C53f20B657dbB52e0Ee44AF",

orderbook: "0xe44278ACe07452e45373D93e458a00aded87AD8a",
Expand Down Expand Up @@ -197,7 +197,16 @@ const tokenLists = {
symbol: "BUSD",
decimals: 18,
address: "0xA0868b1EE3DA3E822cc79fAFDd88594EeaBfB806",
}
},
{
name: "Wrapped ETH",
symbol: "ETH",
decimals: 18,
address: "0x036ff7176ffFB9Cd025e618ee8088D942C4B6714",
logoURI: 'https://cryptologos.cc/logos/ethereum-eth-logo.svg?v=014',
isShortable: true,
isStable: false
},
]
};

Expand Down
3 changes: 2 additions & 1 deletion src/pages/Perpetual/components/Portfolio.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Portfolio = props => {
alpBalance,
alpBalanceUsd,
tokens,
alpTokenList,
aum,
} = props

Expand Down Expand Up @@ -253,7 +254,7 @@ const Portfolio = props => {
infoTokens={infoTokens}
/> */}
<TokenWeightPieChart
tokens={tokens}
tokens={alpTokenList}
/>
</div>
</div>
Expand Down
34 changes: 8 additions & 26 deletions src/pages/Perpetual/components/TokenWeightPieChart.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
import React, { useState, useEffect } from 'react';
// import ReactDOM from 'react-dom';
import { Pie } from '@ant-design/plots';
import form from '@/locales/en-US/form';
import { formatUnits } from '@ethersproject/units';

const TokenWeightPieChart = (props) => {
const {tokens} = props
const data = [
{
type: 'Token 1',
value: 27,
},
{
type: 'Token 2',
value: 25,
},
{
type: 'Token 3',
value: 18,
},
{
type: 'Token 4',
value: 15,
},
{
type: 'Token 5',
value: 10,
},
{
type: 'Token 6',
value: 5,
},
];
const data = tokens?.map(token => {
return {
type: token.symbol,
value: parseInt(formatUnits(token.volume, 18)),
}
})
const config = {
appendPadding: 10,
data,
Expand Down