-
Notifications
You must be signed in to change notification settings - Fork 985
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
Added Bitoro Volume Adapter #1402
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
83b103d
initial implementation for bitoro dex volume adapter
zareklivak 8eb570d
Merge branch 'DefiLlama:master' into master
zareklivak 1d90422
update logic to ensure accuracy
zareklivak 5d0acaf
custom backfill and other fixes
zareklivak 3df8647
Merge branch 'DefiLlama:master' into master
zareklivak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { FetchResultVolume, SimpleAdapter } from "../../adapters/types"; | ||
import { CHAIN } from "../../helpers/chains"; | ||
import { httpGet } from "../../utils/fetchURL"; | ||
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume"; | ||
import customBackfill from "../../helpers/customBackfill"; | ||
|
||
// Bitoro volume API endpoint | ||
const bitoroApiVolumeEndpoint = "https://api.bitoro.network/btr/stats/volume" | ||
// March 25, 2024 UTC timestamp | ||
const bitoroLaunchDate = 1711324800 | ||
// constructing request URL | ||
const makeRequest = (startTime: number, endTime: number) => bitoroApiVolumeEndpoint + `?start=${startTime}&end=${endTime}` | ||
|
||
const fetch = async (timestamp: number) => { | ||
const startOfDayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000)) + 86400 | ||
const endOfDayTimestamp = startOfDayTimestamp + 86400; | ||
|
||
// Get today's volume | ||
let request = makeRequest(startOfDayTimestamp, endOfDayTimestamp) | ||
let data = await httpGet(request) | ||
const todayVolume = data["volume"] | ||
|
||
// Get total volume | ||
request = makeRequest(bitoroLaunchDate, endOfDayTimestamp) | ||
data = await httpGet(request) | ||
const totalVolume = data["volume"] | ||
|
||
return { | ||
timestamp, | ||
dailyVolume: todayVolume.toString(), | ||
totalVolume: totalVolume.toString() | ||
} | ||
} | ||
|
||
const adapter: SimpleAdapter = { | ||
adapter: { | ||
[CHAIN.ARBITRUM]: { | ||
start: bitoroLaunchDate, | ||
fetch, | ||
customBackfill: customBackfill(CHAIN.ARBITRUM, () => fetch) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
export default adapter; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why start time is day +1 ?
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.
I'm under the impression that 24hr volume is meant to be calculated for the current day, not the day before. getUniqStartOfTodayTimestamp gives the end of the prior day and we wanted start of current day. Is 24 hour volume meant to be for the day prior? I can see how this can be an issue with custom backfill
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.
is there tvl 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.
No tvl adapter. Still waiting on endpoint.
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.
Any update?
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.
Can we not merge the volume adapter without a TVL 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.
yes
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.
Why is that the case?
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.
ppl will complaint why that protocol does not tvl but volume high is it fake volume and will delist
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.
Ok. We are working on this.