-
Notifications
You must be signed in to change notification settings - Fork 15
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
[WIP] Add endpoints for Dexscreener support #422
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@CapCap is attempting to deploy a commit to the Econia Labs Team on Vercel. A member of the Team first needs to authorize it. |
… address function
Add a helper function for fetching the real reserves
2b6bb70
to
1383b0a
Compare
…state more effectively Update tests to work Update misc/various types in the SDK, move bonding curve helpers to the SDK
… state of the market
let reserves; | ||
// Bonding is complete | ||
if (event.state.lpCoinSupply > 0) { | ||
reserves = { | ||
reserves: { | ||
asset0: event.swap.baseVolume.toString(), | ||
asset1: event.swap.quoteVolume.toString(), | ||
} | ||
}; | ||
} else { | ||
// Still in bonding | ||
reserves = {}; | ||
} |
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.
let reserves; | |
// Bonding is complete | |
if (event.state.lpCoinSupply > 0) { | |
reserves = { | |
reserves: { | |
asset0: event.swap.baseVolume.toString(), | |
asset1: event.swap.quoteVolume.toString(), | |
} | |
}; | |
} else { | |
// Still in bonding | |
reserves = {}; | |
} | |
const { base, quote } = calculateRealReserves(event.state); | |
const reserves = { | |
asset0: base.toString(), | |
asset1: quote.toString(), | |
}; |
I discussed this with @alnoki, it actually does make sense to provide reserves quantities in- and post- bonding curve.
Once #438 is merged, you should be able to just calculate it like above!
Then just return reserves, I think:
// ...
return {
// ...
reserves,
}
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.
This is amazing work! I'll rebase on top of your PR then
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.
@xbtmatt does this same function also apply to the post bonding curve reserves too for liquidity events?
const sybolEmojis = emojiString.split(""); | ||
|
||
const symbolBytesArray = sybolEmojis.map((e) => SYMBOL_EMOJI_DATA.byEmoji(e)!.bytes); | ||
const symbolBytes = new Uint8Array(symbolBytesArray.flatMap((v) => Array.from(v))); |
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.
const sybolEmojis = emojiString.split(""); | |
const symbolBytesArray = sybolEmojis.map((e) => SYMBOL_EMOJI_DATA.byEmoji(e)!.bytes); | |
const symbolBytes = new Uint8Array(symbolBytesArray.flatMap((v) => Array.from(v))); | |
const symbolEmojis = getSymbolEmojisInString(emojiString); | |
const symbolBytes = encodeEmojis(symbolEmojis); |
Emojis are parsed really oddly; the zero-width joiners makes for a lot of confusing parsing behavior, because lots of emojis are a base emoji + some modifier to indicate the variant.
An obvious example is a person + a zwj + a skin tone. But there are others like the polar bear emoji, which is basically just 🐻\x200d❄️
, see more here if you want, it's kind of interesting lol)
But yeah to reliably parse these use the above or I think some of these will get parsed incorrectly
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.
Yeah this was my fear as well- this is the main place I wanted to write some tests for, too, to ensure stability of the IDs acoss these endpoints- I'll take a read (it is interesting!) and use your helpers 🙏 thank you!
720bbbb
to
c3454ca
Compare
Description
Delete this sentence and add a description that explains what changes you have
done and why they were necessary.
Testing
Delete this sentence and provide a description of how to test the changes in
this PR.
Checklist