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

Stake slashed #37

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9fee80f
add stakeSlashed
jesseptao Sep 21, 2021
6331f00
abstract agent work in progress
jds3d Dec 11, 2021
8a1ed4c
WIP - add delegate_front_runner.
jds3d Dec 17, 2021
8f0e970
WIP
jds3d Dec 17, 2021
6458ad2
WIP. Does not pass tests.
jds3d Dec 24, 2021
932f1d7
WIP
jds3d Dec 28, 2021
1d3c22a
add test_events.py
jds3d Dec 28, 2021
a5eda6a
WIP
jds3d Jan 3, 2022
4d33be1
WIP
jds3d Jan 5, 2022
5dd65d7
WIP
jds3d Jan 5, 2022
ef5ba1f
preliminary code to get AbstractAgent info
jesseptao Jan 5, 2022
531871a
Model runs with agent actions, but does not process them.
jds3d Jan 6, 2022
246f181
Fixed block number shift.
jds3d Jan 12, 2022
c002cab
Cleaned up logging.
jds3d Jan 13, 2022
791c8c8
Removed some unnecessary lists.
jds3d Jan 15, 2022
5f02996
Working on updateState
jds3d Jan 17, 2022
c27bc1d
Rewrite based on english descriptions.
jds3d Jan 17, 2022
19f0a3a
Added elements to event that are needed to process delegation.
jds3d Jan 18, 2022
56b0469
Can now process delegate, undelegate, and withdraw agent events.
jds3d Jan 18, 2022
86828c5
Rework effective timesteps.
jds3d Jan 19, 2022
6ea5aa0
Don't set a plan on the timestep where front runner is acting.
jds3d Jan 19, 2022
c4d8c53
Move the delegate_front_runner to the indexer from the agent state va…
jds3d Jan 19, 2022
257450b
Add event['until'].
jds3d Jan 19, 2022
cbcfb88
Add until to undelegate
jds3d Jan 19, 2022
7c131ca
Only allow open allocations to be front-run.
jds3d Jan 20, 2022
2d8cefb
Merge main into abstract_agent_class.
jds3d Jan 25, 2022
5bbe41b
Merge branch 'abstract_agent_class' of https://github.com/BlockScienc…
jesseptao Jan 26, 2022
3175b12
Added effective timestep back in.
jds3d Jan 26, 2022
59af376
Agent events are again processed by event_processor.
jds3d Jan 27, 2022
8a8a8ec
Tax is taken out before event is created.
jds3d Jan 28, 2022
5a8811c
Merge branch 'abstract_agent_class' of https://github.com/BlockScienc…
jesseptao Jan 28, 2022
b686165
finish pull
jesseptao Jan 28, 2022
78ccbfb
add hard coded blockNumber to front running delegator, need to get bl…
jesseptao Jan 28, 2022
4972598
Track indexer shares.
jds3d Jan 31, 2022
fab4e1a
Merge remote-tracking branch 'origin/abstract_agent_class' into abstr…
jds3d Jan 31, 2022
b97e7be
Revert hardcoded blocknumber.
jds3d Jan 31, 2022
fe89b68
modify portfolio so event does not need blockNumber and analysis
jesseptao Feb 1, 2022
b6cb772
fix merge conflict
jesseptao Feb 1, 2022
22954ef
Merge pull request #36 from jesseptao/abstract_agent_class
jds3d Feb 2, 2022
45e2cd4
Account for tax in delegator.holdings.
jds3d Feb 2, 2022
9b3e6c1
Add timestep logging.
jds3d Feb 2, 2022
68afaec
Undelegation happens when the specific allocation delegated to is clo…
jds3d Feb 7, 2022
22463c0
A/B tax runs
matttyb80 Feb 9, 2022
9aa260d
A/B
matttyb80 Feb 9, 2022
17d3b9b
add plots
matttyb80 Feb 10, 2022
d86ae56
fix merge conflicts
jesseptao Feb 14, 2022
8edaefc
add holdings to plots
matttyb80 Feb 18, 2022
1d4baf8
add plots, format nbs
matttyb80 Feb 23, 2022
79f72c2
add plots and lists
matttyb80 Feb 28, 2022
bc21cb0
beneficiary stakeSlashed
jesseptao Feb 28, 2022
d877657
subtract shares from portfoli
matttyb80 Feb 28, 2022
07b2d68
add stakeSlashed to sys_params
jesseptao Feb 28, 2022
e4a72b3
update sys_params
jesseptao Mar 1, 2022
d1c92c9
implement stake_slashed and hacky test fixes
jesseptao Mar 3, 2022
56c5205
import withdraw fix
jesseptao Mar 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,6 @@ dmypy.json

# Pyre type checker
.pyre/
experiment.p
*.p
.prof_stats
profiling_stats.txt
Binary file modified .prof_stats
Binary file not shown.
6 changes: 3 additions & 3 deletions GraphQL_data/data_access_v2.ipynb

