-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VinuNFT. #2280
base: master
Are you sure you want to change the base?
Add VinuNFT. #2280
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { FetchOptions, SimpleAdapter } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
|
||
const event_purchased = '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: event_purchased, | ||
fromBlock: 5000, | ||
cacheInCloud: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new protocol i prefer remove cacheInCloud too |
||
}); | ||
|
||
await Promise.all(saleLogs.map(async log => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line no need promise |
||
const { _amount, _paymentToken, _price } = log; | ||
dailyVolume.addToken(_paymentToken, _price * _amount); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can use function |
||
} | ||
)) | ||
|
||
return { dailyVolume, }; | ||
} | ||
|
||
const adapter: SimpleAdapter = { | ||
version: 2, | ||
adapter: { | ||
[CHAIN.VINUCHAIN]: { fetch, start: '2024-06-01' } | ||
} | ||
}; | ||
|
||
export default adapter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if don't need fetch since start block plz remove this