Skip to content

Commit

Permalink
Feat: Added wise-lending-v2 fees (#1968)
Browse files Browse the repository at this point in the history
* Added wise-lending-v2 fees

* Updated logic for calculating fees of wise-lending-v2

* code refactor

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
jenelyn0214 and g1nt0ki authored Oct 14, 2024
1 parent 59a0dc0 commit 2715061
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions fees/wise-lending-v2/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { ARBITRUM } from "../../helpers/chains";
const feeMaangerContract = "0x90a022796798f9dbA1Da0f8645234B284d4E8EC6";

const arbitrumPools = [
//aave
"0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
"0x6ab707Aca953eDAeFBc4fD23bA73294241490620",
"0x724dc807b04555b71ed48a6896b6F41593b8C637",
"0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
//native
"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
"0x5979D7b546E38E414F7E9822514be443A4800529",
];

const fetch: any = async ({ api, fromApi, createBalances, }: FetchOptions) => {
const dailyFees = createBalances()
const totalFees = createBalances()
const feeAmounts = await api.multiCall({ abi: "function feeTokens(address) view returns (uint256)", target: feeMaangerContract, calls: arbitrumPools, permitFailure: true, });
const feeAmountsADayAgo = await fromApi.multiCall({ abi: "function feeTokens(address) view returns (uint256)", target: feeMaangerContract, calls: arbitrumPools, permitFailure: true, });


dailyFees.add(arbitrumPools, feeAmounts.map(i => i ?? 0));
totalFees.add(arbitrumPools, feeAmounts.map(i => i ?? 0));
dailyFees.add(arbitrumPools, feeAmountsADayAgo.map(i => (i ?? 0) * -1));

return { dailyFees, totalFees, }
};

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[ARBITRUM]: {
fetch,
start: 1727740800,
},
},
};

export default adapter;

0 comments on commit 2715061

Please sign in to comment.