Large diffs are not rendered by default.

28,863 changes: 17,379 additions & 11,484 deletions another_indexer/all_events/allocationCloseds.csv

Large diffs are not rendered by default.

18,398 changes: 9,522 additions & 8,876 deletions another_indexer/all_events/allocationCollected.csv

Large diffs are not rendered by default.

31,013 changes: 18,549 additions & 12,464 deletions another_indexer/all_events/allocationCreateds.csv

Large diffs are not rendered by default.

197,036 changes: 113,485 additions & 83,551 deletions another_indexer/all_events/combinedEvents.csv

Large diffs are not rendered by default.

2,335 changes: 1,242 additions & 1,093 deletions another_indexer/all_events/delegationParametersUpdateds.csv

Large diffs are not rendered by default.

9,907 changes: 5,305 additions & 4,602 deletions another_indexer/all_events/rebateClaimeds.csv

Large diffs are not rendered by default.

26,781 changes: 16,187 additions & 10,594 deletions another_indexer/all_events/rewardsAssigneds.csv

Large diffs are not rendered by default.

15,758 changes: 9,187 additions & 6,571 deletions another_indexer/all_events/stakeDelegatedLockeds.csv

Large diffs are not rendered by default.

13,053 changes: 7,924 additions & 5,129 deletions another_indexer/all_events/stakeDelegatedWithdrawns.csv

Large diffs are not rendered by default.

37,328 changes: 20,600 additions & 16,728 deletions another_indexer/all_events/stakeDelegateds.csv

Large diffs are not rendered by default.

13,612 changes: 7,593 additions & 6,019 deletions another_indexer/all_events/stakeDepositeds.csv

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions another_indexer/all_events/stakeSlasheds.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
id,blockNumber,logIndex,indexer,tokens,reward,beneficiary,type
0x1596590788e3b6464685e27ab099daa36f8bf9236153ee6ea8cde379bd2da3cf-48,13058230,48,0x76e84025978a0c16fc7ba483718b667388f2973c,29400814429489079062405,14700407214744539531202,0xe3671ff90401c21e2bb55b2dfab4506cede113e5,stakeSlasheds
0x1596590788e3b6464685e27ab099daa36f8bf9236153ee6ea8cde379bd2da3cf-53,13058230,53,0x76e84025978a0c16fc7ba483718b667388f2973c,28665794068751852085844,14332897034375926042922,0xe3671ff90401c21e2bb55b2dfab4506cede113e5,stakeSlasheds
0x1596590788e3b6464685e27ab099daa36f8bf9236153ee6ea8cde379bd2da3cf-58,13058230,58,0x76e84025978a0c16fc7ba483718b667388f2973c,27949149217033055783698,13974574608516527891849,0xe3671ff90401c21e2bb55b2dfab4506cede113e5,stakeSlasheds
0x1596590788e3b6464685e27ab099daa36f8bf9236153ee6ea8cde379bd2da3cf-63,13058230,63,0x76e84025978a0c16fc7ba483718b667388f2973c,27250420486607229389106,13625210243303614694553,0xe3671ff90401c21e2bb55b2dfab4506cede113e5,stakeSlasheds
0x1596590788e3b6464685e27ab099daa36f8bf9236153ee6ea8cde379bd2da3cf-68,13058230,68,0x76e84025978a0c16fc7ba483718b667388f2973c,26569159974442048654378,13284579987221024327189,0xe3671ff90401c21e2bb55b2dfab4506cede113e5,stakeSlasheds
0x1596590788e3b6464685e27ab099daa36f8bf9236153ee6ea8cde379bd2da3cf-73,13058230,73,0x76e84025978a0c16fc7ba483718b667388f2973c,25904930975080997438019,12952465487540498719009,0xe3671ff90401c21e2bb55b2dfab4506cede113e5,stakeSlasheds
567 changes: 473 additions & 94 deletions another_indexer/filter_data.ipynb

Large diffs are not rendered by default.

