-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: support rewards table names from previous releases
handle matching table names
- Loading branch information
1 parent
bf54f48
commit af6da9d
Showing
13 changed files
with
197 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e94b8e364dfddd0743746f089f89a3d570751f03 | ||
d67ef5d895bdc0ccd6a006a1683ac3e58f820ad0 |
19 changes: 19 additions & 0 deletions
19
internal/tests/testdata/operatorAvsSplitSnapshots/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
## seed data | ||
|
||
```sql | ||
select | ||
lower(arguments #>> '{1, Value}') as operator, | ||
lower(arguments #>> '{2, Value}') as avs, | ||
to_timestamp((output_data ->> 'activatedAt')::integer)::timestamp(6) as activated_at, | ||
output_data ->> 'oldOperatorAVSSplitBips' as old_operator_avs_split_bips, | ||
output_data ->> 'newOperatorAVSSplitBips' as new_operator_avs_split_bips, | ||
block_number, | ||
transaction_hash, | ||
log_index | ||
from transaction_logs | ||
where | ||
address = '0xb22ef643e1e067c994019a4c19e403253c05c2b0' | ||
and event_name = 'OperatorAVSSplitBipsSet' | ||
order by block_number desc | ||
``` |
47 changes: 47 additions & 0 deletions
47
internal/tests/testdata/operatorDirectedRewardSubmissions/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
```sql | ||
WITH strategies AS ( | ||
SELECT | ||
tl.*, | ||
output_data->'operatorDirectedRewardsSubmission'->>'token' as token, | ||
output_data->'operatorDirectedRewardsSubmission'->>'duration' as duration, | ||
output_data->'operatorDirectedRewardsSubmission'->>'startTimestamp' as start_timestamp, | ||
strategy_data, | ||
strategy_idx - 1 as strategy_idx -- Subtract 1 for 0-based indexing | ||
FROM transaction_logs as tl, | ||
jsonb_array_elements(output_data->'operatorDirectedRewardsSubmission'->'strategiesAndMultipliers') | ||
WITH ORDINALITY AS t(strategy_data, strategy_idx) | ||
where | ||
address = '0xb22ef643e1e067c994019a4c19e403253c05c2b0' | ||
and event_name = 'OperatorDirectedAVSRewardsSubmissionCreated' | ||
), | ||
operators AS ( | ||
SELECT | ||
operator_data, | ||
output_data->'operatorDirectedRewardsSubmission' as rewards_submission, | ||
operator_idx - 1 as operator_idx -- Subtract 1 to make it 0-based indexing | ||
FROM transaction_logs, | ||
jsonb_array_elements(output_data->'operatorDirectedRewardsSubmission'->'operatorRewards') | ||
WITH ORDINALITY AS t(operator_data, operator_idx) | ||
where | ||
address = '0xb22ef643e1e067c994019a4c19e403253c05c2b0' | ||
and event_name = 'OperatorDirectedAVSRewardsSubmissionCreated' | ||
) | ||
SELECT | ||
lower(arguments #>> '{1, Value}') as avs, | ||
lower(arguments #>> '{2, Value}') as reward_hash, | ||
strategies.token, | ||
operator_data->>'operator' as operator, | ||
operator_idx as operator_index, | ||
operator_data->>'amount' as amount, | ||
strategy_data->>'strategy' as strategy, | ||
strategy_idx as strategy_index, | ||
strategy_data->>'multiplier' as multiplier, | ||
(to_timestamp((rewards_submission->>'startTimestamp')::int))::timestamp(6) as start_timestamp, | ||
(rewards_submission->>'duration')::int as duration, | ||
to_timestamp((rewards_submission->>'startTimestamp')::int + (rewards_submission->>'duration')::int)::timestamp(6) as end_timestamp, | ||
block_number, | ||
transaction_hash, | ||
log_index | ||
FROM strategies | ||
CROSS JOIN operators; | ||
``` |
16 changes: 16 additions & 0 deletions
16
internal/tests/testdata/operatorPISplitSnapshots/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
```sql | ||
select | ||
lower(arguments #>> '{1, Value}') as operator, | ||
to_timestamp((output_data ->> 'activatedAt')::integer)::timestamp(6) as activated_at, | ||
output_data ->> 'oldOperatorPISplitBips' as old_operator_pi_split_bips, | ||
output_data ->> 'newOperatorPISplitBips' as new_operator_pi_split_bips, | ||
block_number, | ||
transaction_hash, | ||
log_index | ||
from transaction_logs | ||
where | ||
address = '0xb22ef643e1e067c994019a4c19e403253c05c2b0' | ||
and event_name = 'OperatorPISplitBipsSet' | ||
order by block_number desc | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters