diff --git a/examples/morpho_blue.ipynb b/examples/morpho_blue.ipynb
new file mode 100644
index 00000000..70b79c38
--- /dev/null
+++ b/examples/morpho_blue.ipynb
@@ -0,0 +1,1022 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import cryo\n",
+ "import polars as pl\n",
+ "import json"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Constants"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "CREATION_MARKET_SIG_HASH = \"0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac\"\n",
+ "ACCRUE_INTEREST_SIG_HASH = \"0x9d9bd501d0657d7dfe415f779a620a62b78bc508ddc0891fbbd8b7ac0f8fce87\"\n",
+ "BORROW_SIG_HASH = \"0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43\"\n",
+ "REPAY_SIG_HASH = \"0x52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa09\"\n",
+ "SUPPLY_COLLATERAL_SIG_HASH = \"0xa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184\"\n",
+ "WITHDRAW_COLLATERAL_SIG_HASH = \"0xe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e321142\"\n",
+ "SUPPLY_SIG_HASH = \"0xedf8870433c83823eb071d3df1caa8d008f12f6440918c20d75a3602cda30fe0\"\n",
+ "WITHDRAW_SIG_HASH = \"0xa56fc0ad5702ec05ce63666221f796fb62437c32db1aa1aa075fc6484cf58fbf\"\n",
+ "LIQUIDATE_SIG_HASH = \"0xa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e41\"\n",
+ "\n",
+ "# Id is an alias for bytes32\n",
+ "# MarketParams is a struct with the following fields:\n",
+ "# - address loanToken\n",
+ "# - address collateralToken\n",
+ "# - address oracle\n",
+ "# - address irm\n",
+ "CREATION_MARKET_SIG = \"event CreateMarket(Id indexed id, MarketParams marketParams)\".replace('Id', \"bytes32\")\\\n",
+ " .replace('MarketParams marketParams', 'address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)')\n",
+ "SUPPLY_SIG = \"event Supply(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares)\".replace('Id', \"bytes32\")\n",
+ "WITHDRAW_SIG = \"event Withdraw(Id indexed id,address caller,address indexed onBehalf,address indexed receiver,uint256 assets,uint256 shares);\".replace('Id', \"bytes32\")\n",
+ "BORROW_SIG = \"event Borrow(Id indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets, uint256 shares)\".replace('Id', \"bytes32\")\n",
+ "REPAY_SIG = \"event Repay(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares)\".replace('Id', \"bytes32\")\n",
+ "SUPPLY_COLLATERAL_SIG = \"event SupplyCollateral(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets)\".replace('Id', \"bytes32\")\n",
+ "WITHDRAW_COLLATERAL_SIG = \"event WithdrawCollateral(Id indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets)\".replace('Id', \"bytes32\")\n",
+ "LIQUIDATE_SIG = \"event Liquidate(Id indexed id,address indexed caller,address indexed borrower,uint256 repaidAssets,uint256 repaidShares,uint256 seizedAssets,uint256 badDebtAssets,uint256 badDebtShares);\".replace('Id', \"bytes32\")\n",
+ "ACCRUE_INTEREST_SIG = \"event AccrueInterest(Id indexed id, uint256 prevBorrowRate, uint256 interest, uint256 feeShares);\".replace('Id', \"bytes32\")\n",
+ "\n",
+ "BLUE_CONTRACT_ADDRESS = \"0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb\"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Utils"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 55,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\n",
+ "\n",
+ "def convert_to_type(data, type, data_offset = 0):\n",
+ " ''' Convert raw data to a specific type\n",
+ " data: the raw data (bytes)\n",
+ " type: the type of the data\n",
+ " data_offset: the offset of the data in the raw data'''\n",
+ "\n",
+ " if type == 'string':\n",
+ " offset = int(data[data_offset+12: data_offset + 32].hex(), 16)\n",
+ " length = int(data[offset:offset + 32].hex(), 16)\n",
+ " return data[offset + 32: offset + 32 + length].decode('utf-8')\n",
+ " elif '[]' in type:\n",
+ " # TODO\n",
+ " raise ValueError(\"Array not implemented yet\")\n",
+ " elif len(type) > 4 and type[:4] == 'uint':\n",
+ " return float(int(data[data_offset+22: data_offset+32].hex(), 16))\n",
+ " elif type == 'address':\n",
+ " return '0x' + data[12+data_offset:32+data_offset].hex()\n",
+ " elif type == 'bool':\n",
+ " return int(data[data_offset: 32 + data_offset].hex(), 16) > 0\n",
+ " elif len(type) > 5 and type[:5] == 'bytes':\n",
+ " bytes_left = 32 - int(type[5:])\n",
+ " return '0x' + data[data_offset+bytes_left: data_offset+32].hex()\n",
+ " else:\n",
+ " raise ValueError(\"Type not handled yet\")\n",
+ " \n",
+ "def parse_raw_events(raw_events: pl.DataFrame, signature: str) -> pl.DataFrame:\n",
+ " '''\n",
+ " Parse raw events from a DataFrame, this dataframe should contain the following columns:\n",
+ " - topic0 to topic3: the topics of the event\n",
+ " - data: the data of the event\n",
+ " The signature is used to determine the type of the event, it should look like this:\n",
+ " \"EventName(uint256 indexed arg1, uint256 indexed arg2, T arg3, ...)\"\n",
+ "\n",
+ " The function works with basic types (string, uint, address, bool, bytes) but not yet (TODO) with arrays or structs.\n",
+ " '''\n",
+ " \n",
+ " # Parse the signature\n",
+ " first_parenthesis = signature.find('(')\n",
+ " last_parenthesis = signature.rfind(')')\n",
+ "\n",
+ " print(f'Parsing Event name: {signature[:first_parenthesis]}')\n",
+ "\n",
+ " types_str = signature[first_parenthesis + 1:last_parenthesis]\n",
+ " types = types_str.split(',')\n",
+ " indexed_types, data_types = [], []\n",
+ "\n",
+ " for t in types:\n",
+ " parts = t.strip().split(' ')\n",
+ " if 'indexed' in parts:\n",
+ " indexed_types.append((parts[0], parts[-1]))\n",
+ " else:\n",
+ " data_types.append((parts[0], parts[-1]))\n",
+ "\n",
+ " # Create one DataFrame for each data variable\n",
+ " # TODO: optimize this\n",
+ " dfs = []\n",
+ " for index, (type, name) in enumerate(data_types):\n",
+ " data_events_cur_df = raw_events.select([\n",
+ " pl.col(\"data\").map_elements(lambda x: convert_to_type(x, type, 32*index)).alias(name)\n",
+ " ] + [pl.col(\"block_number\"), pl.col(\"transaction_index\", \"log_index\")])\n",
+ " dfs.append(data_events_cur_df)\n",
+ " \n",
+ " # Create the DataFrame for the indexed variables\n",
+ " indexed_events_df = raw_events.select([\n",
+ " pl.col(f\"topic{1+index}\").map_elements(lambda x: convert_to_type(x, type)).alias(name)\n",
+ " for index, (type, name) in enumerate(indexed_types)\n",
+ " ] + [pl.col(\"block_number\"), pl.col(\"transaction_index\", \"log_index\")])\n",
+ "\n",
+ " print(f'Indexed types: {indexed_types}')\n",
+ " print(f'Data types: {data_types}')\n",
+ "\n",
+ " # Join all the DataFrames \n",
+ " res_df = indexed_events_df\n",
+ " for df in dfs:\n",
+ " res_df = res_df.join(df, on=[\"block_number\", \"transaction_index\", \"log_index\"], how=\"inner\")\n",
+ "\n",
+ " return res_df"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Blue market creation\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "
shape: (5, 11)block_number | transaction_index | log_index | transaction_hash | address | topic0 | topic1 | topic2 | topic3 | data | chain_id |
---|
u32 | u32 | u32 | binary | binary | binary | binary | binary | binary | binary | u64 |
18919623 | 73 | 135 | b"\\x16\\x1c\\x8d\\xb8X\\x86\\x1e\\xa5\\x11\\x9dhl\\xde#\\xe3\\xda\\xbb\\x88\\xd3\\xd2\\xd2\\xa9\\xe1\\x172\\xca=\\x96`\\xfc\\x97\\xf6" | b"\\xbb\\xbb\\xbb\\xbb\\xbb\\x9c\\xc5\\xe9\\x0e;:\\xf6K\\xda\\xf6,7\\xee\\xff\\xcb" | b"\\xacK$\\x00\\xf1i"\\x0b\\x0c\\x0a\\xfd\\xdez\\x0b2\\xe7u\\xbar~\\xa1\\xcb0\\xb3_\\x93\\\\xda\\xab\\x86\\x83\\xac" | b"\\xc5Mz\\xcf\\x14\\xde)\\xe0\\xe5R|\\xab\\xd7\\xa5vPhp4jx\\xa1\\x1agb\\xe2\\xcc\\xa6c"\\xecA" | null | null | b"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xc0*\\xaa9\\xb2#\\xfe\\x8d\\x0a\\x0e\\O'\\xea\\xd9\\x08<ul\\xc2\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x7f9\\xc5\\x81\\xf5\\x95\\xb5<\\\\xb1\\x9b\\xd0\\xb3\\xf8\\xdal\\x93^,\\xa0"... | 1 |
18919858 | 95 | 141 | b"\\xea\\x1co\\xae\\xa5\\x17)\\xc6\\x91\\x92\\x98\\xd6\\x0e\\x99\\xee\\x20\\xd1\\xb4^<\\xec\\x993\\xeac\\x8c\\xc1\\xa6\\x96$\\xb9\\xdf" | b"\\xbb\\xbb\\xbb\\xbb\\xbb\\x9c\\xc5\\xe9\\x0e;:\\xf6K\\xda\\xf6,7\\xee\\xff\\xcb" | b"\\xacK$\\x00\\xf1i"\\x0b\\x0c\\x0a\\xfd\\xdez\\x0b2\\xe7u\\xbar~\\xa1\\xcb0\\xb3_\\x93\\\\xda\\xab\\x86\\x83\\xac" | b"T\\xef\\xde\\xe0\\x8e'.\\x92\\x904\\xa8\\xf2o|\\xa3K\\x1e\\xbe6K'S\\x91\\x16\\x9b(\\xc6\\xd7\\xdb$\\xdb\\xc8" | null | null | b"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xa0\\xb8i\\x91\\xc6!\\x8b6\\xc1\\xd1\\x9dJ.\\x9e\\xb0\\xce6\\x06\\xebH\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00"... | 1 |
18919860 | 80 | 255 | b"\\xbe\\x0a\\x1a\\x90x\\xef\\xed\\xa0\\xa1\\xbb\\xf0\\x90Lr\\x03\\xa0\\x90Zc\\xb1kc\\xe1\\x05'J*\\x19\\x91_w\\x9d" | b"\\xbb\\xbb\\xbb\\xbb\\xbb\\x9c\\xc5\\xe9\\x0e;:\\xf6K\\xda\\xf6,7\\xee\\xff\\xcb" | b"\\xacK$\\x00\\xf1i"\\x0b\\x0c\\x0a\\xfd\\xdez\\x0b2\\xe7u\\xbar~\\xa1\\xcb0\\xb3_\\x93\\\\xda\\xab\\x86\\x83\\xac" | b"X\\xe2\\x12\\x06\\x06E\\xd1\\x8e\\xabm\\x9b*\\xf3\\xd5o\\xbc\\x90j\\x92\\xffVg8_aof,p7"\\x84" | null | null | b"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xc0*\\xaa9\\xb2#\\xfe\\x8d\\x0a\\x0e\\O'\\xea\\xd9\\x08<ul\\xc2\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00"... | 1 |
18925864 | 126 | 392 | b"%L]\\xd1x6\\xbc\\x80\\xa3\\xe4\\xd6\\xfe\\xfe\\xe4|\\xae{N?\\xe6\\x90D\\x19?\\xab##\\x94\\x0e\\xdd8\\xa0" | b"\\xbb\\xbb\\xbb\\xbb\\xbb\\x9c\\xc5\\xe9\\x0e;:\\xf6K\\xda\\xf6,7\\xee\\xff\\xcb" | b"\\xacK$\\x00\\xf1i"\\x0b\\x0c\\x0a\\xfd\\xdez\\x0b2\\xe7u\\xbar~\\xa1\\xcb0\\xb3_\\x93\\\\xda\\xab\\x86\\x83\\xac" | b"\\x08SX\\x10\\xfe\\xad\\xf5-a\\xa1\\x82\\xdcz\\x12\\xbax\\xf9\\xb3\\x8a\\x82\\x9e\\xe4w\\xe0\\xe1\\xd4\\x88\\xd4\\xe2b\\xbc\\x0a" | null | null | b"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xa0\\xb8i\\x91\\xc6!\\x8b6\\xc1\\xd1\\x9dJ.\\x9e\\xb0\\xce6\\x06\\xebH\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xab\\xc5a\\x86\\xc2\\xdfc\\xc38\\xe0L\\x9c\\x9b\\x98\\x14\\xe2y\\x83\\xa5\\xa9"... | 1 |
18925910 | 94 | 214 | b"\\xf7f\\xfa\\x95`\\x04\\xbc\\xea\\x9b\\x0eW\\xc4V/\\xf9T\\xed\\xfd0f\\xcd\\x9f!\\xe2\\x8f\\xba\\xba\\xe4\\x01\\xb7\\x8e\\xde" | b"\\xbb\\xbb\\xbb\\xbb\\xbb\\x9c\\xc5\\xe9\\x0e;:\\xf6K\\xda\\xf6,7\\xee\\xff\\xcb" | b"\\xacK$\\x00\\xf1i"\\x0b\\x0c\\x0a\\xfd\\xdez\\x0b2\\xe7u\\xbar~\\xa1\\xcb0\\xb3_\\x93\\\\xda\\xab\\x86\\x83\\xac" | b"\\xb3#I_~AH\\xbeVC\\xa4\\xeaJ\\x82!\\xee\\xf1c\\xe4\\xbc\\xcf\\xde\\xdc*oF\\x96\\xba\\xac\\xbc\\x86\\xcc" | null | null | b"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xa0\\xb8i\\x91\\xc6!\\x8b6\\xc1\\xd1\\x9dJ.\\x9e\\xb0\\xce6\\x06\\xebH\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x7f9\\xc5\\x81\\xf5\\x95\\xb5<\\\\xb1\\x9b\\xd0\\xb3\\xf8\\xdal\\x93^,\\xa0"... | 1 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 11)\n",
+ "┌─────────────┬─────────────┬───────────┬────────────┬───┬────────┬────────┬────────────┬──────────┐\n",
+ "│ block_numbe ┆ transaction ┆ log_index ┆ transactio ┆ … ┆ topic2 ┆ topic3 ┆ data ┆ chain_id │\n",
+ "│ r ┆ _index ┆ --- ┆ n_hash ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ --- ┆ --- ┆ u32 ┆ --- ┆ ┆ binary ┆ binary ┆ binary ┆ u64 │\n",
+ "│ u32 ┆ u32 ┆ ┆ binary ┆ ┆ ┆ ┆ ┆ │\n",
+ "╞═════════════╪═════════════╪═══════════╪════════════╪═══╪════════╪════════╪════════════╪══════════╡\n",
+ "│ 18919623 ┆ 73 ┆ 135 ┆ b\"\\x16\\x1c ┆ … ┆ null ┆ null ┆ b\"\\x00\\x00 ┆ 1 │\n",
+ "│ ┆ ┆ ┆ \\x8d\\xb8X\\ ┆ ┆ ┆ ┆ \\x00\\x00\\x ┆ │\n",
+ "│ ┆ ┆ ┆ x86\\x1e\\xa ┆ ┆ ┆ ┆ 00\\x00\\x00 ┆ │\n",
+ "│ ┆ ┆ ┆ 5\\… ┆ ┆ ┆ ┆ \\x… ┆ │\n",
+ "│ 18919858 ┆ 95 ┆ 141 ┆ b\"\\xea\\x1c ┆ … ┆ null ┆ null ┆ b\"\\x00\\x00 ┆ 1 │\n",
+ "│ ┆ ┆ ┆ o\\xae\\xa5\\ ┆ ┆ ┆ ┆ \\x00\\x00\\x ┆ │\n",
+ "│ ┆ ┆ ┆ x17)\\xc6\\x ┆ ┆ ┆ ┆ 00\\x00\\x00 ┆ │\n",
+ "│ ┆ ┆ ┆ 91… ┆ ┆ ┆ ┆ \\x… ┆ │\n",
+ "│ 18919860 ┆ 80 ┆ 255 ┆ b\"\\xbe\\x0a ┆ … ┆ null ┆ null ┆ b\"\\x00\\x00 ┆ 1 │\n",
+ "│ ┆ ┆ ┆ \\x1a\\x90x\\ ┆ ┆ ┆ ┆ \\x00\\x00\\x ┆ │\n",
+ "│ ┆ ┆ ┆ xef\\xed\\xa ┆ ┆ ┆ ┆ 00\\x00\\x00 ┆ │\n",
+ "│ ┆ ┆ ┆ 0\\… ┆ ┆ ┆ ┆ \\x… ┆ │\n",
+ "│ 18925864 ┆ 126 ┆ 392 ┆ b\"%L]\\xd1x ┆ … ┆ null ┆ null ┆ b\"\\x00\\x00 ┆ 1 │\n",
+ "│ ┆ ┆ ┆ 6\\xbc\\x80\\ ┆ ┆ ┆ ┆ \\x00\\x00\\x ┆ │\n",
+ "│ ┆ ┆ ┆ xa3\\xe4\\xd ┆ ┆ ┆ ┆ 00\\x00\\x00 ┆ │\n",
+ "│ ┆ ┆ ┆ 6\\… ┆ ┆ ┆ ┆ \\x… ┆ │\n",
+ "│ 18925910 ┆ 94 ┆ 214 ┆ b\"\\xf7f\\xf ┆ … ┆ null ┆ null ┆ b\"\\x00\\x00 ┆ 1 │\n",
+ "│ ┆ ┆ ┆ a\\x95`\\x04 ┆ ┆ ┆ ┆ \\x00\\x00\\x ┆ │\n",
+ "│ ┆ ┆ ┆ \\xbc\\xea\\x ┆ ┆ ┆ ┆ 00\\x00\\x00 ┆ │\n",
+ "│ ┆ ┆ ┆ 9b… ┆ ┆ ┆ ┆ \\x… ┆ │\n",
+ "└─────────────┴─────────────┴───────────┴────────────┴───┴────────┴────────┴────────────┴──────────┘"
+ ]
+ },
+ "execution_count": 49,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "# Collect the raw events with specific cryo params\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [CREATION_MARKET_SIG_HASH],\n",
+ "}\n",
+ "\n",
+ "# Collect the raw events with cryo\n",
+ "blue_market_creations_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_market_creations_raw.head(5)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 56,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event CreateMarket\n",
+ "Indexed types: [('bytes32', 'id')]\n",
+ "Data types: [('address', 'loanToken'), ('address', 'collateralToken'), ('address', 'oracle'), ('address', 'irm'), ('uint256', 'lltv')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 9)id | block_number | transaction_index | log_index | loanToken | collateralToken | oracle | irm | lltv |
---|
str | u32 | u32 | u32 | str | str | str | str | f64 |
"0xc54d7acf14de… | 18919623 | 73 | 135 | "0xc02aaa39b223… | "0x7f39c581f595… | "0x2a01eb949609… | "0x870ac11d48b1… | 9.4500e17 |
"0x54efdee08e27… | 18919858 | 95 | 141 | "0xa0b86991c621… | "0x000000000000… | "0x000000000000… | "0x000000000000… | 0.0 |
"0x58e212060645… | 18919860 | 80 | 255 | "0xc02aaa39b223… | "0x000000000000… | "0x000000000000… | "0x000000000000… | 0.0 |
"0x08535810fead… | 18925864 | 126 | 392 | "0xa0b86991c621… | "0xabc56186c2df… | "0x6e8f5b2df218… | "0x870ac11d48b1… | 9.6500e17 |
"0xb323495f7e41… | 18925910 | 94 | 214 | "0xa0b86991c621… | "0x7f39c581f595… | "0x48f7e36eb6b8… | "0x870ac11d48b1… | 8.6000e17 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 9)\n",
+ "┌───────────┬───────────┬───────────┬───────────┬───┬───────────┬───────────┬───────────┬──────────┐\n",
+ "│ id ┆ block_num ┆ transacti ┆ log_index ┆ … ┆ collatera ┆ oracle ┆ irm ┆ lltv │\n",
+ "│ --- ┆ ber ┆ on_index ┆ --- ┆ ┆ lToken ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ --- ┆ --- ┆ u32 ┆ ┆ --- ┆ str ┆ str ┆ f64 │\n",
+ "│ ┆ u32 ┆ u32 ┆ ┆ ┆ str ┆ ┆ ┆ │\n",
+ "╞═══════════╪═══════════╪═══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪══════════╡\n",
+ "│ 0xc54d7ac ┆ 18919623 ┆ 73 ┆ 135 ┆ … ┆ 0x7f39c58 ┆ 0x2a01eb9 ┆ 0x870ac11 ┆ 9.4500e1 │\n",
+ "│ f14de29e0 ┆ ┆ ┆ ┆ ┆ 1f595b53c ┆ 496094da0 ┆ d48b15db9 ┆ 7 │\n",
+ "│ e5527cabd ┆ ┆ ┆ ┆ ┆ 5cb19bd0b ┆ 3c4e364de ┆ a138cf899 ┆ │\n",
+ "│ 7a576… ┆ ┆ ┆ ┆ ┆ 3f8da… ┆ f50f5… ┆ d20f1… ┆ │\n",
+ "│ 0x54efdee ┆ 18919858 ┆ 95 ┆ 141 ┆ … ┆ 0x0000000 ┆ 0x0000000 ┆ 0x0000000 ┆ 0.0 │\n",
+ "│ 08e272e92 ┆ ┆ ┆ ┆ ┆ 000000000 ┆ 000000000 ┆ 000000000 ┆ │\n",
+ "│ 9034a8f26 ┆ ┆ ┆ ┆ ┆ 000000000 ┆ 000000000 ┆ 000000000 ┆ │\n",
+ "│ f7ca3… ┆ ┆ ┆ ┆ ┆ 00000… ┆ 00000… ┆ 00000… ┆ │\n",
+ "│ 0x58e2120 ┆ 18919860 ┆ 80 ┆ 255 ┆ … ┆ 0x0000000 ┆ 0x0000000 ┆ 0x0000000 ┆ 0.0 │\n",
+ "│ 60645d18e ┆ ┆ ┆ ┆ ┆ 000000000 ┆ 000000000 ┆ 000000000 ┆ │\n",
+ "│ ab6d9b2af ┆ ┆ ┆ ┆ ┆ 000000000 ┆ 000000000 ┆ 000000000 ┆ │\n",
+ "│ 3d56f… ┆ ┆ ┆ ┆ ┆ 00000… ┆ 00000… ┆ 00000… ┆ │\n",
+ "│ 0x0853581 ┆ 18925864 ┆ 126 ┆ 392 ┆ … ┆ 0xabc5618 ┆ 0x6e8f5b2 ┆ 0x870ac11 ┆ 9.6500e1 │\n",
+ "│ 0feadf52d ┆ ┆ ┆ ┆ ┆ 6c2df63c3 ┆ df218443e ┆ d48b15db9 ┆ 7 │\n",
+ "│ 61a182dc7 ┆ ┆ ┆ ┆ ┆ 38e04c9c9 ┆ 87fe8aa98 ┆ a138cf899 ┆ │\n",
+ "│ a12ba… ┆ ┆ ┆ ┆ ┆ b9814… ┆ 11e69… ┆ d20f1… ┆ │\n",
+ "│ 0xb323495 ┆ 18925910 ┆ 94 ┆ 214 ┆ … ┆ 0x7f39c58 ┆ 0x48f7e36 ┆ 0x870ac11 ┆ 8.6000e1 │\n",
+ "│ f7e4148be ┆ ┆ ┆ ┆ ┆ 1f595b53c ┆ eb6b826b2 ┆ d48b15db9 ┆ 7 │\n",
+ "│ 5643a4ea4 ┆ ┆ ┆ ┆ ┆ 5cb19bd0b ┆ df4b2e630 ┆ a138cf899 ┆ │\n",
+ "│ a8221… ┆ ┆ ┆ ┆ ┆ 3f8da… ┆ b62cd… ┆ d20f1… ┆ │\n",
+ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘"
+ ]
+ },
+ "execution_count": 56,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Parse the raw events to a DataFrame with a specific event signature\n",
+ "\n",
+ "blue_market_creations = parse_raw_events(blue_market_creations_raw, \n",
+ "\"event CreateMarket(bytes32 indexed id, address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)\")\n",
+ "\n",
+ "blue_market_creations.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Interactions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Supply"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event Supply\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'caller'), ('address', 'onBehalf')]\n",
+ "Data types: [('uint256', 'assets'), ('uint256', 'shares')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 8)id | caller | onBehalf | block_number | transaction_index | log_index | assets | shares |
---|
str | str | str | u32 | u32 | u32 | f64 | f64 |
"0x4a8221eef163… | "0x9106cbf2c882… | "0x9106cbf2c882… | 18926166 | 104 | 208 | 1e8 | 1.0000e14 |
"0x4a8221eef163… | "0xbeef01735c13… | "0xbeef01735c13… | 18940531 | 93 | 259 | 1.0000e9 | 9.9999e14 |
"0xd7a576506870… | "0x38989bba00bd… | "0x38989bba00bd… | 18941243 | 38 | 105 | 5.0000e16 | 5.0000e22 |
"0x4a8221eef163… | "0xbeef01735c13… | "0xbeef01735c13… | 18941650 | 87 | 173 | 1.0000e10 | 9.9999e15 |
"0x4a8221eef163… | "0xbeef01735c13… | "0xbeef01735c13… | 18942211 | 74 | 97 | 2e8 | 2.0000e14 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 8)\n",
+ "┌────────────┬────────────┬────────────┬───────────┬───────────┬───────────┬───────────┬───────────┐\n",
+ "│ id ┆ caller ┆ onBehalf ┆ block_num ┆ transacti ┆ log_index ┆ assets ┆ shares │\n",
+ "│ --- ┆ --- ┆ --- ┆ ber ┆ on_index ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ str ┆ str ┆ --- ┆ --- ┆ u32 ┆ f64 ┆ f64 │\n",
+ "│ ┆ ┆ ┆ u32 ┆ u32 ┆ ┆ ┆ │\n",
+ "╞════════════╪════════════╪════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡\n",
+ "│ 0x4a8221ee ┆ 0x9106cbf2 ┆ 0x9106cbf2 ┆ 18926166 ┆ 104 ┆ 208 ┆ 1e8 ┆ 1.0000e14 │\n",
+ "│ f163e4bccf ┆ c882340b23 ┆ c882340b23 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ cc40985c05 ┆ cc40985c05 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ 64… ┆ 64… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221ee ┆ 0xbeef0173 ┆ 0xbeef0173 ┆ 18940531 ┆ 93 ┆ 259 ┆ 1.0000e9 ┆ 9.9999e14 │\n",
+ "│ f163e4bccf ┆ 5c132ada46 ┆ 5c132ada46 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ aa9aa4c546 ┆ aa9aa4c546 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ 23… ┆ 23… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xd7a57650 ┆ 0x38989bba ┆ 0x38989bba ┆ 18941243 ┆ 38 ┆ 105 ┆ 5.0000e16 ┆ 5.0000e22 │\n",
+ "│ 6870346a78 ┆ 00bdf8181f ┆ 00bdf8181f ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ a11a6762e2 ┆ 4082995b3d ┆ 4082995b3d ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ cc… ┆ ea… ┆ ea… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221ee ┆ 0xbeef0173 ┆ 0xbeef0173 ┆ 18941650 ┆ 87 ┆ 173 ┆ 1.0000e10 ┆ 9.9999e15 │\n",
+ "│ f163e4bccf ┆ 5c132ada46 ┆ 5c132ada46 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ aa9aa4c546 ┆ aa9aa4c546 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ 23… ┆ 23… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221ee ┆ 0xbeef0173 ┆ 0xbeef0173 ┆ 18942211 ┆ 74 ┆ 97 ┆ 2e8 ┆ 2.0000e14 │\n",
+ "│ f163e4bccf ┆ 5c132ada46 ┆ 5c132ada46 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ aa9aa4c546 ┆ aa9aa4c546 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ 23… ┆ 23… ┆ ┆ ┆ ┆ ┆ │\n",
+ "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [SUPPLY_SIG_HASH],\n",
+ "}\n",
+ "blue_supply_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_supply = parse_raw_events(blue_supply_raw, SUPPLY_SIG)\n",
+ "\n",
+ "blue_supply.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Withdraw"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event Withdraw\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'onBehalf'), ('address', 'receiver')]\n",
+ "Data types: [('address', 'caller'), ('uint256', 'assets'), ('uint256', 'shares')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 9)id | onBehalf | receiver | block_number | transaction_index | log_index | caller | assets | shares |
---|
str | str | str | u32 | u32 | u32 | str | f64 | f64 |
"0xd7a576506870… | "0x38989bba00bd… | "0x38989bba00bd… | 18941407 | 66 | 104 | "0x38989bba00bd… | 1.2500e16 | 1.2500e22 |
"0x4a8221eef163… | "0xbeef01735c13… | "0xbeef01735c13… | 18941650 | 87 | 180 | "0xbeef01735c13… | 1.0000e9 | 9.9999e14 |
"0x4a8221eef163… | "0xbeef01735c13… | "0xbeef01735c13… | 18963222 | 37 | 88 | "0xbeef01735c13… | 1.0 | 999992.0 |
"0xd7a576506870… | "0x38989bba00bd… | "0x38989bba00bd… | 18965496 | 93 | 234 | "0x38989bba00bd… | 1.0010e15 | 1.0010e21 |
"0xd7a576506870… | "0x38989bba00bd… | "0x38989bba00bd… | 18969656 | 76 | 146 | "0x38989bba00bd… | 2.3000e15 | 2.2999e21 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 9)\n",
+ "┌───────────┬───────────┬───────────┬───────────┬───┬───────────┬───────────┬───────────┬──────────┐\n",
+ "│ id ┆ onBehalf ┆ receiver ┆ block_num ┆ … ┆ log_index ┆ caller ┆ assets ┆ shares │\n",
+ "│ --- ┆ --- ┆ --- ┆ ber ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ str ┆ str ┆ --- ┆ ┆ u32 ┆ str ┆ f64 ┆ f64 │\n",
+ "│ ┆ ┆ ┆ u32 ┆ ┆ ┆ ┆ ┆ │\n",
+ "╞═══════════╪═══════════╪═══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪══════════╡\n",
+ "│ 0xd7a5765 ┆ 0x38989bb ┆ 0x38989bb ┆ 18941407 ┆ … ┆ 104 ┆ 0x38989bb ┆ 1.2500e16 ┆ 1.2500e2 │\n",
+ "│ 06870346a ┆ a00bdf818 ┆ a00bdf818 ┆ ┆ ┆ ┆ a00bdf818 ┆ ┆ 2 │\n",
+ "│ 78a11a676 ┆ 1f4082995 ┆ 1f4082995 ┆ ┆ ┆ ┆ 1f4082995 ┆ ┆ │\n",
+ "│ 2e2cc… ┆ b3dea… ┆ b3dea… ┆ ┆ ┆ ┆ b3dea… ┆ ┆ │\n",
+ "│ 0x4a8221e ┆ 0xbeef017 ┆ 0xbeef017 ┆ 18941650 ┆ … ┆ 180 ┆ 0xbeef017 ┆ 1.0000e9 ┆ 9.9999e1 │\n",
+ "│ ef163e4bc ┆ 35c132ada ┆ 35c132ada ┆ ┆ ┆ ┆ 35c132ada ┆ ┆ 4 │\n",
+ "│ cfdedc2a6 ┆ 46aa9aa4c ┆ 46aa9aa4c ┆ ┆ ┆ ┆ 46aa9aa4c ┆ ┆ │\n",
+ "│ f4696… ┆ 54623… ┆ 54623… ┆ ┆ ┆ ┆ 54623… ┆ ┆ │\n",
+ "│ 0x4a8221e ┆ 0xbeef017 ┆ 0xbeef017 ┆ 18963222 ┆ … ┆ 88 ┆ 0xbeef017 ┆ 1.0 ┆ 999992.0 │\n",
+ "│ ef163e4bc ┆ 35c132ada ┆ 35c132ada ┆ ┆ ┆ ┆ 35c132ada ┆ ┆ │\n",
+ "│ cfdedc2a6 ┆ 46aa9aa4c ┆ 46aa9aa4c ┆ ┆ ┆ ┆ 46aa9aa4c ┆ ┆ │\n",
+ "│ f4696… ┆ 54623… ┆ 54623… ┆ ┆ ┆ ┆ 54623… ┆ ┆ │\n",
+ "│ 0xd7a5765 ┆ 0x38989bb ┆ 0x38989bb ┆ 18965496 ┆ … ┆ 234 ┆ 0x38989bb ┆ 1.0010e15 ┆ 1.0010e2 │\n",
+ "│ 06870346a ┆ a00bdf818 ┆ a00bdf818 ┆ ┆ ┆ ┆ a00bdf818 ┆ ┆ 1 │\n",
+ "│ 78a11a676 ┆ 1f4082995 ┆ 1f4082995 ┆ ┆ ┆ ┆ 1f4082995 ┆ ┆ │\n",
+ "│ 2e2cc… ┆ b3dea… ┆ b3dea… ┆ ┆ ┆ ┆ b3dea… ┆ ┆ │\n",
+ "│ 0xd7a5765 ┆ 0x38989bb ┆ 0x38989bb ┆ 18969656 ┆ … ┆ 146 ┆ 0x38989bb ┆ 2.3000e15 ┆ 2.2999e2 │\n",
+ "│ 06870346a ┆ a00bdf818 ┆ a00bdf818 ┆ ┆ ┆ ┆ a00bdf818 ┆ ┆ 1 │\n",
+ "│ 78a11a676 ┆ 1f4082995 ┆ 1f4082995 ┆ ┆ ┆ ┆ 1f4082995 ┆ ┆ │\n",
+ "│ 2e2cc… ┆ b3dea… ┆ b3dea… ┆ ┆ ┆ ┆ b3dea… ┆ ┆ │\n",
+ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [WITHDRAW_SIG_HASH],\n",
+ "}\n",
+ "\n",
+ "blue_withdraw_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_withdraw = parse_raw_events(blue_withdraw_raw, WITHDRAW_SIG)\n",
+ "\n",
+ "blue_withdraw.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Supply collateral "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event SupplyCollateral\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'caller'), ('address', 'onBehalf')]\n",
+ "Data types: [('uint256', 'assets')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 7)id | caller | onBehalf | block_number | transaction_index | log_index | assets |
---|
str | str | str | u32 | u32 | u32 | f64 |
"0x4a8221eef163… | "0x9106cbf2c882… | "0x9106cbf2c882… | 18926070 | 88 | 135 | 5.0000e16 |
"0xd7a576506870… | "0xa7995f71aa11… | "0x4563364bd619… | 18942176 | 109 | 204 | 4.0000e16 |
"0x4a8221eef163… | "0xa7995f71aa11… | "0x4563364bd619… | 18942176 | 109 | 207 | 4.6777e16 |
"0xd7a576506870… | "0xa7995f71aa11… | "0x6e632701fd42… | 18943134 | 132 | 344 | 1.0000e14 |
"0x4a8221eef163… | "0xa7995f71aa11… | "0x2b5469940fa5… | 18943214 | 93 | 252 | 1.0000e16 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 7)\n",
+ "┌──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬───────────┬───────────┐\n",
+ "│ id ┆ caller ┆ onBehalf ┆ block_number ┆ transaction_ ┆ log_index ┆ assets │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ index ┆ --- ┆ --- │\n",
+ "│ str ┆ str ┆ str ┆ u32 ┆ --- ┆ u32 ┆ f64 │\n",
+ "│ ┆ ┆ ┆ ┆ u32 ┆ ┆ │\n",
+ "╞══════════════╪══════════════╪══════════════╪══════════════╪══════════════╪═══════════╪═══════════╡\n",
+ "│ 0x4a8221eef1 ┆ 0x9106cbf2c8 ┆ 0x9106cbf2c8 ┆ 18926070 ┆ 88 ┆ 135 ┆ 5.0000e16 │\n",
+ "│ 63e4bccfdedc ┆ 82340b23cc40 ┆ 82340b23cc40 ┆ ┆ ┆ ┆ │\n",
+ "│ 2a6f4696… ┆ 985c0564… ┆ 985c0564… ┆ ┆ ┆ ┆ │\n",
+ "│ 0xd7a5765068 ┆ 0xa7995f71aa ┆ 0x4563364bd6 ┆ 18942176 ┆ 109 ┆ 204 ┆ 4.0000e16 │\n",
+ "│ 70346a78a11a ┆ 11525db02fc2 ┆ 1976ba6f1297 ┆ ┆ ┆ ┆ │\n",
+ "│ 6762e2cc… ┆ 473c37de… ┆ c253beae… ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221eef1 ┆ 0xa7995f71aa ┆ 0x4563364bd6 ┆ 18942176 ┆ 109 ┆ 207 ┆ 4.6777e16 │\n",
+ "│ 63e4bccfdedc ┆ 11525db02fc2 ┆ 1976ba6f1297 ┆ ┆ ┆ ┆ │\n",
+ "│ 2a6f4696… ┆ 473c37de… ┆ c253beae… ┆ ┆ ┆ ┆ │\n",
+ "│ 0xd7a5765068 ┆ 0xa7995f71aa ┆ 0x6e632701fd ┆ 18943134 ┆ 132 ┆ 344 ┆ 1.0000e14 │\n",
+ "│ 70346a78a11a ┆ 11525db02fc2 ┆ 42a9b856294a ┆ ┆ ┆ ┆ │\n",
+ "│ 6762e2cc… ┆ 473c37de… ┆ 2172dd63… ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221eef1 ┆ 0xa7995f71aa ┆ 0x2b5469940f ┆ 18943214 ┆ 93 ┆ 252 ┆ 1.0000e16 │\n",
+ "│ 63e4bccfdedc ┆ 11525db02fc2 ┆ a577bc4082c6 ┆ ┆ ┆ ┆ │\n",
+ "│ 2a6f4696… ┆ 473c37de… ┆ 940ee4d8… ┆ ┆ ┆ ┆ │\n",
+ "└──────────────┴──────────────┴──────────────┴──────────────┴──────────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [SUPPLY_COLLATERAL_SIG_HASH]\n",
+ "}\n",
+ "\n",
+ "blue_supply_collateral_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_supply_collateral = parse_raw_events(blue_supply_collateral_raw, SUPPLY_COLLATERAL_SIG)\n",
+ "\n",
+ "blue_supply_collateral.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Withdraw collateral"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event WithdrawCollateral\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'onBehalf'), ('address', 'receiver')]\n",
+ "Data types: [('address', 'caller'), ('uint256', 'assets')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 8)id | onBehalf | receiver | block_number | transaction_index | log_index | caller | assets |
---|
str | str | str | u32 | u32 | u32 | str | f64 |
"0xd7a576506870… | "0x4563364bd619… | "0xa7995f71aa11… | 18942670 | 70 | 189 | "0xa7995f71aa11… | 1.0000e16 |
"0x4a8221eef163… | "0x2b5469940fa5… | "0x2b5469940fa5… | 18965474 | 31 | 111 | "0xa7995f71aa11… | 9.9997e15 |
"0xd7a576506870… | "0x6e632701fd42… | "0xa7995f71aa11… | 18975191 | 117 | 190 | "0xa7995f71aa11… | 1.0000e14 |
"0x4a8221eef163… | "0x9cbf099ff424… | "0x9cbf099ff424… | 18977263 | 122 | 221 | "0xa7995f71aa11… | 1.0000e19 |
"0x695d96d685fa… | "0x1f381f47b9c7… | "0x1f381f47b9c7… | 18982531 | 160 | 278 | "0x1f381f47b9c7… | 2.0000e17 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 8)\n",
+ "┌────────────┬────────────┬────────────┬───────────┬───────────┬───────────┬───────────┬───────────┐\n",
+ "│ id ┆ onBehalf ┆ receiver ┆ block_num ┆ transacti ┆ log_index ┆ caller ┆ assets │\n",
+ "│ --- ┆ --- ┆ --- ┆ ber ┆ on_index ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ str ┆ str ┆ --- ┆ --- ┆ u32 ┆ str ┆ f64 │\n",
+ "│ ┆ ┆ ┆ u32 ┆ u32 ┆ ┆ ┆ │\n",
+ "╞════════════╪════════════╪════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡\n",
+ "│ 0xd7a57650 ┆ 0x4563364b ┆ 0xa7995f71 ┆ 18942670 ┆ 70 ┆ 189 ┆ 0xa7995f7 ┆ 1.0000e16 │\n",
+ "│ 6870346a78 ┆ d61976ba6f ┆ aa11525db0 ┆ ┆ ┆ ┆ 1aa11525d ┆ │\n",
+ "│ a11a6762e2 ┆ 1297c253be ┆ 2fc2473c37 ┆ ┆ ┆ ┆ b02fc2473 ┆ │\n",
+ "│ cc… ┆ ae… ┆ de… ┆ ┆ ┆ ┆ c37de… ┆ │\n",
+ "│ 0x4a8221ee ┆ 0x2b546994 ┆ 0x2b546994 ┆ 18965474 ┆ 31 ┆ 111 ┆ 0xa7995f7 ┆ 9.9997e15 │\n",
+ "│ f163e4bccf ┆ 0fa577bc40 ┆ 0fa577bc40 ┆ ┆ ┆ ┆ 1aa11525d ┆ │\n",
+ "│ dedc2a6f46 ┆ 82c6940ee4 ┆ 82c6940ee4 ┆ ┆ ┆ ┆ b02fc2473 ┆ │\n",
+ "│ 96… ┆ d8… ┆ d8… ┆ ┆ ┆ ┆ c37de… ┆ │\n",
+ "│ 0xd7a57650 ┆ 0x6e632701 ┆ 0xa7995f71 ┆ 18975191 ┆ 117 ┆ 190 ┆ 0xa7995f7 ┆ 1.0000e14 │\n",
+ "│ 6870346a78 ┆ fd42a9b856 ┆ aa11525db0 ┆ ┆ ┆ ┆ 1aa11525d ┆ │\n",
+ "│ a11a6762e2 ┆ 294a2172dd ┆ 2fc2473c37 ┆ ┆ ┆ ┆ b02fc2473 ┆ │\n",
+ "│ cc… ┆ 63… ┆ de… ┆ ┆ ┆ ┆ c37de… ┆ │\n",
+ "│ 0x4a8221ee ┆ 0x9cbf099f ┆ 0x9cbf099f ┆ 18977263 ┆ 122 ┆ 221 ┆ 0xa7995f7 ┆ 1.0000e19 │\n",
+ "│ f163e4bccf ┆ f424979439 ┆ f424979439 ┆ ┆ ┆ ┆ 1aa11525d ┆ │\n",
+ "│ dedc2a6f46 ┆ dfba03f00b ┆ dfba03f00b ┆ ┆ ┆ ┆ b02fc2473 ┆ │\n",
+ "│ 96… ┆ 59… ┆ 59… ┆ ┆ ┆ ┆ c37de… ┆ │\n",
+ "│ 0x695d96d6 ┆ 0x1f381f47 ┆ 0x1f381f47 ┆ 18982531 ┆ 160 ┆ 278 ┆ 0x1f381f4 ┆ 2.0000e17 │\n",
+ "│ 85fa117c49 ┆ b9c7c5216f ┆ b9c7c5216f ┆ ┆ ┆ ┆ 7b9c7c521 ┆ │\n",
+ "│ 85b91a7588 ┆ 346bc22501 ┆ 346bc22501 ┆ ┆ ┆ ┆ 6f346bc22 ┆ │\n",
+ "│ 5c… ┆ a4… ┆ a4… ┆ ┆ ┆ ┆ 501a4… ┆ │\n",
+ "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [WITHDRAW_COLLATERAL_SIG_HASH]\n",
+ "}\n",
+ "\n",
+ "blue_withdraw_collateral_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_withdraw_collateral = parse_raw_events(blue_withdraw_collateral_raw, WITHDRAW_COLLATERAL_SIG)\n",
+ "\n",
+ "blue_withdraw_collateral.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Borrow"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event Borrow\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'onBehalf'), ('address', 'receiver')]\n",
+ "Data types: [('address', 'caller'), ('uint256', 'assets'), ('uint256', 'shares')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 9)id | onBehalf | receiver | block_number | transaction_index | log_index | caller | assets | shares |
---|
str | str | str | u32 | u32 | u32 | str | f64 | f64 |
"0x4a8221eef163… | "0x9106cbf2c882… | "0x9106cbf2c882… | 18926262 | 121 | 190 | "0x9106cbf2c882… | 1e7 | 1.0000e13 |
"0xd7a576506870… | "0x4563364bd619… | "0xa7995f71aa11… | 18942176 | 109 | 212 | "0xa7995f71aa11… | 1.0000e16 | 1.0000e22 |
"0x4a8221eef163… | "0x4563364bd619… | "0x4563364bd619… | 18942176 | 109 | 216 | "0xa7995f71aa11… | 8.8021751e7 | 8.8016e13 |
"0xd7a576506870… | "0x6e632701fd42… | "0x6e632701fd42… | 18943134 | 132 | 349 | "0xa7995f71aa11… | 1.0774e14 | 1.0774e20 |
"0x4a8221eef163… | "0x2b5469940fa5… | "0x2b5469940fa5… | 18943214 | 93 | 257 | "0xa7995f71aa11… | 3.826194e6 | 3.8259e12 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 9)\n",
+ "┌───────────┬───────────┬───────────┬───────────┬───┬───────────┬───────────┬───────────┬──────────┐\n",
+ "│ id ┆ onBehalf ┆ receiver ┆ block_num ┆ … ┆ log_index ┆ caller ┆ assets ┆ shares │\n",
+ "│ --- ┆ --- ┆ --- ┆ ber ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ str ┆ str ┆ --- ┆ ┆ u32 ┆ str ┆ f64 ┆ f64 │\n",
+ "│ ┆ ┆ ┆ u32 ┆ ┆ ┆ ┆ ┆ │\n",
+ "╞═══════════╪═══════════╪═══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪══════════╡\n",
+ "│ 0x4a8221e ┆ 0x9106cbf ┆ 0x9106cbf ┆ 18926262 ┆ … ┆ 190 ┆ 0x9106cbf ┆ 1e7 ┆ 1.0000e1 │\n",
+ "│ ef163e4bc ┆ 2c882340b ┆ 2c882340b ┆ ┆ ┆ ┆ 2c882340b ┆ ┆ 3 │\n",
+ "│ cfdedc2a6 ┆ 23cc40985 ┆ 23cc40985 ┆ ┆ ┆ ┆ 23cc40985 ┆ ┆ │\n",
+ "│ f4696… ┆ c0564… ┆ c0564… ┆ ┆ ┆ ┆ c0564… ┆ ┆ │\n",
+ "│ 0xd7a5765 ┆ 0x4563364 ┆ 0xa7995f7 ┆ 18942176 ┆ … ┆ 212 ┆ 0xa7995f7 ┆ 1.0000e16 ┆ 1.0000e2 │\n",
+ "│ 06870346a ┆ bd61976ba ┆ 1aa11525d ┆ ┆ ┆ ┆ 1aa11525d ┆ ┆ 2 │\n",
+ "│ 78a11a676 ┆ 6f1297c25 ┆ b02fc2473 ┆ ┆ ┆ ┆ b02fc2473 ┆ ┆ │\n",
+ "│ 2e2cc… ┆ 3beae… ┆ c37de… ┆ ┆ ┆ ┆ c37de… ┆ ┆ │\n",
+ "│ 0x4a8221e ┆ 0x4563364 ┆ 0x4563364 ┆ 18942176 ┆ … ┆ 216 ┆ 0xa7995f7 ┆ 8.8021751 ┆ 8.8016e1 │\n",
+ "│ ef163e4bc ┆ bd61976ba ┆ bd61976ba ┆ ┆ ┆ ┆ 1aa11525d ┆ e7 ┆ 3 │\n",
+ "│ cfdedc2a6 ┆ 6f1297c25 ┆ 6f1297c25 ┆ ┆ ┆ ┆ b02fc2473 ┆ ┆ │\n",
+ "│ f4696… ┆ 3beae… ┆ 3beae… ┆ ┆ ┆ ┆ c37de… ┆ ┆ │\n",
+ "│ 0xd7a5765 ┆ 0x6e63270 ┆ 0x6e63270 ┆ 18943134 ┆ … ┆ 349 ┆ 0xa7995f7 ┆ 1.0774e14 ┆ 1.0774e2 │\n",
+ "│ 06870346a ┆ 1fd42a9b8 ┆ 1fd42a9b8 ┆ ┆ ┆ ┆ 1aa11525d ┆ ┆ 0 │\n",
+ "│ 78a11a676 ┆ 56294a217 ┆ 56294a217 ┆ ┆ ┆ ┆ b02fc2473 ┆ ┆ │\n",
+ "│ 2e2cc… ┆ 2dd63… ┆ 2dd63… ┆ ┆ ┆ ┆ c37de… ┆ ┆ │\n",
+ "│ 0x4a8221e ┆ 0x2b54699 ┆ 0x2b54699 ┆ 18943214 ┆ … ┆ 257 ┆ 0xa7995f7 ┆ 3.826194e ┆ 3.8259e1 │\n",
+ "│ ef163e4bc ┆ 40fa577bc ┆ 40fa577bc ┆ ┆ ┆ ┆ 1aa11525d ┆ 6 ┆ 2 │\n",
+ "│ cfdedc2a6 ┆ 4082c6940 ┆ 4082c6940 ┆ ┆ ┆ ┆ b02fc2473 ┆ ┆ │\n",
+ "│ f4696… ┆ ee4d8… ┆ ee4d8… ┆ ┆ ┆ ┆ c37de… ┆ ┆ │\n",
+ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [BORROW_SIG_HASH]\n",
+ "}\n",
+ "\n",
+ "blue_borrow_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_borrow = parse_raw_events(blue_borrow_raw, BORROW_SIG)\n",
+ "\n",
+ "blue_borrow.head(5)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Repay"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event Repay\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'caller'), ('address', 'onBehalf')]\n",
+ "Data types: [('uint256', 'assets'), ('uint256', 'shares')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 8)id | caller | onBehalf | block_number | transaction_index | log_index | assets | shares |
---|
str | str | str | u32 | u32 | u32 | f64 | f64 |
"0x4a8221eef163… | "0xa7995f71aa11… | "0x4563364bd619… | 18942670 | 70 | 185 | 4e7 | 3.9997e13 |
"0x4a8221eef163… | "0xa7995f71aa11… | "0x2b5469940fa5… | 18949974 | 81 | 160 | 100000.0 | 9.9991e10 |
"0x4a8221eef163… | "0xa7995f71aa11… | "0x2b5469940fa5… | 18965474 | 31 | 109 | 3.726e6 | 3.7254e12 |
"0xd7a576506870… | "0xa7995f71aa11… | "0x6e632701fd42… | 18975191 | 117 | 179 | 1.0775e14 | 1.0774e20 |
"0x4a8221eef163… | "0x9106cbf2c882… | "0x9106cbf2c882… | 18982559 | 54 | 77 | 9.5115e9 | 9.5088e15 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 8)\n",
+ "┌────────────┬────────────┬────────────┬───────────┬───────────┬───────────┬───────────┬───────────┐\n",
+ "│ id ┆ caller ┆ onBehalf ┆ block_num ┆ transacti ┆ log_index ┆ assets ┆ shares │\n",
+ "│ --- ┆ --- ┆ --- ┆ ber ┆ on_index ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ str ┆ str ┆ --- ┆ --- ┆ u32 ┆ f64 ┆ f64 │\n",
+ "│ ┆ ┆ ┆ u32 ┆ u32 ┆ ┆ ┆ │\n",
+ "╞════════════╪════════════╪════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡\n",
+ "│ 0x4a8221ee ┆ 0xa7995f71 ┆ 0x4563364b ┆ 18942670 ┆ 70 ┆ 185 ┆ 4e7 ┆ 3.9997e13 │\n",
+ "│ f163e4bccf ┆ aa11525db0 ┆ d61976ba6f ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ 2fc2473c37 ┆ 1297c253be ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ de… ┆ ae… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221ee ┆ 0xa7995f71 ┆ 0x2b546994 ┆ 18949974 ┆ 81 ┆ 160 ┆ 100000.0 ┆ 9.9991e10 │\n",
+ "│ f163e4bccf ┆ aa11525db0 ┆ 0fa577bc40 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ 2fc2473c37 ┆ 82c6940ee4 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ de… ┆ d8… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221ee ┆ 0xa7995f71 ┆ 0x2b546994 ┆ 18965474 ┆ 31 ┆ 109 ┆ 3.726e6 ┆ 3.7254e12 │\n",
+ "│ f163e4bccf ┆ aa11525db0 ┆ 0fa577bc40 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ 2fc2473c37 ┆ 82c6940ee4 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ de… ┆ d8… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xd7a57650 ┆ 0xa7995f71 ┆ 0x6e632701 ┆ 18975191 ┆ 117 ┆ 179 ┆ 1.0775e14 ┆ 1.0774e20 │\n",
+ "│ 6870346a78 ┆ aa11525db0 ┆ fd42a9b856 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ a11a6762e2 ┆ 2fc2473c37 ┆ 294a2172dd ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ cc… ┆ de… ┆ 63… ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x4a8221ee ┆ 0x9106cbf2 ┆ 0x9106cbf2 ┆ 18982559 ┆ 54 ┆ 77 ┆ 9.5115e9 ┆ 9.5088e15 │\n",
+ "│ f163e4bccf ┆ c882340b23 ┆ c882340b23 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ dedc2a6f46 ┆ cc40985c05 ┆ cc40985c05 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 96… ┆ 64… ┆ 64… ┆ ┆ ┆ ┆ ┆ │\n",
+ "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [REPAY_SIG_HASH]\n",
+ "}\n",
+ "\n",
+ "blue_repay_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_repay = parse_raw_events(blue_repay_raw, REPAY_SIG)\n",
+ "\n",
+ "blue_repay.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Liquidate "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event Liquidate\n",
+ "Indexed types: [('bytes32', 'id'), ('address', 'caller'), ('address', 'borrower')]\n",
+ "Data types: [('uint256', 'repaidAssets'), ('uint256', 'repaidShares'), ('uint256', 'seizedAssets'), ('uint256', 'badDebtAssets'), ('uint256', 'badDebtShares')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 11)id | caller | borrower | block_number | transaction_index | log_index | repaidAssets | repaidShares | seizedAssets | badDebtAssets | badDebtShares |
---|
str | str | str | u32 | u32 | u32 | f64 | f64 | f64 | f64 | f64 |
"0x4a8221eef163… | "0x5343d15decb9… | "0x4563364bd619… | 18976844 | 127 | 34 | 1.06555546e8 | 1.0653e14 | 4.0643e16 | 0.0 | 0.0 |
"0xf6ec69ce473d… | "0x5343d15decb9… | "0xa4459ccbd068… | 19130360 | 56 | 155 | 10425.0 | 1.0369e10 | 26.0 | 0.0 | 0.0 |
"0xcaafcf8cd4b9… | "0xd85e92f58a1f… | "0x255c7705e8bb… | 19206767 | 38 | 41 | 1.02435505e8 | 1.0000e14 | 1.0692e20 | 0.0 | 0.0 |
"0xe4b154e16c97… | "0x5343d15decb9… | "0x04c0fd5032c1… | 19216001 | 39 | 42 | 8.3371085e7 | 8.3355e13 | 174417.0 | 0.0 | 0.0 |
"0x86b2f3f9d78e… | "0x8ce45e650ab1… | "0x17fd03969575… | 19250804 | 2 | 19 | 1.6490e18 | 4.2956e23 | 1.6708e18 | 0.0 | 0.0 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 11)\n",
+ "┌───────────┬───────────┬───────────┬───────────┬───┬───────────┬───────────┬───────────┬──────────┐\n",
+ "│ id ┆ caller ┆ borrower ┆ block_num ┆ … ┆ repaidSha ┆ seizedAss ┆ badDebtAs ┆ badDebtS │\n",
+ "│ --- ┆ --- ┆ --- ┆ ber ┆ ┆ res ┆ ets ┆ sets ┆ hares │\n",
+ "│ str ┆ str ┆ str ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ ┆ ┆ u32 ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │\n",
+ "╞═══════════╪═══════════╪═══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪══════════╡\n",
+ "│ 0x4a8221e ┆ 0x5343d15 ┆ 0x4563364 ┆ 18976844 ┆ … ┆ 1.0653e14 ┆ 4.0643e16 ┆ 0.0 ┆ 0.0 │\n",
+ "│ ef163e4bc ┆ decb93095 ┆ bd61976ba ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ cfdedc2a6 ┆ bab7e6194 ┆ 6f1297c25 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ f4696… ┆ 4bea0… ┆ 3beae… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xf6ec69c ┆ 0x5343d15 ┆ 0xa4459cc ┆ 19130360 ┆ … ┆ 1.0369e10 ┆ 26.0 ┆ 0.0 ┆ 0.0 │\n",
+ "│ e473daef9 ┆ decb93095 ┆ bd068f1f1 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 9e28a64ab ┆ bab7e6194 ┆ b00315110 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2340d… ┆ 4bea0… ┆ b012a… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xcaafcf8 ┆ 0xd85e92f ┆ 0x255c770 ┆ 19206767 ┆ … ┆ 1.0000e14 ┆ 1.0692e20 ┆ 0.0 ┆ 0.0 │\n",
+ "│ cd4b91287 ┆ 58a1ff5fe ┆ 5e8bb334d ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ e139a3ec4 ┆ b5071306f ┆ fcae43819 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 23f09… ┆ be99b… ┆ 7f7c4… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xe4b154e ┆ 0x5343d15 ┆ 0x04c0fd5 ┆ 19216001 ┆ … ┆ 8.3355e13 ┆ 174417.0 ┆ 0.0 ┆ 0.0 │\n",
+ "│ 16c9799d3 ┆ decb93095 ┆ 032c1a6c1 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 387076c42 ┆ bab7e6194 ┆ b7d638eac ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 1423e… ┆ 4bea0… ┆ 2533e… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0x86b2f3f ┆ 0x8ce45e6 ┆ 0x17fd039 ┆ 19250804 ┆ … ┆ 4.2956e23 ┆ 1.6708e18 ┆ 0.0 ┆ 0.0 │\n",
+ "│ 9d78eb487 ┆ 50ab17b6c ┆ 69575d462 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ b4ce4d755 ┆ a0dd6071f ┆ 38cdd3a03 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 33cd0… ┆ 7c2b5… ┆ 9a779… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [LIQUIDATE_SIG_HASH]\n",
+ "}\n",
+ "\n",
+ "blue_liquidation_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_liquidation = parse_raw_events(blue_liquidation_raw, LIQUIDATE_SIG)\n",
+ "\n",
+ "blue_liquidation.head(5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Interest"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Parsing Event name: event AccrueInterest\n",
+ "Indexed types: [('bytes32', 'id')]\n",
+ "Data types: [('uint256', 'prevBorrowRate'), ('uint256', 'interest'), ('uint256', 'feeShares')]\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 7)id | block_number | transaction_index | log_index | prevBorrowRate | interest | feeShares |
---|
str | u32 | u32 | u32 | f64 | f64 | f64 |
"0xb323495f7e41… | 18926166 | 104 | 207 | 3.16327097e8 | 0.0 | 0.0 |
"0xb323495f7e41… | 18926262 | 121 | 189 | 3.15263237e8 | 0.0 | 0.0 |
"0xb323495f7e41… | 18940531 | 93 | 258 | 3.73405563e8 | 646.0 | 0.0 |
"0xc54d7acf14de… | 18941243 | 38 | 104 | 2.60458612e8 | 0.0 | 0.0 |
"0xc54d7acf14de… | 18941407 | 66 | 103 | 2.08321558e8 | 0.0 | 0.0 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 7)\n",
+ "┌────────────────┬──────────────┬───────────────┬───────────┬───────────────┬──────────┬───────────┐\n",
+ "│ id ┆ block_number ┆ transaction_i ┆ log_index ┆ prevBorrowRat ┆ interest ┆ feeShares │\n",
+ "│ --- ┆ --- ┆ ndex ┆ --- ┆ e ┆ --- ┆ --- │\n",
+ "│ str ┆ u32 ┆ --- ┆ u32 ┆ --- ┆ f64 ┆ f64 │\n",
+ "│ ┆ ┆ u32 ┆ ┆ f64 ┆ ┆ │\n",
+ "╞════════════════╪══════════════╪═══════════════╪═══════════╪═══════════════╪══════════╪═══════════╡\n",
+ "│ 0xb323495f7e41 ┆ 18926166 ┆ 104 ┆ 207 ┆ 3.16327097e8 ┆ 0.0 ┆ 0.0 │\n",
+ "│ 48be5643a4ea4a ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 8221… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xb323495f7e41 ┆ 18926262 ┆ 121 ┆ 189 ┆ 3.15263237e8 ┆ 0.0 ┆ 0.0 │\n",
+ "│ 48be5643a4ea4a ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 8221… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xb323495f7e41 ┆ 18940531 ┆ 93 ┆ 258 ┆ 3.73405563e8 ┆ 646.0 ┆ 0.0 │\n",
+ "│ 48be5643a4ea4a ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 8221… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xc54d7acf14de ┆ 18941243 ┆ 38 ┆ 104 ┆ 2.60458612e8 ┆ 0.0 ┆ 0.0 │\n",
+ "│ 29e0e5527cabd7 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ a576… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 0xc54d7acf14de ┆ 18941407 ┆ 66 ┆ 103 ┆ 2.08321558e8 ┆ 0.0 ┆ 0.0 │\n",
+ "│ 29e0e5527cabd7 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ a576… ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "└────────────────┴──────────────┴───────────────┴───────────┴───────────────┴──────────┴───────────┘"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "params = {\n",
+ " \"datatype\": \"events\",\n",
+ " \"blocks\": [\"18.9M:\"],\n",
+ " \"inner_request_size\": 10000,\n",
+ " \"contract\": [BLUE_CONTRACT_ADDRESS],\n",
+ " \"topic0\": [ACCRUE_INTEREST_SIG_HASH]\n",
+ "}\n",
+ "\n",
+ "blue_interest_raw = cryo.collect(\n",
+ " **params\n",
+ ")\n",
+ "\n",
+ "blue_interest = parse_raw_events(blue_interest_raw, ACCRUE_INTEREST_SIG)\n",
+ "\n",
+ "blue_interest.head(5)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.18"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}