Query editor
/* RAILGUN 언스테이킹 진행 중인 개별 포지션 상세 (쿼리 C)* 이 파일은 단독 실행용 쿼리 1개입니다. */WITH logs AS (SELECT topic0, topic1 AS account, topic2 AS stake_id, data, block_timeFROM ethereum.logsWHERE contract_address = 0xee6a649aa3766bd117e12c161726b693a1b2ee20AND topic0 IN (0x5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6,0x6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1,0x47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4)),stakes AS (SELECT account, stake_id,CAST(bytearray_to_uint256(data) AS double) / 1e18 AS amountFROM logsWHERE topic0 = 0x5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6),unlocks AS (SELECT account, stake_id, block_time AS unlock_timeFROM logsWHERE topic0 = 0x6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1),claims AS (SELECT DISTINCT account, stake_idFROM logsWHERE topic0 = 0x47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4)SELECTbytearray_substring(u.account, 13, 20) AS staker,bytearray_to_uint256(u.stake_id) AS stake_id,s.amount AS rail_amount,u.unlock_time,u.unlock_time + INTERVAL '30' day AS claimable_at,date_diff('day', now(), u.unlock_time + INTERVAL '30' day) AS days_until_claimable,CASE WHEN u.unlock_time + INTERVAL '30' day > now()THEN 'Cooling down (<30d)' ELSE 'Claimable (unclaimed)' END AS statusFROM unlocks uJOIN stakes s ON s.account = u.account AND s.stake_id = u.stake_idLEFT JOIN claims c ON c.account = u.account AND c.stake_id = u.stake_idWHERE c.stake_id IS NULLORDER BY u.unlock_time DESC