Skip to content

Commit

Permalink
borrow filter depositAddress (#9320)
Browse files Browse the repository at this point in the history
* add arbitrum tvl

* solv protocol funds add KLP

* klp amount

* refactor: dont fetch fsKLP price

* Change the configuration of contract address

* Modify judgment logic

* Modify judgment logic

* change cache file name

* fix bug

* add iziswap lp

* fix

* reduce usage of BigNumber

* add lendle

* add mux lp count

* filter depositAddress

* getSubscribeNav params time to millisecond

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
buchaoqun and g1nt0ki authored Mar 13, 2024
1 parent 8c27614 commit 97c14c1
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions projects/solv-protocol-funds/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@ async function borrowed(ts) {
const network = api.chain;

let address = (await getConfig('solv-protocol/funds', addressUrl));
let gm = address[api.chain]["gm"];
const depositAddress = filterDepositAddress(network, address);

const graphData = await getGraphData(ts, network, api);
if (graphData.pools.length > 0) {
const poolLists = graphData.pools;

var pools = poolLists.filter((value) => {
return gm == undefined || gm["depositAddress"].indexOf(value.vault) == -1;
return depositAddress.length == 0 || depositAddress.indexOf(value.vault) == -1;
});

const poolConcretes = await concrete(pools, api);
const nav = await api.multiCall({
abi: abi.getSubscribeNav,
calls: pools.map((index) => ({
target: index.navOracle,
params: [index.poolId, ts]
params: [index.poolId, ts * 1000]
})),
})

Expand Down Expand Up @@ -249,6 +251,36 @@ async function getGraphData(timestamp, chain, api) {
pools: poolList
};
}

function filterDepositAddress(network, address) {
let depositAddresses = [];
if (address[network]) {
if (address[network]["gm"]) {
for (let depositAddress of address[network]["gm"]["depositAddress"]) {
depositAddresses.push(depositAddress.toLowerCase())
}
}
if (address[network]["mux"]) {
depositAddresses.push(address[network]["mux"]["account"].toLowerCase())
}
if (address[network]["klp"]) {
for (let poolAddress of address[network]["klp"]["klpPool"]) {
depositAddresses.push(poolAddress.toLowerCase())
}
}
if (address[network]["iziswap"]) {
for (let owner of address[network]["iziswap"]["owner"]) {
depositAddresses.push(owner.toLowerCase())
}
}
if (address[network]["lendle"]) {
depositAddresses.push(address[network]["lendle"]["account"]["user"].toLowerCase())
}
}

return depositAddresses;
}

// node test.js projects/solv-protocol-funds
module.exports = {
arbitrum: {
Expand Down

0 comments on commit 97c14c1

Please sign in to comment.