Skip to content
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

Build PoC for byte data extraction #174

Closed
viniabussafi opened this issue Nov 14, 2024 · 3 comments
Closed

Build PoC for byte data extraction #174

viniabussafi opened this issue Nov 14, 2024 · 3 comments
Assignees

Comments

@viniabussafi
Copy link
Member

No description provided.

@viniabussafi viniabussafi self-assigned this Nov 14, 2024
@viniabussafi
Copy link
Member Author

SELECT
contract_address,
evt_tx_hash,
varbinary_to_int256(BYTEARRAY_SUBSTRING(feeCache,1, 8)) AS unused,
varbinary_to_int256(BYTEARRAY_SUBSTRING(feeCache, 9, 16)) AS aum_fee,
varbinary_to_int256(BYTEARRAY_SUBSTRING(feeCache, 17, 24)) AS yield_fee,
varbinary_to_int256(BYTEARRAY_SUBSTRING(feeCache, 25, 32)) AS swap_fee
FROM defi_polygon.ManagedPool_evt_ProtocolFeePercentageCacheUpdated

@viniabussafi
Copy link
Member Author

viniabussafi commented Nov 16, 2024

For 1x10ˆ18 balances

SELECT
varbinary_to_int256(BYTEARRAY_SUBSTRING(0x0000000000000000016345785d8a00000000000000000000016345785d8a0000
,1, 16)) AS underlying_balance,
varbinary_to_int256(BYTEARRAY_SUBSTRING(0x0000000000000000016345785d8a00000000000000000000016345785d8a0000
, 17, 32))
AS wrapped_balance

underlying_balance wrapped_balance
100000000000000000 100000000000000000

For 1x10ˆ6 balances

SELECT
varbinary_to_int256(BYTEARRAY_SUBSTRING(0x000000000000000000000000000f4240000000000000000000000000000f4240
,1, 16)) AS underlying_balance,
varbinary_to_int256(BYTEARRAY_SUBSTRING(0x000000000000000000000000000f4240000000000000000000000000000f4240
, 17, 32))
AS wrapped_balance

underlying_balance wrapped_balance
1000000 1000000

@viniabussafi
Copy link
Member Author

all seems to work, will keep dealing with it on the specific buffer issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant