Skip to content

Commit

Permalink
Merge pull request #1817 from 0xpeluche/paxos-gold
Browse files Browse the repository at this point in the history
feat:Adapter, Paxos-Gold (Fees)
  • Loading branch information
dtmkeng committed Aug 25, 2024
2 parents 416139b + 6c9e490 commit b00a7d4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions fees/paxos-gold/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Adapter, FetchOptions, FetchResultV2 } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";

const PAXG = "0x45804880de22913dafe09f4980848ece6ecbaf78";

const eventAbi = `event FeeCollected(
address indexed from,
address indexed to,
uint256 value
)`;

const fetch = async ({
getLogs,
createBalances,
}: FetchOptions): Promise<FetchResultV2> => {
const dailyFees = createBalances();
const logs = await getLogs({ target: PAXG, eventAbi });

logs.forEach(([_from, _to, fee]) => {
dailyFees.add(PAXG, fee);
});

return { dailyFees };
};

const adapter: Adapter = {
version: 2,
adapter: {
[CHAIN.ETHEREUM]: {
fetch,
start: 1704063600,
},
},
};

export default adapter;

0 comments on commit b00a7d4

Please sign in to comment.