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
24 changes: 24 additions & 0 deletions contracts/api/ExchangeHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ contract ExchangeHelper is Initializable {
}
}

struct PoolData {
address pair;
uint256 fee7;
uint256 tvl;
uint256 volume24;
}
function getPoolData(uint256 from, uint256 to) external view returns (PoolData[] memory pairFees) {
uint256 pairsLength = pairFactory.allPairsLength();
pairFees= new PoolData[](pairsLength);
for (uint i; i < pairsLength; i++) {
// TODO: ONLY WHITELISTED PAIRS
// voter.isWhitelisted()
Pair pair = Pair(pairFactory.allPairs(i));
(uint256 pairFee) = getFeesInUSDForPair(pair);
(,,,,uint256 volume) = getVolumeLockedPerTimeForPair(pair, from, to);
(,,uint256 tvl) = getTVLInUSDForPair(pair );
pairFees[i] = PoolData({
pair: address(pair),
fee7: pairFee,
tvl: tvl,
volume24:volume
});
}
}
/**
*
* @param pair Address of pair
Expand Down
49 changes: 48 additions & 1 deletion scripts/deployments/monadTestnet/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -9810,7 +9810,7 @@
]
},
"ExchangeHelper": {
"contractAddress": "0x7D7e0040890d06663AcbaDB11Fd5A4aAEc21B825",
"contractAddress": "0x0159f1cfE00e287f84d9d4D974Da2FEF1D6099Ac",
"abi": [
{
"inputs": [],
Expand Down Expand Up @@ -9912,6 +9912,52 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "from",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "to",
"type": "uint256"
}
],
"name": "getPoolData",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "pair",
"type": "address"
},
{
"internalType": "uint256",
"name": "fee7",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "tvl",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "volume24",
"type": "uint256"
}
],
"internalType": "struct ExchangeHelper.PoolData[]",
"name": "pairFees",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTVLInUSDForAllPairs",
Expand Down Expand Up @@ -10136,3 +10182,4 @@
]
}
}