Skip to content

Commit

Permalink
Add VinuNFT. (#2280)
Browse files Browse the repository at this point in the history
* Added VinuNFT support.

* code refactor

---------

Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com>
  • Loading branch information
samuelemarro and g1nt0ki authored Jan 10, 2025
1 parent 299edee commit ff5f5e5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dexs/vinunft/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";

const TokenPurchasedAbi = 'event TokenPurchased(address indexed nftAddress, uint256 indexed tokenId, address indexed seller, address buyer, uint256 listingId, uint256 amount, address paymentToken, uint256 price)'

const MARKETPLACE = '0xcA396A95E0EB8B6804e25F9db131780a60564047'

const fetch = async ({ getLogs, createBalances }: FetchOptions) => {
const dailyVolume = createBalances();

const saleLogs = await getLogs({ target: MARKETPLACE, eventAbi: TokenPurchasedAbi, });

saleLogs.map(log => {
dailyVolume.addToken(log.paymentToken, Number(log.price.toString()) * Number(log.amount.toString()));
})

return { dailyVolume, };
}

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.VINUCHAIN]: { fetch, start: '2024-06-01' }
}
};

export default adapter;

0 comments on commit ff5f5e5

Please sign in to comment.