Hyperliquid surge hook#64
Conversation
… file splitting and test additions
Co-authored-by: Juan Ignacio Ubeira <juani@balancerlabs.dev>
Co-authored-by: Juan Ignacio Ubeira <juani@balancerlabs.dev>
joaobrunoah
left a comment
There was a problem hiding this comment.
Hey guys, this is a great hook!
I've left some suggestions about the standards that we follow. Besides, I think it'd be great to have a fork test on HyperEVM to test the PRECOMPILE addresses and make sure it behaves as we expect (although I can do that in another PR, if needed).
Co-authored-by: Juan Ignacio Ubeira <juani@balancerlabs.dev>
Co-authored-by: João Bruno - Balancer Labs <joaobrunoah@gmail.com>
There was a problem hiding this comment.
Hey Chris. Just some notes about szDecimals and the TokenInfo struct returned by the Precompile. Looks like you'll need 2 indexes: the pairIndex to fetch the spot price, and the tokenIndex to fetch the szDecimals. I've checked in Hypercore API, these are two different things.
For example, for UETH, the tokenIndex is 221, and the pairIndex is 151. The structs below are based on a POST request to api https://api.hyperliquid.xyz/info, with body 'type' = 'spotMeta'.
Struct of token index on Hyper API:
{
name: 'UETH',
szDecimals: 4,
weiDecimals: 9,
index: 221,
tokenId: '0xe1edd30daaf5caac3fe63569e24748da',
isCanonical: false,
evmContract: { address: '0xbe6727b535545c67d5caa73dea54865b92cf7907', evm_extra_wei_decimals: 9 },
fullName: 'Unit Ethereum',
deployerTradingFeeShare: '1.0',
}
Struct of pairIndex on Hyper API:
{ tokens: [221, 0], name: '@151', index: 151, isCanonical: false }
Co-authored-by: João Bruno - Balancer Labs <joaobrunoah@gmail.com>
Description
Type of change
Checklist:
main, or there's a description of how to mergeIssue Resolution