61 changes: 48 additions & 13 deletions another_indexer/get_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"source": [
"#save allocationCreated data\n",
"alloc_created_df['type'] = 'allocationCreateds'\n",
"alloc_created_df.to_csv('allocationCreateds.csv', index = False, header = True)"
"alloc_created_df.to_csv('all_events/allocationCreateds.csv', index = False, header = True)"
]
},
{
Expand Down Expand Up @@ -144,7 +144,7 @@
"\n",
"#save allocationClosed data\n",
"alloc_close_df['type'] = 'allocationCloseds'\n",
"alloc_close_df.to_csv('allocationCloseds.csv', index = False, header = True)"
"alloc_close_df.to_csv('all_events/allocationCloseds.csv', index = False, header = True)"
]
},
{
Expand Down Expand Up @@ -178,15 +178,23 @@
"\n",
"# save allocationCollected data\n",
"alloc_collected_df['type'] = 'allocationCollecteds'\n",
"alloc_collected_df.to_csv('allocationCollected.csv', index = False, header = True)"
"alloc_collected_df.to_csv('all_events/allocationCollected.csv', index = False, header = True)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "e3effddc-08e6-43a4-bdf4-82f72da9991b",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"noblock\n"
]
}
],
"source": [
"# get stakeDelegated event\n",
"delegate_query = \"\"\"query{\n",
Expand All @@ -207,7 +215,7 @@
"\n",
"# save stakeDelegated data\n",
"stake_delegate_df['type'] = 'stakeDelegateds'\n",
"stake_delegate_df.to_csv('stakeDelegateds.csv', index = False, header = True)"
"stake_delegate_df.to_csv('all_events/stakeDelegateds.csv', index = False, header = True)"
]
},
{
Expand Down Expand Up @@ -238,7 +246,7 @@
"\n",
"# save stakeLocked data\n",
"stake_locked_df['type'] = 'stakeDelegatedLockeds'\n",
"stake_locked_df.to_csv('stakeDelegatedLockeds.csv', index = False, header = True)"
"stake_locked_df.to_csv('all_events/stakeDelegatedLockeds.csv', index = False, header = True)"
]
},
{
Expand All @@ -265,7 +273,7 @@
"\n",
"# save stakeWithdraw data\n",
"stake_withdraw_df['type'] = 'stakeDelegatedWithdrawns'\n",
"stake_withdraw_df.to_csv('stakeDelegatedWithdrawns.csv', index = False, header = True)"
"stake_withdraw_df.to_csv('all_events/stakeDelegatedWithdrawns.csv', index = False, header = True)"
]
},
{
Expand All @@ -290,7 +298,7 @@
"\n",
"# save fee cut data\n",
"fee_cut_df['type'] = 'delegationParametersUpdateds'\n",
"fee_cut_df.to_csv('delegationParametersUpdateds.csv', index = False, header = True)"
"fee_cut_df.to_csv('all_events/delegationParametersUpdateds.csv', index = False, header = True)"
]
},
{
Expand Down Expand Up @@ -318,7 +326,7 @@
"\n",
"# save rebateClaim data\n",
"rebate_claim_df['type'] = 'rebateClaimeds'\n",
"rebate_claim_df.to_csv('rebateClaimeds.csv', index = False, header = True)"
"rebate_claim_df.to_csv('all_events/rebateClaimeds.csv', index = False, header = True)"
]
},
{
Expand All @@ -343,7 +351,7 @@
"\n",
"# save rewardsAssigned data\n",
"rewards_assigned_df['type'] = 'rewardsAssigneds'\n",
"rewards_assigned_df.to_csv('rewardsAssigneds.csv', index = False, header = True)"
"rewards_assigned_df.to_csv('all_events/rewardsAssigneds.csv', index = False, header = True)"
]
},
{
Expand All @@ -367,7 +375,33 @@
"\n",
"# save stakeDeposited data\n",
"stake_deposit_df['type'] = 'stakeDepositeds'\n",
"stake_deposit_df.to_csv('stakeDepositeds.csv', index = False, header = True)"
"stake_deposit_df.to_csv('all_events/stakeDepositeds.csv', index = False, header = True)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "0947a6a7-ef13-47f3-bbd0-b51a0176f0f6",
"metadata": {},
"outputs": [],
"source": [
"# get stakeSlashed data\n",
"stake_slash_query = \"\"\"query{stakeSlasheds () {\n",
" id\n",
" blockNumber\n",
" logIndex\n",
" indexer\n",
" tokens\n",
" reward\n",
" beneficiary\n",
"}\n",
"}\"\"\"\n",
"field_name = 'stakeSlasheds'\n",
"stake_slashed_df = query_theGraph(stake_slash_query, field_name, url, False)\n",
"\n",
"# save stakeDeposited data\n",
"stake_slashed_df['type'] = 'stakeSlasheds'\n",
"stake_slashed_df.to_csv('all_events/stakeSlasheds.csv', index = False, header = True)"
]
},
{
Expand All @@ -380,10 +414,11 @@
"# combine all events\n",
"combined_events = [alloc_created_df, alloc_close_df, alloc_collected_df, \n",
" stake_delegate_df, stake_locked_df, stake_withdraw_df, \n",
" fee_cut_df, rebate_claim_df, rewards_assigned_df, stake_deposit_df]\n",
" fee_cut_df, rebate_claim_df, rewards_assigned_df, stake_deposit_df,\n",
" stake_slashed_df]\n",
"combined_events = pd.concat(combined_events)\n",
"combined_events.drop_duplicates(inplace = True)\n",
"combined_events.to_csv('../multiple_indexer/allindexer/allEvents.csv', index = False, header=True)"
"combined_events.to_csv('all_events/combinedEvents.csv', index = False, header=True)"
]
},
{
Expand Down
Loading