Query editor
WITH tokens AS(SELECT contract_address, symbol, decimalsFROM tokens.erc20WHERE blockchain = 'arbitrum'),vspot_tokens AS -- if any token is updated in the future, the following queries utilising this table should be broken or incorrect due to multiple entries(SELECT block_time,BYTEARRAY_LTRIM(topic1) AS token,BYTEARRAY_TO_UINT256(topic2) AS productIdFROM arbitrum.logsWHERE topic0 = 0xc2d539e6a806d81b0892f23b002d25b825425d13a98bb6f486438b6b7bc0ce3a -- evt_TokenUpdatedAND contract_address = 0x052ab3fd33cadf9d9f227254252da3f996431f75 -- VertexManagerORDER BY 1 DESC),pool_routers AS(SELECT block_time,id,router,poolType,IF(CAST(address_tokens_array_length AS INT) = 1, -- if array's length = 1ARRAY[BYTEARRAY_LTRIM(BYTEARRAY_SUBSTRING(data, 1 + 32 * (CAST(address_tokens_array_offsets AS INT) + 1), 32))], -- add 32 bytes to the array length's bytes to retrieve the first element's 32 bytesARRAY[BYTEARRAY_LTRIM(BYTEARRAY_SUBSTRING(data, 1 + 32 * (CAST(address_tokens_array_offsets AS INT) + 1), 32))] || ARRAY[BYTEARRAY_LTRIM(BYTEARRAY_SUBSTRING(data, 1 + 32 * (CAST(uint256_hardcaps_array_offsets AS INT) + 2), 32))]) AS tokens,IF(CAST(address_tokens_array_length AS INT) = 1, -- if array's length = 1ARRAY[BYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * (CAST(uint256_hardcaps_array_offsets AS INT) + 1), 32))], -- add 32 bytes to the array length's bytes to retrieve the first element's 32 bytesARRAY[BYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * (CAST(uint256_hardcaps_array_offsets AS INT) + 1), 32))] || ARRAY[BYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * (CAST(uint256_hardcaps_array_offsets AS INT) + 2), 32))]) AS hardcapsFROM (SELECT block_time,BYTEARRAY_TO_UINT256(topic1) AS id, -- the ID of the poolBYTEARRAY_LTRIM(topic2) AS router, -- the router address of the poolBYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1, 32)) AS poolType, -- the type of the poolBYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32, 32))/32 AS address_tokens_array_offsets, -- no. of 32 bytes offsets to arrive at the tokens' array's lengthBYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * CAST(BYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32, 32))/32 AS INT), 32)) AS address_tokens_array_length, -- 32 bytes multiplied by the no. of offsets to find out array lengthBYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * 2, 32))/32 AS uint256_hardcaps_array_offsets, -- no. of 32 bytes offsets to arrive at the hardcaps' array's lengthBYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * CAST(BYTEARRAY_TO_UINT256(BYTEARRAY_SUBSTRING(data, 1 + 32 * 2, 32))/32 AS INT), 32)) AS uint256_hardcaps_array_length,dataFROM arbitrum.logsWHERE topic0 = 0x50359a729c3a8ab8c69964bf137015ff9ec2354dc5aaa708e7f9dbdafcfd87bf -- evt_PoolAddedAND contract_address = 0x052ab3fd33cadf9d9f227254252da3f996431f75 -- VertexManager)ORDER BY 1 DESC),deposits AS((SELECT block_time,--BYTEARRAY_LTRIM(topic1) AS caller, -- caller of the deposit function, for which tokens are taken from--BYTEARRAY_LTRIM(topic2) AS receiver, -- the receiver of the LP balanceCAST(BYTEARRAY_TO_UINT256(topic3) AS INT) AS id, -- ID of the pool deposting toBYTEARRAY_LTRIM(BYTEARRAY_SUBSTRING(data, 1, 32)) AS token, -- CA of the token depositedBYTEARRAY_TO_INT256(BYTEARRAY_SUBSTRING(data, 1 + 32, 32)) AS amount -- token amount depositedFROM arbitrum.logsWHERE topic0 = 0xaaefaf378e10f40556b2167ea878af7e62d89229b0bce3924630aabf1ee611ff -- evt_DepositAND contract_address = 0x052ab3fd33cadf9d9f227254252da3f996431f75 -- VertexManager