diff --git a/examples/morpho_blue.ipynb b/examples/morpho_blue.ipynb index 29bdf15d..50e4235f 100644 --- a/examples/morpho_blue.ipynb +++ b/examples/morpho_blue.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -20,19 +20,19 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ - "CREATION_MARKET_TOPIC = \"0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac\"\n", - "INTEREST_TOPIC = \"0x9d9bd501d0657d7dfe415f779a620a62b78bc508ddc0891fbbd8b7ac0f8fce87\"\n", - "BORROW_TOPIC = \"0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43\"\n", - "REPAY_TOPIC = \"0x52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa09\"\n", - "SUPPLY_COLLATERAL_TOPIC = \"0xa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184\"\n", - "WITHDRAW_COLLATERAL_TOPIC = \"0xe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e321142\"\n", - "SUPPLY_TOPIC = \"0xedf8870433c83823eb071d3df1caa8d008f12f6440918c20d75a3602cda30fe0\"\n", - "WITHDRAW_TOPIC = \"0xa56fc0ad5702ec05ce63666221f796fb62437c32db1aa1aa075fc6484cf58fbf\"\n", - "LIQUIDATION_TOPIC = \"0xa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e41\"\n", + "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", @@ -48,8 +48,8 @@ "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", - "LIQUIDATION_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", - "INTEREST_SIG = \"event AccrueInterest(Id indexed id, uint256 prevBorrowRate, uint256 interest, uint256 feeShares);\".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" ] @@ -63,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -159,7 +159,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -205,7 +205,7 @@ "└─────────────┴─────────────┴───────────┴────────────┴───┴────────┴────────┴────────────┴──────────┘" ] }, - "execution_count": 7, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -218,7 +218,7 @@ " \"blocks\": [\"18.9M:\"],\n", " \"inner_request_size\": 10000,\n", " \"contract\": [BLUE_CONTRACT_ADDRESS],\n", - " \"topic0\": [CREATION_MARKET_TOPIC],\n", + " \"topic0\": [CREATION_MARKET_SIG_HASH],\n", "}\n", "\n", "# Collect the raw events with cryo\n", @@ -231,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -286,7 +286,7 @@ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘" ] }, - "execution_count": 8, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -316,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -371,7 +371,7 @@ "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴───────────┴───────────┘" ] }, - "execution_count": 6, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -383,7 +383,7 @@ " \"blocks\": [\"18.9M:\"],\n", " \"inner_request_size\": 10000,\n", " \"contract\": [BLUE_CONTRACT_ADDRESS],\n", - " \"topic0\": [SUPPLY_TOPIC],\n", + " \"topic0\": [SUPPLY_SIG_HASH],\n", "}\n", "blue_supply_raw = cryo.collect(\n", " **params\n", @@ -403,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -458,7 +458,7 @@ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘" ] }, - "execution_count": 7, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -469,7 +469,7 @@ " \"blocks\": [\"18.9M:\"],\n", " \"inner_request_size\": 10000,\n", " \"contract\": [BLUE_CONTRACT_ADDRESS],\n", - " \"topic0\": [WITHDRAW_TOPIC],\n", + " \"topic0\": [WITHDRAW_SIG_HASH],\n", "}\n", "\n", "blue_withdraw_raw = cryo.collect(\n", @@ -490,7 +490,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -540,7 +540,7 @@ "└──────────────┴──────────────┴──────────────┴──────────────┴──────────────┴───────────┴───────────┘" ] }, - "execution_count": 8, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -552,7 +552,7 @@ " \"blocks\": [\"18.9M:\"],\n", " \"inner_request_size\": 10000,\n", " \"contract\": [BLUE_CONTRACT_ADDRESS],\n", - " \"topic0\": [SUPPLY_COLLATERAL_TOPIC]\n", + " \"topic0\": [SUPPLY_COLLATERAL_SIG_HASH]\n", "}\n", "\n", "blue_supply_collateral_raw = cryo.collect(\n", @@ -573,7 +573,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -628,7 +628,7 @@ "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴───────────┴───────────┘" ] }, - "execution_count": 9, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -640,7 +640,7 @@ " \"blocks\": [\"18.9M:\"],\n", " \"inner_request_size\": 10000,\n", " \"contract\": [BLUE_CONTRACT_ADDRESS],\n", - " \"topic0\": [WITHDRAW_COLLATERAL_TOPIC]\n", + " \"topic0\": [WITHDRAW_COLLATERAL_SIG_HASH]\n", "}\n", "\n", "blue_withdraw_collateral_raw = cryo.collect(\n", @@ -661,7 +661,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -716,7 +716,7 @@ "└───────────┴───────────┴───────────┴───────────┴───┴───────────┴───────────┴───────────┴──────────┘" ] }, - "execution_count": 10, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -728,7 +728,7 @@ " \"blocks\": [\"18.9M:\"],\n", " \"inner_request_size\": 10000,\n", " \"contract\": [BLUE_CONTRACT_ADDRESS],\n", - " \"topic0\": [BORROW_TOPIC]\n", + " \"topic0\": [BORROW_SIG_HASH]\n", "}\n", "\n", "blue_borrow_raw = cryo.collect(\n", @@ -749,66 +749,9 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "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": [ - "
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 |