Skip to content

Commit

Permalink
remove invalid start timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Nov 5, 2024
1 parent ebcfb17 commit c29fc5a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 39 deletions.
1 change: 0 additions & 1 deletion fees/bcraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const adapter: Adapter = {

return { dailyFees, dailyRevenue };
}) as FetchV2,
start: 18607509,
},
},
version: 2,
Expand Down
1 change: 0 additions & 1 deletion fees/dragonswap-sei.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const adapter: Adapter = {
adapter: {
[CHAIN.SEI]: {
fetch: graphs,
start: 79157663,
meta: {
methodology
}
Expand Down
1 change: 0 additions & 1 deletion fees/koi-finance-cl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const adapter: SimpleAdapter = {
adapter: {
[CHAIN.ERA]: {
fetch: fetchFees,
start: 0
},
},
};
Expand Down
1 change: 0 additions & 1 deletion fees/kperp-exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const adapter: Adapter = {
[DISABLED_ADAPTER_KEY]: disabledAdapter,
[CHAIN.KAVA]: {
fetch: async (timestamp: number) => {return{timestamp}},
start: 2578000,
meta: {
methodology: 'All mint, burn, marginAndLiquidation and swap fees are collected and the daily fee amount is determined. Daily revenue is calculated as 30% of the total fee.'
}
Expand Down
2 changes: 0 additions & 2 deletions fees/magpie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ const adapter: SimpleAdapter = {

[CHAIN.BSC]: {
fetch: graph(CHAIN.BSC),
start: 77678653,
},
[CHAIN.ARBITRUM]: {
fetch: graph(CHAIN.ARBITRUM),
start: 77678653,
},
}
};
Expand Down
3 changes: 0 additions & 3 deletions fees/penpie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,12 @@ const adapter: SimpleAdapter = {
adapter: {
[CHAIN.BSC]: {
fetch: graph(CHAIN.BSC),
start: 77678653,
},
[CHAIN.ARBITRUM]: {
fetch: graph(CHAIN.ARBITRUM),
start: 77678653,
},
[CHAIN.ETHEREUM]: {
fetch: graph(CHAIN.ETHEREUM),
start: 77678653,
},
}
};
Expand Down
57 changes: 27 additions & 30 deletions fees/radpie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CHAIN } from "../helpers/chains";
import { Chain } from "@defillama/sdk/build/general";

const event_paid_stream = 'event RewardPaid (address indexed _user, address indexed _receiver, uint256 _reward, address indexed _token)';
const event_paid_rdnt= 'event RDNTEntitled (address indexed _receipt, uint256 _amount)';
const event_paid_rdnt = 'event RDNTEntitled (address indexed _receipt, uint256 _amount)';

type TAddress = {
[c: string]: string;
Expand All @@ -15,49 +15,49 @@ const address_reward: TAddress = {
[CHAIN.ETHEREUM]: '0x7e6E8aeCCb0508FeD6547C9F3731E8f75C5C2932'
}
const address_rdnt_reward: TAddress = {
[CHAIN.BSC]: '0x91DD506e1f27f50dd40d0E8634013b1F2393DCa0',
[CHAIN.ARBITRUM]: '0xD97EbDd4a104e8336760C6350930a96A9A659A66',
[CHAIN.ETHEREUM]: '0x086295a932d0f91da4e878ec33d4355d196bbc44'
[CHAIN.BSC]: '0x91DD506e1f27f50dd40d0E8634013b1F2393DCa0',
[CHAIN.ARBITRUM]: '0xD97EbDd4a104e8336760C6350930a96A9A659A66',
[CHAIN.ETHEREUM]: '0x086295a932d0f91da4e878ec33d4355d196bbc44'

}
const address_rdnt: TAddress = {

[CHAIN.BSC]: '0xf7de7e8a6bd59ed41a4b5fe50278b3b7f31384df',
[CHAIN.ARBITRUM]: '0x3082CC23568eA640225c2467653dB90e9250AaA0',
[CHAIN.ETHEREUM]: '0x137dDB47Ee24EaA998a535Ab00378d6BFa84F893'
}
[CHAIN.BSC]: '0xf7de7e8a6bd59ed41a4b5fe50278b3b7f31384df',
[CHAIN.ARBITRUM]: '0x3082CC23568eA640225c2467653dB90e9250AaA0',
[CHAIN.ETHEREUM]: '0x137dDB47Ee24EaA998a535Ab00378d6BFa84F893'

}

const graph = (chain: Chain) => {
return async ({ createBalances, getLogs, api }: FetchOptions) => {
const dailyFees = createBalances();
let poolLength = await api.call({ abi: 'uint256:poolLength', target:address_reward[chain], });
let poolLength = await api.call({ abi: 'uint256:poolLength', target: address_reward[chain], });
// console.log(poolLength);
let array = Array.from({ length: poolLength }, (_, index) => index);
const pools=await api.multiCall({ abi: 'function poolTokenList(uint256) view returns(address)', calls:array , target:address_reward[chain] }) // (await getLogs({
const pools = await api.multiCall({ abi: 'function poolTokenList(uint256) view returns(address)', calls: array, target: address_reward[chain] }) // (await getLogs({
// console.log(pools)
const rewardContracts = await api.multiCall({ abi: 'function pools(address) view returns ( address asset, address rToken, address vdToken, address rewarder, address receiptToken , uint256 maxCap, uint256 lastActionHandled, bool isNative, bool isActive)', calls:pools , target:address_reward[chain] }) // (await getLogs({
const rewardContracts = await api.multiCall({ abi: 'function pools(address) view returns ( address asset, address rToken, address vdToken, address rewarder, address receiptToken , uint256 maxCap, uint256 lastActionHandled, bool isNative, bool isActive)', calls: pools, target: address_reward[chain] }) // (await getLogs({
// console.log(rewardContracts[0].rewarder)
for (const i of rewardContracts) {
const logs = await getLogs({
target: i.rewarder,
eventAbi: event_paid_stream,
});
// console.log(logs)
logs.forEach((e: any) => {
// console.log(e._token,e._reward)
dailyFees.add(e._token, e._reward);
});
}
const logs = await getLogs({
target: i.rewarder,
eventAbi: event_paid_stream,
});
// console.log(logs)
logs.forEach((e: any) => {
// console.log(e._token,e._reward)
dailyFees.add(e._token, e._reward);
});
}

(await getLogs({
target: address_rdnt_reward[chain],
eventAbi: event_paid_rdnt,
})).map((e: any) => {
// console.log(e)
dailyFees.add(address_rdnt[chain], e._amount)
// console.log(e)
dailyFees.add(address_rdnt[chain], e._amount)
})
return { dailyFees, dailyRevenue: dailyFees,dailyUserFees:dailyFees };
return { dailyFees, dailyRevenue: dailyFees, dailyUserFees: dailyFees };
}
}

Expand All @@ -68,16 +68,13 @@ const adapter: SimpleAdapter = {

[CHAIN.BSC]: {
fetch: graph(CHAIN.BSC),
start: 77678653,
},
[CHAIN.ARBITRUM]: {
fetch: graph(CHAIN.ARBITRUM),
start: 77678653,
},
[CHAIN.ETHEREUM]: {
fetch: graph(CHAIN.ETHEREUM),
start: 77678653,
},
fetch: graph(CHAIN.ETHEREUM),
},
}
};

Expand Down

0 comments on commit c29fc5a

Please sign in to comment.